BisInspPlanDtlDao.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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="cn.com.goldenwater.dcproj.dao.BisInspPlanDtlDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspPlanDtl" id="bisInspPlanDtlResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="planId" column="PLAN_ID"/>
  7. <result property="stTm" column="ST_TM"/>
  8. <result property="enTm" column="EN_TM"/>
  9. <result property="chkPrjSize" column="CHK_PRJ_SIZE"/>
  10. <result property="chkType" column="CHK_TYPE"/>
  11. <result property="onlineChk" column="ONLINE_CHK"/>
  12. <result property="note" column="NOTE"/>
  13. <result property="persId" column="PERS_ID"/>
  14. <result property="intm" column="INTM"/>
  15. <result property="uptm" column="UPTM"/>
  16. <result property="dataStat" column="DATA_STAT"/>
  17. <result property="nm" column="NM"/>
  18. <result property="ddAdCode" column="DD_AD_CODE"/>
  19. <result property="chkContent" column="CHK_CONTENT"/>
  20. <result property="chkImplDept" column="CHK_IMPL_DEPT"/>
  21. </resultMap>
  22. <sql id="table_columns">
  23. ID,
  24. NM,
  25. PLAN_ID,
  26. ST_TM,
  27. EN_TM,
  28. CHK_PRJ_SIZE,
  29. CHK_TYPE,
  30. ONLINE_CHK,
  31. NOTE,
  32. PERS_ID,
  33. INTM,
  34. UPTM,
  35. DATA_STAT,
  36. CHK_CONTENT,
  37. CHK_IMPL_DEPT
  38. </sql>
  39. <sql id="entity_properties">
  40. #{id},
  41. #{nm},
  42. #{planId},
  43. #{stTm},
  44. #{enTm},
  45. #{chkPrjSize},
  46. #{chkType},
  47. #{onlineChk},
  48. #{note},
  49. #{persId},
  50. #{intm},
  51. #{uptm},
  52. #{dataStat},
  53. #{chkContent},
  54. #{chkImplDept}
  55. </sql>
  56. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  57. <sql id="page_where">
  58. <trim prefix="where" prefixOverrides="and | or ">
  59. <if test="planId != null and planId != ''">
  60. and plan_id in (select plan_id
  61. from bis_insp_plandp_rl
  62. where plan_dp_id = #{planId}
  63. union all
  64. select id
  65. from bis_insp_plan_year
  66. where lead_dep_id = #{planId})
  67. </if>
  68. <if test="stTm != null">and ST_TM = #{stTm}</if>
  69. <if test="enTm != null">and EN_TM = #{enTm}</if>
  70. <if test="chkPrjSize != null">and CHK_PRJ_SIZE = #{chkPrjSize}</if>
  71. <if test="chkType != null and chkType != ''">and CHK_TYPE = #{chkType}</if>
  72. <if test="onlineChk != null and onlineChk != ''">and ONLINE_CHK = #{onlineChk}</if>
  73. <if test="note != null and note != ''">and NOTE = #{note}</if>
  74. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  75. <if test="intm != null">and INTM = #{intm}</if>
  76. <if test="uptm != null">and UPTM = #{uptm}</if>
  77. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  78. <if test="yearStr != null and yearStr != ''">
  79. <choose>
  80. <when test="monthStr != null and monthStr != ''">
  81. and (to_char(ST_TM, 'yyyy-MM') = (#{yearStr} || '-' || #{monthStr})
  82. or to_char(EN_TM, 'yyyy-MM') = (#{yearStr} || '-' || #{monthStr}) )
  83. </when>
  84. <otherwise>
  85. and (to_char(ST_TM, 'yyyy') = #{yearStr} or to_char(EN_TM, 'yyyy') = #{yearStr})
  86. </otherwise>
  87. </choose>
  88. </if>
  89. <if test=' null != nm and "" != nm '>and NM like '${nm}%'</if>
  90. <!-- 检查内容、开展检查实施处室(单位) add lxf 2022/10/25 -->
  91. <if test='null != chkContent and "" != chkContent '>and CHK_CONTENT like '${chkContent}%'</if>
  92. and DATA_STAT='0'
  93. </trim>
  94. </sql>
  95. <select id="get" resultMap="bisInspPlanDtlResultMap" parameterType="String">
  96. select
  97. <include refid="table_columns"/>
  98. from BIS_INSP_PLAN_DTL where ID = #{id}
  99. </select>
  100. <select id="getBy" resultMap="bisInspPlanDtlResultMap">
  101. select
  102. <include refid="table_columns"/>
  103. from BIS_INSP_PLAN_DTL
  104. <include refid="page_where"/>
  105. </select>
  106. <select id="findAll" resultMap="bisInspPlanDtlResultMap">
  107. select
  108. <include refid="table_columns"/>
  109. from BIS_INSP_PLAN_DTL
  110. </select>
  111. <select id="findList" resultMap="bisInspPlanDtlResultMap">
  112. select
  113. <include refid="table_columns"/>
  114. from BIS_INSP_PLAN_DTL
  115. <include refid="page_where"/>
  116. </select>
  117. <select id="selectCount" resultType="int">
  118. select count(ID) from BIS_INSP_PLAN_DTL
  119. <include refid="page_where"/>
  120. </select>
  121. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanDtl">
  122. insert into BIS_INSP_PLAN_DTL(
  123. <include refid="table_columns"/>
  124. )
  125. values (
  126. <include refid="entity_properties"/>
  127. )
  128. </insert>
  129. <delete id="delete" parameterType="java.lang.String">
  130. update BIS_INSP_PLAN_DTL
  131. set DATA_STAT='9'
  132. where ID = #{id}
  133. </delete>
  134. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanDtl">
  135. update BIS_INSP_PLAN_DTL set DATA_STAT='9'
  136. <include refid="page_where"/>
  137. </delete>
  138. <update id="deleteInFlag" parameterType="java.lang.String">
  139. update BIS_INSP_PLAN_DTL
  140. set DATA_STAT = '9'
  141. where ID = #{id}
  142. </update>
  143. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanDtl">
  144. update BIS_INSP_PLAN_DTL
  145. <trim prefix="set" suffixOverrides=",">
  146. <if test="planId != null and planId != ''">PLAN_ID = #{planId},</if>
  147. <if test="stTm != null">ST_TM = #{stTm},</if>
  148. <if test="enTm != null">EN_TM = #{enTm},</if>
  149. <if test="chkPrjSize != null">CHK_PRJ_SIZE = #{chkPrjSize},</if>
  150. <if test="chkType != null and chkType != ''">CHK_TYPE = #{chkType},</if>
  151. <if test="onlineChk != null and onlineChk != ''">ONLINE_CHK = #{onlineChk},</if>
  152. <if test="note != null and note != ''">NOTE = #{note},</if>
  153. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  154. <if test="intm != null">INTM = #{intm},</if>
  155. <if test="uptm != null">UPTM = #{uptm},</if>
  156. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  157. <if test="nm != null and nm != ''">NM = #{nm},</if>
  158. <if test='chkContent != null and "" != chkContent ' >CHK_CONTENT = #{chkContent},</if>
  159. <if test='chkImplDept != null and "" != chkImplDept ' >CHK_IMPL_DEPT = #{chkImplDept},</if>
  160. </trim>
  161. <where>ID = #{id}</where>
  162. </update>
  163. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspPlanDtl">
  164. update BIS_INSP_PLAN_DTL
  165. <trim prefix="set" suffixOverrides=",">
  166. <if test="planId != null and planId != ''">PLAN_ID = #{planId},</if>
  167. <if test="stTm != null">ST_TM = #{stTm},</if>
  168. <if test="enTm != null">EN_TM = #{enTm},</if>
  169. <if test="chkPrjSize != null">CHK_PRJ_SIZE = #{chkPrjSize},</if>
  170. <if test="chkType != null and chkType != ''">CHK_TYPE = #{chkType},</if>
  171. <if test="onlineChk != null and onlineChk != ''">ONLINE_CHK = #{onlineChk},</if>
  172. <if test="note != null and note != ''">NOTE = #{note},</if>
  173. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  174. <if test="intm != null">INTM = #{intm},</if>
  175. <if test="uptm != null">UPTM = #{uptm},</if>
  176. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  177. <if test="nm != null and nm != ''">NM = #{nm},</if>
  178. <if test='chkContent != null and "" != chkContent ' >CHK_CONTENT = #{chkContent},</if>
  179. <if test='chkImplDept != null and "" != chkImplDept ' >CHK_IMPL_DEPT = #{chkImplDept},</if>
  180. </trim>
  181. <include refid="page_where"/>
  182. </update>
  183. <!-- 其他自定义SQL -->
  184. <select id="findDtlList" resultType="cn.com.goldenwater.dcproj.dto.BisInspPlanDtlDto">
  185. select
  186. BIPD.ID,
  187. BIPD.NM,
  188. BIPD.PLAN_ID,
  189. BIPD.ST_TM,
  190. BIPD.EN_TM,
  191. BIPD.CHK_PRJ_SIZE,
  192. BIPD.CHK_TYPE,
  193. BIPD.ONLINE_CHK,
  194. BIPD.NOTE,
  195. BIPD.PERS_ID,
  196. BIPD.INTM,
  197. BIPD.UPTM,
  198. BIPD.DATA_STAT,
  199. BIPD.CHK_CONTENT,
  200. BIPD.CHK_IMPL_DEPT,
  201. BIPY.CHK_NAME,
  202. BIPY.STATE,
  203. BIPY.AD_CODE as DD_AD_CODE,
  204. BIPY.CHK_YEAR,
  205. DP.DP_NAME
  206. from BIS_INSP_PLAN_DTL BIPD
  207. left join BIS_INSP_PLAN_YEAR BIPY on BIPY.ID = BIPD.PLAN_ID
  208. left join BIS_INSP_PLAN_DP DP ON DP.ID = BIPY.LEAD_DEP_ID
  209. <trim prefix="where" prefixOverrides="and | or ">
  210. <if test="planId != null and planId != ''">
  211. and BIPY.ID = #{planId}
  212. </if>
  213. <if test="stTm != null">and BIPD.ST_TM = #{stTm}</if>
  214. <if test="enTm != null">and BIPD.EN_TM = #{enTm}</if>
  215. <if test="chkPrjSize != null">and BIPD.CHK_PRJ_SIZE = #{chkPrjSize}</if>
  216. <if test="chkType != null and chkType != ''">and BIPD.CHK_TYPE = #{chkType}</if>
  217. <if test="onlineChk != null and onlineChk != ''">and BIPD.ONLINE_CHK = #{onlineChk}</if>
  218. <if test="note != null and note != ''">and BIPD.NOTE = #{note}</if>
  219. <if test="persId != null and persId != ''">and BIPD.PERS_ID = #{persId}</if>
  220. <if test="intm != null">and BIPD.INTM = #{intm}</if>
  221. <if test="uptm != null">and BIPD.UPTM = #{uptm}</if>
  222. <if test="dataStat != null and dataStat != ''">and BIPD.DATA_STAT = #{dataStat}</if>
  223. <if test="nm != null and nm != ''">and BIPD.NM like '%${nm}%'</if>
  224. <if test="ddAdCode != null and ddAdCode != ''">and BIPY.AD_CODE LIKE '${ddAdCode}%'</if>
  225. <if test="chkYear != null and chkYear != ''">and BIPY.CHK_YEAR = #{chkYear}</if>
  226. <if test="yearStr != null and yearStr != ''">
  227. <choose>
  228. <when test='monthStr != null and monthStr != "" '>
  229. and (to_char(BIPD.ST_TM, 'yyyy-MM') = (#{yearStr} || '-' || #{monthStr})
  230. or to_char(BIPD.EN_TM, 'yyyy-MM') = (#{yearStr} || '-' || #{monthStr}) )
  231. </when>
  232. <otherwise>
  233. and (to_char(BIPD.ST_TM, 'yyyy') = #{yearStr} or to_char(BIPD.EN_TM, 'yyyy') = #{yearStr})
  234. </otherwise>
  235. </choose>
  236. </if>
  237. <if test="planDpId != null and planDpId !=''">
  238. AND (BIPY.ID IN (SELECT DISTINCT PLAN_ID FROM BIS_INSP_PLANDP_RL WHERE PLAN_DP_ID = #{planDpId})
  239. OR BIPY.LEAD_DEP_ID = #{planDpId})
  240. </if>
  241. <if test='chkContent != null and "" != chkContent ' >CHK_CONTENT like '%${chkContent}%' ,</if>
  242. and BIPD.DATA_STAT='0'
  243. </trim>
  244. </select>
  245. </mapper>