| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475 |
- <?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" />
- </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
- </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)
- 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})
- </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>
- </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>
- </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>
- </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}
- 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.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 appDepName,
- c.name payDepName,d.name ,d.bank ,d.accounts ,a.settlement_amount settlementAmount,
- a.liquidation_status liquidationStatus, a.remarks,
- 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
- </sql>
- <select id="selectByid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
- SELECT
- <include refid="selectDtailsSql"/>
- 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
- WHERE a.id= #{id}
- </select>
- <select id="selectExpenseAccountList" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountBo">
- select a.id,a.total_amount totalAmount,a.`type`,a.process_status processStatus,a.status,a.examine_name examineName,
- a.target_type targetType , e.contract_no contractNo,tm.buyer_name buyerName ,f.name depName,d2.name financeName,
- date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,a.aname, b.name appDepName, c.name payDepName
- 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 admin d on a.aid =d.id left join t_order_new e on a.order_no =e.order_no
- left join t_order_mid tm on a.order_no =tm.order_no left join department f on d.department_id =f.id
- left join admin d2 on f.finance_id =d2.id
- where 1=1
- <if test="processStatus ==0">
- and a.aid= #{aid}
- </if>
- <if test="processStatus ==1">
- and a.process_status>0
- and a.status =1
- and d.superior_id =#{aid}
- </if>
- <if test="status != null">
- and a.status= #{status}
- </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="orderNo != null">
- and a.order_no = #{orderNo}
- </if>
- <if test="username != null">
- and tm.buyer_name = #{username}
- </if>
- <if test="applyDep != null">
- and a.apply_dep = #{applyDep}
- </if>
- <if test="payDep != null">
- and a.pay_dep = #{payDep}
- </if>
- order by a.create_time desc
- <if test="page_sql !=null">
- ${page_sql}
- </if>
- </select>
- <select id="selectExpenseAccountCount" resultType="java.lang.Integer">
- select count(*)
- 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 admin d on a.aid =d.id left join t_order_new e on a.order_no =e.order_no
- left join t_order_mid tm on a.order_no =tm.order_no
- where 1=1
- <if test="processStatus ==0">
- and a.aid= #{aid}
- </if>
- <if test="processStatus ==1">
- and a.process_status>0
- and a.status =1
- and d.superior_id =#{aid}
- </if>
- <if test="status != null">
- and a.status= #{status}
- </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="orderNo != null">
- and a.order_no = #{orderNo}
- </if>
- <if test="username != null">
- and tm.buyer_name = #{username}
- </if>
- <if test="applyDep != null">
- and a.apply_dep = #{applyDep}
- </if>
- <if test="payDep != null">
- and a.pay_dep = #{payDep}
- </if>
- </select>
- <select id="selectByaidAndPrid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
- SELECT
- <include refid="selectDtailsSql"/>
- 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
- WHERE a.status= #{status}
- and a.prid= #{prid} and a.aid = #{aid}
- </select>
- <select id="selectByaidAndType" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccount">
- SELECT
- <include refid="selectDtailsSql"/>
- 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
- WHERE a.status=2
- and a.aid= #{aid} and a.type= #{type} and a.pay_dep= #{depId}
- </select>
- <select id="selectStatistics" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountStatistics">
- select a.aid,a.aname ,if(a.`type` <4 ,1,0)bx,if(a.`type`=4 ,1,0)jz,if(a.`type`=5 ,1,0)dk,a.debit_id debitId ,a.target_type targetType ,
- if(a.`type`< 4 ,a.total_amount ,0)bxAmout,if(a.`type`=4 ,a.total_amount ,0)jzAmount,if(a.`type`=5,a.total_amount,0)dkAmount,
- if(a.status< 2,1,0)wshs,if(a.status=3,1,0)bhs
- 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 admin ad on a.aid=ad.id
- where a.status=2
- <if test="name != null">
- and ad.name like concat('%','y','%')
- </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>
- </mapper>
|