123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- <?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.StaSourceFeeDao">
- <resultMap type="com.liang.entity.StaSourceFee" id="StaSourceFeeMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="zb" column="ZB" jdbcType="INTEGER"/>
- <result property="fysq" column="FYSQ" jdbcType="VARCHAR"/>
- <result property="kyfh" column="KYFH" jdbcType="INTEGER"/>
- <result property="bzfy" column="BZFY" jdbcType="VARCHAR"/>
- <result property="tsmc" column="TSMC" jdbcType="VARCHAR"/>
- <result property="cbs" column="CBS" jdbcType="NUMERIC"/>
- <result property="sl" column="SL" jdbcType="NUMERIC"/>
- <result property="zj" column="ZJ" jdbcType="NUMERIC"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="StaSourceFeeMap">
- select ID,
- ZB,
- FYSQ,
- KYFH,
- BZFY,
- TSMC,
- CBS,
- SL,
- ZJ
- from sta_SourceFee
- where ID = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="StaSourceFeeMap">
- select
- ID, ZB, FYSQ, KYFH, BZFY, TSMC, CBS, SL, ZJ
- from sta_SourceFee
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="zb != null">
- and ZB = #{zb}
- </if>
- <if test="fysq != null and fysq != ''">
- and FYSQ = #{fysq}
- </if>
- <if test="kyfh != null">
- and KYFH = #{kyfh}
- </if>
- <if test="bzfy != null and bzfy != ''">
- and BZFY = #{bzfy}
- </if>
- <if test="tsmc != null">
- and TSMC = #{tsmc}
- </if>
- <if test="cbs != null">
- and CBS = #{cbs}
- </if>
- <if test="sl != null">
- and SL = #{sl}
- </if>
- <if test="zj != null">
- and ZJ = #{zj}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from sta_SourceFee
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="zb != null">
- and ZB = #{zb}
- </if>
- <if test="fysq != null and fysq != ''">
- and FYSQ = #{fysq}
- </if>
- <if test="kyfh != null">
- and KYFH = #{kyfh}
- </if>
- <if test="bzfy != null and bzfy != ''">
- and BZFY = #{bzfy}
- </if>
- <if test="tsmc != null">
- and TSMC = #{tsmc}
- </if>
- <if test="cbs != null">
- and CBS = #{cbs}
- </if>
- <if test="sl != null">
- and SL = #{sl}
- </if>
- <if test="zj != null">
- and ZJ = #{zj}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into sta_SourceFee(ZB, FYSQ, KYFH, BZFY, TSMC, CBS, SL, ZJ)
- values (#{zb}, #{fysq}, #{kyfh}, #{bzfy}, #{tsmc}, #{cbs}, #{sl}, #{zj})
- </insert>
- <!--批量插入资料费-->
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into sta_SourceFee(ZB, FYSQ, KYFH, BZFY, TSMC, CBS, SL, ZJ)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.zb}, #{entity.fysq}, #{entity.kyfh}, #{entity.bzfy}, #{entity.tsmc}, #{entity.cbs}, #{entity.sl},
- #{entity.zj})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into sta_SourceFee(ZB, FYSQ, KYFH, BZFY, TSMC, CBS, SL, ZJ)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.zb}, #{entity.fysq}, #{entity.kyfh}, #{entity.bzfy}, #{entity.tsmc}, #{entity.cbs}, #{entity.sl},
- #{entity.zj})
- </foreach>
- on duplicate key update
- ZB = values(ZB),
- FYSQ = values(FYSQ),
- KYFH = values(KYFH),
- BZFY = values(BZFY),
- TSMC = values(TSMC),
- CBS = values(CBS),
- SL = values(SL),
- ZJ = values(ZJ)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update sta_SourceFee
- <set>
- <if test="zb != null">
- ZB = #{zb},
- </if>
- <if test="fysq != null and fysq != ''">
- FYSQ = #{fysq},
- </if>
- <if test="kyfh != null">
- KYFH = #{kyfh},
- </if>
- <if test="bzfy != null and bzfy != ''">
- BZFY = #{bzfy},
- </if>
- <if test="tsmc != null">
- TSMC = #{tsmc},
- </if>
- <if test="cbs != null">
- CBS = #{cbs},
- </if>
- <if test="sl != null">
- SL = #{sl},
- </if>
- <if test="zj != null">
- ZJ = #{zj},
- </if>
- </set>
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete
- from sta_SourceFee
- where ID = #{id}
- </delete>
- <!--通过主表删除-->
- <delete id="deleteByZb">
- delete
- from sta_SourceFee
- where ZB = #{zb}
- </delete>
- <!--批量删除资料费-->
- <delete id="batchDeleteByZb" parameterType="java.util.ArrayList">
- delete from sta_SourceFee
- where ZB in
- <foreach item="item" index="index" collection="zbList" open="(" separator="," close=")">
- #{item}
- </foreach>
- </delete>
- <!--获取资料费列表-->
- <select id="getZlfList" resultMap="StaSourceFeeMap">
- select e.ID,
- e.ZB,
- e.FYSQ,
- e.BZFY,
- e.TSMC,
- e.CBS,
- e.SL,
- e.ZJ,
- sb.bh kyfh
- from sta_SourceFee e
- left join sta_BudgetApproval sb on sb.id = e.zb
- where ZB = #{zb}
- </select>
- <select id="queryByKyfh" resultMap="StaSourceFeeMap">
- select *
- from sta_SourceFee
- where KYFH like #{kyfh} + '%'
- order by ID desc
- </select>
- <!-- 项目报表 资料费查询 -->
- <select id="searchSourceCost" resultType="HashMap">
- SELECT
- sta_SourceFee.ID,
- sys_dept_info.dept_name AS BM,
- sta_BudgetApproval.XMMC,
- sta_BudgetApproval.ERPBH,
- sta_BudgetApproval.SQJE,
- sta_BudgetApproval.NF,
- sta_Reimbursement.BHSJE,
- sta_Reimbursement.BZJE,
- base_ProjectType.XMLXMC,
- base_Person.XM AS XMFZR,
- sta_SourceFee.FYSQ,
- sta_SourceFee.KYFH,
- sta_SourceFee.BZFY,
- sta_SourceFee.TSMC,
- sta_SourceFee.CBS,
- sta_SourceFee.SL,
- sta_SourceFee.ZJ,
- CASE
- WHEN sta_BudgetApproval.SFBYJ = 0 THEN '否'
- WHEN sta_BudgetApproval.SFBYJ = 1 THEN '是'
- ELSE CAST(sta_BudgetApproval.SFBYJ AS VARCHAR(11))
- END AS SFBYJ,
- CAST(sta_BudgetApproval.SQSJ AS DATE) AS SQSJ
- FROM
- sta_SourceFee
- LEFT JOIN
- sta_BudgetApproval ON sta_SourceFee.ZB = sta_BudgetApproval.ID
- INNER JOIN
- prj_Project ON sta_BudgetApproval.XMID = prj_Project.ID
- INNER JOIN
- sys_dept_info ON sta_BudgetApproval.SSBM = sys_dept_info.dept_id
- INNER JOIN
- base_ProjectType ON sta_BudgetApproval.XMLX = base_ProjectType.XMLX
- INNER JOIN
- base_Person ON sta_BudgetApproval.XMFZR = base_Person.ID
- LEFT JOIN
- sta_Reimbursement ON sta_BudgetApproval.ID = sta_Reimbursement.FYSQ
- where
- sta_BudgetApproval.SPZT != '作废'
- <if test="xmmc != null and xmmc != ''">
- AND sta_BudgetApproval.XMMC LIKE '%'+#{xmmc}+'%'
- </if>
- <if test="tsmc != null and tsmc != ''">
- AND sta_SourceFee.TSMC LIKE '%'+#{tsmc}+'%'
- </if>
- <if test="cbs != null and cbs != ''">
- AND sta_SourceFee.CBS LIKE '%'+#{cbs}+'%'
- </if>
- <if test="qsrq != null and qsrq != ''">
- AND sta_BudgetApproval.SQSJ <![CDATA[>= ]]> #{qsrq}
- </if>
- <if test="jsrq != null and jsrq != ''">
- AND sta_BudgetApproval.SQSJ <![CDATA[<= ]]> #{jsrq}
- </if>
- <if test="nf != null and nf != ''">
- AND sta_BudgetApproval.NF = #{nf}
- </if>
- <if test="bh != null and bh != ''">
- AND sta_SourceFee.KYFH LIKE '%'+#{bh}+'%'
- </if>
- <if test="erpbh != null and erpbh != ''">
- AND sta_BudgetApproval.ERPBH LIKE '%'+#{erpbh}+'%'
- </if>
- </select>
- </mapper>
|