123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818 |
- <?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.StaBudgetapprovalDao">
- <resultMap type="com.liang.entity.StaBudgetapproval" id="StaBudgetapprovalMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="xmmc" column="XMMC" jdbcType="VARCHAR"/>
- <result property="xmid" column="XMID" jdbcType="INTEGER"/>
- <result property="bh" column="BH" jdbcType="VARCHAR"/>
- <result property="sqsm" column="SQSM" jdbcType="VARCHAR"/>
- <result property="sqje" column="SQJE" jdbcType="NUMERIC"/>
- <result property="fylb" column="FYLB" jdbcType="INTEGER"/>
- <result property="bbm" column="BBM" jdbcType="VARCHAR"/>
- <result property="fj" column="FJ" jdbcType="VARCHAR"/>
- <result property="shzt" column="SHZT" jdbcType="VARCHAR"/>
- <result property="nf" column="NF" jdbcType="VARCHAR"/>
- <result property="sqr" column="SQR" jdbcType="INTEGER"/>
- <result property="sqrxm" column="SQRXM" jdbcType="VARCHAR"/>
- <result property="sqsj" column="SQSJ" jdbcType="TIMESTAMP"/>
- <result property="sqmc" column="SQMC" jdbcType="VARCHAR"/>
- <result property="spzt" column="SPZT" jdbcType="VARCHAR"/>
- <result property="kyfyxx" column="KYFYXX" jdbcType="VARCHAR"/>
- <result property="bzje" column="BZJE" jdbcType="NUMERIC"/>
- <result property="bxpz" column="BXPZ" jdbcType="VARCHAR"/>
- <result property="bzje2" column="BZJE2" jdbcType="NUMERIC"/>
- <result property="sfbyj" column="SFBYJ" jdbcType="VARCHAR"/>
- <result property="kybg" column="KYBG" jdbcType="VARCHAR"/>
- <result property="erpbh" column="ERPBH" jdbcType="VARCHAR"/>
- <result property="xmlx" column="XMLX" jdbcType="VARCHAR"/>
- <result property="xmfzr" column="XMFZR" jdbcType="INTEGER"/>
- <result property="ssbm" column="SSBM" jdbcType="INTEGER"/>
- <result property="sfbz" column="SFBZ" jdbcType="VARCHAR"/>
- <result property="smwj" column="SMWJ" jdbcType="VARCHAR"/>
- <result property="bhsje" column="BHSJE" jdbcType="NUMERIC"/>
- <result property="sf" column="SF" jdbcType="NUMERIC"/>
- <result property="nys" column="NYS" jdbcType="INTEGER"/>
- <result property="bz" column="BZ" jdbcType="VARCHAR"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="StaBudgetapprovalMap">
- select b.*, d.YSJE
- from sta_BudgetApproval b
- left join prj_AnnualBudgetDetail d on d.NYS = b.NYS and d.ID = b.FYLB
- where b.ID = #{id}
- </select>
- <select id="queryByBH" resultMap="StaBudgetapprovalMap">
- select *
- from sta_BudgetApproval
- where BH like #{bh}+'%' order by ID desc
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="StaBudgetapprovalMap">
- select *
- from s
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="xmmc != null and xmmc != ''">
- and XMMC = #{xmmc}
- </if>
- <if test="xmid != null">
- and XMID = #{xmid}
- </if>
- <if test="bh != null and bh != ''">
- and BH = #{bh}
- </if>
- <if test="sqsm != null and sqsm != ''">
- and SQSM = #{sqsm}
- </if>
- <if test="sqje != null">
- and SQJE = #{sqje}
- </if>
- <if test="fylb != null">
- and FYLB = #{fylb}
- </if>
- <if test="bbm != null and bbm != ''">
- and BBM = #{bbm}
- </if>
- <if test="fj != null and fj != ''">
- and FJ = #{fj}
- </if>
- <if test="shzt != null and shzt != ''">
- and SHZT = #{shzt}
- </if>
- <if test="nf != null and nf != ''">
- and NF = #{nf}
- </if>
- <if test="sqr != null">
- and SQR = #{sqr}
- </if>
- <if test="sqrxm != null and sqrxm != ''">
- and SQRXM = #{sqrxm}
- </if>
- <if test="sqsj != null">
- and SQSJ = #{sqsj}
- </if>
- <if test="sqmc != null and sqmc != ''">
- and SQMC = #{sqmc}
- </if>
- <if test="spzt != null and spzt != ''">
- and SPZT = #{spzt}
- </if>
- <if test="kyfyxx != null and kyfyxx != ''">
- and KYFYXX = #{kyfyxx}
- </if>
- <if test="bzje != null">
- and BZJE = #{bzje}
- </if>
- <if test="bxpz != null and bxpz != ''">
- and BXPZ = #{bxpz}
- </if>
- <if test="bzje2 != null">
- and BZJE2 = #{bzje2}
- </if>
- <if test="sfbyj != null and sfbyj != ''">
- and SFBYJ = #{sfbyj}
- </if>
- <if test="kybg != null and kybg != ''">
- and KYBG = #{kybg}
- </if>
- <if test="erpbh != null and erpbh != ''">
- and ERPBH = #{erpbh}
- </if>
- <if test="xmlx != null and xmlx != ''">
- and XMLX = #{xmlx}
- </if>
- <if test="xmfzr != null">
- and XMFZR = #{xmfzr}
- </if>
- <if test="ssbm != null">
- and SSBM = #{ssbm}
- </if>
- <if test="sfbz != null and sfbz != ''">
- and SFBZ = #{sfbz}
- </if>
- <if test="smwj != null and smwj != ''">
- and SMWJ = #{smwj}
- </if>
- <if test="bhsje != null">
- and BHSJE = #{bhsje}
- </if>
- <if test="sf != null">
- and SF = #{sf}
- </if>
- <if test="nys != null">
- and NYS = #{nys}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from sta_BudgetApproval
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="xmmc != null and xmmc != ''">
- and XMMC = #{xmmc}
- </if>
- <if test="xmid != null">
- and XMID = #{xmid}
- </if>
- <if test="bh != null and bh != ''">
- and BH = #{bh}
- </if>
- <if test="sqsm != null and sqsm != ''">
- and SQSM = #{sqsm}
- </if>
- <if test="sqje != null">
- and SQJE = #{sqje}
- </if>
- <if test="fylb != null">
- and FYLB = #{fylb}
- </if>
- <if test="bbm != null and bbm != ''">
- and BBM = #{bbm}
- </if>
- <if test="fj != null and fj != ''">
- and FJ = #{fj}
- </if>
- <if test="shzt != null and shzt != ''">
- and SHZT = #{shzt}
- </if>
- <if test="nf != null and nf != ''">
- and NF = #{nf}
- </if>
- <if test="sqr != null">
- and SQR = #{sqr}
- </if>
- <if test="sqrxm != null and sqrxm != ''">
- and SQRXM = #{sqrxm}
- </if>
- <if test="sqsj != null">
- and SQSJ = #{sqsj}
- </if>
- <if test="sqmc != null and sqmc != ''">
- and SQMC = #{sqmc}
- </if>
- <if test="spzt != null and spzt != ''">
- and SPZT = #{spzt}
- </if>
- <if test="kyfyxx != null and kyfyxx != ''">
- and KYFYXX = #{kyfyxx}
- </if>
- <if test="bzje != null">
- and BZJE = #{bzje}
- </if>
- <if test="bxpz != null and bxpz != ''">
- and BXPZ = #{bxpz}
- </if>
- <if test="bzje2 != null">
- and BZJE2 = #{bzje2}
- </if>
- <if test="sfbyj != null and sfbyj != ''">
- and SFBYJ = #{sfbyj}
- </if>
- <if test="kybg != null and kybg != ''">
- and KYBG = #{kybg}
- </if>
- <if test="erpbh != null and erpbh != ''">
- and ERPBH = #{erpbh}
- </if>
- <if test="xmlx != null and xmlx != ''">
- and XMLX = #{xmlx}
- </if>
- <if test="xmfzr != null">
- and XMFZR = #{xmfzr}
- </if>
- <if test="ssbm != null">
- and SSBM = #{ssbm}
- </if>
- <if test="sfbz != null and sfbz != ''">
- and SFBZ = #{sfbz}
- </if>
- <if test="smwj != null and smwj != ''">
- and SMWJ = #{smwj}
- </if>
- <if test="bhsje != null">
- and BHSJE = #{bhsje}
- </if>
- <if test="sf != null">
- and SF = #{sf}
- </if>
- <if test="nys != null">
- and NYS = #{nys}
- </if>
- </where>
- </select>
- <!--新增-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into sta_BudgetApproval(SQMC, XMMC, XMID, BH, NF, FYLB, SQJE, SQSM, FJ, SQRXM, SQR, SQSJ, ERPBH, KYBG, XMLX, XMFZR, SSBM, SFBYJ, SFBZ, SPZT, NYS, BZ)
- values (#{sqmc}, #{xmmc}, #{xmid}, #{bh}, #{nf}, #{fylb}, #{sqje}, #{sqsm}, #{fj}, #{sqrxm}, #{sqr}, GETDATE(), #{erpbh}, #{kybg}, #{xmlx}, #{xmfzr}, #{ssbm}, 0, 0, '未提交', #{nys}, #{bz})
- </insert>
- <insert id="insertImprest" keyProperty="id" useGeneratedKeys="true">
- insert into sta_BudgetApproval(SQMC, BH,SQSM , NF, SQJE, SQRXM, SQR, SQSJ, SFBYJ, SFBZ, SPZT)
- values (#{sqmc}, #{bh}, #{sqsm},#{nf}, #{sqje}, #{sqrxm}, #{sqr}, #{sqsj}, 1, 0, '未提交')
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into sta_BudgetApproval(XMMC, XMID, BH, SQSM, SQJE, FYLB, BBM, FJ, SHZT, NF, SQR, SQRXM, SQSJ, SQMC, SPZT, KYFYXX, BZJE, BXPZ, BZJE2, SFBYJ, KYBG, ERPBH, XMLX, XMFZR, SSBM, SFBZ, SMWJ, BHSJE, SF, NYS, BZ)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.xmmc}, #{entity.xmid}, #{entity.bh}, #{entity.sqsm}, #{entity.sqje}, #{entity.fylb}, #{entity.bbm}, #{entity.fj}, #{entity.shzt}, #{entity.nf}, #{entity.sqrxm}, #{entity.sqr}, #{entity.sqsj}, #{entity.sqmc},
- #{entity.spzt}, #{entity.kyfyxx}, #{entity.bzje}, #{entity.bxpz}, #{entity.bzje2}, #{entity.sfbyj}, #{entity.kybg}, #{entity.erpbh}, #{entity.xmlx}, #{entity.xmfzr}, #{entity.ssbm}, #{entity.sfbz}, #{entity.smwj},
- #{entity.bhsje}, #{entity.sf}, #{entity.nys}, #{entity.bz})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into sta_BudgetApproval(XMMC, XMID, BH, SQSM, SQJE, FYLB, BBM, FJ, SHZT, NF, SQR, SQRXM, SQSJ, SQMC, SPZT, KYFYXX, BZJE, BXPZ, BZJE2, SFBYJ, KYBG, ERPBH, XMLX, XMFZR, SSBM, SFBZ, SMWJ, BHSJE, SF, NYS, BZ)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.xmmc}, #{entity.xmid}, #{entity.bh}, #{entity.sqsm}, #{entity.sqje}, #{entity.fylb}, #{entity.bbm}, #{entity.fj}, #{entity.shzt}, #{entity.nf}, #{entity.sqrxm}, #{entity.sqr}, #{entity.sqsj}, #{entity.sqmc},
- #{entity.spzt}, #{entity.kyfyxx}, #{entity.bzje}, #{entity.bxpz}, #{entity.bzje2}, #{entity.sfbyj}, #{entity.kybg}, #{entity.erpbh}, #{entity.xmlx}, #{entity.xmfzr}, #{entity.ssbm}, #{entity.sfbz}, #{entity.smwj},
- #{entity.bhsje}, #{entity.sf}, ##{entity.nys}, #{entity.bz})
- </foreach>
- on duplicate key update
- XMMC = values(XMMC),
- XMID = values(XMID),
- BH = values(BH),
- SQSM = values(SQSM),
- SQJE = values(SQJE),
- FYLB = values(FYLB),
- BBM = values(BBM),
- FJ = values(FJ),
- SHZT = values(SHZT),
- NF = values(NF),
- SQR = values(SQR),
- SQRXM = values(SQRXM),
- SQSJ = values(SQSJ),
- SQMC = values(SQMC),
- SPZT = values(SPZT),
- KYFYXX = values(KYFYXX),
- BZJE = values(BZJE),
- BXPZ = values(BXPZ),
- BZJE2 = values(BZJE2),
- SFBYJ = values(SFBYJ),
- KYBG = values(KYBG),
- ERPBH = values(ERPBH),
- XMLX = values(XMLX),
- XMFZR = values(XMFZR),
- SSBM = values(SSBM),
- SFBZ = values(SFBZ),
- SMWJ = values(SMWJ),
- BHSJE = values(BHSJE),
- SF = values(SF),
- NYS = values(NYS),
- BZ = values(BZ)
- </insert>
- <!--通过主键修改基础数据-->
- <update id="update">
- update sta_BudgetApproval
- set SQJE = #{sqje},
- FJ = #{fj},
- BZ = #{bz},
- SQMC = #{sqmc},
- SQSM = #{sqsm}
- where ID = #{id}
- </update>
- <!-- 修改方法-->
- <!--通过主键修改基础数据-->
- <update id="updateImprest">
- update sta_BudgetApproval
- set SQJE = #{sqje},
- SQSJ = #{sqsj},
- SQMC = #{sqmc},
- SQSM = #{sqsm}
- where ID = #{id}
- </update>
- <!-- 修改方法-->
- <!--备用金关联项目-->
- <update id="ImprestConnect">
- update sta_BudgetApproval
- set XMMC = #{xmmc},
- XMID = #{xmid},
- FYLB = #{fylb},
- FJ = #{fj},
- ERPBH = #{erpbh},
- XMLX = #{xmlx},
- XMFZR = #{xmfzr},
- SSBM = #{ssbm},
- NYS = #{nys},
- BZ = #{bz}
- where ID = #{id}
- </update>
- <!--通过主键修改其它数据-->
- <update id="updateOthers">
- update sta_BudgetApproval
- set ERPBH = #{erpbh},
- XMLX = #{xmlx},
- XMFZR = #{xmfzr},
- SSBM = #{ssbm}
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete from sta_BudgetApproval where ID = #{id}
- </delete>
- <!--获取费用申请列表-->
- <select id="getFysqList" resultMap="StaBudgetapprovalMap" parameterType="map">
- select b.*, t.XMLXMC, d.dept_name as SSBMMC, g.FYMC as FYLBMC, r.XM as XMFZRXM,
- (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
- where id in (select dkyfzrid from
- (select DISTINCT zwmc,SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
- from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
- and SUBSTRING(','+DKYFZR,number,1)=',' and ID = b.XMID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
- from sta_BudgetApproval b
- left join base_ProjectType t on t.XMLX = b.XMLX
- left join prj_Project p on p.ID = b.XMID
- left join sys_dept_info d on d.dept_id = b.SSBM
- left join prj_AnnualBudgetDetail g on g.ID = b.FYLB
- left join base_Person r on r.ID = b.XMFZR
- where b.SFBYJ = 0
- -- and b.SPZT != '审批结束'
- <if test="userId != null and userId != ''">
- and (b.SQR = #{userId} or #{userId} in (select SHR from prj_ApproveRecord where XMID = b.ID))
- </if>
- <if test="sqmc != null and sqmc != ''">
- and b.SQMC like '%'+#{sqmc}+'%'
- </if>
- <if test="spzt != null and spzt != ''">
- and b.SPZT = #{spzt}
- </if>
- <if test="bh != null and bh != ''">
- and b.BH like '%'+#{bh}+'%'
- </if>
- <if test="dkyfzr != null and dkyfzr != ''">
- and p.DKYFZR like '%'+#{dkyfzr}+'%'
- </if>
- <if test="ssbmmc != null and ssbmmc != ''">
- and d.dept_name like '%'+#{ssbmmc}+'%'
- </if>
- <if test="erpbh != null and erpbh != ''">
- and b.ERPBH like '%'+#{erpbh}+'%'
- </if>
- <if test="xmlx != null and xmlx != ''">
- and b.XMLX = #{xmlx}
- </if>
- <if test="nf != null and nf != ''">
- and b.NF = #{nf}
- </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,
- SQSJ DESC
- </select>
- <!--获取备用金申请列表-->
- <select id="getByjsqList" resultMap="StaBudgetapprovalMap" parameterType="map">
- select b.*, g.FYMC as FYLBMC
- from sta_BudgetApproval b
- left join prj_AnnualBudgetDetail g on g.ID = b.FYLB
- where b.SFBYJ = 1
- <if test="userId != null and userId != ''">
- and (b.SQR = #{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="erpbh != null and erpbh != ''">
- and b.ERPBH like '%'+#{erpbh}+'%'
- </if>
- <if test="xmmc != null and xmmc != ''">
- and b.XMMC like '%'+#{xmmc}+'%'
- </if>
- <if test="bh != null and bh != ''">
- and b.BH like '%'+#{bh}+'%'
- </if>
- <if test="nf != null and nf != ''">
- and b.NF = #{nf}
- </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,
- SQSJ DESC
- </select>
- <!--获取年份-->
- <select id="getYearList" resultMap="StaBudgetapprovalMap">
- select distinct NF
- from sta_BudgetApproval
- where NF is not NULL
- </select>
- <!--获取已报账费用申请列表-->
- <select id="getYbzFysqList" resultMap="StaBudgetapprovalMap" parameterType="map">
- select b.*, t.XMLXMC, d.dept_name as SSBMMC, g.FYMC as FYLBMC,
- (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
- where id in (select dkyfzrid from
- (select DISTINCT zwmc,SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
- from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
- and SUBSTRING(','+DKYFZR,number,1)=',' and ID = b.XMID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
- from sta_BudgetApproval b
- left join base_ProjectType t on t.XMLX = b.XMLX
- left join prj_Project p on p.ID = b.XMID
- left join sys_dept_info d on d.dept_id = b.SSBM
- left join prj_AnnualBudgetDetail g on g.ID = b.FYLB
- left join sta_Reimbursement r on r.FYSQ = b.ID
- where b.SFBZ = 1
- <if test="userId != null and userId != ''">
- and (b.SQR = #{userId} or #{userId} in (select SHR from prj_ApproveRecord where XMID = b.ID))
- </if>
- <if test="sqmc != null and sqmc != ''">
- and b.SQMC like '%'+#{sqmc}+'%'
- </if>
- <if test="erpbh != null and erpbh != ''">
- and b.ERPBH like '%'+#{erpbh}+'%'
- </if>
- <if test="bh != null and bh != ''">
- and b.BH like '%'+#{bh}+'%'
- </if>
- <if test="xmlx != null and xmlx != ''">
- and b.XMLX = #{xmlx}
- </if>
- <if test="dkyfzr != null and dkyfzr != ''">
- and p.DKYFZR like '%'+#{dkyfzr}+'%'
- </if>
- <if test="ssbmmc != null and ssbmmc != ''">
- and d.dept_name like '%'+#{ssbm}+'%'
- </if>
- <if test="nf != null and nf != ''">
- and b.NF = #{nf}
- </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>
- <!--获取全部费用申请(审批完成)-->
- <select id="getAllApplyList" resultMap="StaBudgetapprovalMap" parameterType="map">
- select b.*, t.XMLXMC, d.dept_name as SSBMMC, g.FYMC as FYLBMC, r.XM as XMFZRXM,
- case when b.SFBYJ = 1 then '是' else '否' end as SFBYJMC, case when b.SFBZ = 1 then '是' else '否' end as SFBZMC,
- (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
- where id in (select dkyfzrid from
- (select DISTINCT zwmc,SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
- from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
- and SUBSTRING(','+DKYFZR,number,1)=',' and ID = b.XMID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
- from sta_BudgetApproval b
- left join base_ProjectType t on t.XMLX = b.XMLX
- left join prj_Project p on p.ID = b.XMID
- left join sys_dept_info d on d.dept_id = b.SSBM
- left join prj_AnnualBudgetDetail g on g.ID = b.FYLB
- left join base_Person r on r.ID = b.XMFZR
- where 1 = 1
- <if test="bh != null and bh != ''">
- and b.BH like '%'+#{bh}+'%'
- </if>
- <if test="erpbh != null and erpbh != ''">
- and b.ERPBH like '%'+#{erpbh}+'%'
- </if>
- <if test="xmlx != null and xmlx != ''">
- and b.XMLX = #{xmlx}
- </if>
- <if test="sfbyj != null and sfbyj != ''">
- and b.SFBYJ = #{sfbyj}
- </if>
- <if test="xmmc != null and xmmc != ''">
- and b.XMMC like '%'+#{xmmc}+'%'
- </if>
- <if test="ssbmmc != null and ssbmmc != ''">
- and d.dept_name like '%'+#{ssbm}+'%'
- </if>
- <if test="nf != null and nf != ''">
- and b.NF = #{nf}
- </if>
- <if test="spzt != null and spzt != ''">
- and b.SPZT = #{spzt}
- </if>
- <if test="sfbz != null and sfbz != ''">
- and b.SFBZ = #{sfbz}
- </if>
- <if test="dkyfzr != null and dkyfzr != ''">
- and p.DKYFZR like '%'+#{dkyfzr}+'%'
- </if>
- <if test="sqsj1 != null and sqsj1 != ''">
- and b.SQSJ >= #{sqsj1}
- </if>
- <if test="sqsj2 != null and sqsj2 != ''">
- and DATEADD(day, 1, #{sqsj2}) >= b.SQSJ
- </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
- </select>
- <!--获取审批中的费用申请-->
- <select id="getApprovingList" resultMap="StaBudgetapprovalMap" parameterType="map">
- select b.*, t.XMLXMC, d.dept_name as SSBMMC, g.FYMC as FYLBMC, r.XM as XMFZRXM,
- case when b.SFBYJ = 1 then '是' else '否' end as SFBYJMC, case when b.SFBZ = 1 then '是' else '否' end as SFBZMC,
- (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
- where id in (select dkyfzrid from
- (select DISTINCT zwmc,SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
- from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
- and SUBSTRING(','+DKYFZR,number,1)=',' and ID = b.XMID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
- from sta_BudgetApproval b
- left join base_ProjectType t on t.XMLX = b.XMLX
- left join prj_Project p on p.ID = b.XMID
- left join sys_dept_info d on d.dept_id = b.SSBM
- left join prj_AnnualBudgetDetail g on g.ID = b.FYLB
- left join base_Person r on r.ID = b.XMFZR
- where b.SPZT != '未提交' and b.SPZT != '审批结束' and b.SPZT != '作废' and b.SFBYJ = 0
- <if test="spzt != null and spzt != ''">
- and b.SPZT = #{spzt}
- </if>
- <if test="bh != null and bh != ''">
- and b.BH like '%'+#{bh}+'%'
- </if>
- <if test="nf != null and nf != ''">
- and b.NF = #{nf}
- </if>
- <if test="sfbyj != null and sfbyj != ''">
- and b.SFBYJ = #{sfbyj}
- </if>
- <if test="xmmc != null and xmmc != ''">
- and b.XMMC like '%'+#{xmmc}+'%'
- </if>
- <if test="erpbh != null and erpbh != ''">
- and b.ERPBH like '%'+#{erpbh}+'%'
- </if>
- <if test="xmlx != null and xmlx != ''">
- and b.XMLX = #{xmlx}
- </if>
- <if test="ssbmmc != null and ssbmmc != ''">
- and d.dept_name like '%'+#{ssbm}+'%'
- </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
- END
- ASC
- </select>
- <!--批量删除费用申请-->
- <delete id="batchDelete" parameterType="java.util.ArrayList">
- delete from sta_BudgetApproval
- where ID in
- <foreach item="item" index="index" collection="idList" open = "(" separator = "," close = ")">
- #{item}
- </foreach>
- </delete>
- <!--撤销审核状态费用申请-->
- <update id="tjrevokeApprove">
- update sta_BudgetApproval
- set SPZT = '未提交'
- where ID = #{id}
- </update>
- <!--通过主键修改审批状态-->
- <update id="updateSpzt">
- update sta_BudgetApproval
- set SPZT = #{spzt}, BH=#{bh}
- where ID = #{id}
- </update>
- <!--获取费用申请信息-->
- <select id="getFysqById" resultMap="StaBudgetapprovalMap">
- select b.*, t.XMLXMC, d.dept_name as SSBMMC, g.FYMC as FYLBMC, r.XM as XMFZRXM,
- (select MC from base_ProjectBudget g1 where g1.BM = g.FJ) as FJMC,
- case when b.SFBYJ = 1 then '是' else '否' end as SFBYJMC, case when b.SFBZ = 1 then '是' else '否' end as SFBZMC,
- (SELECT STUFF((SELECT ','+XM from (select xm from base_Person
- where id in (select dkyfzrid from
- (select DISTINCT zwmc,SUBSTRING(dkyfzr, number,CHARINDEX(',',dkyfzr+',',number)-number) as dkyfzrid
- from prj_Project WITH(nolock) ,master..spt_values with(nolock) where number >= 1 and len(DKYFZR) > number
- and SUBSTRING(','+DKYFZR,number,1)=',' and ID = b.XMID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
- from sta_BudgetApproval b
- left join base_ProjectType t on t.XMLX = b.XMLX
- left join prj_Project p on p.ID = b.XMID
- left join sys_dept_info d on d.dept_id = b.SSBM
- left join prj_AnnualBudgetDetail g on g.ID = b.FYLB
- left join base_Person r on r.ID = b.XMFZR
- where b.ID = #{id}
- </select>
- <!--获取费用管理列表-->
- <select id="getFyglList" resultMap="StaBudgetapprovalMap" parameterType="map">
- select b.*, t.XMLXMC, d.dept_name as SSBMMC, r.XM as XMFZRXM
- from sta_BudgetApproval b
- left join base_ProjectType t on t.XMLX = b.XMLX
- left join prj_Project p on p.ID = b.XMID
- left join sys_dept_info d on d.dept_id = b.SSBM
- left join base_Person r on r.ID = b.XMFZR
- where 1 = 1
- <if test="xmmc != null and xmmc != ''">
- and b.XMMC like '%'+#{xmmc}+'%'
- </if>
- <if test="erpbh != null and erpbh != ''">
- and b.ERPBH like '%'+#{erpbh}+'%'
- </if>
- <if test="xmlx != null and xmlx != ''">
- and b.XMLX = #{xmlx}
- </if>
- <if test="xmfzrxm != null and xmfzrxm != ''">
- and r.XM like '%'+#{xmfzrxm}+'%'
- </if>
- <if test="ssbmmc != null and ssbmmc != ''">
- and d.dept_name like '%'+#{ssbm}+'%'
- </if>
- <choose>
- <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
- order by ${sortName} ${sortOrder}
- </when>
- </choose>
- </select>
- <!--更新报账数据-->
- <update id="updateReimburse">
- update sta_BudgetApproval
- set SFBZ = 1,
- BXPZ = #{bxpz},
- BZJE = #{bzje},
- BHSJE = #{bhsje},
- SF = #{sf}
- where ID = #{id}
- </update>
- <!--批量修改报账信息-->
- <update id="clearReimburse">
- update sta_BudgetApproval
- set SFBZ = 0,
- BXPZ = null,
- BZJE = null,
- BHSJE = null,
- SF = null
- where ID in
- <foreach item="item" index="index" collection="idList" open = "(" separator = "," close = ")">
- #{item}
- </foreach>
- </update>
- <!--批量作废费用申请-->
- <delete id="batchNullify" parameterType="java.util.ArrayList">
- update sta_BudgetApproval
- set SPZT = '作废'
- where ID in
- <foreach item="item" index="index" collection="idList" open = "(" separator = "," close = ")">
- #{item}
- </foreach>
- </delete>
- <!--项目总体费用信息-->
- <select id="getXmFyInfo" resultMap="StaBudgetapprovalMap">
- select b.NYS, (ISNULL(SUM(b.BZJE),0)+ISNULL((select SUM(SQJE) from sta_BudgetApproval where BZJE is NULL and NYS = #{nys1} and SPZT != '作废' and SFBYJ =0),0)) as SQJE,
- SUM(b.BZJE) as BZJE,
- (select YSJE from prj_AnnualBudgetDetail where NYS = b.NYS and FJ = '') as YSJE
- from sta_BudgetApproval b
- where b.NYS = #{nys} and b.SPZT != '作废' and b.SFBYJ =0
- GROUP BY b.NYS
- </select>
- <!--项目分项费用信息-->
- <select id="getKmFyInfo" resultMap="StaBudgetapprovalMap" parameterType="map">
- select b.NYS, b.FYLB, (ISNULL(SUM(b.BZJE),0)+ISNULL((select SUM(SQJE) from sta_BudgetApproval where BZJE is NULL and NYS = #{nys1} and FYLB = #{fylb1} and SPZT != '作废' and SFBYJ =0),0)) as SQJE,
- SUM(b.BZJE) as BZJE,
- (select YSJE from prj_AnnualBudgetDetail where NYS = b.NYS and ID = b.FYLB) as YSJE
- from sta_BudgetApproval b
- where b.NYS = #{nys} and b.FYLB = #{fylb} and b.SPZT != '作废' and b.SFBYJ =0
- GROUP BY b.NYS, b.FYLB
- </select>
- <!--未关联项目备用金 -->
- <select id="unassociated" resultMap="StaBudgetapprovalMap" parameterType="map">
- SELECT * FROM sta_BudgetApproval WHERE SFBYJ = 1 AND XMMC IS NULL AND SPZT='审批结束'
- </select>
- <!--项目备用金信息-->
- <select id="getByjInfo" resultMap="StaBudgetapprovalMap">
- select b.NYS, (ISNULL(SUM(b.BZJE),0)+ISNULL((select SUM(SQJE) from sta_BudgetApproval where BZJE is NULL and NYS = #{nys1} and SPZT != '作废' and SFBYJ =1),0)) as SQJE,
- SUM(b.BZJE) as BZJE,
- (select YSJE from prj_AnnualBudgetDetail where NYS = b.NYS and FJ = '') as YSJE
- from sta_BudgetApproval b
- where b.NYS = #{nys} and b.SPZT != '作废' and b.SFBYJ =1
- GROUP BY b.NYS
- </select>
- </mapper>
|