8a62c266cca940d116e412e6a0fab7ccebbbf74b.svn-base 15 KB

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