123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- <?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.liang.dao.StaPayapprovalDao">
- <resultMap type="com.liang.entity.StaPayapproval" id="StaPayapprovalMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="sqlx" column="SQLX" jdbcType="VARCHAR"/>
- <result property="fysq" column="FYSQ" jdbcType="INTEGER"/>
- <result property="ht" column="HT" jdbcType="INTEGER"/>
- <result property="htje" column="HTJE" jdbcType="NUMERIC"/>
- <result property="bcfkje" column="BCFKJE" jdbcType="NUMERIC"/>
- <result property="cjr" column="CJR" jdbcType="INTEGER"/>
- <result property="cjsj" column="CJSJ" jdbcType="TIMESTAMP"/>
- <result property="spzt" column="SPZT" jdbcType="VARCHAR"/>
- <result property="yszl" column="YSZL" jdbcType="VARCHAR"/>
- <result property="fkjh" column="FKJH" jdbcType="INTEGER"/>
- <result property="sqmc" column="SQMC" jdbcType="VARCHAR"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="StaPayapprovalMap">
- select b.*, g.SQMC as FYSQMC, p.RWS, g.XMMC as RWSMC, c.HTMC, c.WJ as HTWJ, p.JHMC as FKJHMC, b.CJSJ as CJRQ
- from sta_PayApproval b
- left join prj_PayPlan p on p.ID = b.FKJH
- left join prj_Contract c on c.ID = b.HT
- left join sta_BudgetApproval g on g.ID = b.FYSQ
- where b.ID = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="StaPayapprovalMap">
- select
- ID, SQLX, FYSQ, HT, HTJE, BCFKJE, CJR, CJSJ, SPZT, YSZL, FKJH, SQMC
- from sta_PayApproval
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="sqlx != null and sqlx != ''">
- and SQLX = #{sqlx}
- </if>
- <if test="fysq != null">
- and FYSQ = #{fysq}
- </if>
- <if test="ht != null">
- and HT = #{ht}
- </if>
- <if test="htje != null">
- and HTJE = #{htje}
- </if>
- <if test="bcfkje != null">
- and BCFKJE = #{bcfkje}
- </if>
- <if test="cjr != null">
- and CJR = #{cjr}
- </if>
- <if test="cjsj != null">
- and CJSJ = #{cjsj}
- </if>
- <if test="spzt != null and spzt != ''">
- and SPZT = #{spzt}
- </if>
- <if test="yszl != null and yszl != ''">
- and YSZL = #{yszl}
- </if>
- <if test="fkjh != null">
- and FKJH = #{fkjh}
- </if>
- <if test="sqmc != null and sqmc != ''">
- and SQMC = #{sqmc}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from sta_PayApproval
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="sqlx != null and sqlx != ''">
- and SQLX = #{sqlx}
- </if>
- <if test="fysq != null">
- and FYSQ = #{fysq}
- </if>
- <if test="ht != null">
- and HT = #{ht}
- </if>
- <if test="htje != null">
- and HTJE = #{htje}
- </if>
- <if test="bcfkje != null">
- and BCFKJE = #{bcfkje}
- </if>
- <if test="cjr != null">
- and CJR = #{cjr}
- </if>
- <if test="cjsj != null">
- and CJSJ = #{cjsj}
- </if>
- <if test="spzt != null and spzt != ''">
- and SPZT = #{spzt}
- </if>
- <if test="yszl != null and yszl != ''">
- and YSZL = #{yszl}
- </if>
- <if test="fkjh != null">
- and FKJH = #{fkjh}
- </if>
- <if test="sqmc != null and sqmc != ''">
- and SQMC = #{sqmc}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into sta_PayApproval(SQLX, FYSQ, HT, HTJE, BCFKJE, CJR, CJSJ, SPZT, YSZL, FKJH, SQMC)
- values (#{sqlx}, #{fysq}, #{ht}, #{htje}, #{bcfkje}, #{cjr}, #{cjsj}, #{spzt}, #{yszl}, #{fkjh}, #{sqmc})
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into sta_PayApproval(SQLX, FYSQ, HT, HTJE, BCFKJE, CJR, CJSJ, SPZT, YSZL, FKJH, SQMC)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.sqlx}, #{entity.fysq}, #{entity.ht}, #{entity.htje}, #{entity.bcfkje}, #{entity.cjr}, #{entity.cjsj}, #{entity.spzt}, #{entity.yszl}, #{entity.fkjh}, #{entity.sqmc})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into sta_PayApproval(SQLX, FYSQ, HT, HTJE, BCFKJE, CJR, CJSJ, SPZT, YSZL, FKJH, SQMC)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.sqlx}, #{entity.fysq}, #{entity.ht}, #{entity.htje}, #{entity.bcfkje}, #{entity.cjr}, #{entity.cjsj}, #{entity.spzt}, #{entity.yszl}, #{entity.fkjh}, #{entity.sqmc})
- </foreach>
- on duplicate key update
- SQLX = values(SQLX),
- FYSQ = values(FYSQ),
- HT = values(HT),
- HTJE = values(HTJE),
- BCFKJE = values(BCFKJE),
- CJR = values(CJR),
- CJSJ = values(CJSJ),
- SPZT = values(SPZT),
- YSZL = values(YSZL),
- FKJH = values(FKJH)
- SQMC = values(SQMC),
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update sta_PayApproval
- <set>
- <if test="sqlx != null and sqlx != ''">
- SQLX = #{sqlx},
- </if>
- <if test="htje != null">
- HTJE = #{htje},
- </if>
- <if test="bcfkje != null">
- BCFKJE = #{bcfkje},
- </if>
- <if test="yszl != null and yszl != ''">
- YSZL = #{yszl},
- </if>
- <if test="fkjh != null">
- FKJH = #{fkjh},
- </if>
- <if test="sqmc != null and sqmc != ''">
- SQMC = #{sqmc},
- </if>
- </set>
- where ID = #{id}
- </update>
- <!--撤销审核状态任务书-->
- <update id="tjrevokeApprove">
- update sta_PayApproval
- set SPZT = '未提交'
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete from sta_PayApproval where ID = #{id}
- </delete>
- <!--获取付款申请列表-->
- <select id="getFksqList" resultMap="StaPayapprovalMap" parameterType="map">
- select b.*, u.name as CJRXM, FORMAT(b.CJSJ, 'yyyy-MM-dd') as CJRQ, c.HTMC, c.WJ as HTWJ, p.JHMC as FKJHMC, g.SQMC as FYSQMC, g.XMMC as RWSMC
- from sta_PayApproval b
- left join prj_PayPlan p on p.ID = b.FKJH
- left join prj_Contract c on c.ID = b.HT
- left join sta_BudgetApproval g on g.ID = b.FYSQ
- left join sys_user_info u on u.user_id = b.CJR
- where 1 = 1
- <if test="userId != null and userId != ''">
- and (b.CJR = #{userId} or #{userId} in (select SHR from prj_ApproveRecord where XMID = b.ID))
- </if>
- <if test="spzt != null and spzt != ''">
- and b.SPZT = #{spzt}
- </if>
- <if test="fysqmc != null and fysqmc != ''">
- and g.SQMC like '%'+#{fysqmc}+'%'
- </if>
- <if test="erpbh !=null and erpbh != ''" >
- and g.ERPBH like '%'+#{erpbh}+'%'
- </if>
- <if test="bh != null and bh != ''">
- and g.BH like '%'+#{bh}+'%'
- </if>
- <if test="cjsj1 != null and cjsj1 != ''">
- and b.CJSJ >= #{cjsj1}
- </if>
- <if test="cjsj2 != null and cjsj2 != ''">
- and b.CJSJ <= #{cjsj2}
- </if>
- <choose>
- <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
- order by ${sortName} ${sortOrder}
- </when>
- </choose>
- ORDER BY
- CASE
- WHEN b.SPZT = '部门主任审批' THEN 0
- WHEN b.SPZT = '科技项目管理专责审批' THEN 1
- WHEN b.SPZT = '科技部部门主任审批' THEN 2
- WHEN b.SPZT = '主管院领导审批' THEN 3
- WHEN b.SPZT = '院长审批' THEN 4
- WHEN b.SPZT = '科技项目管理专责确认' THEN 5
- WHEN b.SPZT = '未提交' THEN 996
- WHEN b.SPZT = '未提交(返回)' THEN 997
- WHEN b.SPZT = '审批结束' THEN 998
- WHEN b.SPZT = '作废' THEN 999
- END
- ASC,
- p.CJSJ DESC
- </select>
- <!--批量删除付款申请-->
- <delete id="batchDelete" parameterType="java.util.ArrayList">
- delete from sta_PayApproval
- where ID in
- <foreach item="item" index="index" collection="idList" open = "(" separator = "," close = ")">
- #{item}
- </foreach>
- </delete>
- <!--通过主键修改审批状态-->
- <update id="updateSpzt">
- update sta_PayApproval
- set SPZT = #{spzt}
- where ID = #{id}
- </update>
- </mapper>
|