BisInspWrmRgstrDao.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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.BisInspWrmRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspWrmRgstr" id="bisInspWrmRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="adCode" column="AD_CODE"/>
  8. <result property="adName" column="AD_NAME"/>
  9. <result property="adFullName" column="AD_FULL_NAME"/>
  10. <result property="loc" column="LOC"/>
  11. <result property="centerX" column="CENTER_X"/>
  12. <result property="centerY" column="CENTER_Y"/>
  13. <result property="gdX" column="GD_X"/>
  14. <result property="gdY" column="GD_Y"/>
  15. <result property="bChkUnit" column="B_CHK_UNIT"/>
  16. <result property="contact" column="CONTACT"/>
  17. <result property="contactTel" column="CONTACT_TEL"/>
  18. <result property="principal" column="PRINCIPAL"/>
  19. <result property="principalTel" column="PRINCIPAL_TEL"/>
  20. <result property="note" column="NOTE"/>
  21. <result property="chkUnit" column="CHK_UNIT"/>
  22. <result property="chkPers" column="CHK_PERS"/>
  23. <result property="chkTm" column="CHK_TM"/>
  24. <result property="intInfoStat" column="INT_INFO_STAT"/>
  25. <result property="wintStat" column="WINT_STAT"/>
  26. <result property="persId" column="PERS_ID"/>
  27. <result property="groupId" column="GROUP_ID"/>
  28. <result property="intm" column="INTM"/>
  29. <result property="uptm" column="UPTM"/>
  30. <result property="state" column="STATE"/>
  31. </resultMap>
  32. <sql id="table_columns">
  33. ID,
  34. OBJ_ID,
  35. AD_CODE,
  36. AD_NAME,
  37. AD_FULL_NAME,
  38. LOC,
  39. CENTER_X,
  40. CENTER_Y,
  41. GD_X,
  42. GD_Y,
  43. B_CHK_UNIT,
  44. CONTACT,
  45. CONTACT_TEL,
  46. PRINCIPAL,
  47. PRINCIPAL_TEL,
  48. NOTE,
  49. CHK_UNIT,
  50. CHK_PERS,
  51. CHK_TM,
  52. INT_INFO_STAT,
  53. WINT_STAT,
  54. PERS_ID,
  55. GROUP_ID,
  56. INTM,
  57. UPTM,
  58. STATE
  59. </sql>
  60. <sql id="entity_properties">
  61. #{id},
  62. #{objId},
  63. #{adCode},
  64. #{adName},
  65. #{adFullName},
  66. #{loc},
  67. #{centerX},
  68. #{centerY},
  69. #{gdX},
  70. #{gdY},
  71. #{bChkUnit},
  72. #{contact},
  73. #{contactTel},
  74. #{principal},
  75. #{principalTel},
  76. #{note},
  77. #{chkUnit},
  78. #{chkPers},
  79. #{chkTm},
  80. #{intInfoStat},
  81. #{wintStat},
  82. #{persId},
  83. #{groupId},
  84. #{intm},
  85. #{uptm},
  86. #{state}
  87. </sql>
  88. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  89. <sql id="page_where">
  90. <trim prefix="where" prefixOverrides="and | or ">
  91. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  92. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  93. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  94. <if test="adFullName != null and adFullName != ''">and AD_FULL_NAME = #{adFullName}</if>
  95. <if test="loc != null and loc != ''">and LOC = #{loc}</if>
  96. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  97. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  98. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  99. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  100. <if test="bChkUnit != null and bChkUnit != ''">and B_CHK_UNIT = #{bChkUnit}</if>
  101. <if test="contact != null and contact != ''">and CONTACT = #{contact}</if>
  102. <if test="contactTel != null and contactTel != ''">and CONTACT_TEL = #{contactTel}</if>
  103. <if test="principal != null and principal != ''">and PRINCIPAL = #{principal}</if>
  104. <if test="principalTel != null and principalTel != ''">and PRINCIPAL_TEL = #{principalTel}</if>
  105. <if test="note != null and note != ''">and NOTE = #{note}</if>
  106. <if test="chkUnit != null and chkUnit != ''">and CHK_UNIT = #{chkUnit}</if>
  107. <if test="chkPers != null and chkPers != ''">and CHK_PERS = #{chkPers}</if>
  108. <if test="chkTm != null">and CHK_TM = #{chkTm}</if>
  109. <if test="intInfoStat != null and intInfoStat != ''">and INT_INFO_STAT = #{intInfoStat}</if>
  110. <if test="wintStat != null and wintStat != ''">and WINT_STAT = #{wintStat}</if>
  111. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  112. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  113. <if test="intm != null">and INTM = #{intm}</if>
  114. <if test="uptm != null">and UPTM = #{uptm}</if>
  115. <if test="state != null and state != ''">and STATE = #{state}</if>
  116. </trim>
  117. </sql>
  118. <select id="get" resultMap="bisInspWrmRgstrResultMap" parameterType="String">
  119. select
  120. <include refid="table_columns"/>
  121. from BIS_INSP_WRM_RGSTR where ID = #{id}
  122. </select>
  123. <select id="getBy" resultMap="bisInspWrmRgstrResultMap">
  124. select
  125. <include refid="table_columns"/>
  126. from BIS_INSP_WRM_RGSTR
  127. <include refid="page_where"/>
  128. </select>
  129. <select id="findAll" resultMap="bisInspWrmRgstrResultMap">
  130. select
  131. <include refid="table_columns"/>
  132. from BIS_INSP_WRM_RGSTR
  133. </select>
  134. <select id="findList" resultMap="bisInspWrmRgstrResultMap">
  135. select
  136. <include refid="table_columns"/>
  137. from BIS_INSP_WRM_RGSTR
  138. <include refid="page_where"/>
  139. </select>
  140. <select id="selectCount" resultType="int">
  141. select count(ID) from BIS_INSP_WRM_RGSTR
  142. <include refid="page_where"/>
  143. </select>
  144. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspWrmRgstr">
  145. insert into BIS_INSP_WRM_RGSTR(
  146. <include refid="table_columns"/>
  147. )
  148. values (
  149. <include refid="entity_properties"/>
  150. )
  151. </insert>
  152. <delete id="delete" parameterType="java.lang.String">
  153. delete from BIS_INSP_WRM_RGSTR where ID = #{id}
  154. </delete>
  155. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWrmRgstr">
  156. delete from BIS_INSP_WRM_RGSTR
  157. <include refid="page_where"/>
  158. </delete>
  159. <update id="deleteInFlag" parameterType="java.lang.String">
  160. update BIS_INSP_WRM_RGSTR set flag_valid = 0 where>ID = #{id}
  161. </update>
  162. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspWrmRgstr">
  163. update BIS_INSP_WRM_RGSTR
  164. <trim prefix="set" suffixOverrides=",">
  165. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  166. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  167. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  168. <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
  169. <if test="loc != null and loc != ''">LOC = #{loc},</if>
  170. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  171. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  172. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  173. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  174. <if test="bChkUnit != null and bChkUnit != ''">B_CHK_UNIT = #{bChkUnit},</if>
  175. <if test="contact != null and contact != ''">CONTACT = #{contact},</if>
  176. <if test="contactTel != null and contactTel != ''">CONTACT_TEL = #{contactTel},</if>
  177. <if test="principal != null and principal != ''">PRINCIPAL = #{principal},</if>
  178. <if test="principalTel != null and principalTel != ''">PRINCIPAL_TEL = #{principalTel},</if>
  179. <if test="note != null and note != ''">NOTE = #{note},</if>
  180. <if test="chkUnit != null and chkUnit != ''">CHK_UNIT = #{chkUnit},</if>
  181. <if test="chkPers != null and chkPers != ''">CHK_PERS = #{chkPers},</if>
  182. <if test="chkTm != null">CHK_TM = #{chkTm},</if>
  183. <if test="intInfoStat != null and intInfoStat != ''">INT_INFO_STAT = #{intInfoStat},</if>
  184. <if test="wintStat != null and wintStat != ''">WINT_STAT = #{wintStat},</if>
  185. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  186. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  187. <if test="intm != null">INTM = #{intm},</if>
  188. <if test="uptm != null">UPTM = #{uptm},</if>
  189. <if test="state != null and state != ''">STATE = #{state},</if>
  190. </trim>
  191. <where>ID = #{id}</where>
  192. </update>
  193. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWrmRgstr">
  194. update BIS_INSP_WRM_RGSTR
  195. <trim prefix="set" suffixOverrides=",">
  196. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  197. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  198. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  199. <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
  200. <if test="loc != null and loc != ''">LOC = #{loc},</if>
  201. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  202. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  203. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  204. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  205. <if test="bChkUnit != null and bChkUnit != ''">B_CHK_UNIT = #{bChkUnit},</if>
  206. <if test="contact != null and contact != ''">CONTACT = #{contact},</if>
  207. <if test="contactTel != null and contactTel != ''">CONTACT_TEL = #{contactTel},</if>
  208. <if test="principal != null and principal != ''">PRINCIPAL = #{principal},</if>
  209. <if test="principalTel != null and principalTel != ''">PRINCIPAL_TEL = #{principalTel},</if>
  210. <if test="note != null and note != ''">NOTE = #{note},</if>
  211. <if test="chkUnit != null and chkUnit != ''">CHK_UNIT = #{chkUnit},</if>
  212. <if test="chkPers != null and chkPers != ''">CHK_PERS = #{chkPers},</if>
  213. <if test="chkTm != null">CHK_TM = #{chkTm},</if>
  214. <if test="intInfoStat != null and intInfoStat != ''">INT_INFO_STAT = #{intInfoStat},</if>
  215. <if test="wintStat != null and wintStat != ''">WINT_STAT = #{wintStat},</if>
  216. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  217. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  218. <if test="intm != null">INTM = #{intm},</if>
  219. <if test="uptm != null">UPTM = #{uptm},</if>
  220. <if test="state != null and state != ''">STATE = #{state},</if>
  221. </trim>
  222. <include refid="page_where"/>
  223. </update>
  224. <!-- 其他自定义SQL -->
  225. <select id="findWrmPage" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
  226. SELECT * FROM (
  227. select
  228. A.CODE, A.ID nodeId, A.NM, A.PTYPE, A.OBJ_ID, ia.pnm groupName,
  229. B.ID, b.id as rgstrId,
  230. (CASE WHEN B.STATE IS NULL THEN '0' else b.state end) STATE,
  231. (CASE WHEN b.AD_NAME IS NULL THEN to_char( e.AD_FULL_NAME ) ELSE b.AD_NAME END ) adName,
  232. B.INTM,B.UPTM,B.AD_CODE,b.INT_INFO_STAT,b.WINT_STAT,
  233. E.AD_FULL_NAME
  234. from BIS_INSP_ALL_OBJ
  235. A LEFT JOIN BIS_INSP_WRM_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  236. LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  237. LEFT JOIN ATT_AD_X_BASE e on B.AD_CODE = e.ad_code
  238. where A.ptype= #{pType}
  239. <if test="adCodes ==null or adCodes ==''">
  240. <choose>
  241. <when test='isAll =="1"'>
  242. </when>
  243. <otherwise>
  244. and
  245. A.Id in (
  246. select distinct id from (
  247. SELECT P.id FROM BIS_INSP_ALL P START WITH P.PID IN (SELECT id FROM BIS_INSP_ALL_RLATION A
  248. WHERE A.PERSID = #{presId} and TYPE = #{pType} and length(id) in (3,6,9))
  249. CONNECT BY P.PID = PRIOR P.ID
  250. union all
  251. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  252. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  253. )
  254. )
  255. </otherwise>
  256. </choose>
  257. </if>
  258. <if test="adCodes !=null and adCodes !=''">
  259. and
  260. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  261. b.ad_code like concat('${item}','%')
  262. </foreach>
  263. </if>
  264. ) A WHERE a.PTYPE=#{pType}
  265. <if test="adCode != null and adCode != '' ">
  266. and a.AD_CODE like '${adCode}%'
  267. </if>
  268. <if test="plnaId !=null and plnaId !=''">
  269. and a.nodeId like '${plnaId}%'
  270. </if>
  271. <if test="state !=null and state !=''">
  272. and STATE in (${state})
  273. </if>
  274. <if test="rsName !=null and rsName !=''">
  275. and a.nm like '%${rsName}%'
  276. </if>
  277. <if test="code !=null and code !=''">
  278. and a.code = #{code}
  279. </if>
  280. <if test="adName != null and adName != ''">and a.adName like '%${adName}%'</if>
  281. <if test="sttm != null and sttm != ''">and a.Intm&gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  282. <if test="entm != null and entm != ''">and a.Intm &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  283. <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
  284. order by nodeId asc
  285. <if test="orderBy != null and orderBy != ''">
  286. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  287. </if>
  288. </select>
  289. <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspWrmRgstr"
  290. parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam">
  291. <!-- 获取督察对象 -->
  292. select
  293. T.AD_CODE, T.AD_NAME, T.AD_FULL_NAME, T.LGTD centerX, T.LTTD centerY,
  294. T.LGTDPC gdX, T.LTTD gdY, T.AD_FULL_NAME loc,
  295. C.ID groupId, C.PNM groupName, B.OBJ_ID
  296. FROM ATT_AD_X_BASE T
  297. LEFT JOIN BIS_INSP_ALL_OBJ B ON T.AD_CODE = B.CODE
  298. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  299. where B.ptype = #{objType}
  300. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  301. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  302. <if test="adCode != null and adCode != ''">
  303. and t.AD_CODE like '${adCode}%'
  304. </if>
  305. <choose>
  306. <when test="province != null and province != ''">
  307. and B.AD_CODE LIKE '${province}%'
  308. </when>
  309. <otherwise>
  310. and B.AD_CODE is null
  311. </otherwise>
  312. </choose>
  313. </select>
  314. <sql id="orgIdSql">
  315. <choose>
  316. <when test="orgId !=null and orgId !=''">
  317. and ORG_ID=#{orgId}
  318. </when>
  319. <otherwise>
  320. and ORG_ID is null
  321. </otherwise>
  322. </choose>
  323. </sql>
  324. <select id="getWrmByIdNm" resultType="cn.com.goldenwater.dcproj.model.BisInspWrmRgstr">
  325. select a.*,b.id rgstrId,A.NM from bis_insp_all_obj a left join BIS_INSP_WRM_RGSTR b on a.obj_id=b.obj_id where A.id=#{groupId} and a.nm like '%${nm}%'
  326. </select>
  327. </mapper>