02bc66ea783ab4a473df7c7f8e0fccf68b19c801.svn-base 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  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.BisInspWiujsRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspWiujsRgstr" id="bisInspWiujsRgstrResultMap">
  5. <result property="isUnit" column="IS_UNIT"/>
  6. <result property="id" column="ID"/>
  7. <result property="objId" column="OBJ_ID"/>
  8. <result property="persId" column="PERS_ID"/>
  9. <result property="intm" column="INTM"/>
  10. <result property="uptm" column="UPTM"/>
  11. <result property="state" column="STATE"/>
  12. <result property="dataStat" column="DATA_STAT"/>
  13. <result property="wiuId" column="WIU_ID"/>
  14. <result property="wiuName" column="WIU_NAME"/>
  15. <result property="adName" column="AD_NAME"/>
  16. <result property="adCode" column="AD_CODE"/>
  17. <result property="wiuLoc" column="WIU_LOC"/>
  18. <result property="centerX" column="CENTER_X"/>
  19. <result property="centerY" column="CENTER_Y"/>
  20. <result property="gdX" column="GD_X"/>
  21. <result property="gdY" column="GD_Y"/>
  22. <result property="watLicCode" column="WAT_LIC_CODE"/>
  23. <result property="wiuContact" column="WIU_CONTACT"/>
  24. <result property="wiuContactTel" column="WIU_CONTACT_TEL"/>
  25. <result property="apprUnit" column="APPR_UNIT"/>
  26. <result property="apprContact" column="APPR_CONTACT"/>
  27. <result property="apprContactTel" column="APPR_CONTACT_TEL"/>
  28. <result property="wiuCode" column="WIU_CODE"/>
  29. <result property="wintCode" column="WINT_CODE"/>
  30. <result property="name" column="NAME"/>
  31. <result property="wiuNatName" column="WIU_NAT_NAME"/>
  32. <result property="codeVal" column="CODE_VAL"/>
  33. <result property="unitType" column="UNIT_TYPE"/>
  34. <result property="ndstyType" column="NDSTY_TYPE"/>
  35. <result property="rgstrAddr" column="RGSTR_ADDR"/>
  36. <result property="bizAddr" column="BIZ_ADDR"/>
  37. <result property="wtrcrStat" column="WTRCR_STAT"/>
  38. <result property="unitStat" column="UNIT_STAT"/>
  39. <result property="wtruStat" column="WTRU_STAT"/>
  40. <result property="note" column="NOTE"/>
  41. </resultMap>
  42. <sql id="table_columns">
  43. IS_UNIT,
  44. ID,
  45. OBJ_ID,
  46. PERS_ID,
  47. INTM,
  48. UPTM,
  49. STATE,
  50. DATA_STAT,
  51. WIU_ID,
  52. WIU_NAME,
  53. AD_NAME,
  54. AD_CODE,
  55. WIU_LOC,
  56. CENTER_X,
  57. CENTER_Y,
  58. GD_X,
  59. GD_Y,
  60. WAT_LIC_CODE,
  61. WIU_CONTACT,
  62. WIU_CONTACT_TEL,
  63. APPR_UNIT,
  64. APPR_CONTACT,
  65. APPR_CONTACT_TEL,
  66. WIU_CODE,
  67. WINT_CODE,
  68. NAME,
  69. WIU_NAT_NAME,
  70. CODE_VAL,
  71. UNIT_TYPE,
  72. NDSTY_TYPE,
  73. RGSTR_ADDR,
  74. BIZ_ADDR,
  75. WTRCR_STAT,
  76. UNIT_STAT,
  77. WTRU_STAT,
  78. NOTE
  79. </sql>
  80. <sql id="entity_properties">
  81. #{isUnit},
  82. #{id},
  83. #{objId},
  84. #{persId},
  85. #{intm},
  86. #{uptm},
  87. #{state},
  88. #{dataStat},
  89. #{wiuId},
  90. #{wiuName},
  91. #{adName},
  92. #{adCode},
  93. #{wiuLoc},
  94. #{centerX},
  95. #{centerY},
  96. #{gdX},
  97. #{gdY},
  98. #{watLicCode},
  99. #{wiuContact},
  100. #{wiuContactTel},
  101. #{apprUnit},
  102. #{apprContact},
  103. #{apprContactTel},
  104. #{wiuCode},
  105. #{wintCode},
  106. #{name},
  107. #{wiuNatName},
  108. #{codeVal},
  109. #{unitType},
  110. #{ndstyType},
  111. #{rgstrAddr},
  112. #{bizAddr},
  113. #{wtrcrStat},
  114. #{unitStat},
  115. #{wtruStat},
  116. #{note}
  117. </sql>
  118. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  119. <sql id="page_where">
  120. <trim prefix="where" prefixOverrides="and | or ">
  121. <if test="isUnit != null and isUnit != ''">and IS_UNIT = #{isUnit}</if>
  122. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  123. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  124. <if test="intm != null">and INTM = #{intm}</if>
  125. <if test="uptm != null">and UPTM = #{uptm}</if>
  126. <if test="state != null and state != ''">and STATE = #{state}</if>
  127. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  128. <if test="wiuId != null and wiuId != ''">and WIU_ID = #{wiuId}</if>
  129. <if test="wiuName != null and wiuName != ''">and WIU_NAME = #{wiuName}</if>
  130. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  131. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  132. <if test="wiuLoc != null and wiuLoc != ''">and WIU_LOC = #{wiuLoc}</if>
  133. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  134. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  135. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  136. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  137. <if test="watLicCode != null and watLicCode != ''">and WAT_LIC_CODE = #{watLicCode}</if>
  138. <if test="wiuContact != null and wiuContact != ''">and WIU_CONTACT = #{wiuContact}</if>
  139. <if test="wiuContactTel != null and wiuContactTel != ''">and WIU_CONTACT_TEL = #{wiuContactTel}</if>
  140. <if test="apprUnit != null and apprUnit != ''">and APPR_UNIT = #{apprUnit}</if>
  141. <if test="apprContact != null and apprContact != ''">and APPR_CONTACT = #{apprContact}</if>
  142. <if test="apprContactTel != null and apprContactTel != ''">and APPR_CONTACT_TEL = #{apprContactTel}</if>
  143. <if test="wiuCode != null and wiuCode != ''">and WIU_CODE = #{wiuCode}</if>
  144. <if test="wintCode != null and wintCode != ''">and WINT_CODE = #{wintCode}</if>
  145. <if test="name != null and name != ''">and NAME = #{name}</if>
  146. <if test="wiuNatName != null and wiuNatName != ''">and WIU_NAT_NAME = #{wiuNatName}</if>
  147. <if test="codeVal != null and codeVal != ''">and CODE_VAL = #{codeVal}</if>
  148. <if test="unitType != null and unitType != ''">and UNIT_TYPE = #{unitType}</if>
  149. <if test="ndstyType != null and ndstyType != ''">and NDSTY_TYPE = #{ndstyType}</if>
  150. <if test="rgstrAddr != null and rgstrAddr != ''">and RGSTR_ADDR = #{rgstrAddr}</if>
  151. <if test="bizAddr != null and bizAddr != ''">and BIZ_ADDR = #{bizAddr}</if>
  152. <if test="wtrcrStat != null and wtrcrStat != ''">and WTRCR_STAT = #{wtrcrStat}</if>
  153. <if test="unitStat != null and unitStat != ''">and UNIT_STAT = #{unitStat}</if>
  154. <if test="wtruStat != null and wtruStat != ''">and WTRU_STAT = #{wtruStat}</if>
  155. <if test="note != null and note != ''">and NOTE = #{note}</if>
  156. and DATA_STAT='0'
  157. </trim>
  158. </sql>
  159. <select id="get" resultMap="bisInspWiujsRgstrResultMap" parameterType="String">
  160. select
  161. <include refid="table_columns"/>
  162. from BIS_INSP_WIUJS_RGSTR where ID = #{id}
  163. </select>
  164. <select id="getBy" resultMap="bisInspWiujsRgstrResultMap">
  165. select
  166. <include refid="table_columns"/>
  167. from BIS_INSP_WIUJS_RGSTR
  168. <include refid="page_where"/>
  169. </select>
  170. <select id="findAll" resultMap="bisInspWiujsRgstrResultMap">
  171. select
  172. <include refid="table_columns"/>
  173. from BIS_INSP_WIUJS_RGSTR
  174. </select>
  175. <select id="findList" resultMap="bisInspWiujsRgstrResultMap">
  176. select
  177. <include refid="table_columns"/>
  178. from BIS_INSP_WIUJS_RGSTR
  179. <include refid="page_where"/>
  180. </select>
  181. <select id="selectCount" resultType="int">
  182. select count(ID) from BIS_INSP_WIUJS_RGSTR
  183. <include refid="page_where"/>
  184. </select>
  185. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspWiujsRgstr">
  186. insert into BIS_INSP_WIUJS_RGSTR(
  187. <include refid="table_columns"/>
  188. )
  189. values (
  190. <include refid="entity_properties"/>
  191. )
  192. </insert>
  193. <delete id="delete" parameterType="java.lang.String">
  194. update BIS_INSP_WIUJS_RGSTR set DATA_STAT='9' where ID = #{id}
  195. </delete>
  196. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWiujsRgstr">
  197. update BIS_INSP_WIUJS_RGSTR set DATA_STAT='9'
  198. <include refid="page_where"/>
  199. </delete>
  200. <update id="deleteInFlag" parameterType="java.lang.String">
  201. update BIS_INSP_WIUJS_RGSTR set DATA_STAT = '9' where ID = #{id}
  202. </update>
  203. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspWiujsRgstr">
  204. update BIS_INSP_WIUJS_RGSTR
  205. <trim prefix="set" suffixOverrides=",">
  206. <if test="isUnit != null and isUnit != ''">IS_UNIT = #{isUnit},</if>
  207. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  208. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  209. <if test="intm != null">INTM = #{intm},</if>
  210. <if test="uptm != null">UPTM = #{uptm},</if>
  211. <if test="state != null and state != ''">STATE = #{state},</if>
  212. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  213. <if test="wiuId != null and wiuId != ''">WIU_ID = #{wiuId},</if>
  214. <if test="wiuName != null and wiuName != ''">WIU_NAME = #{wiuName},</if>
  215. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  216. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  217. <if test="wiuLoc != null and wiuLoc != ''">WIU_LOC = #{wiuLoc},</if>
  218. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  219. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  220. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  221. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  222. <if test="watLicCode != null and watLicCode != ''">WAT_LIC_CODE = #{watLicCode},</if>
  223. <if test="wiuContact != null and wiuContact != ''">WIU_CONTACT = #{wiuContact},</if>
  224. <if test="wiuContactTel != null and wiuContactTel != ''">WIU_CONTACT_TEL = #{wiuContactTel},</if>
  225. <if test="apprUnit != null and apprUnit != ''">APPR_UNIT = #{apprUnit},</if>
  226. <if test="apprContact != null and apprContact != ''">APPR_CONTACT = #{apprContact},</if>
  227. <if test="apprContactTel != null and apprContactTel != ''">APPR_CONTACT_TEL = #{apprContactTel},</if>
  228. <if test="wiuCode != null and wiuCode != ''">WIU_CODE = #{wiuCode},</if>
  229. <if test="wintCode != null and wintCode != ''">WINT_CODE = #{wintCode},</if>
  230. <if test="name != null and name != ''">NAME = #{name},</if>
  231. <if test="wiuNatName != null and wiuNatName != ''">WIU_NAT_NAME = #{wiuNatName},</if>
  232. <if test="codeVal != null and codeVal != ''">CODE_VAL = #{codeVal},</if>
  233. <if test="unitType != null and unitType != ''">UNIT_TYPE = #{unitType},</if>
  234. <if test="ndstyType != null and ndstyType != ''">NDSTY_TYPE = #{ndstyType},</if>
  235. <if test="rgstrAddr != null and rgstrAddr != ''">RGSTR_ADDR = #{rgstrAddr},</if>
  236. <if test="bizAddr != null and bizAddr != ''">BIZ_ADDR = #{bizAddr},</if>
  237. <if test="wtrcrStat != null and wtrcrStat != ''">WTRCR_STAT = #{wtrcrStat},</if>
  238. <if test="unitStat != null and unitStat != ''">UNIT_STAT = #{unitStat},</if>
  239. <if test="wtruStat != null and wtruStat != ''">WTRU_STAT = #{wtruStat},</if>
  240. <if test="note != null and note != ''">NOTE = #{note},</if>
  241. </trim>
  242. <where>ID = #{id}</where>
  243. </update>
  244. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWiujsRgstr">
  245. update BIS_INSP_WIUJS_RGSTR
  246. <trim prefix="set" suffixOverrides=",">
  247. <if test="isUnit != null and isUnit != ''">IS_UNIT = #{isUnit},</if>
  248. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  249. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  250. <if test="intm != null">INTM = #{intm},</if>
  251. <if test="uptm != null">UPTM = #{uptm},</if>
  252. <if test="state != null and state != ''">STATE = #{state},</if>
  253. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  254. <if test="wiuId != null and wiuId != ''">WIU_ID = #{wiuId},</if>
  255. <if test="wiuName != null and wiuName != ''">WIU_NAME = #{wiuName},</if>
  256. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  257. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  258. <if test="wiuLoc != null and wiuLoc != ''">WIU_LOC = #{wiuLoc},</if>
  259. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  260. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  261. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  262. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  263. <if test="watLicCode != null and watLicCode != ''">WAT_LIC_CODE = #{watLicCode},</if>
  264. <if test="wiuContact != null and wiuContact != ''">WIU_CONTACT = #{wiuContact},</if>
  265. <if test="wiuContactTel != null and wiuContactTel != ''">WIU_CONTACT_TEL = #{wiuContactTel},</if>
  266. <if test="apprUnit != null and apprUnit != ''">APPR_UNIT = #{apprUnit},</if>
  267. <if test="apprContact != null and apprContact != ''">APPR_CONTACT = #{apprContact},</if>
  268. <if test="apprContactTel != null and apprContactTel != ''">APPR_CONTACT_TEL = #{apprContactTel},</if>
  269. <if test="wiuCode != null and wiuCode != ''">WIU_CODE = #{wiuCode},</if>
  270. <if test="wintCode != null and wintCode != ''">WINT_CODE = #{wintCode},</if>
  271. <if test="name != null and name != ''">NAME = #{name},</if>
  272. <if test="wiuNatName != null and wiuNatName != ''">WIU_NAT_NAME = #{wiuNatName},</if>
  273. <if test="codeVal != null and codeVal != ''">CODE_VAL = #{codeVal},</if>
  274. <if test="unitType != null and unitType != ''">UNIT_TYPE = #{unitType},</if>
  275. <if test="ndstyType != null and ndstyType != ''">NDSTY_TYPE = #{ndstyType},</if>
  276. <if test="rgstrAddr != null and rgstrAddr != ''">RGSTR_ADDR = #{rgstrAddr},</if>
  277. <if test="bizAddr != null and bizAddr != ''">BIZ_ADDR = #{bizAddr},</if>
  278. <if test="wtrcrStat != null and wtrcrStat != ''">WTRCR_STAT = #{wtrcrStat},</if>
  279. <if test="unitStat != null and unitStat != ''">UNIT_STAT = #{unitStat},</if>
  280. <if test="wtruStat != null and wtruStat != ''">WTRU_STAT = #{wtruStat},</if>
  281. <if test="note != null and note != ''">NOTE = #{note},</if>
  282. </trim>
  283. <include refid="page_where"/>
  284. </update>
  285. <!-- 其他自定义SQL -->
  286. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspWiujsRgstrDto">
  287. SELECT * FROM (
  288. select
  289. A.CODE, A.ID nodeId, A.NM, A.ptype, ia.pnm groupName,
  290. B.id as rgstrId, AW.AD_FULL_NAME,
  291. B.IS_UNIT,
  292. B.ID,
  293. B.OBJ_ID,
  294. B.PERS_ID,
  295. B.INTM,
  296. B.UPTM,
  297. B.STATE,
  298. B.DATA_STAT,
  299. B.WIU_ID,
  300. B.WIU_NAME,
  301. B.AD_NAME,
  302. B.AD_CODE,
  303. B.WIU_LOC,
  304. B.CENTER_X,
  305. B.CENTER_Y,
  306. B.GD_X,
  307. B.GD_Y,
  308. B.WAT_LIC_CODE,
  309. B.WIU_CONTACT,
  310. B.WIU_CONTACT_TEL,
  311. B.APPR_UNIT,
  312. B.APPR_CONTACT,
  313. B.APPR_CONTACT_TEL,
  314. B.WIU_CODE,
  315. B.WINT_CODE,
  316. B.NAME,
  317. B.WIU_NAT_NAME,
  318. B.CODE_VAL,
  319. B.UNIT_TYPE,
  320. B.NDSTY_TYPE,
  321. B.RGSTR_ADDR,
  322. B.BIZ_ADDR,
  323. B.WTRCR_STAT,
  324. B.UNIT_STAT,
  325. B.WTRU_STAT,
  326. B.NOTE
  327. FROM BIS_INSP_ALL_OBJ A
  328. JOIN BIS_INSP_WIUJS_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  329. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  330. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  331. where A.ptype = #{pType}
  332. and B.DATA_STAT= '0'
  333. <if test="adCodes ==null or adCodes ==''">
  334. <choose>
  335. <when test='isAll =="1"'>
  336. </when>
  337. <otherwise>
  338. and
  339. A.Id in (
  340. select distinct id from (
  341. SELECT P.id FROM BIS_INSP_ALL P START WITH P.PID IN (SELECT id FROM BIS_INSP_ALL_RLATION A
  342. WHERE A.PERSID = #{presId} and TYPE = #{pType} and length(id) in (3,6,9))
  343. CONNECT BY P.PID = PRIOR P.ID
  344. union all
  345. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  346. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  347. )
  348. )
  349. </otherwise>
  350. </choose>
  351. </if>
  352. <if test="adCodes !=null and adCodes !=''">
  353. and
  354. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  355. b.ad_code like concat('${item}','%')
  356. </foreach>
  357. </if>
  358. ) A
  359. <where>
  360. <if test="id !=null and id !=''">and nodeId like '${id}%'</if>
  361. <if test="plnaId !=null and plnaId !=''">and nodeId like '${plnaId}%'</if>
  362. <if test="groupId != null and groupId != ''">and nodeId like '${groupId}%'</if>
  363. <if test="code !=null and code !=''">and code = #{code}</if>
  364. <if test="nm !=null and nm !=''">and nm like '%${nm}%'</if>
  365. <if test="rsName !=null and rsName !=''">and nm like '%${rsName}%'</if>
  366. <if test="state !=null and state !=''">and STATE in (${state})</if>
  367. <if test="adName != null and adName != ''">and AD_NAME like '%${adName}%'</if>
  368. <if test="sttm != null and sttm != ''">and INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  369. <if test="entm != null and entm != ''">and INTM &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  370. </where>
  371. order by nodeId asc
  372. <if test="orderBy != null and orderBy != ''">
  373. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  374. </if>
  375. </select>
  376. </mapper>