123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317 |
- <?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"/>
- <result property="mc" column="MC" jdbcType="VARCHAR"/>
- <result property="fymc" column="FYMC" jdbcType="VARCHAR"/>
- <result property="bzid" column="BZID" jdbcType="VARCHAR"/>
- <result property="xmzys" column="XMZYS" jdbcType="NUMERIC"/>
- <result property="zbzje" column="ZBZJE" jdbcType="NUMERIC"/>
- <result property="sfth" column="SFTH" jdbcType="INTEGER"/>
- <result property="sl" column="SL" jdbcType="VARCHAR"/>
- <result property="ssbmmc" column="SSBMMC" jdbcType="VARCHAR"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="StaBudgetapprovalMap">
- select b.*, d.YSJE,d.FYMC,c.dept_name as SSBMMC
- from sta_BudgetApproval b
- left join prj_AnnualBudgetDetail d on d.NYS = b.NYS and d.ID = b.FYLB
- left join sys_dept_info c on b.SSBM = c.dept_id
- 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,SFTH,ZBJE)
- values (#{sqmc}, #{xmmc}, #{xmid}, #{bh}, #{nf}, #{fylb}, #{sqje}, #{sqsm}, #{fj}, #{sqrxm}, #{sqr}, GETDATE(),
- #{erpbh}, #{kybg}, #{xmlx}, #{xmfzr}, #{ssbm}, 0, #{sfbz}, '未提交', #{nys}, #{bz},#{sfth},#{zbje})
- </insert>
- <insert id="insertImprest" keyProperty="id" useGeneratedKeys="true">
- insert into sta_BudgetApproval(SQMC, BH, SQSM, NF, SQJE, SQRXM, SQR, SQSJ, SFBYJ, SFBZ, SPZT,SFTH)
- values (#{sqmc}, #{bh}, #{sqsm}, #{nf}, #{sqje}, #{sqrxm}, #{sqr}, #{sqsj}, 1, 0, '未提交',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}
- ,BZJE = #{bzje}
- ,BHSJE = #{bhsje}
- <if test="sfbz != null">
- ,SFBZ = #{sfbz}
- </if>
- ,SF = #{sf}
- where ID = #{id}
- </update>
- <update id="updatebmbg">
- update sta_BudgetApproval
- set SSBM = #{ssbm}
- 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
- LEFT JOIN sta_Reimbursement c ON c.FYSQ = b.ID
- WHERE
- 1=1
- <if test="bzid != null and bzid != ''">
- and b.SFBZ = #{bzid}
- </if>
- <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="deptName!= null and deptName != ''">
- and(
- <if test="deptName !='电源技术中心'">
- d.dept_name = #{deptName}
- </if>
- <if test="deptName == '电源技术中心'">
- d.dept_name in (SELECT dept_name FROM sys_dept_info WHERE dept_name LIKE '%电源%')
- </if>
- )
- </if>
- <if test="sqmc != null and sqmc != ''">
- and b.SQMC like '%'+#{sqmc}+'%'
- </if>
- <if test="fylb != null and fylb != ''">
- and g.FYMC like '%'+#{fylb}+'%'
- </if>
- <if test="sqr != null and sqr != ''">
- and b.SQRXM like '%'+#{sqr}+'%'
- </if>
- <if test="sfbyj != null and sfbyj != ''">
- and b.SFBYJ = #{sfbyj}
- </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>
- <if test="xmmc != null and xmmc != ''">
- and b.XMMC like '%'+#{xmmc}+'%'
- </if>
- <if test="id != null and id != ''">
- and b.ID = #{id}
- </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>
- <if test="sqmc != null and sqmc != ''">
- and b.sqmc like '%'+ #{sqmc}+'%'
- </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
- ORDER BY NF DESC
- </select>
- <!--获取项目类型-->
- <select id="getXmlx" resultMap="StaBudgetapprovalMap">
- select
- b.FYMC
- from prj_AnnualBudgetDetail b
- where NYS = 355
- and BM not in (
- select distinct FJ
- from prj_AnnualBudgetDetail
- where FJ != '' AND NYS=355
- )
- </select>
- <!--获取已报账费用申请列表-->
- <select id="getYbzFysqList" resultMap="StaBudgetapprovalMap" parameterType="map">
- select b.*, t.XMLXMC, d.dept_name as SSBMMC, g.FYMC as FYLBMC,r.SL,r.SPZT as RSPZT,
- (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
- -- and r.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="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 '%'+#{ssbmmc}+'%'-->
- <!-- </if>-->
- <if test="ssbmmc!= null and ssbmmc != ''">
- and(
- <if test="ssbmmc !='电源技术中心'">
- d.dept_name = #{ssbmmc}
- </if>
- <if test="ssbmmc == '电源技术中心'">
- d.dept_name in (SELECT dept_name FROM sys_dept_info WHERE dept_name LIKE '%电源%')
- </if>
- )
- </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>
- <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
- c.ID AS BZID,
- 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
- LEFT JOIN sta_Reimbursement c ON b.ID = c.FYSQ
- 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="fylb != null and fylb != ''">
- and g.FYMC like '%'+#{fylb}+'%'
- </if>
- <if test="sqr != null and sqr != ''">
- and b.sqrxm like '%'+#{sqr}+'%'
- </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>
- <if test="spzt != null and spzt != ''">
- and b.SPZT = #{spzt}
- </if>
- <if test="sfth != null and sfth != ''">
- and b.SFTH = #{sfth}
- </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,
- b.SQSJ DESC
- </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 '%'+#{ssbmmc}+'%'
- </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,
- b.SQSJ DESC
- </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},
- <if test="spzt == '未提交(返回)'">
- SFTH = 1,
- </if>
- <if test="spzt == '审批结束'">
- SFTH = 0,
- </if>
- </set>
- 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>
- <update id="updateBatchBh">
- <foreach collection="entities" item="entity" separator=";">
- update sta_BudgetApproval
- set
- BH=#{entity.bh}
- where
- id = #{entity.id}
- </foreach>
- </update>
- <update id="updateSfbz">
- update sta_BudgetApproval
- set
- SFBZ= 0
- where
- id = #{fysq}
- </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((select SUM(SQJE) from sta_BudgetApproval where NYS = #{nys} and FYLB = #{fylb} and SPZT != '作废' and SFBYJ = 0),0) as SQJE,
- (select
- SUM(sr.bzje)
- from
- sta_Reimbursement sr
- left join sta_BudgetApproval sb on sr.fysq = sb.id
- where
- sb.NYS = #{nys}
- and sb.FYLB = #{fylb}
- and sb.SPZT != '作废'
- and sb.SFBYJ = 0
- and sr.spzt = '审批结束') as BZJE,
- (select
- SUM(COALESCE(sr.bzje, 0))
- from
- sta_Reimbursement sr
- left join sta_BudgetApproval sb on sr.fysq = sb.id
- where
- sb.NYS = #{nys}
- and sb.FYLB = #{fylb}
- and sb.SPZT != '作废'
- and sb.SFBYJ = 0
- and sr.spzt != '审批结束'
- and sr.spzt != '作废'
- ) as BZZJE,
- (select YSJE from prj_AnnualBudgetDetail where NYS = b.NYS and ID = b.FYLB) as YSJE,
- (SELECT
- sum(ISNULL(sr.BZJE ,sb.SQJE))
- from
- sta_BudgetApproval sb
- left join sta_Reimbursement sr on sr.fysq = sb.id and sr.SPZT = '审批结束'
- where
- sb.NYS = #{nys}
- and sb.fylb = #{fylb}
- and sb.spzt != '作废'
- and sb.SFBYJ = 0
- ) xmndjfysq
- 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="getSqjes" resultMap="StaBudgetapprovalMap">
- select
- ISNULL(sum(SQJE),0) AS SQJE,
- ISNULL(sum(BZJE),0) AS BZJE
- FROM sta_BudgetApproval
- where SPZT != '作废'
- <if test="nys != null and nys != ''">
- and NYS = #{nys}
- </if>
- </select>
- <!--未关联项目备用金 -->
- <select id="unassociated" resultMap="StaBudgetapprovalMap" parameterType="map">
- SELECT * FROM sta_BudgetApproval
- WHERE
- SFBYJ = 1
- AND XMMC IS NULL
- AND SPZT='审批结束'
- <if test="xmmc != null and xmmc != ''">
- and XMMC like '%'+#{xmmc}+'%'
- </if>
- <if test="bh != null and bh != ''">
- and BH like '%'+#{bh}+'%'
- </if>
- <if test="nf != null and nf != ''">
- and NF = #{nf}
- </if>
- </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>
- <select id="getBhById" resultType="java.lang.String">
- SELECT BH FROM sta_BudgetApproval where ID = #{id}
- </select>
- <select id="listSPJS" resultType="com.liang.entity.StaBudgetapproval">
- SELECT
- *
- from sta_BudgetApproval sba
- where
- sba.SPZT = '审批结束'
- and sba.BH = ''
- </select>
- <select id="getBayID" resultMap="StaBudgetapprovalMap">
- SELECT * FROM sta_BudgetApproval where ID = #{id}
- </select>
- <select id="getSqje" resultMap="StaBudgetapprovalMap" resultType="hashmap">
- SELECT COALESCE(SUM(SQJE), 0.00) AS SQJE
- FROM sta_BudgetApproval
- WHERE
- SFBYJ = 1
- and SPZT != '作废'
- <if test="nf != null and nf != ''">
- and NF = #{nf}
- </if>
- <if test="erpbh != null and erpbh != ''">
- and ERPBH = #{erpbh}
- </if>
- </select>
- <select id="getId" resultMap="StaBudgetapprovalMap">
- select * from sta_BudgetApproval
- <where>
- <if test="id != null and id != ''">
- ID = #{id}
- </if>
- </where>
- </select>
- <select id="getZbzje" resultType="com.liang.entity.StaBudgetapproval">
- SELECT
- (SELECT XMZYS * 10000 FROM prj_AnnualBudgetDetail WHERE FJ = '' AND NYS = #{nys}) AS XMZYS,
- (SELECT BYJ * 10000 FROM prj_AnnualBudgetDetail WHERE FJ = '' AND NYS = #{nys}) AS BYJ,
- (SELECT XMZ * 10000 FROM prj_AnnualBudgetDetail WHERE ID = #{fylb} AND NYS = #{nys}) AS KMZYS,
- (select
- SUM(sr.bzje)
- from
- sta_Reimbursement sr
- left join sta_BudgetApproval sb on sr.fysq = sb.id
- where
- sb.NYS = #{nys}
- and sb.SPZT != '作废'
- and sr.spzt != '作废') AS ZBZJE,
- (select
- SUM(sr.bzje)
- from
- sta_Reimbursement sr
- left join sta_BudgetApproval sb on sr.fysq = sb.id
- where
- sb.NYS = #{nys}
- and sb.SPZT != '作废'
- and sb.SFBYJ = 1
- and sr.spzt != '作废' ) AS BYJBZZE,
- (select
- SUM(sr.bzje)
- from
- sta_Reimbursement sr
- left join sta_BudgetApproval sb on sr.fysq = sb.id
- where
- sb.NYS = #{nys}
- and sb.FYLB = #{fylb}
- and sb.SPZT != '作废'
- and sb.SFBYJ = 0
- and sr.spzt != '作废') as KMYBZJE
- </select>
- <!-- <select id="getxmndjfysq" resultMap="StaBudgetapprovalMap">
- select ISNULL(SUM(BZJE), 0.00) AS SQJE FROM sta_BudgetApproval
- where spzt = '审批结束'
- and SFBYJ = 0
- and SFBZ = 1
- <if test="xmid != null and xmid != ''">
- </if>
- <if test="nf != null and nf != ''">
- </if>
- </select>-->
- <!-- 获取费用小项的当年申请总金额 不包含备用金 -->
- <select id="getSqfyze" resultMap="StaBudgetapprovalMap" resultType="hashmap">
- select COALESCE(SUM(SQJE),0.00)AS SQJE
- from sta_BudgetApproval a
- LEFT JOIN prj_AnnualBudgetDetail b ON a.FYLB = b.ID
- WHERE
- a.SPZT != '作废'
- AND a.SFBYJ = 0
- <if test="nys != null and nys != ''">
- AND a.NYS = #{nys}
- </if>
- <if test="fymc != null and fymc != ''">
- AND b.FYMC = #{fymc}
- </if>
- </select>
- <!-- 获取备用金小项 申请金额 -->
- <select id="getByjze" resultMap="StaBudgetapprovalMap" resultType="hashmap">
- select COALESCE(SUM(SQJE),0.00)AS SQJE,COALESCE(SUM (BZJE),0.00)AS BZJE
- from sta_BudgetApproval a
- LEFT JOIN prj_AnnualBudgetDetail b ON a.FYLB = b.ID
- WHERE
- a.SPZT != '作废'
- AND a.SFBYJ = 1
- <if test="nys != null and nys != ''">
- AND a.NYS = #{nys}
- </if>
- <if test="fymc != null and fymc != ''">
- AND b.FYMC = #{fymc}
- </if>
- </select>
- <select id="getFyzz" resultType="com.liang.entity.StaBudgetapproval">
- SELECT
- COALESCE (
- SUM(CASE
- WHEN a.SFBZ = 0 THEN a.SQJE
- ELSE a.BZJE
- END ),0.00
- ) AS xmndjfysq
- FROM sta_BudgetApproval a
- LEFT JOIN prj_AnnualBudgetDetail b ON a.FYLB = b.ID
- WHERE
- a.SFBYJ = 0
- AND
- a.SPZT != '作废'
- <if test="nys != null and nys != ''">
- AND
- a.NYS = #{nys}
- </if>
- <if test="fymc != null and fymc != ''">
- AND b.FYMC = #{fymc}
- </if>
- </select>
- <select id="getByjzje" resultType="com.liang.entity.PrjAnnualbudgetdetail">
- select * from
- prj_AnnualBudgetDetail
- where FYMC = '总计'
- <if test="nys != null and nys != ''">
- and NYS = #{nys}
- </if>
- </select>
- <select id="getSqe" resultType="com.liang.entity.StaBudgetapproval">
- SELECT COALESCE
- ( SUM ( CASE WHEN a.SFBZ = 0 THEN a.SQJE ELSE a.BZJE END ), 0.00 ) AS SQJE
- FROM
- sta_BudgetApproval a
- LEFT JOIN prj_AnnualBudgetDetail b ON a.FYLB = b.ID
- WHERE
- a.SPZT != '作废'
- <if test="nys != null and nys !=''">
- AND a.NYS = #{nys}
- </if>
- <if test="fymc != null and fymc != ''">
- AND b.FYMC = #{fymc}
- </if>
- </select>
- <select id="getFylb" resultType="com.liang.entity.StaBudgetapproval">
- SELECT
- a.ID,
- a.NYS,
- a.XMMC,
- a.BZJE,
- C.FYMC
- FROM
- sta_BudgetApproval a
- LEFT JOIN
- prj_AnnualBudget b ON b.ID = a.NYS AND b.SPZT = '审批结束'
- LEFT JOIN
- prj_AnnualBudgetDetail c ON c.ID = a.FYLB
- WHERE
- a.SPZT = '审批结束'
- AND a.SFBZ = 1
- <if test="nys != null and nys != ''">
- AND a.NYS = #{nys}
- </if>
- <if test="fymc != null and fymc != ''">
- AND c.FYMC LIKE '%'+#{fymc}+'%'
- </if>
- </select>
- </mapper>
|