| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.goafanti.common.dao.ExpenseAccountMapper">
- <resultMap id="BaseResultMap" type="com.goafanti.common.model.ExpenseAccount">
- <id column="id" jdbcType="INTEGER" property="id" />
- <result column="prid" jdbcType="INTEGER" property="prid" />
- <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
- <result column="aid" jdbcType="VARCHAR" property="aid" />
- <result column="aname" jdbcType="VARCHAR" property="aname" />
- <result column="type" jdbcType="INTEGER" property="type" />
- <result column="type_other" jdbcType="VARCHAR" property="typeOther" />
- <result column="status" jdbcType="INTEGER" property="status" />
- <result column="process_status" jdbcType="INTEGER" property="processStatus" />
- <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
- <result column="attachment_url" jdbcType="VARCHAR" property="attachmentUrl" />
- <result column="apply_dep" jdbcType="VARCHAR" property="applyDep" />
- <result column="pay_dep" jdbcType="VARCHAR" property="payDep" />
- <result column="eaaid" jdbcType="INTEGER" property="eaaid" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="district_name" jdbcType="VARCHAR" property="districtName" />
- <result column="user_names" jdbcType="VARCHAR" property="userNames" />
- <result column="release_start" jdbcType="TIMESTAMP" property="releaseStart" />
- <result column="release_end" jdbcType="TIMESTAMP" property="releaseEnd" />
- <result column="duration" jdbcType="DOUBLE" property="duration" />
- <result column="examine_name" jdbcType="VARCHAR" property="examineName" />
- <result column="settlement_amount" jdbcType="DECIMAL" property="settlementAmount" />
- <result column="debit_id" jdbcType="INTEGER" property="debitId" />
- <result column="target_type" jdbcType="INTEGER" property="targetType" />
- <result column="liquidation_status" jdbcType="INTEGER" property="liquidationStatus" />
- <result column="remarks" jdbcType="VARCHAR" property="remarks" />
- <result column="check_no" jdbcType="VARCHAR" property="checkNo" />
- <result column="expense_main" jdbcType="INTEGER" property="expenseMain" />
- <result column="real_amount" jdbcType="DECIMAL" property="realAmount" />
- <result column="secondary_type" jdbcType="INTEGER" property="secondaryType" />
- <result column="secondary_type_other" jdbcType="VARCHAR" property="secondaryTypeOther" />
- <result column="amount" jdbcType="DECIMAL" property="amount" />
- <result column="approval" jdbcType="INTEGER" property="approval" />
- </resultMap>
- <sql id="Base_Column_List">
- id, prid, order_no, aid, aname, `type`, type_other, `status`, process_status, total_amount,
- attachment_url, apply_dep, pay_dep, eaaid, create_time, district_name, user_names,
- release_start, release_end, duration, examine_name, settlement_amount, debit_id,
- target_type, liquidation_status, remarks, check_no, expense_main, real_amount, secondary_type,
- secondary_type_other, amount, approval
- </sql>
- <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from expense_account
- where id = #{id,jdbcType=INTEGER}
- </select>
- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
- delete from expense_account
- where id = #{id,jdbcType=INTEGER}
- </delete>
- <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccount" useGeneratedKeys="true">
- insert into expense_account (prid, order_no, aid,
- aname, `type`, type_other,
- `status`, process_status, total_amount,
- attachment_url, apply_dep, pay_dep,
- eaaid, create_time, district_name,
- user_names, release_start, release_end,
- duration, examine_name, settlement_amount,
- debit_id, target_type, liquidation_status,
- remarks, check_no, expense_main,
- real_amount, secondary_type, secondary_type_other,
- amount, approval)
- values (#{prid,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
- #{aname,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{typeOther,jdbcType=VARCHAR},
- #{status,jdbcType=INTEGER}, #{processStatus,jdbcType=INTEGER}, #{totalAmount,jdbcType=DECIMAL},
- #{attachmentUrl,jdbcType=VARCHAR}, #{applyDep,jdbcType=VARCHAR}, #{payDep,jdbcType=VARCHAR},
- #{eaaid,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{districtName,jdbcType=VARCHAR},
- #{userNames,jdbcType=VARCHAR}, #{releaseStart,jdbcType=TIMESTAMP}, #{releaseEnd,jdbcType=TIMESTAMP},
- #{duration,jdbcType=DOUBLE}, #{examineName,jdbcType=VARCHAR}, #{settlementAmount,jdbcType=DECIMAL},
- #{debitId,jdbcType=INTEGER}, #{targetType,jdbcType=INTEGER}, #{liquidationStatus,jdbcType=INTEGER},
- #{remarks,jdbcType=VARCHAR}, #{checkNo,jdbcType=VARCHAR}, #{expenseMain,jdbcType=INTEGER},
- #{realAmount,jdbcType=DECIMAL}, #{secondaryType,jdbcType=INTEGER}, #{secondaryTypeOther,jdbcType=VARCHAR},
- #{amount,jdbcType=DECIMAL}, #{approval,jdbcType=INTEGER})
- </insert>
- <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccount" useGeneratedKeys="true">
- insert into expense_account
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="prid != null">
- prid,
- </if>
- <if test="orderNo != null">
- order_no,
- </if>
- <if test="aid != null">
- aid,
- </if>
- <if test="aname != null">
- aname,
- </if>
- <if test="type != null">
- `type`,
- </if>
- <if test="typeOther != null">
- type_other,
- </if>
- <if test="status != null">
- `status`,
- </if>
- <if test="processStatus != null">
- process_status,
- </if>
- <if test="totalAmount != null">
- total_amount,
- </if>
- <if test="attachmentUrl != null">
- attachment_url,
- </if>
- <if test="applyDep != null">
- apply_dep,
- </if>
- <if test="payDep != null">
- pay_dep,
- </if>
- <if test="eaaid != null">
- eaaid,
- </if>
- <if test="createTime != null">
- create_time,
- </if>
- <if test="districtName != null">
- district_name,
- </if>
- <if test="userNames != null">
- user_names,
- </if>
- <if test="releaseStart != null">
- release_start,
- </if>
- <if test="releaseEnd != null">
- release_end,
- </if>
- <if test="duration != null">
- duration,
- </if>
- <if test="examineName != null">
- examine_name,
- </if>
- <if test="settlementAmount != null">
- settlement_amount,
- </if>
- <if test="debitId != null">
- debit_id,
- </if>
- <if test="targetType != null">
- target_type,
- </if>
- <if test="liquidationStatus != null">
- liquidation_status,
- </if>
- <if test="remarks != null">
- remarks,
- </if>
- <if test="checkNo != null">
- check_no,
- </if>
- <if test="expenseMain != null">
- expense_main,
- </if>
- <if test="realAmount != null">
- real_amount,
- </if>
- <if test="secondaryType != null">
- secondary_type,
- </if>
- <if test="secondaryTypeOther != null">
- secondary_type_other,
- </if>
- <if test="amount != null">
- amount,
- </if>
- <if test="approval != null">
- approval,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="prid != null">
- #{prid,jdbcType=INTEGER},
- </if>
- <if test="orderNo != null">
- #{orderNo,jdbcType=VARCHAR},
- </if>
- <if test="aid != null">
- #{aid,jdbcType=VARCHAR},
- </if>
- <if test="aname != null">
- #{aname,jdbcType=VARCHAR},
- </if>
- <if test="type != null">
- #{type,jdbcType=INTEGER},
- </if>
- <if test="typeOther != null">
- #{typeOther,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- #{status,jdbcType=INTEGER},
- </if>
- <if test="processStatus != null">
- #{processStatus,jdbcType=INTEGER},
- </if>
- <if test="totalAmount != null">
- #{totalAmount,jdbcType=DECIMAL},
- </if>
- <if test="attachmentUrl != null">
- #{attachmentUrl,jdbcType=VARCHAR},
- </if>
- <if test="applyDep != null">
- #{applyDep,jdbcType=VARCHAR},
- </if>
- <if test="payDep != null">
- #{payDep,jdbcType=VARCHAR},
- </if>
- <if test="eaaid != null">
- #{eaaid,jdbcType=INTEGER},
- </if>
- <if test="createTime != null">
- #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="districtName != null">
- #{districtName,jdbcType=VARCHAR},
- </if>
- <if test="userNames != null">
- #{userNames,jdbcType=VARCHAR},
- </if>
- <if test="releaseStart != null">
- #{releaseStart,jdbcType=TIMESTAMP},
- </if>
- <if test="releaseEnd != null">
- #{releaseEnd,jdbcType=TIMESTAMP},
- </if>
- <if test="duration != null">
- #{duration,jdbcType=DOUBLE},
- </if>
- <if test="examineName != null">
- #{examineName,jdbcType=VARCHAR},
- </if>
- <if test="settlementAmount != null">
- #{settlementAmount,jdbcType=DECIMAL},
- </if>
- <if test="debitId != null">
- #{debitId,jdbcType=INTEGER},
- </if>
- <if test="targetType != null">
- #{targetType,jdbcType=INTEGER},
- </if>
- <if test="liquidationStatus != null">
- #{liquidationStatus,jdbcType=INTEGER},
- </if>
- <if test="remarks != null">
- #{remarks,jdbcType=VARCHAR},
- </if>
- <if test="checkNo != null">
- #{checkNo,jdbcType=VARCHAR},
- </if>
- <if test="expenseMain != null">
- #{expenseMain,jdbcType=INTEGER},
- </if>
- <if test="realAmount != null">
- #{realAmount,jdbcType=DECIMAL},
- </if>
- <if test="secondaryType != null">
- #{secondaryType,jdbcType=INTEGER},
- </if>
- <if test="secondaryTypeOther != null">
- #{secondaryTypeOther,jdbcType=VARCHAR},
- </if>
- <if test="amount != null">
- #{amount,jdbcType=DECIMAL},
- </if>
- <if test="approval != null">
- #{approval,jdbcType=INTEGER},
- </if>
- </trim>
- </insert>
- <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ExpenseAccount">
- update expense_account
- <set>
- <if test="prid != null">
- prid = #{prid,jdbcType=INTEGER},
- </if>
- <if test="orderNo != null">
- order_no = #{orderNo,jdbcType=VARCHAR},
- </if>
- <if test="aid != null">
- aid = #{aid,jdbcType=VARCHAR},
- </if>
- <if test="aname != null">
- aname = #{aname,jdbcType=VARCHAR},
- </if>
- <if test="type != null">
- `type` = #{type,jdbcType=INTEGER},
- </if>
- <if test="typeOther != null">
- type_other = #{typeOther,jdbcType=VARCHAR},
- </if>
- <if test="status != null">
- `status` = #{status,jdbcType=INTEGER},
- </if>
- <if test="processStatus != null">
- process_status = #{processStatus,jdbcType=INTEGER},
- </if>
- <if test="totalAmount != null">
- total_amount = #{totalAmount,jdbcType=DECIMAL},
- </if>
- <if test="attachmentUrl != null">
- attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
- </if>
- <if test="applyDep != null">
- apply_dep = #{applyDep,jdbcType=VARCHAR},
- </if>
- <if test="payDep != null">
- pay_dep = #{payDep,jdbcType=VARCHAR},
- </if>
- <if test="eaaid != null">
- eaaid = #{eaaid,jdbcType=INTEGER},
- </if>
- <if test="createTime != null">
- create_time = #{createTime,jdbcType=TIMESTAMP},
- </if>
- <if test="districtName != null">
- district_name = #{districtName,jdbcType=VARCHAR},
- </if>
- <if test="userNames != null">
- user_names = #{userNames,jdbcType=VARCHAR},
- </if>
- <if test="releaseStart != null">
- release_start = #{releaseStart,jdbcType=TIMESTAMP},
- </if>
- <if test="releaseEnd != null">
- release_end = #{releaseEnd,jdbcType=TIMESTAMP},
- </if>
- <if test="duration != null">
- duration = #{duration,jdbcType=DOUBLE},
- </if>
- <if test="examineName != null">
- examine_name = #{examineName,jdbcType=VARCHAR},
- </if>
- <if test="settlementAmount != null">
- settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
- </if>
- <if test="debitId != null">
- debit_id = #{debitId,jdbcType=INTEGER},
- </if>
- <if test="targetType != null">
- target_type = #{targetType,jdbcType=INTEGER},
- </if>
- <if test="liquidationStatus != null">
- liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
- </if>
- <if test="remarks != null">
- remarks = #{remarks,jdbcType=VARCHAR},
- </if>
- <if test="checkNo != null">
- check_no = #{checkNo,jdbcType=VARCHAR},
- </if>
- <if test="expenseMain != null">
- expense_main = #{expenseMain,jdbcType=INTEGER},
- </if>
- <if test="realAmount != null">
- real_amount = #{realAmount,jdbcType=DECIMAL},
- </if>
- <if test="secondaryType != null">
- secondary_type = #{secondaryType,jdbcType=INTEGER},
- </if>
- <if test="secondaryTypeOther != null">
- secondary_type_other = #{secondaryTypeOther,jdbcType=VARCHAR},
- </if>
- <if test="amount != null">
- amount = #{amount,jdbcType=DECIMAL},
- </if>
- <if test="approval != null">
- approval = #{approval,jdbcType=INTEGER},
- </if>
- </set>
- where id = #{id,jdbcType=INTEGER}
- </update>
- <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.ExpenseAccount">
- update expense_account
- set prid = #{prid,jdbcType=INTEGER},
- order_no = #{orderNo,jdbcType=VARCHAR},
- aid = #{aid,jdbcType=VARCHAR},
- aname = #{aname,jdbcType=VARCHAR},
- `type` = #{type,jdbcType=INTEGER},
- type_other = #{typeOther,jdbcType=VARCHAR},
- `status` = #{status,jdbcType=INTEGER},
- process_status = #{processStatus,jdbcType=INTEGER},
- total_amount = #{totalAmount,jdbcType=DECIMAL},
- attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
- apply_dep = #{applyDep,jdbcType=VARCHAR},
- pay_dep = #{payDep,jdbcType=VARCHAR},
- eaaid = #{eaaid,jdbcType=INTEGER},
- create_time = #{createTime,jdbcType=TIMESTAMP},
- district_name = #{districtName,jdbcType=VARCHAR},
- user_names = #{userNames,jdbcType=VARCHAR},
- release_start = #{releaseStart,jdbcType=TIMESTAMP},
- release_end = #{releaseEnd,jdbcType=TIMESTAMP},
- duration = #{duration,jdbcType=DOUBLE},
- examine_name = #{examineName,jdbcType=VARCHAR},
- settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
- debit_id = #{debitId,jdbcType=INTEGER},
- target_type = #{targetType,jdbcType=INTEGER},
- liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
- remarks = #{remarks,jdbcType=VARCHAR},
- check_no = #{checkNo,jdbcType=VARCHAR},
- expense_main = #{expenseMain,jdbcType=INTEGER},
- real_amount = #{realAmount,jdbcType=DECIMAL},
- secondary_type = #{secondaryType,jdbcType=INTEGER},
- secondary_type_other = #{secondaryTypeOther,jdbcType=VARCHAR},
- amount = #{amount,jdbcType=DECIMAL},
- approval = #{approval,jdbcType=INTEGER}
- where id = #{id,jdbcType=INTEGER}
- </update>
- <sql id="selectDtailsSql">
- a.id, a.prid, a.order_no orderNo, o.contract_no contractNo ,tm.buyer_name buyerName, a.aid, a.aname, a.`type`,
- a.type_other typeOther , a.status,a.process_status processStatus,a.total_amount totalAmount,a.debit_id debitId,
- a.attachment_url attachmentUrl,a.apply_dep applyDep, a.pay_dep payDep, a.eaaid,a.district_name districtName,a.approval,
- a.user_names userNames,a.create_time, a.release_start,a.release_end, a.duration,b.name applyDepName,a.amount,
- c.name payDepName,d.name ,d.bank ,d.accounts ,a.settlement_amount settlementAmount,a.secondary_type secondaryType,
- a.liquidation_status liquidationStatus, a.remarks,a.check_no checkNo,a.secondary_type_other secondaryTypeOther,
- a.create_time createTime, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,pr.type publicReleaseType,
- date_format(a.release_start,'%Y-%m-%d %H:%i:%S')releaseStartStr,
- date_format(a.release_end,'%Y-%m-%d %H:%i:%S')releaseEndStr
- FROM expense_account a left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
- left join expense_account_private d on a.eaaid=d.id left join t_order_new o on a.order_no =o.order_no
- left join t_order_mid tm on a.order_no =tm.order_no left join public_release pr on a.prid=pr.id
- </sql>
- <select id="selectByid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
- SELECT
- <include refid="selectDtailsSql"/>
- WHERE a.id= #{id}
- </select>
- <select id="selectByCheckNo" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
- SELECT
- <include refid="selectDtailsSql"/>
- WHERE a.check_no= #{checkNo}
- </select>
- <select id="selectExpenseAccountList" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountBo">
- select a.id,a.total_amount totalAmount,a.`type`,a.process_status processStatus,a.type_other typeOther,
- a.attachment_url attachmentUrl ,a.real_amount realAmount,e.contract_no contractNo,tm.buyer_name buyerName,
- a.secondary_type secondaryType, a.secondary_type_other secondaryTypeOther,a.status,a.user_names userNames,
- date_format(a.release_start,'%Y-%m-%d %H:%i:%S')releaseStartStr,a.user_names userNames,a.amount,
- date_format(a.release_end,'%Y-%m-%d %H:%i:%S')releaseEndStr,
- <if test="processStatus ==1">
- eae.type eaeType,
- </if>
- <if test="expenseMain ==0">
- mea.examine_name examineName,mea.check_no checkNo,mea.id mainId, mea.target_type targetType,
- </if>
- <if test="expenseMain ==1">
- a.examine_name examineName,a.check_no checkNo,a.target_type targetType,
- </if>
- f.name depName,d2.name financeName, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,a.aname,
- b.name applyDepName, c.name payDepName
- from expense_account a
- <if test="type !=null">
- right join (select a.id
- from expense_account a left join expense_relationship b on a.id =b.id
- left join expense_account c on b.ea_id =c.id
- where c.`type` = #{type})x on a.id=x.id
- </if>
- left join admin d on a.aid =d.id left join department f on d.department_id =f.id
- <if test="expenseMain ==0">
- left join expense_relationship er on a.id=er.ea_id
- left join expense_account mea on er.id=mea.id
- left join t_order_new e on mea.order_no =e.order_no
- left join department b on mea.apply_dep =b.id left join department c on mea.pay_dep =c.id
- left join admin d2 on b.expense_finance_id =d2.id
- </if>
- <if test="expenseMain ==1">
- left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
- left join t_order_new e on a.order_no =e.order_no
- left join admin d2 on b.expense_finance_id =d2.id
- </if>
- left join t_order_mid tm on e.order_no =tm.order_no
- <if test="processStatus ==1">
- inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
- where auditor= #{auditor} group by eaid) eae on a.id=eae.eaid
- </if>
- <include refid="selectExpenseAccountSql"/>
- order by a.status,a.create_time desc
- <if test="page_sql !=null">
- ${page_sql}
- </if>
- </select>
- <sql id="selectExpenseAccountSql">
- where 1=1
- <if test="processStatus ==1">
- and a.process_status>0
- <if test="examineStatus ==1">
- and a.process_status =eae.`type`
- </if>
- <if test="examineStatus ==2">
- and a.process_status >eae.`type`
- </if>
- </if>
- <if test="processStatus ==2">
- <if test="roleType ==0">
- and f.finance_id = #{auditor}
- </if>
- <if test="examineStatus ==0">
- and a.process_status> 1
- and a.status in (1,2)
- </if>
- <if test="examineStatus ==1">
- and a.process_status= 2
- and a.status=1
- </if>
- <if test="examineStatus ==2">
- and a.process_status> 2
- and a.status in (1,2)
- </if>
- </if>
- <if test="processStatus ==5">
- and f.finance_id in (select id from admin where superior_id = #{auditor})
- </if>
- <if test="processStatus ==6">
- <if test="examineStatus ==1">
- and a.status=1
- </if>
- <if test="examineStatus ==2">
- and a.status in (2)
- </if>
- </if>
- <if test=" aid !=null">
- and a.aid= #{aid}
- </if>
- <if test="status != null">
- and a.status= #{status}
- </if>
- <if test="checkNo != null " >
- <if test="expenseMain ==0">
- and mea.check_no like concat('%',#{checkNo},'%')
- </if>
- <if test="expenseMain ==1">
- and a.check_no like concat('%',#{checkNo},'%')
- </if>
- </if>
- <if test="username != null" >
- and a.user_names like concat('%',#{username},'%')
- </if>
- <if test="startTime !=null and endTime !=null">
- and a.create_time between #{startTime} and #{endTime}
- </if>
- <if test="depId != null">
- and d.department_id = #{depId}
- </if>
- <if test="contractNo != null">
- and e.contract_no like concat('%',#{contractNo},'%')
- </if>
- <if test="applyDep != null">
- and a.apply_dep = #{applyDep}
- </if>
- <if test="payDep != null">
- and a.pay_dep = #{payDep}
- </if>
- <if test="expenseMain != null">
- and a.expense_main= #{expenseMain}
- </if>
- <if test="secondaryType != null">
- and a.secondary_type= #{secondaryType}
- </if>
- </sql>
- <select id="selectExpenseAccountCount" resultType="java.lang.Integer">
- select count(*)
- from expense_account a
- <if test="type !=null">
- right join (select a.id
- from expense_account a left join expense_relationship b on a.id =b.id
- left join expense_account c on b.ea_id =c.id
- where c.`type` = #{type})x on a.id=x.id
- </if>
- left join admin d on a.aid =d.id left join department f on d.department_id =f.id
- left join admin d2 on f.finance_id =d2.id
- <if test="expenseMain ==0">
- left join expense_relationship er on a.id=er.ea_id
- left join expense_account mea on er.id=mea.id
- left join t_order_new e on mea.order_no =e.order_no
- left join department b on mea.apply_dep =b.id left join department c on mea.pay_dep =c.id
- </if>
- <if test="expenseMain ==1">
- left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
- </if>
- <if test="processStatus ==1">
- inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
- where auditor= #{auditor} group by eaid) eae on a.id=eae.eaid
- </if>
- <include refid="selectExpenseAccountSql"/>
- </select>
- <select id="selectExpenseAccountTotalAmount" resultType="java.math.BigDecimal">
- select sum(a.amount) totalAmount
- from expense_account a
- <if test="type !=null">
- right join (select a.id
- from expense_account a left join expense_relationship b on a.id =b.id
- left join expense_account c on b.ea_id =c.id
- where c.`type` = #{type})x on a.id=x.id
- </if>
- left join admin d on a.aid =d.id left join department f on d.department_id =f.id
- <if test="expenseMain ==0">
- left join expense_relationship er on a.id=er.ea_id
- left join expense_account mea on er.id=mea.id
- left join t_order_new e on mea.order_no =e.order_no
- left join department b on mea.apply_dep =b.id left join department c on mea.pay_dep =c.id
- </if>
- <if test="expenseMain ==1">
- left join t_order_new e on a.order_no =e.order_no
- left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
- </if>
- <if test="processStatus ==1">
- inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
- where auditor= #{auditor} group by eaid) eae on a.id=eae.eaid
- </if>
- <include refid="selectExpenseAccountSql"/>
- </select>
- <select id="selectByaidAndPrid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
- SELECT
- <include refid="selectDtailsSql"/>
- WHERE 1=1
- <if test="status !=null">
- and a.status= #{status}
- </if>
- and a.prid= #{prid} and a.aid = #{aid}
- </select>
- <select id="selectByaidAndType" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
- SELECT
- a.id, a.prid, a.order_no orderNo, o.contract_no contractNo ,tm.buyer_name buyerName, a.aid, a.aname, a.`type`,
- a.type_other typeOther , a.status,a.process_status processStatus,a.total_amount totalAmount,a.debit_id debitId,
- a.attachment_url attachmentUrl,a.apply_dep applyDep, a.pay_dep payDep, a.eaaid,a.district_name districtName,
- a.user_names userNames,a.create_time, a.release_start,a.release_end, a.duration,b.name applyDepName,
- c.name payDepName,d.name ,d.bank ,d.accounts ,t0.amount settlementAmount,a.check_no checkNo,
- a.liquidation_status liquidationStatus, a.remarks,a.real_amount realAmount,
- date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,
- date_format(a.release_start,'%Y-%m-%d %H:%i:%S')releaseStartStr,
- date_format(a.release_end,'%Y-%m-%d %H:%i:%S')releaseEndStr
- FROM expense_account a left join department b on a.apply_dep =b.id left join department c on a.pay_dep =c.id
- left join expense_account_private d on a.eaaid=d.id left join t_order_new o on a.order_no =o.order_no
- left join t_order_mid tm on a.order_no =tm.order_no
- left join (select debit_id ,sum(settlement_amount) amount from expense_account where debit_id is not null and
- id != #{id} group by debit_id )t0 on a.id =t0.debit_id
- WHERE a.status=2 and a.liquidation_status in (0,1,2)
- and a.aid= #{aid} and a.type= #{type} and a.pay_dep= #{depId}
- order by a.create_time desc
- </select>
- <select id="selectStatistics" resultType="com.goafanti.expenseAccount.bo.OutMyEAStatistics">
- select a.aid,a.aname ,a.type,a.status ,a.amount totalAmount ,ifnull(a.debit_id,0) debitId ,a.target_type targetType ,ifnull(a2.settlement_amount,0) bxdkAmount
- from expense_account a
- left join expense_account a2 on a.debit_id =a2.id left join admin ad on a.aid=ad.id
- left join department dep on ad.department_id=dep.id
- where 1=1 and a.expense_main=0 and a.status>0
- <if test="lander != null">
- and dep.finance_id = #{lander}
- </if>
- <if test="name != null">
- and a.aname like concat('%',#{name},'%')
- </if>
- <if test="depId != null">
- and ad.department_id = #{depId}
- </if>
- <if test="startTime != null and endTime != null">
- and a.create_time between #{startTime} and #{endTime}
- </if>
- </select>
- <select id="selectByDebitId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from expense_account
- where debit_id = #{debitId}
- </select>
- <select id="selectByCheckNoNot" parameterType="java.lang.Integer" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from expense_account
- where check_no =''
- </select>
- <select id="selectCountByFinance" resultType="com.goafanti.common.model.FinanceCount">
- select x.aid, x.dates dateTime, count(*)expenseCount, sum(if(x.process_status = 1, 1, 0))expenseUnauditedCount
- from (select c.finance_id aid , a.process_status, DATE_FORMAT(a.create_time , '%Y-%m-%d') dates
- from expense_account a left join admin b on a.aid=b.id left join department c on b.department_id =c.id
- where a.status in (1, 2) and a.process_status >0 and c.finance_id = #{aid})x
- group by x.aid, x.dates;
- </select>
- <select id="selectByIds" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from expense_account
- where id in
- <foreach collection="list" open="(" close=")" separator="," item="id">
- #{id}
- </foreach>
- </select>
- <select id="selectByMainId" resultMap="MainMap">
- select b.id,b.check_no,b.total_amount,b.amount,b.aname,b.apply_dep,b.pay_dep,b.real_amount,b.type_other ,b.aid,
- date_format(b.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,b.examine_name, dep.name applyDepName,dep2.name payDepName,
- b.remarks,b.eaaid ,eap.name ,eap.bank ,eap.accounts ,b.status,b.process_status,
- c.id sonId,c.total_amount sonTotalAmount,c.settlement_amount sonSettlementAmount,c.amount sonAmount, c.`type` sonType,c.type_other sonTypeOther,
- c.user_names ,c.release_start ,c.release_end , c.district_name districtName,c.user_names userNames,c.secondary_type ,c.secondary_type_other,c.attachment_url,
- c.duration,pr.plan,c.real_amount sonRealAmount,o.order_no,o.contract_no,pr.type publicReleaseType,
- c.debit_id debitId, debit.real_amount DebitRealAmount ,debit.settlement_amount DebitSettlementAmount,debit.liquidation_status DebitliquidationStatus,
- d.id detId,d.`type` detType,d.amount detAmount,d.real_amount detRealAmount ,d.start_district ,d.end_district,d.vehicle,d.vehicle_other,
- d.pay_type ,d.invoice_type ,d.invoice_no,d.payer_name ,d.open_bank ,d.bank_accounts ,d.open_bank_address,d.type_other detTypeOther,
- date_format(d.start_time,'%Y-%m-%d %H:%i:%S')startTime,date_format(d.end_time,'%Y-%m-%d %H:%i:%S')endTime,
- date_format(d.agree_time,'%Y-%m-%d')agreeTime
- from expense_relationship a left join expense_account b on a.id =b.id left join expense_account c on a.ea_id =c.id
- left join department dep on b.apply_dep =dep.id left join department dep2 on b.pay_dep =dep2.id
- left join expense_account_private eap on b.eaaid =eap.id left join expense_account_details d on c.id =d.eaid
- left join t_order_new o on c.order_no =o.order_no left join public_release pr on c.prid=pr.id left join t_order_new pro on pr.order_no=pro.order_no
- left join expense_account debit on c.debit_id=debit.id
- where a.id= #{id}
- </select>
- <select id="selectListByMainId" resultMap="BaseResultMap">
- select b.*
- from expense_relationship a left join expense_account b on a.ea_id =b.id
- where a.id =#{id}
- </select>
- <resultMap id="MainMap" type="com.goafanti.expenseAccount.bo.MainExpenseAccount">
- <id column="id" jdbcType="INTEGER" property="id" />
- <result column="check_no" jdbcType="VARCHAR" property="checkNo" />
- <result column="aid" jdbcType="VARCHAR" property="aid" />
- <result column="type_other" jdbcType="VARCHAR" property="typeOther" />
- <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
- <result column="real_amount" jdbcType="DECIMAL" property="realAmount" />
- <result column="amount" jdbcType="DECIMAL" property="amount" />
- <result column="aname" jdbcType="VARCHAR" property="aname" />
- <result column="apply_dep" jdbcType="VARCHAR" property="applyDep" />
- <result column="pay_dep" jdbcType="VARCHAR" property="payDep" />
- <result column="applyDepName" jdbcType="VARCHAR" property="applyDepName" />
- <result column="payDepName" jdbcType="VARCHAR" property="payDepName" />
- <result column="remarks" jdbcType="VARCHAR" property="remarks" />
- <result column="eaaid" jdbcType="INTEGER" property="eaaid" />
- <result column="name" jdbcType="VARCHAR" property="name" />
- <result column="bank" jdbcType="VARCHAR" property="bank" />
- <result column="accounts" jdbcType="VARCHAR" property="accounts" />
- <result column="status" jdbcType="INTEGER" property="status" />
- <result column="process_status" jdbcType="INTEGER" property="processStatus" />
- <result column="createTimeStr" jdbcType="VARCHAR" property="createTimeStr" />
- <result column="examine_name" jdbcType="VARCHAR" property="examineName" />
- <association property="sonList" resultMap="SonExpenseAccountMap"></association>
- </resultMap>
- <resultMap id="SonExpenseAccountMap" type="com.goafanti.expenseAccount.bo.SonExpenseAccount">
- <id column="sonId" jdbcType="INTEGER" property="id" />
- <result column="prid" jdbcType="INTEGER" property="prid" />
- <result column="sonTotalAmount" jdbcType="DECIMAL" property="totalAmount" />
- <result column="sonSettlementAmount" jdbcType="DECIMAL" property="settlementAmount" />
- <result column="sonRealAmount" jdbcType="DECIMAL" property="realAmount" />
- <result column="sonAmount" jdbcType="DECIMAL" property="amount" />
- <result column="sonType" jdbcType="INTEGER" property="type" />
- <result column="sonTypeOther" jdbcType="VARCHAR" property="typeOther" />
- <result column="secondary_type" jdbcType="INTEGER" property="secondaryType" />
- <result column="secondary_type_other" jdbcType="INTEGER" property="secondaryTypeOther" />
- <result column="attachment_url" jdbcType="INTEGER" property="attachmentUrl" />
- <result column="user_names" jdbcType="VARCHAR" property="userNames" />
- <result column="release_start" jdbcType="VARCHAR" property="releaseStart" />
- <result column="release_end" jdbcType="VARCHAR" property="releaseEnd" />
- <result column="districtName" jdbcType="VARCHAR" property="districtName" />
- <result column="duration" jdbcType="VARCHAR" property="duration" />
- <result column="plan" jdbcType="VARCHAR" property="plan" />
- <result column="debitId" jdbcType="INTEGER" property="debitId" />
- <result column="debitRealAmount" jdbcType="DECIMAL" property="debitRealAmount" />
- <result column="debitSettlementAmount" jdbcType="DECIMAL" property="debitSettlementAmount" />
- <result column="debitLiquidationStatus" jdbcType="INTEGER" property="debitLiquidationStatus" />
- <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
- <result column="contract_no" jdbcType="VARCHAR" property="contractNo" />
- <result column="publicReleaseType" jdbcType="INTEGER" property="publicReleaseType" />
- <association property="detList" resultMap="ExpenseAccountDetailsMap"></association>
- </resultMap>
- <resultMap id="ExpenseAccountDetailsMap" type="com.goafanti.expenseAccount.bo.SonExpenseAccountDetails">
- <id column="detId" jdbcType="INTEGER" property="id" />
- <result column="detType" jdbcType="INTEGER" property="type" />
- <result column="detTypeOther" jdbcType="INTEGER" property="typeOther" />
- <result column="detAmount" jdbcType="DECIMAL" property="amount" />
- <result column="detRealAmount" jdbcType="DECIMAL" property="realAmount" />
- <result column="start_district" jdbcType="VARCHAR" property="startDistrict" />
- <result column="end_district" jdbcType="VARCHAR" property="endDistrict" />
- <result column="vehicle" jdbcType="INTEGER" property="vehicle" />
- <result column="vehicle_other" jdbcType="VARCHAR" property="vehicleOther" />
- <result column="pay_type" jdbcType="INTEGER" property="payType" />
- <result column="invoice_type" jdbcType="INTEGER" property="invoiceType" />
- <result column="invoice_no" jdbcType="VARCHAR" property="invoiceNo" />
- <result column="payer_name" jdbcType="VARCHAR" property="payerName" />
- <result column="open_bank" jdbcType="VARCHAR" property="openBank" />
- <result column="bank_accounts" jdbcType="VARCHAR" property="bankAccounts" />
- <result column="open_bank_address" jdbcType="VARCHAR" property="openBankAddress" />
- <result column="startTime" jdbcType="VARCHAR" property="startTime" />
- <result column="endTime" jdbcType="VARCHAR" property="endTime" />
- <result column="agreeTime" jdbcType="VARCHAR" property="agreeTime" />
- </resultMap>
- <update id="updateByIds" >
- update expense_account
- set status= #{status}
- where id in
- <foreach collection="list" open="(" close=")" separator="," item="item">
- #{item.id}
- </foreach>
- </update>
- <update id="updateByMainId">
- update expense_relationship a ,expense_account b
- set b.status= #{status}
- where a.id= #{id} and a.ea_id=b.id
- </update>
- <update id="updateSonByDetId">
- update expense_account x ,(select b.id,sum(c.real_amount) amount
- from expense_account_details a left join expense_account b on a.eaid =b.id
- left join expense_account_details c on b.id =c.eaid
- where a.id= #{id} group by b.id)y
- set x.real_amount =y.amount
- where x.id=y.id;
- </update>
- <update id="updateMainByDetId">
- update expense_account x ,( select a.id,sum(c.real_amount)amount
- from expense_account a left join expense_relationship b on a.id=b.id
- left join expense_account c on b.ea_id =c.id
- where a.id in(select c.id
- from expense_account_details a left join expense_account b on a.eaid =b.id
- left join expense_relationship c on b.id =c.ea_id
- where a.id= #{id}) group by a.id)y
- set x.real_amount =y.amount
- where x.id=y.id
- </update>
- <update id="updateDeleteDebitId">
- update expense_account
- set debit_id=null,settlement_amount=0
- where id= #{id}
- </update>
- <update id="updateSonByMainId">
- update expense_relationship a left join expense_account b on a.id =b.id
- left join expense_account c on a.ea_id =c.id
- set c.status =b.status ,c.process_status =b.process_status
- where a.id= #{id}
- </update>
- <select id="ExpenseMainList" resultMap="MainMap">
- select b.id,b.check_no,b.total_amount,b.real_amount ,b.order_no,o.contract_no ,b.aname,b.apply_dep,b.pay_dep,b.amount,
- date_format(b.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,b.status,b.process_status,b.examine_name,
- dep.name applyDepName,dep2.name payDepName, b.remarks,b.eaaid
- from expense_account b left join department dep on b.apply_dep =dep.id
- left join department dep2 on b.pay_dep =dep2.id left join t_order_new o on b.order_no =o.order_no
- left join admin ad on b.aid=ad.id
- left join department adDep on ad.department_id=adDep.id
- <if test="roleType > 0">
- inner join (select eaid ,auditor,min(process_status)`type`,status from expense_account_examine
- where auditor= #{aid}
- <if test="listStatus ==0"> and status=0 </if>
- <if test="listStatus ==1"> and status=1 </if>
- group by eaid) eae on b.id=eae.eaid
- </if>
- <if test="username !=null">
- left join expense_relationship er on er.id=b.id
- left join expense_account ea2 on ea2.id=er.ea_id
- </if>
- <include refid="ExpenseMainSql"/>
- order by if(b.status=3,-1,b.status) ,b.create_time desc
- ${page_sql}
- </select>
- <sql id="ExpenseMainSql">
- where 1=1 and b.expense_main =1 and b.status < 4
- <if test="checkNo !=null">
- and b.check_no like concat('%',#{checkNo},'%')
- </if>
- <if test=" status != null">
- and b.status = #{status}
- </if>
- <if test=" roleType ==0">
- and b.aid = #{aid}
- <if test="listStatus ==0">
- and b.status >=0
- </if>
- <if test="listStatus ==1">
- and b.status =2
- </if>
- </if>
- <if test="roleType > 0">
- <if test="listStatus ==0">
- and b.process_status =eae.type
- and eae.status=0
- </if>
- <if test="listStatus ==1">
- and b.process_status >= eae.type
- and eae.status=1
- </if>
- </if>
- <if test="startTime !=null and endTime !=null ">
- and b.create_time between #{startTime} and #{endTime}
- </if>
- <if test="username !=null">
- and ea2.user_names like concat('%',#{username},'%')
- </if>
- </sql>
- <select id="ExpenseMainCount" resultType="java.lang.Integer">
- select count(*)
- from expense_account b
- <if test="username !=null">
- left join expense_relationship er on er.id=b.id
- left join expense_account ea2 on ea2.id=er.ea_id
- </if>
- left join admin ad on b.aid=ad.id left join department adDep on ad.department_id=adDep.id
- <if test="roleType > 0">
- inner join (select eaid ,auditor,min(process_status)`type`,status from expense_account_examine
- where auditor= #{aid}
- <if test="listStatus ==0"> and status=0 </if>
- <if test="listStatus ==1"> and status=1 </if>
- group by eaid) eae on b.id=eae.eaid
- </if>
- <include refid="ExpenseMainSql"/>
- </select>
- <select id="ExpenseDetailsList" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountDetailsList">
- select mea.check_no checkNo ,ead.`type`,ead.type_other typeOther,
- ead.amount ,ead.real_amount realAmount ,o.contract_no contractNo ,dep.name applyDepName,
- a.type sonType ,a.type_other sonTypeOther ,
- dep2.name payDepName ,a.aname ,ad2.name financeName,a.status ,mea.process_status processStatus ,mea.id mainId,mea.target_type targetType,
- tm.buyer_name buyerName ,date_format(mea.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr
- from expense_account_details ead left join expense_account a on ead.eaid =a.id
- left join expense_relationship er on a.id=er.ea_id left join expense_account mea on er.id=mea.id
- left join t_order_new o on mea.order_no =o.order_no left join t_order_mid tm on o.order_no =tm.order_no
- left join department dep on mea.apply_dep =dep.id
- left join department dep2 on mea.pay_dep =dep2.id left join admin ad on a.aid=ad.id
- left join department dep3 on ad.department_id =dep3.id left join admin ad2 on dep.expense_finance_id =ad2.id
- where 1=1
- <include refid="ExpenseDetailsSql"/>
- ${page_sql}
- </select>
- <sql id="ExpenseDetailsSql">
- <if test=" status != null">
- and mea.status = #{status}
- </if>
- <if test="deps !=null">
- and ad.department_id in
- <foreach collection="deps" item="dep" open="(" close=")" separator=",">
- #{dep}
- </foreach>
- </if>
- <if test="roleType ==1">
- and dep.expense_finance_id = #{aid}
- </if>
- <if test="roleType ==2">
- and dep.expense_finance_id in (select id from admin where superior_id = #{aid})
- </if>
- <if test=" contractNo != null">
- and o.contract_no like concat('%',#{contractNo},'%')
- </if><if test=" buyerName != null">
- and tm.buyer_name like concat('%','buyerName','%')
- </if><if test=" type != null">
- and ead.`type` = #{type}
- </if><if test=" aname != null">
- and mea.aname like concat('%',#{aname},'%')
- </if><if test=" applyDep != null">
- and mea.apply_dep =#{applyDep}
- </if><if test=" payDep != null">
- and mea.pay_dep =#{payDep}
- </if><if test=" startTime != null and endTime !=null">
- and mea.create_time between #{startTime} and #{endTime}
- </if><if test=" checkNo != null">
- and mea.check_no like concat('%',#{checkNo},'%')
- </if>
- </sql>
- <select id="ExpenseDetailsCount" resultType="java.lang.Integer">
- select count(*)
- from expense_account_details ead left join expense_account a on ead.eaid =a.id
- left join expense_relationship er on a.id=er.ea_id left join expense_account mea on er.id=mea.id
- left join t_order_new o on mea.order_no =o.order_no left join t_order_mid tm on o.order_no =tm.order_no
- left join department dep on mea.apply_dep =dep.id
- left join department dep2 on mea.pay_dep =dep2.id left join admin ad on mea.aid=ad.id
- left join department dep3 on ad.department_id =dep3.id left join admin ad2 on dep3.finance_id =ad2.id
- where 1=1
- <include refid="ExpenseDetailsSql"/>
- </select>
- <select id="ExpenseDetailsTotalAmount" resultType="java.math.BigDecimal">
- select sum(ead.amount) totalAmount
- from expense_account_details ead left join expense_account a on ead.eaid =a.id
- left join expense_relationship er on a.id=er.ea_id left join expense_account mea on er.id=mea.id
- left join t_order_new o on mea.order_no =o.order_no left join t_order_mid tm on o.order_no =tm.order_no
- left join department dep on mea.apply_dep =dep.id
- left join department dep2 on mea.pay_dep =dep2.id left join admin ad on mea.aid=ad.id
- left join department dep3 on ad.department_id =dep3.id left join admin ad2 on dep3.finance_id =ad2.id
- where 1=1
- <include refid="ExpenseDetailsSql"/>
- </select>
- <select id="selectCountByIdsAndType" resultType="java.lang.Integer">
- select count(*) from expense_account
- where type =#{type}
- and id in
- <foreach collection="list" item="id" open="(" close=")" separator=",">
- #{id}
- </foreach>
- </select>
- <select id="selectAllMain" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
- from expense_account
- where expense_main=1
- </select>
- <select id="selectSonByMainIds" resultMap="MainMap">
- select b.id,
- c.id sonId,c.total_amount sonTotalAmount,c.settlement_amount sonSettlementAmount,c.amount sonAmount,c.real_amount sonRealAmount,
- c.`type` sonType,c.type_other sonTypeOTher, c.user_names ,c.release_start ,c.release_end,c.prid,
- c.attachment_url attachmentUrl,c.secondary_type,c.secondary_type_other
- from expense_relationship a
- left join expense_account b on a.id =b.id
- left join department dep on b.apply_dep =dep.id left join department dep2 on b.pay_dep =dep2.id
- left join t_order_new o on b.order_no =o.order_no left join expense_account c on a.ea_id =c.id
- left join admin ad on b.aid=ad.id left join department adDep on ad.department_id=adDep.id
- where b.id in
- <foreach collection="list" separator="," open="(" close=")" item="id">
- #{id}
- </foreach>
- </select>
- <select id="selectbySonId" resultMap="MainMap">
- select b.id id,
- c.id sonId,c.total_amount sonTotalAmount,c.settlement_amount sonSettlementAmount,c.amount sonAmount,c.real_amount sonRealAmount,
- c.`type` sonType,c.type_other sonTypeOTher, c.user_names ,c.release_start ,c.release_end,
- c.attachment_url attachmentUrl,c.secondary_type,c.secondary_type_other
- from expense_relationship a
- left join expense_account b on a.id =b.id
- left join department dep on b.apply_dep =dep.id left join department dep2 on b.pay_dep =dep2.id
- left join t_order_new o on b.order_no =o.order_no left join expense_account c on a.ea_id =c.id
- left join admin ad on b.aid=ad.id left join department adDep on ad.department_id=adDep.id
- where c.id in (#{id})
- </select>
- <select id="selectDeleteIdBySonId" resultType="java.lang.Integer">
- select b.id
- from expense_account a left join expense_relationship b on a.id =b.ea_id
- left join expense_account c on b.id =c.id
- where a.id= #{id} and c.id is null
- </select>
- </mapper>
|