123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660 |
- <?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.PrjAnnualbudgetdetailDao">
- <resultMap type="com.liang.entity.PrjAnnualbudgetdetail" id="PrjAnnualbudgetdetailMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="fymc" column="FYMC" jdbcType="VARCHAR"/>
- <result property="ysje" column="YSJE" jdbcType="NUMERIC"/>
- <result property="ysqje" column="YSQJE" jdbcType="NUMERIC"/>
- <result property="nys" column="NYS" jdbcType="INTEGER"/>
- <result property="bm" column="BM" jdbcType="VARCHAR"/>
- <result property="fj" column="FJ" jdbcType="VARCHAR"/>
- <result property="nf" column="NF" jdbcType="INTEGER"/>
- <result property="px" column="PX" jdbcType="VARCHAR"/>
- <result property="hjbm" column="HJBM" jdbcType="VARCHAR"/>
- <result property="bz" column="BZ" jdbcType="VARCHAR"/>
- <result property="bndsqje" column="bndbzje" jdbcType="NUMERIC"/>
- <result property="bndsqje" column="bndbzje" jdbcType="NUMERIC"/>
- <result property="dw1" column="DW1" jdbcType="NUMERIC"/>
- <result property="dw2" column="DW2" jdbcType="NUMERIC"/>
- <result property="dw3" column="DW3" jdbcType="NUMERIC"/>
- <result property="dw4" column="DW4" jdbcType="NUMERIC"/>
- <result property="dw5" column="DW5" jdbcType="NUMERIC"/>
- <result property="dw6" column="DW6" jdbcType="NUMERIC"/>
- <result property="dw7" column="DW7" jdbcType="NUMERIC"/>
- <result property="dw8" column="DW8" jdbcType="NUMERIC"/>
- <result property="dw9" column="DW9" jdbcType="NUMERIC"/>
- <result property="dw10" column="DW10" jdbcType="NUMERIC"/>
- <result property="sjys1" column="SJYS1" jdbcType="NUMERIC"/>
- <result property="sjys2" column="SJYS2" jdbcType="NUMERIC"/>
- <result property="sjys3" column="SJYS3" jdbcType="NUMERIC"/>
- <result property="sjys4" column="SJYS4" jdbcType="NUMERIC"/>
- <result property="sjys5" column="SJYS5" jdbcType="NUMERIC"/>
- <result property="sjys6" column="SJYS6" jdbcType="NUMERIC"/>
- <result property="sjys7" column="SJYS7" jdbcType="NUMERIC"/>
- <result property="sjys8" column="SJYS8" jdbcType="NUMERIC"/>
- <result property="sjys9" column="SJYS9" jdbcType="NUMERIC"/>
- <result property="sjys10" column="SJYS10" jdbcType="NUMERIC"/>
- <result property="xtjsyzx" column="XTJSYZX" jdbcType="NUMERIC"/>
- <result property="xmz" column="XMZ" jdbcType="NUMERIC"/>
- <result property="byj" column="BYJ" jdbcType="NUMERIC"/>
- <result property="zrje" column="ZRJE" jdbcType="NUMERIC"/>
- <result property="rwsys" column="RWSYS" jdbcType="NUMERIC"/>
- <result property="xmzys" column="XMZYS" jdbcType="NUMERIC"/>
- <result property="ybzje" column="YBZJE" jdbcType="NUMERIC"/>
- <result property="zcbyj" column="ZCBYJ" jdbcType="NUMERIC"/>
- <result property="kyys" column="KYYS" jdbcType="NUMERIC"/>
- <result property="zcje" column="ZCJE" jdbcType="NUMERIC"/>
- <result property="byjysq" column="BYJYSQ" jdbcType="NUMERIC"/>
- <result property="byqybz" column="BYQYBZ" jdbcType="NUMERIC"/>
- <result property="zrbyj" column="ZRBYJ" jdbcType="NUMERIC"/>
- <result property="sjyzx" column="SJYZX" jdbcType="NUMERIC"/>
- <result property="dnzyzf" column="DNZYZF" jdbcType="NUMERIC"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="PrjAnnualbudgetdetailMap">
- select *
- from prj_AnnualBudgetDetail
- where ID = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="PrjAnnualbudgetdetailMap">
- select *
- from prj_AnnualBudgetDetail
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="fymc != null and fymc != ''">
- and FYMC = #{fymc}
- </if>
- <if test="ysje != null">
- and YSJE = #{ysje}
- </if>
- <if test="ysqje != null">
- and YSQJE = #{ysqje}
- </if>
- <if test="nys != null">
- and NYS = #{nys}
- </if>
- <if test="bm != null and bm != ''">
- and BM = #{bm}
- </if>
- <if test="fj != null and fj != ''">
- and FJ = #{fj}
- </if>
- <if test="nf != null">
- and NF = #{nf}
- </if>
- <if test="px != null and px != ''">
- and PX = #{px}
- </if>
- <if test="hjbm != null and hjbm != ''">
- and HJBM = #{hjbm}
- </if>
- <if test="bz != null and bz != ''">
- and BZ = #{bz}
- </if>
- <if test="dw1 != null">
- and DW1 = #{dw1}
- </if>
- <if test="dw2 != null">
- and DW2 = #{dw2}
- </if>
- <if test="dw3 != null">
- and DW3 = #{dw3}
- </if>
- <if test="dw4 != null">
- and DW4 = #{dw4}
- </if>
- <if test="dw5 != null">
- and DW5 = #{dw5}
- </if>
- <if test="dw6 != null">
- and DW6 = #{dw6}
- </if>
- <if test="dw7 != null">
- and DW7 = #{dw7}
- </if>
- <if test="dw8 != null">
- and DW8 = #{dw8}
- </if>
- <if test="dw9 != null">
- and DW9 = #{dw9}
- </if>
- <if test="dw10 != null">
- and DW10 = #{dw10}
- </if>
- <if test="sjys1 != null">
- and SJYS1 = #{sjys1}
- </if>
- <if test="sjys2 != null">
- and SJYS2 = #{sjys2}
- </if>
- <if test="sjys3 != null">
- and SJYS3 = #{sjys3}
- </if>
- <if test="sjys4 != null">
- and SJYS4 = #{sjys4}
- </if>
- <if test="sjys5 != null">
- and SJYS5 = #{sjys5}
- </if>
- <if test="sjys6 != null">
- and SJYS6 = #{sjys6}
- </if>
- <if test="sjys7 != null">
- and SJYS7 = #{sjys7}
- </if>
- <if test="sjys8 != null">
- and SJYS8 = #{sjys8}
- </if>
- <if test="sjys9 != null">
- and SJYS9 = #{sjys9}
- </if>
- <if test="sjys10 != null">
- and SJYS10 = #{sjys10}
- </if>
- <if test="xtjsyzx != null">
- and XTJSYZX = #{xtjsyzx}
- </if>
- <if test="xmz != null">
- and XMZ = #{xmz}
- </if>
- <if test="byj != null">
- and BYJ = #{byj}
- </if>
- <if test="zrje != null">
- and ZRJE = #{zrje}
- </if>
- <if test="rwsys != null">
- and RWSYS = #{rwsys}
- </if>
- <if test="xmzys != null">
- and XMZYS = #{xmzys}
- </if>
- <if test="ybzje != null">
- and YBZJE = #{ybzje}
- </if>
- <if test="zcbyj != null">
- and ZCBYJ = #{zcbyj}
- </if>
- <if test="kyys != null">
- and KYYS = #{kyys}
- </if>
- <if test="zcje != null">
- and ZCJE = #{zcje}
- </if>
- <if test="byjysq != null">
- and BYJYSQ = #{byjysq}
- </if>
- <if test="byqybz != null">
- and BYQYBZ = #{byqybz}
- </if>
- <if test="zrbyj != null">
- and ZRBYJ = #{zrbyj}
- </if>
- <if test="sjyzx != null">
- and SJYZX = #{sjyzx}
- </if>
- <if test="dnzyzf != null">
- and DNZYZF = #{dnzyzf}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from prj_AnnualBudgetDetail
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="fymc != null and fymc != ''">
- and FYMC = #{fymc}
- </if>
- <if test="ysje != null">
- and YSJE = #{ysje}
- </if>
- <if test="ysqje != null">
- and YSQJE = #{ysqje}
- </if>
- <if test="nys != null">
- and NYS = #{nys}
- </if>
- <if test="bm != null and bm != ''">
- and BM = #{bm}
- </if>
- <if test="fj != null and fj != ''">
- and FJ = #{fj}
- </if>
- <if test="nf != null">
- and NF = #{nf}
- </if>
- <if test="px != null and px != ''">
- and PX = #{px}
- </if>
- <if test="hjbm != null and hjbm != ''">
- and HJBM = #{hjbm}
- </if>
- <if test="bz != null and bz != ''">
- and BZ = #{bz}
- </if>
- <if test="dw1 != null">
- and DW1 = #{dw1}
- </if>
- <if test="dw2 != null">
- and DW2 = #{dw2}
- </if>
- <if test="dw3 != null">
- and DW3 = #{dw3}
- </if>
- <if test="dw4 != null">
- and DW4 = #{dw4}
- </if>
- <if test="dw5 != null">
- and DW5 = #{dw5}
- </if>
- <if test="dw6 != null">
- and DW6 = #{dw6}
- </if>
- <if test="dw7 != null">
- and DW7 = #{dw7}
- </if>
- <if test="dw8 != null">
- and DW8 = #{dw8}
- </if>
- <if test="dw9 != null">
- and DW9 = #{dw9}
- </if>
- <if test="dw10 != null">
- and DW10 = #{dw10}
- </if>
- <if test="sjys1 != null">
- and SJYS1 = #{sjys1}
- </if>
- <if test="sjys2 != null">
- and SJYS2 = #{sjys2}
- </if>
- <if test="sjys3 != null">
- and SJYS3 = #{sjys3}
- </if>
- <if test="sjys4 != null">
- and SJYS4 = #{sjys4}
- </if>
- <if test="sjys5 != null">
- and SJYS5 = #{sjys5}
- </if>
- <if test="sjys6 != null">
- and SJYS6 = #{sjys6}
- </if>
- <if test="sjys7 != null">
- and SJYS7 = #{sjys7}
- </if>
- <if test="sjys8 != null">
- and SJYS8 = #{sjys8}
- </if>
- <if test="sjys9 != null">
- and SJYS9 = #{sjys9}
- </if>
- <if test="sjys10 != null">
- and SJYS10 = #{sjys10}
- </if>
- <if test="xtjsyzx != null">
- and XTJSYZX = #{xtjsyzx}
- </if>
- <if test="xmz != null">
- and XMZ = #{xmz}
- </if>
- <if test="byj != null">
- and BYJ = #{byj}
- </if>
- <if test="zrje != null">
- and ZRJE = #{zrje}
- </if>
- <if test="rwsys != null">
- and RWSYS = #{rwsys}
- </if>
- <if test="xmzys != null">
- and XMZYS = #{xmzys}
- </if>
- <if test="ybzje != null">
- and YBZJE = #{ybzje}
- </if>
- <if test="zcbyj != null">
- and ZCBYJ = #{zcbyj}
- </if>
- <if test="kyys != null">
- and KYYS = #{kyys}
- </if>
- <if test="zcje != null">
- and ZCJE = #{zcje}
- </if>
- <if test="byjysq != null">
- and BYJYSQ = #{byjysq}
- </if>
- <if test="byqybz != null">
- and BYQYBZ = #{byqybz}
- </if>
- <if test="zrbyj != null">
- and ZRBYJ = #{zrbyj}
- </if>
- <if test="sjyzx != null">
- and SJYZX = #{sjyzx}
- </if>
- <if test="dnzyzf != null">
- and DNZYZF = #{dnzyzf}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into prj_AnnualBudgetDetail(FYMC, YSJE, YSQJE, NYS, BM, FJ, NF, PX, HJBM, BZ, DW1, DW2, DW3, DW4, DW5,
- DW6, DW7, DW8, DW9, DW10, SJYS1, SJYS2, SJYS3, SJYS4, SJYS5, SJYS6, SJYS7,
- SJYS8, SJYS9, SJYS10, XTJSYZX, XMZ, BYJ, ZRJE, RWSYS, XMZYS, YBZJE, ZCBYJ,
- KYYS, ZCJE, BYJYSQ, BYQYBZ, ZRBYJ, SJYZX, DNZYZF)
- values (#{fymc}, #{ysje}, #{ysqje}, #{nys}, #{bm}, #{fj}, #{nf}, #{px}, #{hjbm}, #{bz}, #{dw1}, #{dw2}, #{dw3},
- #{dw4}, #{dw5}, #{dw6}, #{dw7}, #{dw8}, #{dw9}, #{dw10}, #{sjys1}, #{sjys2}, #{sjys3}, #{sjys4},
- #{sjys5}, #{sjys6}, #{sjys7}, #{sjys8}, #{sjys9}, #{sjys10}, #{xtjsyzx}, #{xmz}, #{byj}, #{zrje},
- #{rwsys}, #{xmzys}, #{ybzje}, #{zcbyj}, #{kyys}, #{zcje}, #{byjysq}, #{byqybz}, #{zrbyj}, #{sjyzx},
- #{dnzyzf})
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into prj_AnnualBudgetDetail(FYMC, YSJE, YSQJE, NYS, BM, FJ, NF, PX, HJBM, BZ, DW1, DW2, DW3, DW4, DW5,
- DW6, DW7, DW8, DW9, DW10, SJYS1, SJYS2, SJYS3, SJYS4, SJYS5, SJYS6, SJYS7, SJYS8, SJYS9, SJYS10, XTJSYZX, XMZ,
- BYJ, ZRJE, RWSYS, XMZYS, YBZJE, ZCBYJ, KYYS, ZCJE, BYJYSQ, BYQYBZ, ZRBYJ, SJYZX, DNZYZF)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.fymc}, #{entity.ysje}, #{entity.ysqje}, #{entity.nys}, #{entity.bm}, #{entity.fj}, #{entity.nf},
- #{entity.px}, #{entity.hjbm}, #{entity.bz}, #{entity.dw1}, #{entity.dw2}, #{entity.dw3}, #{entity.dw4},
- #{entity.dw5}, #{entity.dw6}, #{entity.dw7}, #{entity.dw8}, #{entity.dw9}, #{entity.dw10}, #{entity.sjys1},
- #{entity.sjys2}, #{entity.sjys3}, #{entity.sjys4}, #{entity.sjys5}, #{entity.sjys6}, #{entity.sjys7},
- #{entity.sjys8}, #{entity.sjys9}, #{entity.sjys10}, #{entity.xtjsyzx}, #{entity.xmz}, #{entity.byj},
- #{entity.zrje}, #{entity.rwsys}, #{entity.xmzys}, #{entity.ybzje}, #{entity.zcbyj}, #{entity.kyys},
- #{entity.zcje}, #{entity.byjysq}, #{entity.byqybz}, #{entity.zrbyj}, #{entity.sjyzx}, #{entity.dnzyzf})
- </foreach>
- on duplicate key update
- FYMC = values(FYMC),
- YSJE = values(YSJE),
- YSQJE = values(YSQJE),
- NYS = values(NYS),
- BM = values(BM),
- FJ = values(FJ),
- NF = values(NF),
- PX = values(PX),
- HJBM = values(HJBM),
- BZ = values(BZ),
- DW1 = values(DW1),
- DW2 = values(DW2),
- DW3 = values(DW3),
- DW4 = values(DW4),
- DW5 = values(DW5),
- DW6 = values(DW6),
- DW7 = values(DW7),
- DW8 = values(DW8),
- DW9 = values(DW9),
- DW10 = values(DW10),
- SJYS1 = values(SJYS1),
- SJYS2 = values(SJYS2),
- SJYS3 = values(SJYS3),
- SJYS4 = values(SJYS4),
- SJYS5 = values(SJYS5),
- SJYS6 = values(SJYS6),
- SJYS7 = values(SJYS7),
- SJYS8 = values(SJYS8),
- SJYS9 = values(SJYS9),
- SJYS10 = values(SJYS10),
- XTJSYZX = values(XTJSYZX),
- XMZ = values(XMZ),
- BYJ = values(BYJ),
- ZRJE = values(ZRJE),
- RWSYS = values(RWSYS),
- XMZYS = values(XMZYS),
- YBZJE = values(YBZJE),
- ZCBYJ = values(ZCBYJ),
- KYYS = values(KYYS),
- ZCJE = values(ZCJE),
- BYJYSQ = values(BYJYSQ),
- BYQYBZ = values(BYQYBZ),
- ZRBYJ = values(ZRBYJ),
- SJYZX = values(SJYZX),
- DNZYZF = values(DNZYZF)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update prj_AnnualBudgetDetail
- set XMZYS = #{xmzys},
- XTJSYZX = #{xtjsyzx},
- SJYZX = #{sjyzx},
- YSJE = #{ysje},
- XMZ = #{xmz},
- BYJ = #{byj}
- where ID = #{id}
- </update>
- <update id="updateRWSYS">
- update A
- set A.XMZYS = B.DW from prj_AnnualBudgetDetail A
- inner join (SELECT MC, ${DW} as DW
- , YSJE from prj_Budget where XM = #{id}) B
- on A.FYMC = B.MC
- where
- NYS in (SELECT ID from prj_AnnualBudget where RWS = #{id} )
- and A.FYMC != '1.外委研究支出费'
- and A.FYMC != '总计'
- </update>
- <update id="updateWWYJZCF">
- update prj_AnnualBudgetDetail
- set RWSYS = #{WWYJZCF},
- XMZYS = #{WWYJZCF}
- where NYS in (SELECT ID from prj_AnnualBudget where RWS = #{id})
- and FYMC = '1.外委研究支出费'
- </update>
- <update id="updateXMZYS">
- update prj_AnnualBudgetDetail
- set XMZYS = #{rwsys},
- rwsys = #{rwsys}
- where NYS in (SELECT ID from prj_AnnualBudget where RWS = #{id})
- and FYMC = '总计'
- </update>
- <update id="updateNDYS">
- update prj_AnnualBudgetDetail
- set YSJE = null
- where NYS in (SELECT ID from prj_AnnualBudget where RWS = #{id})
- and FYMC != '1.外委研究支出费' and FYMC != '总计'
- </update>
- <update id="updateWWYJZCFSUM">
- update A
- set A.xmzys = B.XMZYS from prj_AnnualBudgetDetail A
- inner join (
- SELECT sum(XMZYS)XMZYS ,pa.NYS
- from prj_AnnualBudgetDetail pa
- where NYS in (SELECT ID from prj_AnnualBudget where RWS = #{id})
- and (FYMC = '1.外委研究支出费' or FYMC = '2.仪器设备租赁费' or FYMC = '3.外协测试试验与加工费')
- group by pa.NYS
- ) B
- on A.NYS = B.NYS
- where
- a.FYMC = '(三)外委支出费'
- </update>
- <update id="updateRWSYS_SX">
- update A
- set A.xmzys = B.ysje from prj_AnnualBudgetDetail A
- inner join (SELECT MC,YSJE from prj_Budget where XM = #{id}) B
- on A.FYMC = B.MC
- where
- NYS in (SELECT ID from prj_AnnualBudget where RWS = #{id} )
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete
- from prj_AnnualBudgetDetail
- where ID = #{id}
- </delete>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into prj_AnnualBudgetDetail(FYMC, NYS, BM, FJ, NF, PX, HJBM, BZ, DW1, DW2, DW3, DW4, DW5, DW6, DW7, DW8,
- DW9, DW10, RWSYS,XMZYS)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.mc}, #{entity.xm}, #{entity.bm}, #{entity.fj}, #{entity.nf}, #{entity.px}, #{entity.hjbm},
- #{entity.bz}, #{entity.dw1}, #{entity.dw2},
- #{entity.dw3}, #{entity.dw4}, #{entity.dw5}, #{entity.dw6}, #{entity.dw7}, #{entity.dw8}, #{entity.dw9},
- #{entity.dw10}, #{entity.ysje},#{entity.xmzys})
- </foreach>
- </insert>
- <!--获取年度预算-->
- <select id="getBudgetList" resultMap="PrjAnnualbudgetdetailMap">
- select (select FYMC from prj_AnnualBudgetDetail where BM = b.FJ and NYS = b.NYS) as FJMC,
- ID, b.FYMC, YSJE, YSQJE, NYS, BM, FJ, NF, PX, HJBM, BZ, DW1, DW2, DW3, DW4, DW5, DW6, DW7, DW8, DW9, DW10, SJYS1, SJYS2, SJYS3, SJYS4, SJYS5, SJYS6, SJYS7, SJYS8, SJYS9, SJYS10, XTJSYZX, XMZ,BYJ, ZRJE, RWSYS, XMZYS, YBZJE, ZCBYJ, KYYS, ZCJE, BYJYSQ, BYQYBZ, ZRBYJ, DNZYZF,
- a.bzje sjyzx,
- c.bndsqje,
- c.bndbzje
- from prj_AnnualBudgetDetail b
- left join (
- SELECT convert(decimal(18,2),(sum(BZJE)/10000)) BZJE ,pa.fymc
- from(SELECT id ,fylb
- from sta_BudgetApproval
- where nys in (
- select id
- from prj_AnnualBudget
- where rws = (select rws from prj_AnnualBudget where id = #{nys}) and nf < (select nf from prj_AnnualBudget where id = #{nys}) )) sb
- left join sta_Reimbursement sa on sa.fysq = sb.id
- LEFT join prj_AnnualBudgetDetail pa on pa.id = sb.fylb group by pa.fymc
- ) a on a.fymc = b.fymc
- left join (
- SELECT SUM(sb.SQJE) bndsqje, SUM(sr.BZJE) bndbzje,pa.FYMC
- from
- sta_BudgetApproval sb
- left join sta_Reimbursement sr on sr.FYSQ = sb.ID and sr.SPZT = '审批结束'
- left join prj_AnnualBudgetDetail pa on pa.ID = sb.FYLB
- where
- sb.NYS = #{nys} and sb.SPZT != '作废'
- GROUP by pa.FYMC
- ) c on c.fymc = b.fymc
- where NYS = #{nys}
- </select>
- <!--获取费用申请年度预算-->
- <select id="getFysqBudgetList" resultMap="PrjAnnualbudgetdetailMap">
- select (select FYMC from prj_AnnualBudgetDetail where BM = b.FJ and NYS = b.NYS) as FJMC, b.*
- from prj_AnnualBudgetDetail b
- where NYS = #{nys}
- -- and ID not in (select FYLB from sta_BudgetApproval where FYLB = b.ID and SPZT != '作废')
- </select>
- <!--批量删除年度预算明细-->
- <delete id="batchDelete" parameterType="java.util.ArrayList">
- delete from prj_AnnualBudgetDetail
- where NYS in
- <foreach item="item" index="index" collection="nysList" open="(" separator="," close=")">
- #{item}
- </foreach>
- </delete>
- <!--获取费用申请年度预算-->
- <select id="getSubNode" resultMap="PrjAnnualbudgetdetailMap">
- select top ${limit} *
- from (
- select
- (select FYMC from prj_AnnualBudgetDetail where BM = b.FJ and NYS = b.NYS) as FJMC,
- b.*,
- row_number() over (order by b.id asc) as rownumber
- from prj_AnnualBudgetDetail b
- where NYS = #{nys}
- and BM not in (select distinct FJ from prj_AnnualBudgetDetail where FJ != ''
- AND NYS=#{nys})
- <if test="mc != null and mc != ''">
- AND b.FYMC LIKE CONCAT('%',#{mc},'%')
- </if>
- ) temp_row
- where rownumber > ((${page} - 1) * ${limit})
- </select>
- <select id="selectWWYJZCF_GW" resultType="java.math.BigDecimal">
- select ((SELECT SUM(SKJE)
- from (SELECT ID, ZB from prj_feescheme where ZB = #{id} and DWMC LIKE '%国网陕西省电力%') pf
- left join prj_UndertakeCompany pu on pu.ZB = pf.ID
- where pu.DWMC not LIKE '%国网陕西省电力%')
- +
- (select ISNULL(${DW}, 0)
- from prj_Budget
- where XM = #{id}
- and mc = '1.外委研究支出费'))
- </select>
- <select id="selectWWYJZCF_SX" resultType="java.math.BigDecimal">
- SELECT YSJE - ISNULL(${DW}, 0) + (select ISNULL(${DW}, 0) from prj_Budget where XM = #{id} and mc = '1.外委研究支出费')
- from prj_Budget
- where XM = #{id}
- and MC = '总计'
- </select>
- <select id="selectXMZYS" resultType="java.math.BigDecimal">
- SELECT SUM(CZJE)
- from prj_feescheme
- where ZB = #{id}
- and DWMC LIKE '%国网陕西省电力%'
- </select>
- <select id="selectXMZYS_SX" resultType="java.math.BigDecimal">
- SELECT SUM(CZJE)
- from prj_feescheme
- where ZB = #{id}
- </select>
- <select id="getSubNodeCount" resultType="java.lang.Integer">
- select
- count(*)
- from prj_AnnualBudgetDetail b
- where NYS = #{nys}
- and BM not in (select distinct FJ from prj_AnnualBudgetDetail where FJ != ''
- AND NYS=#{nys})
- </select>
- <select id="getYzxqk" resultType="com.liang.vo.PrjAnnualbudgetYzxqkVo">
- SELECT convert(decimal(18,2),(sum(BZJE)/10000)) BZJE ,pa.fymc,sb.nf
- from(SELECT sb.id ,sb.fylb,pa.nf
- from sta_BudgetApproval sb
- left join prj_AnnualBudget pa on pa.id = sb.nys
- where nys in (
- select id
- from prj_AnnualBudget
- where rws = (select rws from prj_AnnualBudget where ID = #{nys})
- AND NF <( select DISTINCT NF from prj_AnnualBudget where id = #{nys} )
- )) sb
- left join sta_Reimbursement sa on sa.fysq = sb.id
- LEFT join prj_AnnualBudgetDetail pa on pa.id = sb.fylb
- group by pa.fymc,sb.nf
- order by sb.nf asc
- </select>
- <select id="getNf" resultType="com.liang.vo.PrjAnnualbudgetYzxqkVo">
- select DISTINCT NF
- from prj_AnnualBudget
- where
- rws = (SELECT RWS from prj_AnnualBudget where id = #{nys})
- AND NF <( select DISTINCT NF from prj_AnnualBudget where id = #{nys} )
- </select>
- <select id="listAllBudgetDetail" resultType="com.liang.entity.PrjAnnualbudgetdetail">
- select a.FYMC ,a.YSJE ,b.NF
- from
- prj_AnnualBudgetDetail A
- left join prj_AnnualBudget B on b.ID = A.NYS
- where
- nys in (select ID from prj_AnnualBudget where rws = (select rws from prj_AnnualBudget where id = #{nys}))
- </select>
- </mapper>
|