BisInspRsvrSdDao.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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.BisInspRsvrSdDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspRsvrSd" id="bisInspRsvrSdResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="rsvrNm" column="RSVR_NM"/>
  8. <result property="adCode" column="AD_CODE"/>
  9. <result property="resCreateTime" column="RES_CREATE_TIME"/>
  10. <result property="engScal" column="ENG_SCAL"/>
  11. <result property="hystSite" column="HYST_SITE"/>
  12. <result property="totCap" column="TOT_CAP"/>
  13. <result property="damRegCode" column="DAM_REG_CODE"/>
  14. <result property="gdX" column="GD_X"/>
  15. <result property="gdY" column="GD_Y"/>
  16. <result property="centerX" column="CENTER_X"/>
  17. <result property="centerY" column="CENTER_Y"/>
  18. <result property="state" column="STATE"/>
  19. <result property="dutyStat" column="DUTY_STAT"/>
  20. <result property="fcsStat" column="FCS_STAT"/>
  21. <result property="rprStat" column="RPR_STAT"/>
  22. <result property="synStat" column="SYN_STAT"/>
  23. <result property="bldnStat" column="BLDN_STAT"/>
  24. <result property="fcltyStat" column="FCLTY_STAT"/>
  25. <result property="dataStat" column="DATA_STAT"/>
  26. <result property="persId" column="PERS_ID"/>
  27. <result property="intm" column="INTM"/>
  28. <result property="uptm" column="UPTM"/>
  29. <result property="note" column="NOTE"/>
  30. <result property="rsCode" column="RS_CODE"/>
  31. <result property="adFullName" column="AD_FULL_NAME"/>
  32. </resultMap>
  33. <sql id="table_columns">
  34. ID,
  35. OBJ_ID,
  36. RSVR_NM,
  37. AD_CODE,
  38. RES_CREATE_TIME,
  39. ENG_SCAL,
  40. HYST_SITE,
  41. TOT_CAP,
  42. DAM_REG_CODE,
  43. GD_X,
  44. GD_Y,
  45. CENTER_X,
  46. CENTER_Y,
  47. STATE,
  48. DUTY_STAT,
  49. FCS_STAT,
  50. RPR_STAT,
  51. SYN_STAT,
  52. BLDN_STAT,
  53. FCLTY_STAT,
  54. DATA_STAT,
  55. PERS_ID,
  56. INTM,
  57. UPTM,
  58. NOTE,
  59. RS_CODE,
  60. AD_FULL_NAME
  61. </sql>
  62. <sql id="entity_properties">
  63. #{id},
  64. #{objId},
  65. #{rsvrNm},
  66. #{adCode},
  67. #{resCreateTime},
  68. #{engScal},
  69. #{hystSite},
  70. #{totCap},
  71. #{damRegCode},
  72. #{gdX},
  73. #{gdY},
  74. #{centerX},
  75. #{centerY},
  76. #{state},
  77. #{dutyStat},
  78. #{fcsStat},
  79. #{rprStat},
  80. #{synStat},
  81. #{bldnStat},
  82. #{fcltyStat},
  83. #{dataStat},
  84. #{persId},
  85. #{intm},
  86. #{uptm},
  87. #{note},
  88. #{rsCode},
  89. #{adFullName}
  90. </sql>
  91. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  92. <sql id="page_where">
  93. <trim prefix="where" prefixOverrides="and | or ">
  94. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  95. <if test="rsvrNm != null and rsvrNm != ''">and RSVR_NM = #{rsvrNm}</if>
  96. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  97. <if test="resCreateTime != null">and RES_CREATE_TIME = #{resCreateTime}</if>
  98. <if test="engScal != null and engScal != ''">and ENG_SCAL = #{engScal}</if>
  99. <if test="hystSite != null and hystSite != ''">and HYST_SITE = #{hystSite}</if>
  100. <if test="totCap != null and totCap != ''">and TOT_CAP = #{totCap}</if>
  101. <if test="damRegCode != null and damRegCode != ''">and DAM_REG_CODE = #{damRegCode}</if>
  102. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  103. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  104. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  105. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  106. <if test="state != null and state != ''">and STATE = #{state}</if>
  107. <if test="dutyStat != null and dutyStat != ''">and DUTY_STAT = #{dutyStat}</if>
  108. <if test="fcsStat != null and fcsStat != ''">and FCS_STAT = #{fcsStat}</if>
  109. <if test="rprStat != null and rprStat != ''">and RPR_STAT = #{rprStat}</if>
  110. <if test="synStat != null and synStat != ''">and SYN_STAT = #{synStat}</if>
  111. <if test="bldnStat != null and bldnStat != ''">and BLDN_STAT = #{bldnStat}</if>
  112. <if test="fcltyStat != null and fcltyStat != ''">and FCLTY_STAT = #{fcltyStat}</if>
  113. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  114. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  115. <if test="intm != null">and INTM = #{intm}</if>
  116. <if test="uptm != null">and UPTM = #{uptm}</if>
  117. <if test="note != null and note != ''">and NOTE = #{note}</if>
  118. </trim>
  119. </sql>
  120. <select id="get" resultMap="bisInspRsvrSdResultMap" parameterType="String" >
  121. select <include refid="table_columns" /> from BIS_INSP_RSVR_SD where ID = #{id}
  122. </select>
  123. <select id="getBy" resultMap="bisInspRsvrSdResultMap">
  124. select <include refid="table_columns" /> from BIS_INSP_RSVR_SD <include refid="page_where" />
  125. </select>
  126. <select id="findAll" resultMap="bisInspRsvrSdResultMap">
  127. select <include refid="table_columns" /> from BIS_INSP_RSVR_SD
  128. </select>
  129. <select id="findList" resultMap="bisInspRsvrSdResultMap">
  130. select <include refid="table_columns" /> from BIS_INSP_RSVR_SD <include refid="page_where" />
  131. </select>
  132. <select id="selectCount" resultType="int" >
  133. select count(ID) from BIS_INSP_RSVR_SD <include refid="page_where" />
  134. </select>
  135. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrSd">
  136. insert into BIS_INSP_RSVR_SD( <include refid="table_columns" /> )
  137. values ( <include refid="entity_properties" /> )
  138. </insert>
  139. <delete id="delete" parameterType="java.lang.String">
  140. update BIS_INSP_RSVR_SD set DATA_STAT='9' where ID = #{id}
  141. </delete>
  142. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrSd">
  143. delete from BIS_INSP_RSVR_SD <include refid="page_where" />
  144. </delete>
  145. <update id="deleteInFlag" parameterType="java.lang.String">
  146. update BIS_INSP_RSVR_SD set flag_valid = 0 where ID = #{id}
  147. </update>
  148. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrSd">
  149. update BIS_INSP_RSVR_SD
  150. <trim prefix="set" suffixOverrides=",">
  151. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  152. <if test="rsvrNm != null and rsvrNm != ''">RSVR_NM = #{rsvrNm},</if>
  153. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  154. <if test="resCreateTime != null">RES_CREATE_TIME = #{resCreateTime},</if>
  155. <if test="engScal != null and engScal != ''">ENG_SCAL = #{engScal},</if>
  156. <if test="hystSite != null and hystSite != ''">HYST_SITE = #{hystSite},</if>
  157. <if test="totCap != null and totCap != ''">TOT_CAP = #{totCap},</if>
  158. <if test="damRegCode != null and damRegCode != ''">DAM_REG_CODE = #{damRegCode},</if>
  159. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  160. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  161. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  162. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  163. <if test="state != null and state != ''">STATE = #{state},</if>
  164. <if test="dutyStat != null and dutyStat != ''">DUTY_STAT = #{dutyStat},</if>
  165. <if test="fcsStat != null and fcsStat != ''">FCS_STAT = #{fcsStat},</if>
  166. <if test="rprStat != null and rprStat != ''">RPR_STAT = #{rprStat},</if>
  167. <if test="synStat != null and synStat != ''">SYN_STAT = #{synStat},</if>
  168. <if test="bldnStat != null and bldnStat != ''">BLDN_STAT = #{bldnStat},</if>
  169. <if test="fcltyStat != null and fcltyStat != ''">FCLTY_STAT = #{fcltyStat},</if>
  170. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  171. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  172. <if test="intm != null">INTM = #{intm},</if>
  173. <if test="uptm != null">UPTM = #{uptm},</if>
  174. <if test="note != null and note != ''">NOTE = #{note},</if>
  175. <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
  176. </trim>
  177. <where>ID = #{id}</where>
  178. </update>
  179. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrSd">
  180. update BIS_INSP_RSVR_SD
  181. <trim prefix="set" suffixOverrides=",">
  182. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  183. <if test="rsvrNm != null and rsvrNm != ''">RSVR_NM = #{rsvrNm},</if>
  184. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  185. <if test="resCreateTime != null">RES_CREATE_TIME = #{resCreateTime},</if>
  186. <if test="engScal != null and engScal != ''">ENG_SCAL = #{engScal},</if>
  187. <if test="hystSite != null and hystSite != ''">HYST_SITE = #{hystSite},</if>
  188. <if test="totCap != null and totCap != ''">TOT_CAP = #{totCap},</if>
  189. <if test="damRegCode != null and damRegCode != ''">DAM_REG_CODE = #{damRegCode},</if>
  190. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  191. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  192. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  193. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  194. <if test="state != null and state != ''">STATE = #{state},</if>
  195. <if test="dutyStat != null and dutyStat != ''">DUTY_STAT = #{dutyStat},</if>
  196. <if test="fcsStat != null and fcsStat != ''">FCS_STAT = #{fcsStat},</if>
  197. <if test="rprStat != null and rprStat != ''">RPR_STAT = #{rprStat},</if>
  198. <if test="synStat != null and synStat != ''">SYN_STAT = #{synStat},</if>
  199. <if test="bldnStat != null and bldnStat != ''">BLDN_STAT = #{bldnStat},</if>
  200. <if test="fcltyStat != null and fcltyStat != ''">FCLTY_STAT = #{fcltyStat},</if>
  201. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  202. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  203. <if test="intm != null">INTM = #{intm},</if>
  204. <if test="uptm != null">UPTM = #{uptm},</if>
  205. <if test="note != null and note != ''">NOTE = #{note},</if>
  206. <if test="adFullName != null and adFullName != ''">AD_FULL_NAME = #{adFullName},</if>
  207. </trim>
  208. <include refid="page_where" />
  209. </update>
  210. <!-- 其他自定义SQL -->
  211. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspRsvrSdDto">
  212. SELECT * FROM (
  213. select
  214. A.CODE, A.ID nodeId, A.NM, A.ptype, ia.pnm groupName,
  215. B.id as rgstrId, AW.AD_FULL_NAME,
  216. B.ID,
  217. B.OBJ_ID,
  218. B.AD_CODE,
  219. B.NOTE,
  220. B.STATE,
  221. B.ENG_SCAL,
  222. B.CENTER_X,
  223. B.CENTER_Y,
  224. B.GD_X,
  225. B.GD_Y,
  226. B.INTM,
  227. B.UPTM,
  228. B.DATA_STAT,
  229. B.DUTY_STAT,
  230. B.FCS_STAT,
  231. B.RPR_STAT,
  232. B.SYN_STAT,
  233. B.BLDN_STAT,
  234. B.FCLTY_STAT
  235. FROM BIS_INSP_ALL_OBJ A
  236. JOIN BIS_INSP_RSVR_SD B ON A.OBJ_ID=B.OBJ_ID
  237. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  238. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  239. where A.ptype = #{pType}
  240. and B.DATA_STAT= '0'
  241. <if test="adCodes ==null or adCodes ==''">
  242. <choose>
  243. <when test='isAll =="1"'>
  244. </when>
  245. <otherwise>
  246. and
  247. A.Id in (
  248. select distinct id from (
  249. SELECT P.id FROM BIS_INSP_ALL P
  250. WHERE FIND_IN_SET(P.id, getSubNodes_bis_insp_all( (SELECT group_concat(A.id) FROM BIS_INSP_ALL_RLATION A
  251. WHERE A.PERSID = #{presId} and A.TYPE = #{pType} and length(A.id) in (3,6,9) group by A.PERSID ),0,0) ) &gt; 0
  252. union all
  253. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  254. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  255. )
  256. )
  257. </otherwise>
  258. </choose>
  259. </if>
  260. <if test="adCodes !=null and adCodes !=''">
  261. and
  262. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  263. b.ad_code like concat('${item}','%')
  264. </foreach>
  265. </if>
  266. ) A
  267. <where>
  268. <if test="id !=null and id !=''">and nodeId like '${id}%'</if>
  269. <if test="plnaId !=null and plnaId !=''">and nodeId like '${plnaId}%'</if>
  270. <if test="groupId != null and groupId != ''">and nodeId like '${groupId}%'</if>
  271. <if test="code !=null and code !=''">and code = #{code}</if>
  272. <if test="nm !=null and nm !=''">and nm like '%${nm}%'</if>
  273. <if test="rsName !=null and rsName !=''">and nm like '%${rsName}%'</if>
  274. <if test="engScal !=null and engScal !=''">and ENG_SCAL IN (${engScal})</if>
  275. <if test="state !=null and state !=''">and STATE in (${state})</if>
  276. <if test="adName != null and adName != ''">and AD_FULL_NAME like '%${adName}%'</if>
  277. <if test="sttm != null and sttm != ''">and INTM &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d')</if>
  278. <if test="entm != null and entm != ''">and INTM &lt; DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') , INTERVAL 1 DAY)</if>
  279. </where>
  280. order by nodeId asc
  281. <if test="orderBy != null and orderBy != ''">
  282. ,CONVERT( nm USING gbk ) COLLATE gbk_chinese_ci ASC
  283. </if>
  284. </select>
  285. <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.dto.BisInspRsvrSdDto"
  286. parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam">
  287. select t.id,
  288. t.id as rgstrId,
  289. (case
  290. when t.STATE is null then
  291. '0'
  292. else
  293. t.state
  294. end) STATE,
  295. t.rsvr_nm nm,
  296. t.AD_CODE,
  297. t.ENG_SCAL,
  298. t.HYST_SITE,
  299. t.CENTER_X,
  300. t.CENTER_Y,
  301. t.GD_X,
  302. t.GD_Y,
  303. t.PERS_ID,
  304. t.INTM,
  305. t.UPTM,
  306. t.DATA_STAT,
  307. C.id groupId,
  308. C.PNM groupName,
  309. B.obj_id,
  310. B.code code
  311. from BIS_INSP_RSVR_SD t
  312. left join BIS_INSP_ALL_OBJ B
  313. on t.OBJ_ID = B.OBJ_ID
  314. LEFT JOIN BIS_INSP_ALL C
  315. ON B.ID = C.ID
  316. and B.ptype = #{objType}
  317. where 1 = 1
  318. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  319. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  320. <if test="adCode != null and adCode != ''">
  321. and t.AD_CODE like '${adCode}%'
  322. </if>
  323. <if test="wtdstNm !=null and wtdstNm !=''">
  324. and nm like '%${wtdstNm}%'
  325. </if>
  326. <choose>
  327. <when test="province != null and province != ''">
  328. and B.AD_CODE LIKE '${province}%'
  329. </when>
  330. <otherwise>
  331. and B.AD_CODE is null
  332. </otherwise>
  333. </choose>
  334. </select>
  335. </mapper>