123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403 |
- <?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.PrjBudgetDao">
- <resultMap type="com.liang.entity.PrjBudget" id="PrjBudgetMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="mc" column="MC" jdbcType="VARCHAR"/>
- <result property="ysje" column="YSJE" jdbcType="NUMERIC"/>
- <result property="xm" column="XM" jdbcType="INTEGER"/>
- <result property="sjje" column="SJJE" jdbcType="NUMERIC"/>
- <result property="fj" column="FJ" jdbcType="VARCHAR"/>
- <result property="nf" column="NF" jdbcType="INTEGER"/>
- <result property="px" column="PX" jdbcType="VARCHAR"/>
- <result property="bm" column="BM" jdbcType="VARCHAR"/>
- <result property="hjbm" column="HJBM" jdbcType="VARCHAR"/>
- <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="bz" column="BZ" jdbcType="VARCHAR"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="PrjBudgetMap">
- select
- ID, MC, YSJE, XM, SJJE, FJ, NF, PX, BM, HJBM, DW1, DW2, DW3, DW4, DW5, DW6, DW7, DW8, DW9, DW10, SJYS1, SJYS2, SJYS3, SJYS4, SJYS5, SJYS6, SJYS7, SJYS8, SJYS9, SJYS10, BZ
- from prj_Budget
- where ID = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="PrjBudgetMap">
- select
- ID, MC, YSJE, XM, SJJE, FJ, NF, PX, BM, HJBM, DW1, DW2, DW3, DW4, DW5, DW6, DW7, DW8, DW9, DW10, SJYS1, SJYS2, SJYS3, SJYS4, SJYS5, SJYS6, SJYS7, SJYS8, SJYS9, SJYS10, BZ
- from prj_Budget
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="mc != null and mc != ''">
- and MC = #{mc}
- </if>
- <if test="ysje != null">
- and YSJE = #{ysje}
- </if>
- <if test="xm != null">
- and XM = #{xm}
- </if>
- <if test="sjje != null">
- and SJJE = #{sjje}
- </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="bm != null and bm != ''">
- and BM = #{bm}
- </if>
- <if test="hjbm != null and hjbm != ''">
- and HJBM = #{hjbm}
- </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="bz != null and bz != ''">
- and BZ = #{bz}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from prj_Budget
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="mc != null and mc != ''">
- and MC = #{mc}
- </if>
- <if test="ysje != null">
- and YSJE = #{ysje}
- </if>
- <if test="xm != null">
- and XM = #{xm}
- </if>
- <if test="sjje != null">
- and SJJE = #{sjje}
- </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="bm != null and bm != ''">
- and BM = #{bm}
- </if>
- <if test="hjbm != null and hjbm != ''">
- and HJBM = #{hjbm}
- </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="bz != null and bz != ''">
- and BZ = #{bz}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into prj_Budget(MC, YSJE, XM, SJJE, FJ, NF, PX, BM, HJBM, DW1, DW2, DW3, DW4, DW5, DW6, DW7, DW8, DW9, DW10, SJYS1, SJYS2, SJYS3, SJYS4, SJYS5, SJYS6, SJYS7, SJYS8, SJYS9, SJYS10, BZ)
- values (#{mc}, #{ysje}, #{xm}, #{sjje}, #{fj}, #{nf}, #{px}, #{bm}, #{hjbm}, #{dw1}, #{dw2}, #{dw3}, #{dw4}, #{dw5}, #{dw6}, #{dw7}, #{dw8}, #{dw9}, #{dw10}, #{sjys1}, #{sjys2}, #{sjys3}, #{sjys4}, #{sjys5}, #{sjys6}, #{sjys7}, #{sjys8}, #{sjys9}, #{sjys10}, #{bz})
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into prj_Budget(MC, XM, FJ, PX, BM, HJBM, BZ)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.mc}, #{entity.xm}, #{entity.fj}, #{entity.px}, #{entity.bm}, #{entity.hjbm}, #{entity.bz})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into prj_Budget(MC, YSJE, XM, SJJE, FJ, NF, PX, BM, HJBM, DW1, DW2, DW3, DW4, DW5, DW6, DW7, DW8, DW9, DW10, SJYS1, SJYS2, SJYS3, SJYS4, SJYS5, SJYS6, SJYS7, SJYS8, SJYS9, SJYS10, BZ)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.mc}, #{entity.ysje}, #{entity.xm}, #{entity.sjje}, #{entity.fj}, #{entity.nf}, #{entity.px}, #{entity.bm}, #{entity.hjbm}, #{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.bz})
- </foreach>
- on duplicate key update
- MC = values(MC),
- YSJE = values(YSJE),
- XM = values(XM),
- SJJE = values(SJJE),
- FJ = values(FJ),
- NF = values(NF),
- PX = values(PX),
- BM = values(BM),
- HJBM = values(HJBM),
- 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),
- BZ = values(BZ)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update prj_Budget
- set YSJE = #{ysje},
- DW1 = #{dw1},
- DW2 = #{dw2},
- DW3 = #{dw3},
- DW4 = #{dw4},
- DW5 = #{dw5},
- DW6 = #{dw6},
- DW7 = #{dw7},
- DW8 = #{dw8},
- DW9 = #{dw9},
- DW10 = #{dw10}
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete from prj_Budget where ID = #{id}
- </delete>
- <!--删除项目预算-->
- <delete id="deleteByXm">
- delete from prj_Budget where XM = #{xm}
- </delete>
- <!--批量删除项目预算-->
- <delete id="batchDeleteByXm">
- delete from prj_Budget
- where XM in
- <foreach item="item" index="index" collection="xmList" open = "(" separator = "," close = ")">
- #{item}
- </foreach>
- </delete>
- <!--获取项目预算-->
- <select id="getBudgetList" resultMap="PrjBudgetMap" parameterType="map">
- select b.*, p.ZWMC as XMMC
- from prj_Budget b
- left join prj_Project p on p.ID = b.XM
- where b.XM = #{xm}
- </select>
- <!--通过项目修改数据-->
- <update id="updateYsByXm">
- update prj_Budget
- <set>
- <if test="count == 0">
- DW1 = NULL, DW2 = NULL, DW3 = NULL, DW4 = NULL, DW5 = NULL, DW6 = NULL, DW7 = NULL, DW8 = NULL, DW9 = NULL, DW10 = NULL,
- </if>
- <if test="count == 1">
- DW2 = NULL, DW3 = NULL, DW4 = NULL, DW5 = NULL, DW6 = NULL, DW7 = NULL, DW8 = NULL, DW9 = NULL, DW10 = NULL,
- </if>
- <if test="count == 2">
- DW3 = NULL, DW4 = NULL, DW5 = NULL, DW6 = NULL, DW7 = NULL, DW8 = NULL, DW9 = NULL, DW10 = NULL,
- </if>
- <if test="count == 3">
- DW4 = NULL, DW5 = NULL, DW6 = NULL, DW7 = NULL, DW8 = NULL, DW9 = NULL, DW10 = NULL,
- </if>
- <if test="count == 4">
- DW5 = NULL, DW6 = NULL, DW7 = NULL, DW8 = NULL, DW9 = NULL, DW10 = NULL,
- </if>
- <if test="count == 5">
- DW6 = NULL, DW7 = NULL, DW8 = NULL, DW9 = NULL, DW10 = NULL,
- </if>
- <if test="count == 6">
- DW7 = NULL, DW8 = NULL, DW9 = NULL, DW10 = NULL,
- </if>
- <if test="count == 7">
- DW8 = NULL, DW9 = NULL, DW10 = NULL,
- </if>
- <if test="count == 8">
- DW9 = NULL, DW10 = NULL,
- </if>
- <if test="count == 9">
- DW10 = NULL,
- </if>
- </set>
- where XM = #{xm}
- </update>
- <update id="updateYSYE">
- update prj_Budget
- set YSJE = (case when DW1 IS NULL then 0 else DW1 end + case when DW2 IS NULL then 0 else DW2 end
- + case when DW3 IS NULL then 0 else DW3 end + case when DW4 IS NULL then 0 else DW4 end
- + case when DW5 IS NULL then 0 else DW5 end + case when DW6 IS NULL then 0 else DW6 end
- + case when DW7 IS NULL then 0 else DW7 end + case when DW8 IS NULL then 0 else DW8 end
- + case when DW9 IS NULL then 0 else DW9 end + case when DW10 IS NULL then 0 else DW10 end)
- where XM = #{xm}
- </update>
- <update id="emptyYSYE">
- update prj_Budget
- set YSJE = NULL
- where XM = #{xm} and YSJE = 0
- </update>
- </mapper>
|