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