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