123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673 |
- <?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.PrjProjectDao">
- <resultMap type="com.liang.entity.PrjProject" id="PrjProjectMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="zwmc" column="ZWMC" jdbcType="VARCHAR"/>
- <result property="xkfl1" column="XKFL1" jdbcType="VARCHAR"/>
- <result property="xkfl2" column="XKFL2" jdbcType="VARCHAR"/>
- <result property="xkfl3" column="XKFL3" jdbcType="VARCHAR"/>
- <result property="sfgjmmjsxm" column="SFGJMMJSXM" jdbcType="VARCHAR"/>
- <result property="ssgmjjhy" column="SSGMJJHY" jdbcType="VARCHAR"/>
- <result property="qs" column="QS" jdbcType="TIMESTAMP"/>
- <result property="wc" column="WC" jdbcType="TIMESTAMP"/>
- <result property="cjrq" column="CJRQ" jdbcType="TIMESTAMP"/>
- <result property="xmlx" column="XMLX" jdbcType="VARCHAR"/>
- <result property="ywmc" column="YWMC" jdbcType="VARCHAR"/>
- <result property="xmmb" column="XMMB" jdbcType="VARCHAR"/>
- <result property="qy" column="QY" jdbcType="VARCHAR"/>
- <result property="zrs" column="ZRS" jdbcType="INTEGER"/>
- <result property="gjzc" column="GJZC" jdbcType="INTEGER"/>
- <result property="zjzc" column="ZJZC" jdbcType="INTEGER"/>
- <result property="cjzc" column="CJZC" jdbcType="INTEGER"/>
- <result property="yjs" column="YJS" jdbcType="INTEGER"/>
- <result property="txsm" column="TXSM" jdbcType="VARCHAR"/>
- <result property="yjnrjkhzb" column="YJNRJKHZB" jdbcType="VARCHAR"/>
- <result property="ygwtsm" column="YGWTSM" jdbcType="VARCHAR"/>
- <result property="cjr" column="CJR" jdbcType="INTEGER"/>
- <result property="tdi432" column="tdi432" jdbcType="VARCHAR"/>
- <result property="sfkybg" column="SFKYBG" jdbcType="VARCHAR"/>
- <result property="bm" column="BM" jdbcType="INTEGER"/>
- <result property="bm2" column="BM2" jdbcType="VARCHAR"/>
- <result property="sfkybg2" column="SFKYBG2" jdbcType="VARCHAR"/>
- <result property="fj" column="FJ" jdbcType="VARCHAR"/>
- <result property="ssbm" column="SSBM" jdbcType="INTEGER"/>
- <result property="erpbh" column="ERPBH" jdbcType="VARCHAR"/>
- <result property="spzt" column="SPZT" jdbcType="VARCHAR"/>
- <result property="fyly" column="FYLY" jdbcType="VARCHAR"/>
- <result property="dkyfzr" column="DKYFZR" jdbcType="VARCHAR"/>
- <result property="fj2" column="FJ2" jdbcType="VARCHAR"/>
- </resultMap>
- <resultMap type="com.liang.entity.FeeManagemant" id="FeeManagementMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="zwmc" column="ZWMC" jdbcType="VARCHAR"/>
- <result property="erpbh" column="ERPBH" jdbcType="VARCHAR"/>
- <result property="xmlx" column="XMLX" jdbcType="VARCHAR"/>
- <result property="xmlxmc" column="XMLXMC" jdbcType="VARCHAR"/>
- <result property="xmfzrxm" column="XMFZRXM" jdbcType="VARCHAR"/>
- <result property="ssbmmc" column="SSBMMC" jdbcType="VARCHAR"/>
- <result property="nf" column="NF" jdbcType="VARCHAR"/>
- <result property="ysje" column="YSJE" jdbcType="NUMERIC"/>
- <result property="xmz" column="XMZ" jdbcType="NUMERIC"/>
- <result property="sqje" column="SQJE" jdbcType="NUMERIC"/>
- <result property="bzje" column="BZJE" jdbcType="NUMERIC"/>
- <result property="byj" column="BYJ" jdbcType="NUMERIC"/>
- <result property="byjsqje" column="BYJSQJE" jdbcType="NUMERIC"/>
- <result property="byjbzje" column="BYJBZJE" jdbcType="NUMERIC"/>
- <result property="ye" column="YE" jdbcType="NUMERIC"/>
- <result property="byjye" column="BYJYE" jdbcType="NUMERIC"/>
- <result property="rzbfb" column="RZBFB" jdbcType="NUMERIC"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="PrjProjectMap">
- select p.*, e.name as SSGMJJHYMC, t.XMLXMC, s1.name as XKFLMC1, s2.name as XKFLMC2, s3.name as XKFLMC3,
- d.dept_name as SSBMMC, k.MC as KYBGMC, b.YSJE,
- (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
- (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) 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 = #{id}) t)) B for xml path('')),1,1,'')) as DKYFZRXM
- from prj_Project p left join base_EconomicSector e on e.id = p.SSGMJJHY
- left join base_ProjectType t on t.XMLX = p.XMLX
- left join base_SubjectName s1 on s1.id = p.XKFL1
- left join base_SubjectName s2 on s2.id = p.XKFL2
- left join base_SubjectName s3 on s3.id = p.XKFL3
- left join sys_dept_info d on d.dept_id = p.SSBM
- left join sta_FeasibilityReport k on k.ID = p.BM
- left join prj_Budget b on b.XM = p.ID and b.FJ = ''
- where p.ID = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="PrjProjectMap">
- select
- ID, ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, XMMB, QY, ZRS, GJZC, ZJZC, CJZC, YJS, TXSM, YJNRJKHZB, YGWTSM, CJR, tdi432, SFKYBG, BM, BM2, SFKYBG2, FJ, SSBM, ERPBH, SPZT, FYLY, DKYFZR, FJ2
- from prj_Project
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="zwmc != null and zwmc != ''">
- and ZWMC = #{zwmc}
- </if>
- <if test="xkfl1 != null and xkfl1 != ''">
- and XKFL1 = #{xkfl1}
- </if>
- <if test="xkfl2 != null and xkfl2 != ''">
- and XKFL2 = #{xkfl2}
- </if>
- <if test="xkfl3 != null and xkfl3 != ''">
- and XKFL3 = #{xkfl3}
- </if>
- <if test="sfgjmmjsxm != null and sfgjmmjsxm != ''">
- and SFGJMMJSXM = #{sfgjmmjsxm}
- </if>
- <if test="ssgmjjhy != null and ssgmjjhy != ''">
- and SSGMJJHY = #{ssgmjjhy}
- </if>
- <if test="qs != null">
- and QS = #{qs}
- </if>
- <if test="wc != null">
- and WC = #{wc}
- </if>
- <if test="cjrq != null">
- and CJRQ = #{cjrq}
- </if>
- <if test="xmlx != null and xmlx != ''">
- and XMLX = #{xmlx}
- </if>
- <if test="ywmc != null and ywmc != ''">
- and YWMC = #{ywmc}
- </if>
- <if test="xmmb != null and xmmb != ''">
- and XMMB = #{xmmb}
- </if>
- <if test="qy != null and qy != ''">
- and QY = #{qy}
- </if>
- <if test="zrs != null">
- and ZRS = #{zrs}
- </if>
- <if test="gjzc != null">
- and GJZC = #{gjzc}
- </if>
- <if test="zjzc != null">
- and ZJZC = #{zjzc}
- </if>
- <if test="cjzc != null">
- and CJZC = #{cjzc}
- </if>
- <if test="yjs != null">
- and YJS = #{yjs}
- </if>
- <if test="txsm != null and txsm != ''">
- and TXSM = #{txsm}
- </if>
- <if test="yjnrjkhzb != null and yjnrjkhzb != ''">
- and YJNRJKHZB = #{yjnrjkhzb}
- </if>
- <if test="ygwtsm != null and ygwtsm != ''">
- and YGWTSM = #{ygwtsm}
- </if>
- <if test="cjr != null">
- and CJR = #{cjr}
- </if>
- <if test="tdi432 != null and tdi432 != ''">
- and tdi432 = #{tdi432}
- </if>
- <if test="sfkybg != null and sfkybg != ''">
- and SFKYBG = #{sfkybg}
- </if>
- <if test="bm != null">
- and BM = #{bm}
- </if>
- <if test="bm2 != null and bm2 != ''">
- and BM2 = #{bm2}
- </if>
- <if test="sfkybg2 != null and sfkybg2 != ''">
- and SFKYBG2 = #{sfkybg2}
- </if>
- <if test="fj != null and fj != ''">
- and FJ = #{fj}
- </if>
- <if test="ssbm != null">
- and SSBM = #{ssbm}
- </if>
- <if test="erpbh != null and erpbh != ''">
- and ERPBH = #{erpbh}
- </if>
- <if test="spzt != null and spzt != ''">
- and SPZT = #{spzt}
- </if>
- <if test="fyly != null and fyly != ''">
- and FYLY = #{fyly}
- </if>
- <if test="dkyfzr != null and dkyfzr != ''">
- and DKYFZR = #{dkyfzr}
- </if>
- <if test="fj2 != null and fj2 != ''">
- and FJ2 = #{fj2}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from prj_Project
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="zwmc != null and zwmc != ''">
- and ZWMC = #{zwmc}
- </if>
- <if test="xkfl1 != null and xkfl1 != ''">
- and XKFL1 = #{xkfl1}
- </if>
- <if test="xkfl2 != null and xkfl2 != ''">
- and XKFL2 = #{xkfl2}
- </if>
- <if test="xkfl3 != null and xkfl3 != ''">
- and XKFL3 = #{xkfl3}
- </if>
- <if test="sfgjmmjsxm != null and sfgjmmjsxm != ''">
- and SFGJMMJSXM = #{sfgjmmjsxm}
- </if>
- <if test="ssgmjjhy != null and ssgmjjhy != ''">
- and SSGMJJHY = #{ssgmjjhy}
- </if>
- <if test="qs != null">
- and QS = #{qs}
- </if>
- <if test="wc != null">
- and WC = #{wc}
- </if>
- <if test="cjrq != null">
- and CJRQ = #{cjrq}
- </if>
- <if test="xmlx != null and xmlx != ''">
- and XMLX = #{xmlx}
- </if>
- <if test="ywmc != null and ywmc != ''">
- and YWMC = #{ywmc}
- </if>
- <if test="xmmb != null and xmmb != ''">
- and XMMB = #{xmmb}
- </if>
- <if test="qy != null and qy != ''">
- and QY = #{qy}
- </if>
- <if test="zrs != null">
- and ZRS = #{zrs}
- </if>
- <if test="gjzc != null">
- and GJZC = #{gjzc}
- </if>
- <if test="zjzc != null">
- and ZJZC = #{zjzc}
- </if>
- <if test="cjzc != null">
- and CJZC = #{cjzc}
- </if>
- <if test="yjs != null">
- and YJS = #{yjs}
- </if>
- <if test="txsm != null and txsm != ''">
- and TXSM = #{txsm}
- </if>
- <if test="yjnrjkhzb != null and yjnrjkhzb != ''">
- and YJNRJKHZB = #{yjnrjkhzb}
- </if>
- <if test="ygwtsm != null and ygwtsm != ''">
- and YGWTSM = #{ygwtsm}
- </if>
- <if test="cjr != null">
- and CJR = #{cjr}
- </if>
- <if test="tdi432 != null and tdi432 != ''">
- and tdi432 = #{tdi432}
- </if>
- <if test="sfkybg != null and sfkybg != ''">
- and SFKYBG = #{sfkybg}
- </if>
- <if test="bm != null">
- and BM = #{bm}
- </if>
- <if test="bm2 != null and bm2 != ''">
- and BM2 = #{bm2}
- </if>
- <if test="sfkybg2 != null and sfkybg2 != ''">
- and SFKYBG2 = #{sfkybg2}
- </if>
- <if test="fj != null and fj != ''">
- and FJ = #{fj}
- </if>
- <if test="ssbm != null">
- and SSBM = #{ssbm}
- </if>
- <if test="erpbh != null and erpbh != ''">
- and ERPBH = #{erpbh}
- </if>
- <if test="spzt != null and spzt != ''">
- and SPZT = #{spzt}
- </if>
- <if test="fyly != null and fyly != ''">
- and FYLY = #{fyly}
- </if>
- <if test="dkyfzr != null and dkyfzr != ''">
- and DKYFZR = #{dkyfzr}
- </if>
- <if test="fj2 != null and fj2 != ''">
- and FJ2 = #{fj2}
- </if>
- </where>
- </select>
- <!--新增基本信息-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into prj_Project(ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, XMMB, ZRS, GJZC, ZJZC, CJZC, YJS, CJR, BM, FJ, SSBM, ERPBH, SPZT, FYLY, DKYFZR)
- values (#{zwmc}, #{xkfl1}, #{xkfl2}, #{xkfl3},#{sfgjmmjsxm}, #{ssgmjjhy}, #{qs}, #{wc}, GETDATE(), #{xmlx}, #{ywmc}, 0, #{zrs}, #{gjzc}, #{zjzc}, #{cjzc}, #{yjs}, #{cjr},
- #{bm}, #{fj}, #{ssbm}, #{erpbh}, #{spzt}, #{fyly}, #{dkyfzr})
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into prj_Project(ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, XMMB, QY, ZRS, GJZC, ZJZC, CJZC, YJS, TXSM, YJNRJKHZB, YGWTSM, CJR, tdi432, SFKYBG, BM, BM2, SFKYBG2, FJ, SSBM, ERPBH, SPZT, FYLY, DKYFZR, FJ2)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.zwmc}, #{entity.xkfl1}, #{entity.xkfl2}, #{entity.xkfl3}, #{entity.sfgjmmjsxm}, #{entity.ssgmjjhy}, #{entity.qs}, #{entity.wc}, #{entity.cjrq}, #{entity.xmlx}, #{entity.ywmc}, #{entity.xmmb}, #{entity.qy}, #{entity.zrs}, #{entity.gjzc}, #{entity.zjzc}, #{entity.cjzc}, #{entity.yjs}, #{entity.txsm}, #{entity.yjnrjkhzb}, #{entity.ygwtsm}, #{entity.cjr}, #{entity.tdi432}, #{entity.sfkybg}, #{entity.bm}, #{entity.bm2}, #{entity.sfkybg2}, #{entity.fj}, #{entity.ssbm}, #{entity.erpbh}, #{entity.spzt}, #{entity.fyly}, #{entity.dkyfzr}, #{entity.fj2})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into prj_Project(ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, XMMB, QY, ZRS, GJZC, ZJZC, CJZC, YJS, TXSM, YJNRJKHZB, YGWTSM, CJR, tdi432, SFKYBG, BM, BM2, SFKYBG2, FJ, SSBM, ERPBH, SPZT, FYLY, DKYFZR, FJ2)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.zwmc}, #{entity.xkfl1}, #{entity.xkfl2}, #{entity.xkfl3}, #{entity.sfgjmmjsxm}, #{entity.ssgmjjhy}, #{entity.qs}, #{entity.wc}, #{entity.cjrq}, #{entity.xmlx}, #{entity.ywmc}, #{entity.xmmb}, #{entity.qy}, #{entity.zrs}, #{entity.gjzc}, #{entity.zjzc}, #{entity.cjzc}, #{entity.yjs}, #{entity.txsm}, #{entity.yjnrjkhzb}, #{entity.ygwtsm}, #{entity.cjr}, #{entity.tdi432}, #{entity.sfkybg}, #{entity.bm}, #{entity.bm2}, #{entity.sfkybg2}, #{entity.fj}, #{entity.ssbm}, #{entity.erpbh}, #{entity.spzt}, #{entity.fyly}, #{entity.dkyfzr}, #{entity.fj2})
- </foreach>
- on duplicate key update
- ZWMC = values(ZWMC),
- XKFL1 = values(XKFL1),
- XKFL2 = values(XKFL2),
- XKFL3 = values(XKFL3),
- SFGJMMJSXM = values(SFGJMMJSXM),
- SSGMJJHY = values(SSGMJJHY),
- QS = values(QS),
- WC = values(WC),
- CJRQ = values(CJRQ),
- XMLX = values(XMLX),
- YWMC = values(YWMC),
- XMMB = values(XMMB),
- QY = values(QY),
- ZRS = values(ZRS),
- GJZC = values(GJZC),
- ZJZC = values(ZJZC),
- CJZC = values(CJZC),
- YJS = values(YJS),
- TXSM = values(TXSM),
- YJNRJKHZB = values(YJNRJKHZB),
- YGWTSM = values(YGWTSM),
- CJR = values(CJR),
- tdi432 = values(tdi432),
- SFKYBG = values(SFKYBG),
- BM = values(BM),
- BM2 = values(BM2),
- SFKYBG2 = values(SFKYBG2),
- FJ = values(FJ),
- SSBM = values(SSBM),
- ERPBH = values(ERPBH),
- SPZT = values(SPZT),
- FYLY = values(FYLY),
- DKYFZR = values(DKYFZR),
- FJ2 = values(FJ2)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update prj_Project
- set ZWMC = #{zwmc},
- XKFL1 = #{xkfl1},
- XKFL2 = #{xkfl2},
- XKFL3 = #{xkfl3},
- SSGMJJHY = #{ssgmjjhy},
- QS = #{qs},
- WC = #{wc},
- XMLX = #{xmlx},
- BM = #{bm},
- YWMC = #{ywmc},
- ZRS = #{zrs},
- GJZC = #{gjzc},
- ZJZC = #{zjzc},
- CJZC = #{cjzc},
- YJS = #{yjs},
- SSBM = #{ssbm},
- ERPBH = #{erpbh},
- SFGJMMJSXM = #{sfgjmmjsxm},
- FYLY = #{fyly},
- DKYFZR = #{dkyfzr},
- SPZT = #{spzt}
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete from prj_Project where ID = #{id}
- </delete>
- <!--项目列表-->
- <select id="getProjectList" resultMap="PrjProjectMap" parameterType="map">
- select p.*, t.XMLXMC, u.name as CJRXM, k.MC as KYBGMC, b.YSJE
- from prj_Project p
- left join base_ProjectType t on t.XMLX = p.XMLX
- left join sys_user_info u on u.user_id = p.CJR
- left join sta_FeasibilityReport k on k.ID = p.BM
- left join prj_Budget b on b.XM = p.ID and b.FJ = ''
- where p.XMMB != 1
- <if test="userId != null and userId != ''">
- and (p.CJR = #{userId} or #{userId} in (select SHR from prj_ApproveRecord where XMID = p.ID))
- </if>
- <if test="deptId != null and deptId != ''">
- and p.SSBM = #{deptId}
- </if>
- <if test="spzt != null and spzt != ''">
- and p.SPZT = #{spzt}
- </if>
- <if test="zwmc != null and zwmc != ''">
- and p.ZWMC like '%'+#{zwmc}+'%'
- </if>
- <if test="erpbh != null and erpbh != ''">
- and p.ERPBH like '%'+#{erpbh}+'%'
- </if>
- <if test="xmlx != null and xmlx != ''">
- and p.XMLX = #{xmlx}
- </if>
- <choose>
- <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
- order by ${sortName} ${sortOrder}
- </when>
- <otherwise>
- order by p.ID desc
- </otherwise>
- </choose>
- </select>
- <!--年度预算项目列表-->
- <select id="getNdysProjectList" resultMap="PrjProjectMap" parameterType="map">
- select DISTINCT p.ID, p.ZWMC, p.QS, p.WC, p.ERPBH, p.XMLX, t.XMLXMC, u.name as CJRXM, k.MC as KYBGMC, p.SSBM, d.dept_name as SSBMMC, b.YSJE,
- (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
- (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) 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 = p.ID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
- from prj_Project p
- left join base_ProjectType t on t.XMLX = p.XMLX
- left join sys_user_info u on u.user_id = p.CJR
- left join sta_FeasibilityReport k on k.ID = p.BM
- left join sys_dept_info d on d.dept_id = p.SSBM
- left join prj_Member m on m.XM = p.ID and m.XMJS = 1
- left join prj_Budget b on b.XM = p.ID and b.FJ = ''
- left join prj_FeeScheme f on f.ZB = p.ID
- where p.XMMB != 1
- and p.SPZT = '审批结束'
- and CONCAT(p.ID, f.NF) not in (select CONCAT(RWS, NF) from prj_AnnualBudget where XMLX !='s8')
- <if test="zwmc != null and zwmc != ''">
- and p.ZWMC like '%'+#{zwmc}+'%'
- </if>
- <if test="erpbh != null and erpbh != ''">
- and p.ERPBH like '%'+#{erpbh}+'%'
- </if>
- <if test="xmlx != null and xmlx != ''">
- and p.XMLX = #{xmlx}
- </if>
- <choose>
- <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
- order by ${sortName} ${sortOrder}
- </when>
- <otherwise>
- order by p.ID asc
- </otherwise>
- </choose>
- </select>
- <!--批量删除项目任务书-->
- <delete id="batchDelete" parameterType="java.util.ArrayList">
- delete from prj_Project
- where ID in
- <foreach item="item" index="index" collection="idList" open = "(" separator = "," close = ")">
- #{item}
- </foreach>
- </delete>
- <!--撤销审核状态任务书-->
- <update id="tjrevokeApprove">
- update prj_Project
- set SPZT = '未提交'
- where ID = #{id}
- </update>
- <!--新增基本信息-->
- <insert id="insertNormal" keyProperty="id" useGeneratedKeys="true">
- insert into prj_Project(ZWMC, XKFL1, XKFL2, XKFL3, SFGJMMJSXM, SSGMJJHY, QS, WC, CJRQ, XMLX, YWMC, ZRS, GJZC, ZJZC, CJZC, YJS, CJR, BM, SSBM, ERPBH, SPZT, FYLY, DKYFZR)
- values (#{zwmc}, #{xkfl1}, #{xkfl2}, #{xkfl3}, #{sfgjmmjsxm}, #{ssgmjjhy}, #{qs}, #{wc}, GETDATE(), #{xmlx}, #{ywmc}, #{zrs}, #{gjzc}, #{zjzc}, #{cjzc}, #{yjs}, #{cjr}, #{bm}, #{ssbm}, #{erpbh}, #{spzt}, #{fyly}, #{dkyfzr})
- </insert>
- <!--修改基本信息-->
- <update id="updateNormal">
- update prj_Project
- set ZWMC = #{zwmc},
- XKFL1 = #{xkfl1},
- XKFL2 = #{xkfl2},
- XKFL3 = #{xkfl3},
- SSGMJJHY = #{ssgmjjhy},
- QS = #{qs},
- WC = #{wc},
- YWMC = #{ywmc},
- ZRS = #{zrs},
- GJZC = #{gjzc},
- ZJZC = #{zjzc},
- CJZC = #{cjzc},
- YJS = #{yjs},
- SSBM = #{ssbm},
- ERPBH = #{erpbh},
- SFGJMMJSXM = #{sfgjmmjsxm},
- FYLY = #{fyly},
- DKYFZR = #{dkyfzr}
- where ID = #{id}
- </update>
- <!--通修改填写说明-->
- <update id="updateTXSM">
- update prj_Project
- set TXSM = #{txsm}
- where ID = #{id}
- </update>
- <!--修改内容-->
- <update id="updateContent">
- update prj_Project
- set YJNRJKHZB = #{yjnrjkhzb}
- where ID = #{id}
- </update>
- <!--通过主键修改数据-->
- <update id="updateYGWTSM">
- update prj_Project
- set YGWTSM = #{ygwtsm}
- where ID = #{id}
- </update>
- <!--通过主键修改数据-->
- <update id="updateFJ">
- update prj_Project
- set FJ = #{fj}
- where ID = #{id}
- </update>
- <!--获取任务书列表-->
- <select id="getRwsList" resultMap="PrjProjectMap" parameterType="map">
- select p.*, t.XMLXMC, d.dept_name as SSBMMC,
- (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
- (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) 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 = p.ID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
- from prj_Project p
- left join base_ProjectType t on t.XMLX = p.XMLX
- left join sys_dept_info d on d.dept_id = p.SSBM
- left join sta_FeasibilityReport f on f.ID = p.BM
- where p.XMMB != 1
- <if test="spzt != null and spzt != ''">
- and p.SPZT = #{spzt}
- </if>
- <if test="zwmc != null and zwmc != ''">
- and p.ZWMC like '%'+#{zwmc}+'%'
- </if>
- <choose>
- <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
- order by ${sortName} ${sortOrder}
- </when>
- <otherwise>
- order by p.ID asc
- </otherwise>
- </choose>
- </select>
- <!--年度预算任务书-->
- <select id="getNdysRwsList" resultMap="PrjProjectMap" parameterType="map">
- select p.*, t.XMLXMC, d.dept_name as SSBMMC,
- (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
- (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) 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 = p.ID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
- from prj_Project p
- left join base_ProjectType t on t.XMLX = p.XMLX
- left join sys_dept_info d on d.dept_id = p.SSBM
- left join sta_FeasibilityReport f on f.ID = p.BM
- where p.SPZT = '审批结束'
- and p.ID not in (select distinct RWS from prj_AnnualBudget where RWS is not NULL)
- <if test="zwmc != null and zwmc != ''">
- and p.ZWMC like '%'+#{zwmc}+'%'
- </if>
- <if test="erpbh != null and erpbh != ''">
- and p.ERPBH like '%'+#{erpbh}+'%'
- </if>
- <if test="xmlx != null and xmlx != ''">
- and p.XMLX like '%'+#{xmlx}+'%'
- </if>
- </select>
- <!--通过主键修改审批状态-->
- <update id="updateSpzt">
- update prj_Project
- set SPZT = #{spzt}
- where ID = #{id}
- </update>
- <!--年度预算项目列表-->
- <select id="getByjProjectList" resultMap="PrjProjectMap" parameterType="map">
- select DISTINCT p.ID, p.ZWMC, p.QS, p.WC, p.ERPBH, p.XMLX, t.XMLXMC, p.SSBM, d.dept_name as SSBMMC,
- (select TOP 1 RY from prj_Member where XM = p.ID and XMJS = 1) as XMFZR,
- (select TOP 1 RYXM from prj_Member where XM = p.ID and XMJS = 1) 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 = p.ID) t)) B for xml path('')),1,1,'')) as DKYFZRXM
- from prj_Project p
- left join base_ProjectType t on t.XMLX = p.XMLX
- left join sys_dept_info d on d.dept_id = p.SSBM
- left join prj_Member m on m.XM = p.ID and m.XMJS = 1
- left join prj_AnnualBudget b on b.RWS = p.ID and b.NF = #{nf}
- left join prj_FeeScheme f on f.ZB = p.ID
- where p.XMMB != 1
- and p.SPZT = '审批结束'
- and CONCAT(p.ID, f.NF) in (select CONCAT(RWS, NF) from prj_AnnualBudget)
- <if test="zwmc != null and zwmc != ''">
- and p.ZWMC like '%'+#{zwmc}+'%'
- </if>
- <if test="erpbh != null and erpbh != ''">
- and p.ERPBH like '%'+#{erpbh}+'%'
- </if>
- <if test="xmlx != null and xmlx != ''">
- and p.XMLX = #{xmlx}
- </if>
- <choose>
- <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
- order by ${sortName} ${sortOrder}
- </when>
- <otherwise>
- order by p.ID asc
- </otherwise>
- </choose>
- </select>
- <!-- 获取费用管理列表 -->
- <select id="getFyglList" resultMap="FeeManagementMap" parameterType="map">
- select p.ID,p.ZWMC,p.ERPBH,p.XMLX,t.XMLXMC,b.XMFZRXM,d.dept_name as SSBMMC,b.NF, case when aa.NF=b.NF then aa.YSJE else 0 end as YSJE, case when aa.NF=b.NF then aa.XMZ else 0 end as XMZ, (SUM(case when b.BZJE is null and b.SFBYJ =0 then b.SQJE else 0 end)/10000+SUM(case when b.BZJE is not null and b.SFBYJ =0 then b.BZJE else 0 end)/10000) as SQJE, (SUM(case when b.BZJE is not null and b.SFBYJ =0 then b.BZJE else 0 end)/10000) as BZJE, case when aa.NF=b.NF then aa.BYJ else 0 end as BYJ, (SUM(case when b.BZJE is null and b.SFBYJ =1 then b.SQJE else 0 end)/10000+SUM(case when b.BZJE is not null and b.SFBYJ =1 then b.BZJE else 0 end)/10000) as BYJSQJE, (SUM(case when b.BZJE is not null and b.SFBYJ =1 then b.BZJE else 0 end)/10000) as BYJBZJE, ((case when aa.NF=b.NF then aa.XMZ else 0 end)-(SUM(case when b.BZJE is null and b.SFBYJ =0 then b.SQJE else 0 end)/10000+SUM(case when b.BZJE is not null and b.SFBYJ =0 then b.BZJE else 0 end)/10000)) as YE, ((case when aa.NF=b.NF then aa.BYJ else 0 end)-(SUM(case when b.BZJE is null and b.SFBYJ =1 then b.SQJE else 0 end)/10000+SUM(case when b.BZJE is not null and b.SFBYJ =1 then b.BZJE else 0 end)/10000)) as BYJYE, (((SUM(case when b.BZJE is not null and b.NYS=aa.ID and b.SFBYJ =0 then b.BZJE else 0 end)/10000)+(SUM(case when b.BZJE is not null and b.NYS=aa.ID and b.SFBYJ =1 then b.BZJE else 0 end)/10000))/(case when aa.NF=b.NF then aa.YSJE else 1 end)) as RZBFB from prj_Project p left join (select s.*,r.XM as XMFZRXM from sta_BudgetApproval s left join base_Person r on r.ID=s.XMFZR where s.SPZT != '作废') b on b.XMID=p.ID left join base_ProjectType t on t.XMLX=p.XMLX left join sys_dept_info d on d.dept_id=p.SSBM left join (select a.*,bd.YSJE,bd.XMZ,bd.BYJ from prj_AnnualBudget a left join prj_AnnualBudgetDetail bd on bd.NYS = a.ID and bd.FJ = '' where a.SPZT != '作废') aa on aa.RWS=p.ID where 1 = 1
- <if test="xmmc != null and xmmc != ''"> and p.ZWMC like '%'+#{xmmc}+'%' </if>
- <if test="erpbh != null and erpbh != ''"> and p.ERPBH like '%'+#{erpbh}+'%' </if>
- <if test="xmlx != null and xmlx != ''"> and p.XMLX = #{xmlx} </if>
- <if test="xmfzrxm != null and xmfzrxm != ''"> and b.XMFZRXM like '%'+#{xmfzrxm}+'%' </if>
- <if test="ssbmmc != null and ssbmmc != ''"> and d.dept_name like '%'+#{ssbmmc}+'%' </if>
- <if test="nf != null and nf != ''"> and b.NF = #{nf} </if>
- group by p.ID,p.ZWMC,p.ERPBH,p.XMLX,t.XMLXMC,b.XMFZRXM,d.dept_name,b.NF,aa.NF,aa.YSJE,aa.XMZ,aa.BYJ
- <choose>
- <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''"> order by ${sortName} ${sortOrder} </when>
- </choose>
- </select>
- </mapper>
|