BisInspWtprjRegisterDao.xml 13 KB

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