BisInspDpgmRgstrDao.xml 15 KB

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