StaSourceFeeDao.xml 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.liang.dao.StaSourceFeeDao">
  4. <resultMap type="com.liang.entity.StaSourceFee" id="StaSourceFeeMap">
  5. <result property="id" column="ID" jdbcType="INTEGER"/>
  6. <result property="zb" column="ZB" jdbcType="INTEGER"/>
  7. <result property="fysq" column="FYSQ" jdbcType="VARCHAR"/>
  8. <result property="kyfh" column="KYFH" jdbcType="INTEGER"/>
  9. <result property="bzfy" column="BZFY" jdbcType="VARCHAR"/>
  10. <result property="tsmc" column="TSMC" jdbcType="VARCHAR"/>
  11. <result property="cbs" column="CBS" jdbcType="NUMERIC"/>
  12. <result property="sl" column="SL" jdbcType="NUMERIC"/>
  13. <result property="zj" column="ZJ" jdbcType="NUMERIC"/>
  14. </resultMap>
  15. <!--查询单个-->
  16. <select id="queryById" resultMap="StaSourceFeeMap">
  17. select ID,
  18. ZB,
  19. FYSQ,
  20. KYFH,
  21. BZFY,
  22. TSMC,
  23. CBS,
  24. SL,
  25. ZJ
  26. from sta_SourceFee
  27. where ID = #{id}
  28. </select>
  29. <!--查询指定行数据-->
  30. <select id="queryAllByLimit" resultMap="StaSourceFeeMap">
  31. select
  32. ID, ZB, FYSQ, KYFH, BZFY, TSMC, CBS, SL, ZJ
  33. from sta_SourceFee
  34. <where>
  35. <if test="id != null">
  36. and ID = #{id}
  37. </if>
  38. <if test="zb != null">
  39. and ZB = #{zb}
  40. </if>
  41. <if test="fysq != null and fysq != ''">
  42. and FYSQ = #{fysq}
  43. </if>
  44. <if test="kyfh != null">
  45. and KYFH = #{kyfh}
  46. </if>
  47. <if test="bzfy != null and bzfy != ''">
  48. and BZFY = #{bzfy}
  49. </if>
  50. <if test="tsmc != null">
  51. and TSMC = #{tsmc}
  52. </if>
  53. <if test="cbs != null">
  54. and CBS = #{cbs}
  55. </if>
  56. <if test="sl != null">
  57. and SL = #{sl}
  58. </if>
  59. <if test="zj != null">
  60. and ZJ = #{zj}
  61. </if>
  62. </where>
  63. limit #{pageable.offset}, #{pageable.pageSize}
  64. </select>
  65. <!--统计总行数-->
  66. <select id="count" resultType="java.lang.Long">
  67. select count(1)
  68. from sta_SourceFee
  69. <where>
  70. <if test="id != null">
  71. and ID = #{id}
  72. </if>
  73. <if test="zb != null">
  74. and ZB = #{zb}
  75. </if>
  76. <if test="fysq != null and fysq != ''">
  77. and FYSQ = #{fysq}
  78. </if>
  79. <if test="kyfh != null">
  80. and KYFH = #{kyfh}
  81. </if>
  82. <if test="bzfy != null and bzfy != ''">
  83. and BZFY = #{bzfy}
  84. </if>
  85. <if test="tsmc != null">
  86. and TSMC = #{tsmc}
  87. </if>
  88. <if test="cbs != null">
  89. and CBS = #{cbs}
  90. </if>
  91. <if test="sl != null">
  92. and SL = #{sl}
  93. </if>
  94. <if test="zj != null">
  95. and ZJ = #{zj}
  96. </if>
  97. </where>
  98. </select>
  99. <!--新增所有列-->
  100. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  101. insert into sta_SourceFee(ZB, FYSQ, KYFH, BZFY, TSMC, CBS, SL, ZJ)
  102. values (#{zb}, #{fysq}, #{kyfh}, #{bzfy}, #{tsmc}, #{cbs}, #{sl}, #{zj})
  103. </insert>
  104. <!--批量插入资料费-->
  105. <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
  106. insert into sta_SourceFee(ZB, FYSQ, KYFH, BZFY, TSMC, CBS, SL, ZJ)
  107. values
  108. <foreach collection="entities" item="entity" separator=",">
  109. (#{entity.zb}, #{entity.fysq}, #{entity.kyfh}, #{entity.bzfy}, #{entity.tsmc}, #{entity.cbs}, #{entity.sl},
  110. #{entity.zj})
  111. </foreach>
  112. </insert>
  113. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  114. insert into sta_SourceFee(ZB, FYSQ, KYFH, BZFY, TSMC, CBS, SL, ZJ)
  115. values
  116. <foreach collection="entities" item="entity" separator=",">
  117. (#{entity.zb}, #{entity.fysq}, #{entity.kyfh}, #{entity.bzfy}, #{entity.tsmc}, #{entity.cbs}, #{entity.sl},
  118. #{entity.zj})
  119. </foreach>
  120. on duplicate key update
  121. ZB = values(ZB),
  122. FYSQ = values(FYSQ),
  123. KYFH = values(KYFH),
  124. BZFY = values(BZFY),
  125. TSMC = values(TSMC),
  126. CBS = values(CBS),
  127. SL = values(SL),
  128. ZJ = values(ZJ)
  129. </insert>
  130. <!--通过主键修改数据-->
  131. <update id="update">
  132. update sta_SourceFee
  133. <set>
  134. <if test="zb != null">
  135. ZB = #{zb},
  136. </if>
  137. <if test="fysq != null and fysq != ''">
  138. FYSQ = #{fysq},
  139. </if>
  140. <if test="kyfh != null">
  141. KYFH = #{kyfh},
  142. </if>
  143. <if test="bzfy != null and bzfy != ''">
  144. BZFY = #{bzfy},
  145. </if>
  146. <if test="tsmc != null">
  147. TSMC = #{tsmc},
  148. </if>
  149. <if test="cbs != null">
  150. CBS = #{cbs},
  151. </if>
  152. <if test="sl != null">
  153. SL = #{sl},
  154. </if>
  155. <if test="zj != null">
  156. ZJ = #{zj},
  157. </if>
  158. </set>
  159. where ID = #{id}
  160. </update>
  161. <!--通过主键删除-->
  162. <delete id="deleteById">
  163. delete
  164. from sta_SourceFee
  165. where ID = #{id}
  166. </delete>
  167. <!--通过主表删除-->
  168. <delete id="deleteByZb">
  169. delete
  170. from sta_SourceFee
  171. where ZB = #{zb}
  172. </delete>
  173. <!--批量删除资料费-->
  174. <delete id="batchDeleteByZb" parameterType="java.util.ArrayList">
  175. delete from sta_SourceFee
  176. where ZB in
  177. <foreach item="item" index="index" collection="zbList" open="(" separator="," close=")">
  178. #{item}
  179. </foreach>
  180. </delete>
  181. <!--获取资料费列表-->
  182. <select id="getZlfList" resultMap="StaSourceFeeMap">
  183. select e.ID,
  184. e.ZB,
  185. e.FYSQ,
  186. e.BZFY,
  187. e.TSMC,
  188. e.CBS,
  189. e.SL,
  190. e.ZJ,
  191. sb.bh kyfh
  192. from sta_SourceFee e
  193. left join sta_BudgetApproval sb on sb.id = e.zb
  194. where ZB = #{zb}
  195. </select>
  196. <select id="queryByKyfh" resultMap="StaSourceFeeMap">
  197. select *
  198. from sta_SourceFee
  199. where KYFH like #{kyfh} + '%'
  200. order by ID desc
  201. </select>
  202. <!-- 项目报表 资料费查询 -->
  203. <select id="searchSourceCost" resultType="HashMap">
  204. SELECT
  205. sta_SourceFee.ID,
  206. sys_dept_info.dept_name AS BM,
  207. sta_BudgetApproval.XMMC,
  208. sta_BudgetApproval.ERPBH,
  209. sta_BudgetApproval.SQJE,
  210. sta_BudgetApproval.NF,
  211. sta_Reimbursement.BHSJE,
  212. sta_Reimbursement.BZJE,
  213. base_ProjectType.XMLXMC,
  214. base_Person.XM AS XMFZR,
  215. sta_SourceFee.FYSQ,
  216. sta_SourceFee.KYFH,
  217. sta_SourceFee.BZFY,
  218. sta_SourceFee.TSMC,
  219. sta_SourceFee.CBS,
  220. sta_SourceFee.SL,
  221. sta_SourceFee.ZJ,
  222. CASE
  223. WHEN sta_BudgetApproval.SFBYJ = 0 THEN '否'
  224. WHEN sta_BudgetApproval.SFBYJ = 1 THEN '是'
  225. ELSE CAST(sta_BudgetApproval.SFBYJ AS VARCHAR(11))
  226. END AS SFBYJ,
  227. CAST(sta_BudgetApproval.SQSJ AS DATE) AS SQSJ
  228. FROM
  229. sta_SourceFee
  230. LEFT JOIN
  231. sta_BudgetApproval ON sta_SourceFee.ZB = sta_BudgetApproval.ID
  232. INNER JOIN
  233. prj_Project ON sta_BudgetApproval.XMID = prj_Project.ID
  234. INNER JOIN
  235. sys_dept_info ON sta_BudgetApproval.SSBM = sys_dept_info.dept_id
  236. INNER JOIN
  237. base_ProjectType ON sta_BudgetApproval.XMLX = base_ProjectType.XMLX
  238. INNER JOIN
  239. base_Person ON sta_BudgetApproval.XMFZR = base_Person.ID
  240. LEFT JOIN
  241. sta_Reimbursement ON sta_BudgetApproval.ID = sta_Reimbursement.FYSQ
  242. where
  243. sta_BudgetApproval.SPZT != '作废'
  244. <if test="xmmc != null and xmmc != ''">
  245. AND sta_BudgetApproval.XMMC LIKE '%'+#{xmmc}+'%'
  246. </if>
  247. <if test="tsmc != null and tsmc != ''">
  248. AND sta_SourceFee.TSMC LIKE '%'+#{tsmc}+'%'
  249. </if>
  250. <if test="cbs != null and cbs != ''">
  251. AND sta_SourceFee.CBS LIKE '%'+#{cbs}+'%'
  252. </if>
  253. <if test="qsrq != null and qsrq != ''">
  254. AND sta_BudgetApproval.SQSJ <![CDATA[>= ]]> #{qsrq}
  255. </if>
  256. <if test="jsrq != null and jsrq != ''">
  257. AND sta_BudgetApproval.SQSJ <![CDATA[<= ]]> #{jsrq}
  258. </if>
  259. <if test="nf != null and nf != ''">
  260. AND sta_BudgetApproval.NF = #{nf}
  261. </if>
  262. <if test="bh != null and bh != ''">
  263. AND sta_SourceFee.KYFH LIKE '%'+#{bh}+'%'
  264. </if>
  265. <if test="erpbh != null and erpbh != ''">
  266. AND sta_BudgetApproval.ERPBH LIKE '%'+#{erpbh}+'%'
  267. </if>
  268. </select>
  269. </mapper>