64ccbe84a8f2c28fe5c73b3ccddaa6b62b93fb49.svn-base 16 KB

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