BisInspRdwpgdRgstrDao.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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.BisInspRdwpgdRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspRdwpgdRgstr" id="bisInspRdwpgdRgstrResultMap">
  5. <result property="state" column="STATE"/>
  6. <result property="prjUnitNature" column="PRJ_UNIT_NATURE"/>
  7. <result property="waterUnitLeaderName" column="WATER_UNIT_LEADER_NAME"/>
  8. <result property="waterUnitLeaderPhone" column="WATER_UNIT_LEADER_PHONE"/>
  9. <result property="maintainPhone" column="MAINTAIN_PHONE"/>
  10. <result property="intm" column="INTM"/>
  11. <result property="uptm" column="UPTM"/>
  12. <result property="dataStat" column="DATA_STAT"/>
  13. <result property="id" column="ID"/>
  14. <result property="objId" column="OBJ_ID"/>
  15. <result property="prjName" column="PRJ_NAME"/>
  16. <result property="prjType" column="PRJ_TYPE"/>
  17. <result property="adCode" column="AD_CODE"/>
  18. <result property="adName" column="AD_NAME"/>
  19. <result property="siteOfPrj" column="SITE_OF_PRJ"/>
  20. <result property="waterScale" column="WATER_SCALE"/>
  21. <result property="waterYield" column="WATER_YIELD"/>
  22. <result property="desWsp" column="DES_WSP"/>
  23. <result property="actWsp" column="ACT_WSP"/>
  24. <result property="wtType" column="WT_TYPE"/>
  25. <result property="wtName" column="WT_NAME"/>
  26. <result property="purificationWay" column="PURIFICATION_WAY"/>
  27. <result property="disinfectionWay" column="DISINFECTION_WAY"/>
  28. <result property="prjUnitName" column="PRJ_UNIT_NAME"/>
  29. <result property="waterUnitPhone" column="WATER_UNIT_PHONE"/>
  30. <result property="centerX" column="CENTER_X"/>
  31. <result property="centerY" column="CENTER_Y"/>
  32. <result property="gdX" column="GD_X"/>
  33. <result property="gdY" column="GD_Y"/>
  34. </resultMap>
  35. <sql id="table_columns">
  36. STATE,
  37. PRJ_UNIT_NATURE,
  38. WATER_UNIT_LEADER_NAME,
  39. WATER_UNIT_LEADER_PHONE,
  40. MAINTAIN_PHONE,
  41. INTM,
  42. UPTM,
  43. DATA_STAT,
  44. ID,
  45. OBJ_ID,
  46. PRJ_NAME,
  47. PRJ_TYPE,
  48. AD_CODE,
  49. AD_NAME,
  50. SITE_OF_PRJ,
  51. WATER_SCALE,
  52. WATER_YIELD,
  53. DES_WSP,
  54. ACT_WSP,
  55. WT_TYPE,
  56. WT_NAME,
  57. PURIFICATION_WAY,
  58. DISINFECTION_WAY,
  59. PRJ_UNIT_NAME,
  60. WATER_UNIT_PHONE,
  61. CENTER_X,
  62. CENTER_Y,
  63. GD_X,
  64. GD_Y
  65. </sql>
  66. <sql id="entity_properties">
  67. #{state},
  68. #{prjUnitNature},
  69. #{waterUnitLeaderName},
  70. #{waterUnitLeaderPhone},
  71. #{maintainPhone},
  72. #{intm},
  73. #{uptm},
  74. #{dataStat},
  75. #{id},
  76. #{objId},
  77. #{prjName},
  78. #{prjType},
  79. #{adCode},
  80. #{adName},
  81. #{siteOfPrj},
  82. #{waterScale},
  83. #{waterYield},
  84. #{desWsp},
  85. #{actWsp},
  86. #{wtType},
  87. #{wtName},
  88. #{purificationWay},
  89. #{disinfectionWay},
  90. #{prjUnitName},
  91. #{waterUnitPhone},
  92. #{centerX},
  93. #{centerY},
  94. #{gdX},
  95. #{gdY}
  96. </sql>
  97. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  98. <sql id="page_where">
  99. <trim prefix="where" prefixOverrides="and | or ">
  100. <if test="prjUnitNature != null and prjUnitNature != ''">and PRJ_UNIT_NATURE = #{prjUnitNature}</if>
  101. <if test="waterUnitLeaderName != null and waterUnitLeaderName != ''">and WATER_UNIT_LEADER_NAME = #{waterUnitLeaderName}</if>
  102. <if test="waterUnitLeaderPhone != null and waterUnitLeaderPhone != ''">and WATER_UNIT_LEADER_PHONE = #{waterUnitLeaderPhone}</if>
  103. <if test="maintainPhone != null and maintainPhone != ''">and MAINTAIN_PHONE = #{maintainPhone}</if>
  104. <if test="intm != null">and INTM = #{intm}</if>
  105. <if test="uptm != null">and UPTM = #{uptm}</if>
  106. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  107. <if test="id != null and id != ''">and ID = #{id}</if>
  108. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  109. <if test="prjName != null and prjName != ''">and PRJ_NAME = #{prjName}</if>
  110. <if test="prjType != null and prjType != ''">and PRJ_TYPE = #{prjType}</if>
  111. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  112. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  113. <if test="siteOfPrj != null and siteOfPrj != ''">and SITE_OF_PRJ = #{siteOfPrj}</if>
  114. <if test="waterScale != null and waterScale != ''">and WATER_SCALE = #{waterScale}</if>
  115. <if test="waterYield != null and waterYield != ''">and WATER_YIELD = #{waterYield}</if>
  116. <if test="desWsp != null and desWsp != ''">and DES_WSP = #{desWsp}</if>
  117. <if test="actWsp != null and actWsp != ''">and ACT_WSP = #{actWsp}</if>
  118. <if test="wtType != null and wtType != ''">and WT_TYPE = #{wtType}</if>
  119. <if test="wtName != null and wtName != ''">and WT_NAME = #{wtName}</if>
  120. <if test="purificationWay != null and purificationWay != ''">and PURIFICATION_WAY = #{purificationWay}</if>
  121. <if test="disinfectionWay != null and disinfectionWay != ''">and DISINFECTION_WAY = #{disinfectionWay}</if>
  122. <if test="prjUnitName != null and prjUnitName != ''">and PRJ_UNIT_NAME = #{prjUnitName}</if>
  123. <if test="waterUnitPhone != null and waterUnitPhone != ''">and WATER_UNIT_PHONE = #{waterUnitPhone}</if>
  124. <if test="state != null and state != ''">and STATE = #{state}</if>
  125. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  126. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  127. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  128. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  129. and DATA_STAT='0'
  130. </trim>
  131. </sql>
  132. <select id="get" resultMap="bisInspRdwpgdRgstrResultMap" parameterType="String" >
  133. select <include refid="table_columns" /> from BIS_INSP_RDWPGD_RGSTR where ID = #{id}
  134. </select>
  135. <select id="getBy" resultMap="bisInspRdwpgdRgstrResultMap">
  136. select <include refid="table_columns" /> from BIS_INSP_RDWPGD_RGSTR <include refid="page_where" />
  137. </select>
  138. <select id="findAll" resultMap="bisInspRdwpgdRgstrResultMap">
  139. select <include refid="table_columns" /> from BIS_INSP_RDWPGD_RGSTR
  140. </select>
  141. <select id="findList" resultMap="bisInspRdwpgdRgstrResultMap">
  142. select <include refid="table_columns" /> from BIS_INSP_RDWPGD_RGSTR <include refid="page_where" />
  143. </select>
  144. <select id="selectCount" resultType="int" >
  145. select count(ID) from BIS_INSP_RDWPGD_RGSTR <include refid="page_where" />
  146. </select>
  147. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspRdwpgdRgstr">
  148. insert into BIS_INSP_RDWPGD_RGSTR( <include refid="table_columns" /> )
  149. values ( <include refid="entity_properties" /> )
  150. </insert>
  151. <delete id="delete" parameterType="java.lang.String">
  152. update BIS_INSP_RDWPGD_RGSTR set DATA_STAT='9' where ID = #{id}
  153. </delete>
  154. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRdwpgdRgstr">
  155. update BIS_INSP_RDWPGD_RGSTR set DATA_STAT='9' <include refid="page_where" />
  156. </delete>
  157. <update id="deleteInFlag" parameterType="java.lang.String">
  158. update BIS_INSP_RDWPGD_RGSTR set DATA_STAT = '9' where ID = #{id}
  159. </update>
  160. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspRdwpgdRgstr">
  161. update BIS_INSP_RDWPGD_RGSTR
  162. <trim prefix="set" suffixOverrides=",">
  163. <if test="prjUnitNature != null and prjUnitNature != ''">PRJ_UNIT_NATURE = #{prjUnitNature},</if>
  164. <if test="waterUnitLeaderName != null and waterUnitLeaderName != ''">WATER_UNIT_LEADER_NAME = #{waterUnitLeaderName},</if>
  165. <if test="waterUnitLeaderPhone != null and waterUnitLeaderPhone != ''">WATER_UNIT_LEADER_PHONE = #{waterUnitLeaderPhone},</if>
  166. <if test="maintainPhone != null and maintainPhone != ''">MAINTAIN_PHONE = #{maintainPhone},</if>
  167. <if test="intm != null">INTM = #{intm},</if>
  168. <if test="uptm != null">UPTM = #{uptm},</if>
  169. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  170. <if test="id != null and id != ''">ID = #{id},</if>
  171. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  172. <if test="prjName != null and prjName != ''">PRJ_NAME = #{prjName},</if>
  173. <if test="prjType != null and prjType != ''">PRJ_TYPE = #{prjType},</if>
  174. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  175. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  176. <if test="siteOfPrj != null and siteOfPrj != ''">SITE_OF_PRJ = #{siteOfPrj},</if>
  177. <if test="waterScale != null and waterScale != ''">WATER_SCALE = #{waterScale},</if>
  178. <if test="waterYield != null and waterYield != ''">WATER_YIELD = #{waterYield},</if>
  179. <if test="desWsp != null and desWsp != ''">DES_WSP = #{desWsp},</if>
  180. <if test="actWsp != null and actWsp != ''">ACT_WSP = #{actWsp},</if>
  181. <if test="wtType != null and wtType != ''">WT_TYPE = #{wtType},</if>
  182. <if test="wtName != null and wtName != ''">WT_NAME = #{wtName},</if>
  183. <if test="purificationWay != null and purificationWay != ''">PURIFICATION_WAY = #{purificationWay},</if>
  184. <if test="disinfectionWay != null and disinfectionWay != ''">DISINFECTION_WAY = #{disinfectionWay},</if>
  185. <if test="prjUnitName != null and prjUnitName != ''">PRJ_UNIT_NAME = #{prjUnitName},</if>
  186. <if test="waterUnitPhone != null and waterUnitPhone != ''">WATER_UNIT_PHONE = #{waterUnitPhone},</if>
  187. <if test="state != null and state != ''">STATE = #{state},</if>
  188. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  189. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  190. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  191. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  192. </trim>
  193. <where>ID = #{id}</where>
  194. </update>
  195. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRdwpgdRgstr">
  196. update BIS_INSP_RDWPGD_RGSTR
  197. <trim prefix="set" suffixOverrides=",">
  198. <if test="prjUnitNature != null and prjUnitNature != ''">PRJ_UNIT_NATURE = #{prjUnitNature},</if>
  199. <if test="waterUnitLeaderName != null and waterUnitLeaderName != ''">WATER_UNIT_LEADER_NAME = #{waterUnitLeaderName},</if>
  200. <if test="waterUnitLeaderPhone != null and waterUnitLeaderPhone != ''">WATER_UNIT_LEADER_PHONE = #{waterUnitLeaderPhone},</if>
  201. <if test="maintainPhone != null and maintainPhone != ''">MAINTAIN_PHONE = #{maintainPhone},</if>
  202. <if test="intm != null">INTM = #{intm},</if>
  203. <if test="uptm != null">UPTM = #{uptm},</if>
  204. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  205. <if test="id != null and id != ''">ID = #{id},</if>
  206. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  207. <if test="prjName != null and prjName != ''">PRJ_NAME = #{prjName},</if>
  208. <if test="prjType != null and prjType != ''">PRJ_TYPE = #{prjType},</if>
  209. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  210. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  211. <if test="siteOfPrj != null and siteOfPrj != ''">SITE_OF_PRJ = #{siteOfPrj},</if>
  212. <if test="waterScale != null and waterScale != ''">WATER_SCALE = #{waterScale},</if>
  213. <if test="waterYield != null and waterYield != ''">WATER_YIELD = #{waterYield},</if>
  214. <if test="desWsp != null and desWsp != ''">DES_WSP = #{desWsp},</if>
  215. <if test="actWsp != null and actWsp != ''">ACT_WSP = #{actWsp},</if>
  216. <if test="wtType != null and wtType != ''">WT_TYPE = #{wtType},</if>
  217. <if test="wtName != null and wtName != ''">WT_NAME = #{wtName},</if>
  218. <if test="purificationWay != null and purificationWay != ''">PURIFICATION_WAY = #{purificationWay},</if>
  219. <if test="disinfectionWay != null and disinfectionWay != ''">DISINFECTION_WAY = #{disinfectionWay},</if>
  220. <if test="prjUnitName != null and prjUnitName != ''">PRJ_UNIT_NAME = #{prjUnitName},</if>
  221. <if test="waterUnitPhone != null and waterUnitPhone != ''">WATER_UNIT_PHONE = #{waterUnitPhone},</if>
  222. <if test="state != null and state != ''">STATE = #{state},</if>
  223. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  224. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  225. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  226. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  227. </trim>
  228. <include refid="page_where" />
  229. </update>
  230. <!-- 其他自定义SQL -->
  231. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspRdwpgdRgstrDto">
  232. SELECT * FROM (
  233. SELECT A.CODE AS CODE,
  234. B.PRJ_NAME AS NM,
  235. A.PTYPE AS PTYPE,
  236. A.ID AS nodeId,
  237. IA.PNM AS groupName,
  238. B.ID AS rgstrId,
  239. (CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END) AS STATE,
  240. B.PRJ_UNIT_NATURE,
  241. B.WATER_UNIT_LEADER_NAME,
  242. B.WATER_UNIT_LEADER_PHONE,
  243. B.MAINTAIN_PHONE,
  244. B.INTM,
  245. B.UPTM,
  246. B.DATA_STAT,
  247. B.ID,
  248. B.OBJ_ID,
  249. B.PRJ_NAME,
  250. B.PRJ_TYPE,
  251. B.AD_CODE,
  252. B.AD_NAME,
  253. B.SITE_OF_PRJ,
  254. B.WATER_SCALE,
  255. B.WATER_YIELD,
  256. B.DES_WSP,
  257. B.ACT_WSP,
  258. B.WT_TYPE,
  259. B.WT_NAME,
  260. B.PURIFICATION_WAY,
  261. B.DISINFECTION_WAY,
  262. B.PRJ_UNIT_NAME,
  263. B.WATER_UNIT_PHONE,
  264. B.CENTER_X,
  265. B.CENTER_Y,
  266. B.GD_X,
  267. B.GD_Y
  268. FROM BIS_INSP_ALL_OBJ A
  269. JOIN BIS_INSP_RDWPGD_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  270. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  271. <where>
  272. <if test="adCodes ==null or adCodes ==''">
  273. <choose>
  274. <when test='isAll =="1"'>
  275. </when>
  276. <otherwise>
  277. <if test="groupIds != null and groupIds.length &gt; 0">
  278. <foreach collection="groupIds" index="index" item="gId" separator=" OR " open="and ("
  279. close=")">
  280. A.ID LIKE '${gId}%'
  281. </foreach>
  282. </if>
  283. </otherwise>
  284. </choose>
  285. </if>
  286. <if test="adCodes !=null and adCodes !=''">
  287. and
  288. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  289. B.AD_CODE LIKE CONCAT('${item}','%')
  290. </foreach>
  291. </if>
  292. </where>
  293. ) A
  294. <where>
  295. <if test="id !=null and id !=''">and nodeId like '${id}%'</if>
  296. <if test="plnaId !=null and plnaId !=''">and nodeId like '${plnaId}%'</if>
  297. <if test="groupId != null and groupId != ''">and nodeId like '${groupId}%'</if>
  298. <if test="code !=null and code !=''">and code = #{code}</if>
  299. <if test="nm !=null and nm !=''">and nm like '%${nm}%'</if>
  300. <if test="rsName !=null and rsName !=''">and nm like '%${rsName}%'</if>
  301. <if test="engScal != null and engScal != ''">and eng_scal in (${engScal})</if>
  302. <if test="state !=null and state !=''">and STATE in (${state})</if>
  303. <if test="adName != null and adName != ''">and AD_NAME like '%${adName}%'</if>
  304. <if test="sttm != null and sttm != ''">and Intm &gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  305. <if test="entm != null and entm != ''">and Intm &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  306. </where>
  307. order by nodeId asc
  308. <if test="orderBy != null and orderBy != ''">
  309. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  310. </if>
  311. </select>
  312. </mapper>