BisInspFscPblmDao.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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.BisInspFscPblmDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspFscPblm" id="bisInspFscPblmResultMap">
  5. <result property="name" column="NAME"/>
  6. <result property="type" column="TYPE"/>
  7. <result property="admOrg" column="ADM_ORG"/>
  8. <result property="basName" column="BAS_NAME"/>
  9. <result property="province" column="PROVINCE"/>
  10. <result property="city" column="CITY"/>
  11. <result property="country" column="COUNTRY"/>
  12. <result property="groupName" column="GROUP_NAME"/>
  13. <result property="persName" column="PERS_NAME"/>
  14. <result property="id" column="ID"/>
  15. <result property="rgstrId" column="RGSTR_ID"/>
  16. <result property="aUnit" column="A_UNIT"/>
  17. <result property="pblmDesc" column="PBLM_DESC"/>
  18. <result property="pblmImgSum" column="PBLM_IMG_SUM"/>
  19. <result property="pblmImgNum" column="PBLM_IMG_NUM"/>
  20. <result property="rectConc" column="RECT_CONC"/>
  21. <result property="rectMeas" column="RECT_MEAS"/>
  22. <result property="rectImgSum" column="RECT_IMG_SUM"/>
  23. <result property="rectImgNum" column="RECT_IMG_NUM"/>
  24. <result property="fdTm" column="FD_TM"/>
  25. <result property="rectLead" column="RECT_LEAD"/>
  26. <result property="rectMemb" column="RECT_MEMB"/>
  27. <result property="rectTm" column="RECT_TM"/>
  28. <result property="note" column="NOTE"/>
  29. <result property="dataStat" column="DATA_STAT"/>
  30. <result property="persId" column="PERS_ID"/>
  31. <result property="groupId" column="GROUP_ID"/>
  32. <result property="inTm" column="IN_TM"/>
  33. <result property="upTm" column="UP_TM"/>
  34. </resultMap>
  35. <sql id="table_columns">
  36. ID,
  37. RGSTR_ID,
  38. A_UNIT,
  39. PBLM_DESC,
  40. PBLM_IMG_SUM,
  41. PBLM_IMG_NUM,
  42. RECT_CONC,
  43. RECT_MEAS,
  44. RECT_IMG_SUM,
  45. RECT_IMG_NUM,
  46. FD_TM,
  47. RECT_LEAD,
  48. RECT_MEMB,
  49. RECT_TM,
  50. NOTE,
  51. DATA_STAT,
  52. PERS_ID,
  53. GROUP_ID,
  54. IN_TM,
  55. UP_TM
  56. </sql>
  57. <sql id="entity_properties">
  58. #{id},
  59. #{rgstrId},
  60. #{aUnit},
  61. #{pblmDesc},
  62. #{pblmImgSum},
  63. #{pblmImgNum},
  64. #{rectConc},
  65. #{rectMeas},
  66. #{rectImgSum},
  67. #{rectImgNum},
  68. #{fdTm},
  69. #{rectLead},
  70. #{rectMemb},
  71. #{rectTm},
  72. #{note},
  73. #{dataStat},
  74. #{persId},
  75. #{groupId},
  76. #{inTm},
  77. #{upTm}
  78. </sql>
  79. <sql id="entity_properties_item">
  80. #{item.id},
  81. #{item.rgstrId},
  82. #{item.aUnit},
  83. #{item.pblmDesc},
  84. #{item.pblmImgSum},
  85. #{item.pblmImgNum},
  86. #{item.rectConc},
  87. #{item.rectMeas},
  88. #{item.rectImgSum},
  89. #{item.rectImgNum},
  90. #{item.fdTm},
  91. #{item.rectLead},
  92. #{item.rectMemb},
  93. #{item.rectTm},
  94. #{item.note},
  95. #{item.dataStat},
  96. #{item.persId},
  97. #{item.groupId},
  98. #{item.inTm},
  99. #{item.upTm}
  100. </sql>
  101. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  102. <sql id="page_where">
  103. <trim prefix="where" prefixOverrides="and | or ">
  104. <if test="rgstrId != null and rgstrId != ''">and RGSTR_ID = #{rgstrId}</if>
  105. <if test="aUnit != null and aUnit != ''">and A_UNIT = #{aUnit}</if>
  106. <if test="pblmDesc != null and pblmDesc != ''">and PBLM_DESC = #{pblmDesc}</if>
  107. <if test="pblmImgSum != null and pblmImgSum != ''">and PBLM_IMG_SUM = #{pblmImgSum}</if>
  108. <if test="pblmImgNum != null and pblmImgNum != ''">and PBLM_IMG_NUM = #{pblmImgNum}</if>
  109. <if test="rectConc != null and rectConc != ''">and RECT_CONC = #{rectConc}</if>
  110. <if test="rectMeas != null and rectMeas != ''">and RECT_MEAS = #{rectMeas}</if>
  111. <if test="rectImgSum != null and rectImgSum != ''">and RECT_IMG_SUM = #{rectImgSum}</if>
  112. <if test="rectImgNum != null and rectImgNum != ''">and RECT_IMG_NUM = #{rectImgNum}</if>
  113. <if test="fdTm != null">and FD_TM = #{fdTm}</if>
  114. <if test="rectLead != null and rectLead != ''">and RECT_LEAD = #{rectLead}</if>
  115. <if test="rectMemb != null and rectMemb != ''">and RECT_MEMB = #{rectMemb}</if>
  116. <if test="rectTm != null">and RECT_TM = #{rectTm}</if>
  117. <if test="note != null and note != ''">and NOTE = #{note}</if>
  118. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  119. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  120. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  121. <if test="inTm != null">and IN_TM = #{inTm}</if>
  122. <if test="upTm != null">and UP_TM = #{upTm}</if>
  123. </trim>
  124. </sql>
  125. <select id="get" resultMap="bisInspFscPblmResultMap" parameterType="String">
  126. select
  127. <include refid="table_columns"/>
  128. from BIS_INSP_FSC_PBLM where ID = #{id}
  129. </select>
  130. <select id="getBy" resultMap="bisInspFscPblmResultMap">
  131. select
  132. <include refid="table_columns"/>
  133. from BIS_INSP_FSC_PBLM
  134. <include refid="page_where"/>
  135. </select>
  136. <select id="findAll" resultMap="bisInspFscPblmResultMap">
  137. select
  138. <include refid="table_columns"/>
  139. from BIS_INSP_FSC_PBLM
  140. </select>
  141. <select id="findList" resultMap="bisInspFscPblmResultMap">
  142. select
  143. <include refid="table_columns"/>
  144. from BIS_INSP_FSC_PBLM
  145. <include refid="page_where"/>
  146. </select>
  147. <select id="findPageList" resultMap="bisInspFscPblmResultMap">
  148. SELECT B.NAME,
  149. B.TYPE,
  150. B.ADM_ORG,
  151. H.BAS_NAME,
  152. G.AD_NAME AS PROVINCE,
  153. F.AD_NAME AS CITY,
  154. E.AD_NAME AS COUNTRY,
  155. D.ID AS GROUP_ID,
  156. D.PNM AS GROUP_NAME,
  157. A.ID,
  158. A.RGSTR_ID,
  159. A.A_UNIT,
  160. A.PBLM_DESC,
  161. A.PBLM_IMG_SUM,
  162. A.PBLM_IMG_NUM,
  163. A.RECT_CONC,
  164. A.RECT_MEAS,
  165. A.RECT_IMG_SUM,
  166. A.RECT_IMG_NUM,
  167. A.FD_TM,
  168. A.RECT_LEAD,
  169. A.RECT_MEMB,
  170. A.RECT_TM,
  171. A.NOTE,
  172. A.DATA_STAT,
  173. A.PERS_ID,
  174. A.IN_TM,
  175. A.UP_TM
  176. FROM BIS_INSP_FSC_PBLM A
  177. LEFT JOIN BIS_INSP_FSC_RGSTR B
  178. ON A.RGSTR_ID = B.ID
  179. LEFT JOIN BIS_INSP_ALL_OBJ C
  180. ON B.OBJ_ID = C.OBJ_ID
  181. LEFT JOIN BIS_INSP_ALL D
  182. ON C.ID = D.ID
  183. LEFT JOIN ATT_AD_X_BASE E
  184. ON B.AD_CODE = E.AD_CODE
  185. AND E.AD_GRAD = '4'
  186. LEFT JOIN ATT_AD_X_BASE F
  187. ON CONCAT(SUBSTR(B.AD_CODE, 1, 4), '00000000') = F.AD_CODE
  188. AND F.AD_GRAD = '3'
  189. LEFT JOIN ATT_AD_X_BASE G
  190. ON CONCAT(SUBSTR(B.AD_CODE, 1, 2), '0000000000') = G.AD_CODE
  191. AND G.AD_GRAD = '2'
  192. LEFT JOIN ATT_BAS_BASE H
  193. ON B.ADM_ORG = H.BAS_CODE
  194. <trim prefix="where" prefixOverrides="and | or ">
  195. 1=1
  196. <if test="rgstrId != null and rgstrId != ''">and A.RGSTR_ID = #{rgstrId}</if>
  197. <if test="aUnit != null and aUnit != ''">and A.A_UNIT LIKE CONCAT('%',CONCAT(#{aUnit},'%'))</if>
  198. <if test="pblmDesc != null and pblmDesc != ''">and A.PBLM_DESC LIKE CONCAT('%',CONCAT(#{pblmDesc},'%'))</if>
  199. <if test="pblmImgSum != null and pblmImgSum != ''">and A.PBLM_IMG_SUM = #{pblmImgSum}</if>
  200. <if test="pblmImgNum != null and pblmImgNum != ''">and A.PBLM_IMG_NUM = #{pblmImgNum}</if>
  201. <if test="rectConc != null and rectConc != ''">and A.RECT_CONC = #{rectConc}</if>
  202. <if test="rectMeas != null and rectMeas != ''">and A.RECT_MEAS LIKE CONCAT('%',CONCAT(#{rectMeas},'%'))</if>
  203. <if test="rectImgSum != null and rectImgSum != ''">and A.RECT_IMG_SUM = #{rectImgSum}</if>
  204. <if test="rectImgNum != null and rectImgNum != ''">and A.RECT_IMG_NUM = #{rectImgNum}</if>
  205. <if test="fdTm != null">and A.FD_TM = #{fdTm}</if>
  206. <if test="rectLead != null and rectLead != ''">and A.RECT_LEAD LIKE CONCAT('%',CONCAT(#{rectLead},'%'))</if>
  207. <if test="rectMemb != null and rectMemb != ''">and A.RECT_MEMB LIKE CONCAT('%',CONCAT(#{rectMemb},'%'))</if>
  208. <if test="rectTm != null">and A.RECT_TM = #{rectTm}</if>
  209. <if test="note != null and note != ''">and A.NOTE = #{note}</if>
  210. <if test="dataStat != null and dataStat != ''">and A.DATA_STAT = #{dataStat}</if>
  211. <if test="groupId != null and groupId != ''">and D.ID = #{groupId}</if>
  212. <if test="orgIds != null and orgIds != ''">and D.ID IN
  213. <foreach item="item" index="index" collection="orgIds.split(',')" open="(" separator="," close=")">
  214. '${item}'
  215. </foreach>
  216. </if>
  217. <if test="adCode != null and adCode != ''">and B.AD_CODE LIKE CONCAT(#{adCode},'%')</if>
  218. <if test="adName != null and adName != ''">and E.AD_FULL_NAME LIKE CONCAT('%',CONCAT(#{adName},'%'))</if>
  219. <if test="startTime != null">
  220. <if test='tmType =="1" or tmType =="" or tmType ==null'>
  221. and A.FD_TM &gt;= #{startTime}
  222. </if>
  223. <if test='tmType =="2"'>
  224. and A.RECT_TM &gt;= #{startTime}
  225. </if>
  226. </if>
  227. <if test="endTime != null">
  228. <if test='tmType =="1" or tmType =="" or tmType ==null'>
  229. and A.FD_TM &lt;= #{endTime}
  230. </if>
  231. <if test='tmType =="2"'>
  232. and A.RECT_TM &lt;= #{endTime}
  233. </if>
  234. </if>
  235. <if test="inTm != null">and A.IN_TM = #{inTm}</if>
  236. <if test="upTm != null">and A.UP_TM = #{upTm}</if>
  237. <if test="persId != null and persId != '' and inIdsSql != null and inIdsSql != '' ">
  238. and D.id in (${inIdsSql})
  239. </if>
  240. <if test="persName != null and persName != ''">
  241. AND J.PERS_NAME LIKE CONCAT('%',CONCAT(#{persName},'%'))
  242. </if>
  243. <if test="name != null and name != ''">and B.NAME LIKE CONCAT('%',CONCAT(#{name},'%'))</if>
  244. <if test="groupName != null and groupName != ''">and D.PNM LIKE CONCAT('%',CONCAT(#{groupName},'%'))</if>
  245. </trim>
  246. </select>
  247. <select id="selectCount" resultType="int">
  248. select count(ID) from BIS_INSP_FSC_PBLM
  249. <include refid="page_where"/>
  250. </select>
  251. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspFscPblm">
  252. insert into BIS_INSP_FSC_PBLM(
  253. <include refid="table_columns"/>
  254. )
  255. values (
  256. <include refid="entity_properties"/>
  257. )
  258. </insert>
  259. <delete id="delete" parameterType="java.lang.String">
  260. delete from BIS_INSP_FSC_PBLM where ID = #{id}
  261. </delete>
  262. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspFscPblm">
  263. delete from BIS_INSP_FSC_PBLM
  264. <include refid="page_where"/>
  265. </delete>
  266. <update id="deleteInFlag" parameterType="java.lang.String">
  267. update BIS_INSP_FSC_PBLM set flag_valid = 0 where ID = #{id}
  268. </update>
  269. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspFscPblm">
  270. update BIS_INSP_FSC_PBLM
  271. <trim prefix="set" suffixOverrides=",">
  272. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
  273. <if test="aUnit != null and aUnit != ''">A_UNIT = #{aUnit},</if>
  274. <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
  275. <if test="pblmImgSum != null and pblmImgSum != ''">PBLM_IMG_SUM = #{pblmImgSum},</if>
  276. <if test="pblmImgNum != null and pblmImgNum != ''">PBLM_IMG_NUM = #{pblmImgNum},</if>
  277. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  278. <if test="rectMeas != null and rectMeas != ''">RECT_MEAS = #{rectMeas},</if>
  279. <if test="rectImgSum != null and rectImgSum != ''">RECT_IMG_SUM = #{rectImgSum},</if>
  280. <if test="rectImgNum != null and rectImgNum != ''">RECT_IMG_NUM = #{rectImgNum},</if>
  281. <if test="fdTm != null">FD_TM = #{fdTm},</if>
  282. <if test="rectLead != null and rectLead != ''">RECT_LEAD = #{rectLead},</if>
  283. <if test="rectMemb != null and rectMemb != ''">RECT_MEMB = #{rectMemb},</if>
  284. <if test="rectTm != null">RECT_TM = #{rectTm},</if>
  285. <if test="note != null and note != ''">NOTE = #{note},</if>
  286. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  287. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  288. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  289. <if test="inTm != null">IN_TM = #{inTm},</if>
  290. <if test="upTm != null">UP_TM = #{upTm},</if>
  291. </trim>
  292. <where>ID = #{id}</where>
  293. </update>
  294. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspFscPblm">
  295. update BIS_INSP_FSC_PBLM
  296. <trim prefix="set" suffixOverrides=",">
  297. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
  298. <if test="aUnit != null and aUnit != ''">A_UNIT = #{aUnit},</if>
  299. <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
  300. <if test="pblmImgSum != null and pblmImgSum != ''">PBLM_IMG_SUM = #{pblmImgSum},</if>
  301. <if test="pblmImgNum != null and pblmImgNum != ''">PBLM_IMG_NUM = #{pblmImgNum},</if>
  302. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  303. <if test="rectMeas != null and rectMeas != ''">RECT_MEAS = #{rectMeas},</if>
  304. <if test="rectImgSum != null and rectImgSum != ''">RECT_IMG_SUM = #{rectImgSum},</if>
  305. <if test="rectImgNum != null and rectImgNum != ''">RECT_IMG_NUM = #{rectImgNum},</if>
  306. <if test="fdTm != null">FD_TM = #{fdTm},</if>
  307. <if test="rectLead != null and rectLead != ''">RECT_LEAD = #{rectLead},</if>
  308. <if test="rectMemb != null and rectMemb != ''">RECT_MEMB = #{rectMemb},</if>
  309. <if test="rectTm != null">RECT_TM = #{rectTm},</if>
  310. <if test="note != null and note != ''">NOTE = #{note},</if>
  311. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  312. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  313. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  314. <if test="inTm != null">IN_TM = #{inTm},</if>
  315. <if test="upTm != null">UP_TM = #{upTm},</if>
  316. </trim>
  317. <include refid="page_where"/>
  318. </update>
  319. <!-- 其他自定义SQL -->
  320. <insert id="insertList" parameterType="java.util.List" useGeneratedKeys="false">
  321. insert into BIS_INSP_FSC_PBLM(
  322. <include refid="table_columns"/>
  323. )
  324. <foreach collection="list" item="item" index="index" open="values " separator=",">
  325. (
  326. <include refid="entity_properties_item"/>
  327. )
  328. </foreach>
  329. </insert>
  330. <select id="findPblmList" parameterType="cn.com.goldenwater.dcproj.param.FileParam"
  331. resultType="cn.com.goldenwater.dcproj.dto.BisInspFscPblmDto">
  332. select x.id as groupObjId,x.name,x.ad_full_name,x.riverName,x.type,x.adm_org org,p.* from (
  333. select * from (
  334. select A.*,b.id as rgstrId,CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS fscState,(case when b.name is
  335. null then cast(c.name as char) else b.name end) as name,b.type,b.IN_TM,b.UP_TM,
  336. c.id as baseId,b.adm_org,
  337. (case when b.location is null then c.location else b.location end) as location,ia.pnm groupName,ria.pnm
  338. riverName,ad.ad_full_name from BIS_INSP_ALL_OBJ A join BIS_INSP_FSC_RGSTR B on A.Obj_Id = B.Obj_Id left join
  339. att_fsc_base c on a.code = c.id
  340. left join ATT_AD_X_BASE ad on b.ad_code = ad.ad_code LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  341. left join BIS_INSP_ALL ria on substr(A.ID,1,6) = ria.id
  342. where 1 = 1
  343. <if test="adName != null and adName != ''">and ad.AD_FULL_NAME LIKE '%${adName}%'</if>
  344. <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
  345. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  346. AND B.IN_TM &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d') AND B.UP_TM &lt; STR_TO_DATE(#{entm},'%Y-%m-%d')
  347. </if>
  348. and
  349. A.id in (${inIdsSql})
  350. ) where 1 = 1
  351. <if test="state != null and state != ''">
  352. and fscState in (${state})
  353. </if>
  354. <if test="name != null and name != ''">
  355. and name like '%${name}%'
  356. </if>
  357. ) x left join BIS_INSP_FSC_PBLM p on x.rgstrId = p.rgstr_id
  358. </select>
  359. </mapper>