a8a73872bf64bb2139cad1c18cabb56ca0d6e3a8.svn-base 15 KB

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