StaExpertFeeDao.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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.StaExpertFeeDao">
  4. <resultMap type="com.liang.entity.StaExpertFee" id="StaExpertFeeMap">
  5. <result property="id" column="ID" jdbcType="INTEGER"/>
  6. <result property="zb" column="ZB" jdbcType="INTEGER"/>
  7. <result property="zjxm" column="ZJXM" jdbcType="VARCHAR"/>
  8. <result property="sfzh" column="SFZH" jdbcType="VARCHAR"/>
  9. <result property="fysq" column="FYSQ" jdbcType="NUMERIC"/>
  10. <result property="bzfy" column="BZFY" jdbcType="NUMERIC"/>
  11. <result property="zc" column="ZC" jdbcType="VARCHAR"/>
  12. <result property="kyfh" column="KYFH" jdbcType="VARCHAR"/>
  13. </resultMap>
  14. <!--查询单个-->
  15. <select id="queryById" resultMap="StaExpertFeeMap">
  16. select ID,
  17. ZB,
  18. ZJXM,
  19. SFZH,
  20. FYSQ,
  21. BZFY,
  22. ZC,
  23. KYFH
  24. from sta_ExpertFee
  25. where ID = #{id}
  26. </select>
  27. <!--查询指定行数据-->
  28. <select id="queryAllByLimit" resultMap="StaExpertFeeMap">
  29. select
  30. ID, ZB, ZJXM, SFZH, FYSQ, BZFY, ZC, KYFH
  31. from sta_ExpertFee
  32. <where>
  33. <if test="id != null">
  34. and ID = #{id}
  35. </if>
  36. <if test="zb != null">
  37. and ZB = #{zb}
  38. </if>
  39. <if test="zjxm != null and zjxm != ''">
  40. and ZJXM = #{zjxm}
  41. </if>
  42. <if test="sfzh != null and sfzh != ''">
  43. and SFZH = #{sfzh}
  44. </if>
  45. <if test="fysq != null">
  46. and FYSQ = #{fysq}
  47. </if>
  48. <if test="bzfy != null">
  49. and BZFY = #{bzfy}
  50. </if>
  51. <if test="zc != null and zc != ''">
  52. and ZC = #{zc}
  53. </if>
  54. <if test="kyfh != null and kyfh != ''">
  55. and KYFH = #{kyfh}
  56. </if>
  57. </where>
  58. limit #{pageable.offset}, #{pageable.pageSize}
  59. </select>
  60. <!--统计总行数-->
  61. <select id="count" resultType="java.lang.Long">
  62. select count(1)
  63. from sta_ExpertFee
  64. <where>
  65. <if test="id != null">
  66. and ID = #{id}
  67. </if>
  68. <if test="zb != null">
  69. and ZB = #{zb}
  70. </if>
  71. <if test="zjxm != null and zjxm != ''">
  72. and ZJXM = #{zjxm}
  73. </if>
  74. <if test="sfzh != null and sfzh != ''">
  75. and SFZH = #{sfzh}
  76. </if>
  77. <if test="fysq != null">
  78. and FYSQ = #{fysq}
  79. </if>
  80. <if test="bzfy != null">
  81. and BZFY = #{bzfy}
  82. </if>
  83. <if test="zc != null and zc != ''">
  84. and ZC = #{zc}
  85. </if>
  86. <if test="kyfh != null and kyfh != ''">
  87. and KYFH = #{kyfh}
  88. </if>
  89. </where>
  90. </select>
  91. <!--新增所有列-->
  92. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  93. insert into sta_ExpertFee(ZB, ZJXM, SFZH, FYSQ, BZFY, ZC, KYFH)
  94. values (#{zb}, #{zjxm}, #{sfzh}, #{fysq}, #{bzfy}, #{zc}, #{kyfh})
  95. </insert>
  96. <!--批量插入专家咨询费-->
  97. <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
  98. insert into sta_ExpertFee(ZB, ZJXM, SFZH, FYSQ, BZFY, ZC, KYFH)
  99. values
  100. <foreach collection="entities" item="entity" separator=",">
  101. (#{entity.zb}, #{entity.zjxm}, #{entity.sfzh}, #{entity.fysq}, #{entity.bzfy}, #{entity.zc}, #{entity.kyfh})
  102. </foreach>
  103. </insert>
  104. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  105. insert into sta_ExpertFee(ZB, ZJXM, SFZH, FYSQ, BZFY, ZC, KYFH)
  106. values
  107. <foreach collection="entities" item="entity" separator=",">
  108. (#{entity.zb}, #{entity.zjxm}, #{entity.sfzh}, #{entity.fysq}, #{entity.bzfy}, #{entity.zc}, #{entity.kyfh})
  109. </foreach>
  110. on duplicate key update
  111. ZB = values(ZB),
  112. ZJXM = values(ZJXM),
  113. SFZH = values(SFZH),
  114. FYSQ = values(FYSQ),
  115. BZFY = values(BZFY),
  116. ZC = values(ZC),
  117. KYFH = values(KYFH)
  118. </insert>
  119. <!--通过主键修改数据-->
  120. <update id="update">
  121. update sta_ExpertFee
  122. <set>
  123. <if test="zb != null">
  124. ZB = #{zb},
  125. </if>
  126. <if test="zjxm != null and zjxm != ''">
  127. ZJXM = #{zjxm},
  128. </if>
  129. <if test="sfzh != null and sfzh != ''">
  130. SFZH = #{sfzh},
  131. </if>
  132. <if test="fysq != null">
  133. FYSQ = #{fysq},
  134. </if>
  135. <if test="bzfy != null">
  136. BZFY = #{bzfy},
  137. </if>
  138. <if test="zc != null and zc != ''">
  139. ZC = #{zc},
  140. </if>
  141. <if test="kyfh != null and kyfh != ''">
  142. KYFH = #{kyfh},
  143. </if>
  144. </set>
  145. where ID = #{id}
  146. </update>
  147. <!--通过主键删除-->
  148. <delete id="deleteById">
  149. delete
  150. from sta_ExpertFee
  151. where ID = #{id}
  152. </delete>
  153. <!--通过主表删除-->
  154. <delete id="deleteByZb">
  155. delete
  156. from sta_ExpertFee
  157. where ZB = #{zb}
  158. </delete>
  159. <!--批量删除专家咨询费-->
  160. <delete id="batchDeleteByZb" parameterType="java.util.ArrayList">
  161. delete from sta_ExpertFee
  162. where ZB in
  163. <foreach item="item" index="index" collection="zbList" open="(" separator="," close=")">
  164. #{item}
  165. </foreach>
  166. </delete>
  167. <!--获取专家咨询费列表-->
  168. <select id="getZjfList" resultMap="StaExpertFeeMap">
  169. select e.*
  170. from sta_ExpertFee e
  171. where ZB = #{zb}
  172. </select>
  173. <select id="queryByKyfh" resultMap="StaExpertFeeMap">
  174. select *
  175. from sta_ExpertFee
  176. where KYFH like #{kyfh} + '%'
  177. order by ID desc
  178. </select>
  179. <select id="searchExpertFeeCost" resultType="Map">
  180. SELECT sta_ExpertFee.ID,
  181. sys_dept_info.dept_name AS BM,
  182. sta_BudgetApproval.XMMC,
  183. base_ProjectType.XMLXMC,
  184. base_Person.XM AS XMFZR,
  185. sta_ExpertFee.ZJXM,
  186. sta_ExpertFee.SFZH,
  187. sta_ExpertFee.FYSQ,
  188. sta_ExpertFee.BZFY,
  189. sta_ExpertFee.ZC,
  190. sta_ExpertFee.KYFH,
  191. CASE
  192. WHEN sta_BudgetApproval.SFBYJ = 0 THEN '否'
  193. WHEN sta_BudgetApproval.SFBYJ = 1 THEN '是'
  194. ELSE CAST(sta_BudgetApproval.SFBYJ AS varchar(11))
  195. END AS SFBYJ,
  196. CAST(sta_BudgetApproval.SQSJ AS date) AS SQSJ
  197. FROM sta_ExpertFee,
  198. sta_BudgetApproval,
  199. prj_Project,
  200. sys_dept_info,
  201. base_Person,
  202. base_ProjectType
  203. WHERE sta_ExpertFee.ZB = sta_BudgetApproval.ID
  204. AND sta_BudgetApproval.XMID = prj_Project.ID
  205. AND sta_BudgetApproval.SSBM = sys_dept_info.dept_id
  206. AND sta_BudgetApproval.XMFZR = base_Person.ID
  207. AND sta_BudgetApproval.XMLX = base_ProjectType.XMLX
  208. <if test="MC != null and MC != ''">
  209. AND sta_BudgetApproval.XMMC LIKE '%${MC}%'
  210. </if>
  211. <if test="ZJXM != null and ZJXM != ''">
  212. AND sta_ExpertFee.ZJXM LIKE '%${ZJXM}%'
  213. </if>
  214. <if test="ZC != null and ZC != ''">
  215. AND sta_ExpertFee.ZC LIKE '%${ZC}%'
  216. </if>
  217. <if test="QSRQ != null and QSRQ != ''">
  218. AND sta_BudgetApproval.SQSJ <![CDATA[>= ]]> #{QSRQ}
  219. </if>
  220. <if test="JZRQ != null and JZRQ != ''">
  221. AND sta_BudgetApproval.SQSJ <![CDATA[<= ]]> #{JZRQ}
  222. </if>
  223. </select>
  224. </mapper>