AttSdBaseDao.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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.AttSdBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttSdBase" id="attSdBaseResultMap">
  5. <result property="sdCode" column="SD_CODE"/>
  6. <result property="sdName" column="SD_NAME"/>
  7. <result property="sdType" column="SD_TYPE"/>
  8. <result property="sdTypeStr" column="SD_TYPE_STR"/>
  9. <result property="conArea" column="CON_AREA"/>
  10. <result property="totCap" column="TOT_CAP"/>
  11. <result property="flcoCap" column="FLCO_CAP"/>
  12. <result property="sdrCap" column="SDR_CAP"/>
  13. <result property="flcoYear" column="FLCO_YEAR"/>
  14. <result property="warpCap" column="WARP_CAP"/>
  15. <result property="damSizeHig" column="DAM_SIZE_HIG"/>
  16. <result property="damTopLen" column="DAM_TOP_LEN"/>
  17. <result property="adCode" column="AD_CODE"/>
  18. <result property="sdLoc" column="SD_LOC"/>
  19. <result property="centerX" column="CENTER_X"/>
  20. <result property="centerY" column="CENTER_Y"/>
  21. <result property="gdX" column="GD_X"/>
  22. <result property="gdY" column="GD_Y"/>
  23. <result property="asinttds" column="ASINTTDS"/>
  24. <result property="noSpway" column="NO_SPWAY"/>
  25. <result property="damTear" column="DAM_TEAR"/>
  26. <result property="damLandSubSide" column="DAM_LAND_SUB_SIDE"/>
  27. <result property="damRsog" column="DAM_RSOG"/>
  28. <result property="damLopc" column="DAM_LOPC"/>
  29. <result property="dsLts" column="DS_LTS"/>
  30. <result property="dsCc" column="DS_CC"/>
  31. <result property="dsOc" column="DS_OC"/>
  32. <result property="frsMar" column="FRS_MAR"/>
  33. <result property="frsTbd" column="FRS_TBD"/>
  34. <result property="frsOth" column="FRS_OTH"/>
  35. <result property="note" column="NOTE"/>
  36. <result property="inTm" column="IN_TM"/>
  37. <result property="upTm" column="UP_TM"/>
  38. </resultMap>
  39. <sql id="table_columns">
  40. SD_CODE,
  41. SD_NAME,
  42. SD_TYPE,
  43. SD_TYPE_STR,
  44. CON_AREA,
  45. TOT_CAP,
  46. FLCO_CAP,
  47. SDR_CAP,
  48. FLCO_YEAR,
  49. WARP_CAP,
  50. DAM_SIZE_HIG,
  51. DAM_TOP_LEN,
  52. AD_CODE,
  53. SD_LOC,
  54. CENTER_X,
  55. CENTER_Y,
  56. GD_X,
  57. GD_Y,
  58. ASINTTDS,
  59. NO_SPWAY,
  60. DAM_TEAR,
  61. DAM_LAND_SUB_SIDE,
  62. DAM_RSOG,
  63. DAM_LOPC,
  64. DS_LTS,
  65. DS_CC,
  66. DS_OC,
  67. FRS_MAR,
  68. FRS_TBD,
  69. FRS_OTH,
  70. NOTE,
  71. IN_TM,
  72. UP_TM
  73. </sql>
  74. <sql id="entity_properties">
  75. #{sdCode},
  76. #{sdName},
  77. #{sdType},
  78. #{sdTypeStr},
  79. #{conArea},
  80. #{totCap},
  81. #{flcoCap},
  82. #{sdrCap},
  83. #{flcoYear},
  84. #{warpCap},
  85. #{damSizeHig},
  86. #{damTopLen},
  87. #{adCode},
  88. #{sdLoc},
  89. #{centerX},
  90. #{centerY},
  91. #{gdX},
  92. #{gdY},
  93. #{asinttds},
  94. #{noSpway},
  95. #{damTear},
  96. #{damLandSubSide},
  97. #{damRsog},
  98. #{damLopc},
  99. #{dsLts},
  100. #{dsCc},
  101. #{dsOc},
  102. #{frsMar},
  103. #{frsTbd},
  104. #{frsOth},
  105. #{note},
  106. #{inTm},
  107. #{upTm}
  108. </sql>
  109. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  110. <sql id="page_where">
  111. <trim prefix="where" prefixOverrides="and | or ">
  112. <if test="sdName != null and sdName != ''">and SD_NAME = #{sdName}</if>
  113. <if test="sdType != null and sdType != ''">and SD_TYPE = #{sdType}</if>
  114. <if test="sdTypeStr != null and sdTypeStr != ''">and SD_TYPE_STR = #{sdTypeStr}</if>
  115. <if test="conArea != null and conArea != ''">and CON_AREA = #{conArea}</if>
  116. <if test="totCap != null and totCap != ''">and TOT_CAP = #{totCap}</if>
  117. <if test="flcoCap != null and flcoCap != ''">and FLCO_CAP = #{flcoCap}</if>
  118. <if test="sdrCap != null and sdrCap != ''">and SDR_CAP = #{sdrCap}</if>
  119. <if test="flcoYear != null and flcoYear != ''">and FLCO_YEAR = #{flcoYear}</if>
  120. <if test="warpCap != null and warpCap != ''">and WARP_CAP = #{warpCap}</if>
  121. <if test="damSizeHig != null and damSizeHig != ''">and DAM_SIZE_HIG = #{damSizeHig}</if>
  122. <if test="damTopLen != null and damTopLen != ''">and DAM_TOP_LEN = #{damTopLen}</if>
  123. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  124. <if test="sdLoc != null and sdLoc != ''">and SD_LOC = #{sdLoc}</if>
  125. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  126. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  127. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  128. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  129. <if test="asinttds != null and asinttds != ''">and ASINTTDS = #{asinttds}</if>
  130. <if test="noSpway != null and noSpway != ''">and NO_SPWAY = #{noSpway}</if>
  131. <if test="damTear != null and damTear != ''">and DAM_TEAR = #{damTear}</if>
  132. <if test="damLandSubSide != null and damLandSubSide != ''">and DAM_LAND_SUB_SIDE = #{damLandSubSide}</if>
  133. <if test="damRsog != null and damRsog != ''">and DAM_RSOG = #{damRsog}</if>
  134. <if test="damLopc != null and damLopc != ''">and DAM_LOPC = #{damLopc}</if>
  135. <if test="dsLts != null and dsLts != ''">and DS_LTS = #{dsLts}</if>
  136. <if test="dsCc != null and dsCc != ''">and DS_CC = #{dsCc}</if>
  137. <if test="dsOc != null and dsOc != ''">and DS_OC = #{dsOc}</if>
  138. <if test="frsMar != null and frsMar != ''">and FRS_MAR = #{frsMar}</if>
  139. <if test="frsTbd != null and frsTbd != ''">and FRS_TBD = #{frsTbd}</if>
  140. <if test="frsOth != null and frsOth != ''">and FRS_OTH = #{frsOth}</if>
  141. <if test="note != null and note != ''">and NOTE = #{note}</if>
  142. <if test="inTm != null">and IN_TM = #{inTm}</if>
  143. <if test="upTm != null">and UP_TM = #{upTm}</if>
  144. </trim>
  145. </sql>
  146. <select id="get" resultMap="attSdBaseResultMap" parameterType="String" >
  147. select <include refid="table_columns" /> from ATT_SD_BASE where SD_CODE = #{id}
  148. </select>
  149. <select id="getBy" resultMap="attSdBaseResultMap">
  150. select <include refid="table_columns" /> from ATT_SD_BASE <include refid="page_where" />
  151. </select>
  152. <select id="findAll" resultMap="attSdBaseResultMap">
  153. select <include refid="table_columns" /> from ATT_SD_BASE
  154. </select>
  155. <select id="findList" resultMap="attSdBaseResultMap">
  156. select <include refid="table_columns" /> from ATT_SD_BASE <include refid="page_where" />
  157. </select>
  158. <select id="selectCount" resultType="int" >
  159. select count(ID) from ATT_SD_BASE <include refid="page_where" />
  160. </select>
  161. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttSdBase">
  162. insert into ATT_SD_BASE( <include refid="table_columns" /> )
  163. values ( <include refid="entity_properties" /> )
  164. </insert>
  165. <delete id="delete" parameterType="java.lang.String">
  166. delete from ATT_SD_BASE where ID = #{id}
  167. </delete>
  168. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttSdBase">
  169. delete from ATT_SD_BASE <include refid="page_where" />
  170. </delete>
  171. <update id="deleteInFlag" parameterType="java.lang.String">
  172. update ATT_SD_BASE set flag_valid = 0 where ID = #{id}
  173. </update>
  174. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttSdBase">
  175. update ATT_SD_BASE
  176. <trim prefix="set" suffixOverrides=",">
  177. <if test="sdName != null and sdName != ''">SD_NAME = #{sdName},</if>
  178. <if test="sdType != null and sdType != ''">SD_TYPE = #{sdType},</if>
  179. <if test="sdTypeStr != null and sdTypeStr != ''">SD_TYPE_STR = #{sdTypeStr},</if>
  180. <if test="conArea != null and conArea != ''">CON_AREA = #{conArea},</if>
  181. <if test="totCap != null and totCap != ''">TOT_CAP = #{totCap},</if>
  182. <if test="flcoCap != null and flcoCap != ''">FLCO_CAP = #{flcoCap},</if>
  183. <if test="sdrCap != null and sdrCap != ''">SDR_CAP = #{sdrCap},</if>
  184. <if test="flcoYear != null and flcoYear != ''">FLCO_YEAR = #{flcoYear},</if>
  185. <if test="warpCap != null and warpCap != ''">WARP_CAP = #{warpCap},</if>
  186. <if test="damSizeHig != null and damSizeHig != ''">DAM_SIZE_HIG = #{damSizeHig},</if>
  187. <if test="damTopLen != null and damTopLen != ''">DAM_TOP_LEN = #{damTopLen},</if>
  188. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  189. <if test="sdLoc != null and sdLoc != ''">SD_LOC = #{sdLoc},</if>
  190. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  191. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  192. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  193. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  194. <if test="asinttds != null and asinttds != ''">ASINTTDS = #{asinttds},</if>
  195. <if test="noSpway != null and noSpway != ''">NO_SPWAY = #{noSpway},</if>
  196. <if test="damTear != null and damTear != ''">DAM_TEAR = #{damTear},</if>
  197. <if test="damLandSubSide != null and damLandSubSide != ''">DAM_LAND_SUB_SIDE = #{damLandSubSide},</if>
  198. <if test="damRsog != null and damRsog != ''">DAM_RSOG = #{damRsog},</if>
  199. <if test="damLopc != null and damLopc != ''">DAM_LOPC = #{damLopc},</if>
  200. <if test="dsLts != null and dsLts != ''">DS_LTS = #{dsLts},</if>
  201. <if test="dsCc != null and dsCc != ''">DS_CC = #{dsCc},</if>
  202. <if test="dsOc != null and dsOc != ''">DS_OC = #{dsOc},</if>
  203. <if test="frsMar != null and frsMar != ''">FRS_MAR = #{frsMar},</if>
  204. <if test="frsTbd != null and frsTbd != ''">FRS_TBD = #{frsTbd},</if>
  205. <if test="frsOth != null and frsOth != ''">FRS_OTH = #{frsOth},</if>
  206. <if test="note != null and note != ''">NOTE = #{note},</if>
  207. <if test="inTm != null">IN_TM = #{inTm},</if>
  208. <if test="upTm != null">UP_TM = #{upTm},</if>
  209. </trim>
  210. <where>SD_CODE = #{id}</where>
  211. </update>
  212. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttSdBase">
  213. update ATT_SD_BASE
  214. <trim prefix="set" suffixOverrides=",">
  215. <if test="sdName != null and sdName != ''">SD_NAME = #{sdName},</if>
  216. <if test="sdType != null and sdType != ''">SD_TYPE = #{sdType},</if>
  217. <if test="sdTypeStr != null and sdTypeStr != ''">SD_TYPE_STR = #{sdTypeStr},</if>
  218. <if test="conArea != null and conArea != ''">CON_AREA = #{conArea},</if>
  219. <if test="totCap != null and totCap != ''">TOT_CAP = #{totCap},</if>
  220. <if test="flcoCap != null and flcoCap != ''">FLCO_CAP = #{flcoCap},</if>
  221. <if test="sdrCap != null and sdrCap != ''">SDR_CAP = #{sdrCap},</if>
  222. <if test="flcoYear != null and flcoYear != ''">FLCO_YEAR = #{flcoYear},</if>
  223. <if test="warpCap != null and warpCap != ''">WARP_CAP = #{warpCap},</if>
  224. <if test="damSizeHig != null and damSizeHig != ''">DAM_SIZE_HIG = #{damSizeHig},</if>
  225. <if test="damTopLen != null and damTopLen != ''">DAM_TOP_LEN = #{damTopLen},</if>
  226. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  227. <if test="sdLoc != null and sdLoc != ''">SD_LOC = #{sdLoc},</if>
  228. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  229. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  230. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  231. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  232. <if test="asinttds != null and asinttds != ''">ASINTTDS = #{asinttds},</if>
  233. <if test="noSpway != null and noSpway != ''">NO_SPWAY = #{noSpway},</if>
  234. <if test="damTear != null and damTear != ''">DAM_TEAR = #{damTear},</if>
  235. <if test="damLandSubSide != null and damLandSubSide != ''">DAM_LAND_SUB_SIDE = #{damLandSubSide},</if>
  236. <if test="damRsog != null and damRsog != ''">DAM_RSOG = #{damRsog},</if>
  237. <if test="damLopc != null and damLopc != ''">DAM_LOPC = #{damLopc},</if>
  238. <if test="dsLts != null and dsLts != ''">DS_LTS = #{dsLts},</if>
  239. <if test="dsCc != null and dsCc != ''">DS_CC = #{dsCc},</if>
  240. <if test="dsOc != null and dsOc != ''">DS_OC = #{dsOc},</if>
  241. <if test="frsMar != null and frsMar != ''">FRS_MAR = #{frsMar},</if>
  242. <if test="frsTbd != null and frsTbd != ''">FRS_TBD = #{frsTbd},</if>
  243. <if test="frsOth != null and frsOth != ''">FRS_OTH = #{frsOth},</if>
  244. <if test="note != null and note != ''">NOTE = #{note},</if>
  245. <if test="inTm != null">IN_TM = #{inTm},</if>
  246. <if test="upTm != null">UP_TM = #{upTm},</if>
  247. </trim>
  248. <include refid="page_where" />
  249. </update>
  250. <select id="getObjByPersId" resultType="cn.com.goldenwater.dcproj.model.AttSdBase" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  251. SELECT A.* ,B.OBJ_ID,B.ID groupId,C.ID rgstrId FROM ATT_SD_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.sd_code = B.CODE
  252. LEFT JOIN BIS_INSP_SD_RGSTR C ON B.OBJ_ID = C.OBJ_ID
  253. WHERE B.PTYPE = #{objType} AND
  254. B.id in (${inIdsSql})
  255. <choose>
  256. <when test="province !=null and province !=''">
  257. and B.AD_CODE =#{province}
  258. </when>
  259. <otherwise>
  260. and B.AD_CODE is null
  261. </otherwise>
  262. </choose>
  263. <if test="adName != null and adName != ''">and A.NAME LIKE '%${adName}%'</if>
  264. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  265. </select>
  266. <!-- 其他自定义SQL -->
  267. <select id="findListBy" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam" resultType="cn.com.goldenwater.dcproj.model.AttSdBase">
  268. SELECT
  269. A.SD_CODE,
  270. A.SD_NAME,
  271. A.SD_TYPE,
  272. A.SD_TYPE_STR,
  273. A.CON_AREA,
  274. A.TOT_CAP,
  275. A.FLCO_CAP
  276. A.SDR_CAP,
  277. A.FLCO_YEAR,
  278. A.WARP_CAP,
  279. A.DAM_SIZE_HIG,
  280. A.DAM_TOP_LEN,
  281. A.AD_CODE,
  282. A.SD_LOC,
  283. A.CENTER_X,
  284. A.CENTER_Y,
  285. A.GD_X,
  286. A.GD_Y,
  287. A.ASINTTDS,
  288. A.NO_SPWAY,
  289. A.DAM_TEAR,
  290. A.DAM_LAND_SUB_SIDE,
  291. A.DAM_RSOG,
  292. A.DAM_LOPC,
  293. A.DS_LTS,
  294. A.DS_CC,
  295. A.DS_OC,
  296. A.FRS_MAR,
  297. A.FRS_TBD,
  298. A.FRS_OTH,
  299. A.NOTE,
  300. A.IN_TM,
  301. A.UP_TM
  302. FROM ATT_SD_BASE A
  303. where 1=1
  304. <if test="adName != null and adName != ''">and A.SD_NAME LIKE '%${adName}%'</if>
  305. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  306. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  307. #{minLgtd} AND #{maxLgtd}
  308. </if>
  309. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  310. #{minLttd} AND #{maxLttd}
  311. </if>
  312. </select>
  313. <select id="getObjListNotInspGroupId" resultType="cn.com.goldenwater.dcproj.model.AttSdBase" parameterType="String">
  314. select t.*
  315. from ATT_SD_BASE t
  316. where t.SD_CODE not in (
  317. select CODE from BIS_INSP_ALL_OBJ B where id like concat(#{inspGroupId},'%') and B.obj_type=#{objType}
  318. <choose>
  319. <when test="province !=null and province !=''">
  320. and B.AD_CODE =#{province}
  321. </when>
  322. <otherwise>
  323. and B.AD_CODE is null
  324. </otherwise>
  325. </choose>
  326. )
  327. <if test="adName != null and adName != ''">and t.nm LIKE '%${adName}%'</if>
  328. <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
  329. </select>
  330. </mapper>