123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <?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.StaReimbursementDao">
- <resultMap type="com.liang.entity.StaReimbursement" id="StaReimbursementMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="bxpz" column="BXPZ" jdbcType="VARCHAR"/>
- <result property="fysq" column="FYSQ" jdbcType="INTEGER"/>
- <result property="bzje" column="BZJE" jdbcType="NUMERIC"/>
- <result property="sl" column="SL" jdbcType="NUMERIC"/>
- <result property="bhsje" column="BHSJE" jdbcType="NUMERIC"/>
- <result property="sf" column="SF" jdbcType="NUMERIC"/>
- <result property="bzr" column="BZR" jdbcType="INTEGER"/>
- <result property="cjsj" column="CJSJ" jdbcType="TIMESTAMP"/>
- <result property="mc" column="MC" jdbcType="VARCHAR"/>
- <result property="spzt" column="SPZT" jdbcType="VARCHAR"/>
- <result property="sfbyj" column="SFBYJ" jdbcType="VARCHAR" />
- </resultMap>
- <!--id查询单个-->
- <select id="queryById" resultMap="StaReimbursementMap">
- select r.*, b.FYLB, g.FYMC as FYLBMC, b.SQJE
- from sta_Reimbursement r
- left join sta_BudgetApproval b on b.ID = r.FYSQ
- left join prj_AnnualBudgetDetail g on g.ID = b.FYLB
- where r.ID = #{id}
- </select>
- <!--fysq查询单个-->
- <select id="queryByFYSQ" resultMap="StaReimbursementMap">
- select *
- from sta_Reimbursement
- where FYSQ = #{fysq}
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="StaReimbursementMap">
- select *
- from sta_Reimbursement
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="bxpz != null and bxpz != ''">
- and BXPZ = #{bxpz}
- </if>
- <if test="fysq != null">
- and FYSQ = #{fysq}
- </if>
- <if test="bzje != null">
- and BZJE = #{bzje}
- </if>
- <if test="sl != null">
- and SL = #{sl}
- </if>
- <if test="bhsje != null">
- and BHSJE = #{bhsje}
- </if>
- <if test="sf != null">
- and SF = #{sf}
- </if>
- <if test="bzr != null">
- and BZR = #{bzr}
- </if>
- <if test="cjsj != null">
- and CJSJ = #{cjsj}
- </if>
- <if test="mc != null and mc != ''">
- and MC = #{mc}
- </if>
- <if test="spzt != null and spzt != ''">
- and SPZT = #{spzt}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from sta_Reimbursement
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="bxpz != null and bxpz != ''">
- and BXPZ = #{bxpz}
- </if>
- <if test="fysq != null">
- and FYSQ = #{fysq}
- </if>
- <if test="bzje != null">
- and BZJE = #{bzje}
- </if>
- <if test="sl != null">
- and SL = #{sl}
- </if>
- <if test="bhsje != null">
- and BHSJE = #{bhsje}
- </if>
- <if test="sf != null">
- and SF = #{sf}
- </if>
- <if test="bzr != null">
- and BZR = #{bzr}
- </if>
- <if test="cjsj != null">
- and CJSJ = #{cjsj}
- </if>
- <if test="mc != null and mc != ''">
- and MC = #{mc}
- </if>
- <if test="spzt != null and spzt != ''">
- and SPZT = #{spzt}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into sta_Reimbursement(BXPZ, FYSQ, BZJE, SL, BHSJE, SF, BZR, CJSJ, MC, SPZT)
- values (#{bxpz}, #{fysq}, #{bzje}, #{sl}, #{bhsje}, #{sf}, #{bzr}, #{cjsj}, #{mc}, #{spzt})
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into sta_Reimbursement(BXPZ, FYSQ, BZJE, SL, BHSJE, SF, BZR, CJSJ, MC, SPZT)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.bxpz}, #{entity.fysq}, #{entity.bzje}, #{entity.sl}, #{entity.bhsje}, #{entity.sf}, #{entity.bzr},
- #{entity.cjsj}, #{entity.mc}, #{entity.spzt})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into sta_Reimbursement(BXPZ, FYSQ, BZJE, SL, BHSJE, SF, BZR, CJSJ, MC, SPZT)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.bxpz}, #{entity.fysq}, #{entity.bzje}, #{entity.sl}, #{entity.bhsje}, #{entity.sf}, #{entity.bzr},
- #{entity.cjsj}, #{entity.mc}, #{entity.spzt})
- </foreach>
- on duplicate key update
- BXPZ = values(BXPZ),
- FYSQ = values(FYSQ),
- BZJE = values(BZJE),
- SL = values(SL),
- BHSJE = values(BHSJE),
- SF = values(SF),
- BZR = values(BZR),
- CJSJ = values(CJSJ),
- MC = values(MC),
- SPZT = values(SPZT)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update sta_Reimbursement
- set MC = #{mc},
- BXPZ = #{bxpz},
- BZJE = #{bzje},
- SL = #{sl},
- BHSJE = #{bhsje},
- SF = #{sf}
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete
- from sta_Reimbursement
- where ID = #{id}
- </delete>
- <!--获取报账列表-->
- <select id="getReimburseList" resultMap="StaReimbursementMap" parameterType="map">
- select r.*, a.BH as FYSQBH, a.SQMC as FYSQMC, u.name as BZRXM, a.XMID, a.XMMC,
- CASE
- WHEN a.SFBYJ = 1 THEN '是' ELSE '否'
- END AS SFBYJ
- from sta_Reimbursement r
- inner join sta_BudgetApproval a on a.ID = r.FYSQ
- left join sys_user_info u on u.user_id = r.BZR
- where 1 = 1
- <if test="userId != null and userId != ''">
- and (r.BZR = #{userId} or #{userId} in (select SHR from prj_ApproveRecord where XMID = r.ID))
- </if>
- <if test="spzt != null and spzt != ''">
- and r.SPZT = #{spzt}
- </if>
- <if test="fysqbh != null and fysqbh != ''">
- and a.BH like '%'+#{fysqbh}+'%'
- </if>
- <if test="mc != null and mc != ''">
- and r.MC like '%'+#{mc}+'%'
- </if>
- <if test="xmmc !=null and mc != ''">
- and r.XMMC like '%'+#{xmmc}+'%'
- </if>
- <choose>
- <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
- order by ${sortName} ${sortOrder}
- </when>
- </choose>
- ORDER BY
- CASE
- WHEN r.SPZT = '部门主任审批' THEN 0
- WHEN r.SPZT = '科技项目管理专责审批' THEN 1
- WHEN r.SPZT = '科技部部门主任审批' THEN 2
- WHEN r.SPZT = '主管院领导审批' THEN 3
- WHEN r.SPZT = '院长审批' THEN 4
- WHEN r.SPZT = '科技项目管理专责确认' THEN 5
- WHEN r.SPZT = '未提交' THEN 996
- WHEN r.SPZT = '未提交(返回)' THEN 997
- WHEN r.SPZT = '审批结束' THEN 998
- WHEN r.SPZT = '作废' THEN 999
- END
- ASC,
- CJSJ DESC
- </select>
- <!--批量删除报账-->
- <delete id="batchDelete" parameterType="java.util.ArrayList">
- delete from sta_Reimbursement
- where ID in
- <foreach item="item" index="index" collection="idList" open="(" separator="," close=")">
- #{item}
- </foreach>
- </delete>
- <!--撤销审核状态报账-->
- <update id="tjrevokeApprove">
- update sta_Reimbursement
- set SPZT = '未提交'
- where ID = #{id}
- </update>
- <!--通过主键修改审批状态-->
- <update id="updateSpzt">
- update sta_Reimbursement
- set SPZT = #{spzt}
- where ID = #{id}
- </update>
- <!-- 通过主键修改报账-->
- <update id="updateBZJE">
- update sta_Reimbursement
- set BZJE = #{bzje}
- where ID = #{id}
- </update>
- </mapper>
|