123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
- <?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.StaMaterialDao">
- <resultMap type="com.liang.entity.StaMaterial" id="StaMaterialMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="zb" column="ZB" jdbcType="INTEGER"/>
- <result property="fysq" column="FYSQ" jdbcType="NUMERIC"/>
- <result property="clmc" column="CLMC" jdbcType="VARCHAR"/>
- <result property="wlbm" column="WLBM" jdbcType="VARCHAR"/>
- <result property="cgdj" column="CGDJ" jdbcType="NUMERIC"/>
- <result property="bhsje" column="BHSJE" jdbcType="NUMERIC"/>
- <result property="hsje" column="HSJE" jdbcType="NUMERIC"/>
- <result property="bz" column="BZ" jdbcType="VARCHAR"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="StaMaterialMap">
- select
- ID, ZB, FYSQ, CLMC, WLBM, CGDJ, BHSJE, HSJE, BZ
- from sta_Material
- where ID = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="StaMaterialMap">
- select
- ID, ZB, FYSQ, CLMC, WLBM, CGDJ, BHSJE, HSJE, BZ
- from sta_Material
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="zb != null">
- and ZB = #{zb}
- </if>
- <if test="fysq != null">
- and FYSQ = #{fysq}
- </if>
- <if test="clmc != null and clmc != ''">
- and CLMC = #{clmc}
- </if>
- <if test="wlbm != null and wlbm != ''">
- and WLBM = #{wlbm}
- </if>
- <if test="cgdj != null">
- and CGDJ = #{cgdj}
- </if>
- <if test="bhsje != null">
- and BHSJE = #{bhsje}
- </if>
- <if test="hsje != null">
- and HSJE = #{hsje}
- </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 sta_Material
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="zb != null">
- and ZB = #{zb}
- </if>
- <if test="fysq != null">
- and FYSQ = #{fysq}
- </if>
- <if test="clmc != null and clmc != ''">
- and CLMC = #{clmc}
- </if>
- <if test="wlbm != null and wlbm != ''">
- and WLBM = #{wlbm}
- </if>
- <if test="cgdj != null">
- and CGDJ = #{cgdj}
- </if>
- <if test="bhsje != null">
- and BHSJE = #{bhsje}
- </if>
- <if test="hsje != null">
- and HSJE = #{hsje}
- </if>
- <if test="bz != null and bz != ''">
- and BZ = #{bz}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into sta_Material(ZB, FYSQ, CLMC, WLBM, CGDJ, BHSJE, HSJE, BZ)
- values (#{zb}, #{fysq}, #{clmc}, #{wlbm}, #{cgdj}, #{bhsje}, #{hsje}, #{bz})
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into sta_Material(ZB, FYSQ, CLMC, WLBM, CGDJ, BHSJE, HSJE, BZ)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.zb}, #{entity.fysq}, #{entity.clmc}, #{entity.wlbm}, #{entity.cgdj}, #{entity.bhsje}, #{entity.hsje}, #{entity.bz})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into sta_Material(ZB, FYSQ, CLMC, WLBM, CGDJ, BHSJE, HSJE, BZ)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.zb}, #{entity.fysq}, #{entity.clmc}, #{entity.wlbm}, #{entity.cgdj}, #{entity.bhsje}, #{entity.hsje}, #{entity.bz})
- </foreach>
- on duplicate key update
- ZB = values(ZB),
- FYSQ = values(FYSQ),
- CLMC = values(CLMC),
- WLBM = values(WLBM),
- CGDJ = values(CGDJ),
- BHSJE = values(BHSJE),
- HSJE = values(HSJE),
- BZ = values(BZ)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update sta_Material
- <set>
- <if test="zb != null">
- ZB = #{zb},
- </if>
- <if test="fysq != null">
- FYSQ = #{fysq},
- </if>
- <if test="clmc != null and clmc != ''">
- CLMC = #{clmc},
- </if>
- <if test="wlbm != null and wlbm != ''">
- WLBM = #{wlbm},
- </if>
- <if test="cgdj != null">
- CGDJ = #{cgdj},
- </if>
- <if test="bhsje != null">
- BHSJE = #{bhsje},
- </if>
- <if test="hsje != null">
- HSJE = #{hsje},
- </if>
- <if test="bz != null and bz != ''">
- BZ = #{bz},
- </if>
- </set>
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete from sta_Material where ID = #{id}
- </delete>
- <!--获取材料费列表-->
- <select id="getList" resultMap="StaMaterialMap">
- select *
- from sta_Material
- where ZB = #{zb}
- </select>
- <!--通过主表删除-->
- <delete id="deleteByZb">
- delete from sta_Material where ZB = #{zb}
- </delete>
- <!--批量删除-->
- <delete id="batchDeleteByZb" parameterType="java.util.ArrayList">
- delete from sta_Material
- where ZB in
- <foreach item="item" index="index" collection="zbList" open = "(" separator = "," close = ")">
- #{item}
- </foreach>
- </delete>
- <!--统计报表(材料费)查询 -->
- <select id="searchMaterialCost" resultType="Map">
- SELECT sta_Material.ID,
- sys_dept_info.dept_name AS BM,
- prj_Project.BM AS XMBH,
- sta_BudgetApproval.XMMC,
- base_ProjectType.XMLXMC,
- sta_Material.FYSQ,
- sta_Material.CLMC,
- sta_Material.WLBM,
- sta_Material.CGDJ,
- sta_Material.BHSJE,
- sta_Material.HSJE,
- CASE
- WHEN sta_BudgetApproval.SFBYJ = 0 THEN '否'
- WHEN sta_BudgetApproval.SFBYJ = 1 THEN '是'
- ELSE CAST(sta_BudgetApproval.SFBYJ AS varchar(11))
- END AS SFBYJ,
- sta_Material.BZ,
- CAST(sta_BudgetApproval.SQSJ AS date) AS SQSJ
- FROM sta_Material,
- sta_BudgetApproval,
- prj_Project,
- base_ProjectType,
- sys_dept_info
- WHERE sta_Material.ZB = sta_BudgetApproval.ID
- AND sta_BudgetApproval.XMID = prj_Project.ID
- AND sta_BudgetApproval.SSBM = sys_dept_info.dept_id
- AND sta_BudgetApproval.XMLX = base_ProjectType.XMLX
- <if test="MC != null and MC != ''">
- AND sta_BudgetApproval.XMMC LIKE '%${MC}%'
- </if>
- <if test="CLMC != null and CLMC != ''">
- AND sta_Material.CLMC LIKE '%${CLMC}%'
- </if>
- <if test="WLBM != null and WLBM != ''">
- AND sta_Material.WLBM LIKE '%${WLBM}%'
- </if>
- <if test="BZ != null and BZ != ''">
- AND sta_Material.BZ LIKE '%${BZ}%'
- </if>
- <if test="QSRQ != null and QSRQ != ''">
- AND sta_BudgetApproval.SQSJ <![CDATA[>= ]]> #{QSRQ}
- </if>
- <if test="JZRQ != null and JZRQ != ''">
- AND sta_BudgetApproval.SQSJ <![CDATA[<= ]]> #{JZRQ}
- </if>
- </select>
- </mapper>
|