AttJskejianFlkdisBaseDao.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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.AttJskejianFlkdisBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisBase" id="attJskejianFlkdisBaseResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="name" column="NAME"/>
  7. <result property="rvReaLkName" column="RV_REA_LK_NAME"/>
  8. <result property="adCode" column="AD_CODE"/>
  9. <result property="adName" column="AD_NAME"/>
  10. <result property="location" column="LOCATION"/>
  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="contRvonNameDuty" column="CONT_RVON_NAME_DUTY"/>
  16. <result property="townRvonNameDuty" column="TOWN_RVON_NAME_DUTY"/>
  17. <result property="vilgRvonNameDuty" column="VILG_RVON_NAME_DUTY"/>
  18. <result property="pblmType" column="PBLM_TYPE"/>
  19. <result property="pblmDesc" column="PBLM_DESC"/>
  20. <result property="rectConc" column="RECT_CONC"/>
  21. <result property="persId" column="PERS_ID"/>
  22. <result property="intm" column="INTM"/>
  23. <result property="uptm" column="UPTM"/>
  24. </resultMap>
  25. <sql id="table_columns">
  26. ID,
  27. NAME,
  28. RV_REA_LK_NAME,
  29. AD_CODE,
  30. AD_NAME,
  31. LOCATION,
  32. CENTER_X,
  33. CENTER_Y,
  34. GD_X,
  35. GD_Y,
  36. CONT_RVON_NAME_DUTY,
  37. TOWN_RVON_NAME_DUTY,
  38. VILG_RVON_NAME_DUTY,
  39. PBLM_TYPE,
  40. PBLM_DESC,
  41. RECT_CONC,
  42. PERS_ID,
  43. INTM,
  44. UPTM
  45. </sql>
  46. <sql id="entity_properties">
  47. #{id},
  48. #{name},
  49. #{rvReaLkName},
  50. #{adCode},
  51. #{adName},
  52. #{location},
  53. #{centerX},
  54. #{centerY},
  55. #{gdX},
  56. #{gdY},
  57. #{contRvonNameDuty},
  58. #{townRvonNameDuty},
  59. #{vilgRvonNameDuty},
  60. #{pblmType},
  61. #{pblmDesc},
  62. #{rectConc},
  63. #{persId},
  64. #{intm},
  65. #{uptm}
  66. </sql>
  67. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  68. <sql id="page_where">
  69. <trim prefix="where" prefixOverrides="and | or ">
  70. <if test="name != null and name != ''">and NAME = #{name}</if>
  71. <if test="rvReaLkName != null and rvReaLkName != ''">and RV_REA_LK_NAME = #{rvReaLkName}</if>
  72. <if test="adCode != null and adCode != ''">and AD_CODE like '${adCode}%'</if>
  73. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  74. <if test="location != null and location != ''">and LOCATION = #{location}</if>
  75. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  76. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  77. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  78. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  79. <if test="contRvonNameDuty != null and contRvonNameDuty != ''">and CONT_RVON_NAME_DUTY = #{contRvonNameDuty}</if>
  80. <if test="townRvonNameDuty != null and townRvonNameDuty != ''">and TOWN_RVON_NAME_DUTY = #{townRvonNameDuty}</if>
  81. <if test="vilgRvonNameDuty != null and vilgRvonNameDuty != ''">and VILG_RVON_NAME_DUTY = #{vilgRvonNameDuty}</if>
  82. <if test="pblmType != null and pblmType != ''">and PBLM_TYPE = #{pblmType}</if>
  83. <if test="pblmDesc != null and pblmDesc != ''">and PBLM_DESC = #{pblmDesc}</if>
  84. <if test="rectConc != null and rectConc != ''">and RECT_CONC = #{rectConc}</if>
  85. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  86. <if test="intm != null">and INTM = #{intm}</if>
  87. <if test="uptm != null">and UPTM = #{uptm}</if>
  88. <if test="province !=null and province !=''">
  89. and AD_CODE like '${province}%'
  90. </if>
  91. </trim>
  92. </sql>
  93. <select id="get" resultMap="attJskejianFlkdisBaseResultMap" parameterType="String" >
  94. select <include refid="table_columns" /> from ATT_JSKEJIAN_FLKDIS_BASE where ID = #{id}
  95. </select>
  96. <select id="getBy" resultMap="attJskejianFlkdisBaseResultMap">
  97. select <include refid="table_columns" /> from ATT_JSKEJIAN_FLKDIS_BASE <include refid="page_where" />
  98. </select>
  99. <select id="findAll" resultMap="attJskejianFlkdisBaseResultMap">
  100. select <include refid="table_columns" /> from ATT_JSKEJIAN_FLKDIS_BASE
  101. </select>
  102. <select id="findList" resultMap="attJskejianFlkdisBaseResultMap">
  103. select <include refid="table_columns" /> from ATT_JSKEJIAN_FLKDIS_BASE <include refid="page_where" />
  104. </select>
  105. <select id="selectCount" resultType="int" >
  106. select count(ID) from ATT_JSKEJIAN_FLKDIS_BASE <include refid="page_where" />
  107. </select>
  108. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisBase">
  109. insert into ATT_JSKEJIAN_FLKDIS_BASE( <include refid="table_columns" /> )
  110. values ( <include refid="entity_properties" /> )
  111. </insert>
  112. <delete id="delete" parameterType="java.lang.String">
  113. delete from ATT_JSKEJIAN_FLKDIS_BASE where ID = #{id}
  114. </delete>
  115. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisBase">
  116. delete from ATT_JSKEJIAN_FLKDIS_BASE <include refid="page_where" />
  117. </delete>
  118. <update id="deleteInFlag" parameterType="java.lang.String">
  119. update ATT_JSKEJIAN_FLKDIS_BASE set flag_valid = 0 where ID = #{id}
  120. </update>
  121. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisBase">
  122. update ATT_JSKEJIAN_FLKDIS_BASE
  123. <trim prefix="set" suffixOverrides=",">
  124. <if test="name != null and name != ''">NAME = #{name},</if>
  125. <if test="rvReaLkName != null and rvReaLkName != ''">RV_REA_LK_NAME = #{rvReaLkName},</if>
  126. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  127. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  128. <if test="location != null and location != ''">LOCATION = #{location},</if>
  129. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  130. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  131. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  132. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  133. <if test="contRvonNameDuty != null and contRvonNameDuty != ''">CONT_RVON_NAME_DUTY = #{contRvonNameDuty},</if>
  134. <if test="townRvonNameDuty != null and townRvonNameDuty != ''">TOWN_RVON_NAME_DUTY = #{townRvonNameDuty},</if>
  135. <if test="vilgRvonNameDuty != null and vilgRvonNameDuty != ''">VILG_RVON_NAME_DUTY = #{vilgRvonNameDuty},</if>
  136. <if test="pblmType != null and pblmType != ''">PBLM_TYPE = #{pblmType},</if>
  137. <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
  138. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  139. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  140. <if test="intm != null">INTM = #{intm},</if>
  141. <if test="uptm != null">UPTM = #{uptm},</if>
  142. </trim>
  143. <where>ID = #{id}</where>
  144. </update>
  145. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisBase">
  146. update ATT_JSKEJIAN_FLKDIS_BASE
  147. <trim prefix="set" suffixOverrides=",">
  148. <if test="name != null and name != ''">NAME = #{name},</if>
  149. <if test="rvReaLkName != null and rvReaLkName != ''">RV_REA_LK_NAME = #{rvReaLkName},</if>
  150. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  151. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  152. <if test="location != null and location != ''">LOCATION = #{location},</if>
  153. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  154. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  155. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  156. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  157. <if test="contRvonNameDuty != null and contRvonNameDuty != ''">CONT_RVON_NAME_DUTY = #{contRvonNameDuty},</if>
  158. <if test="townRvonNameDuty != null and townRvonNameDuty != ''">TOWN_RVON_NAME_DUTY = #{townRvonNameDuty},</if>
  159. <if test="vilgRvonNameDuty != null and vilgRvonNameDuty != ''">VILG_RVON_NAME_DUTY = #{vilgRvonNameDuty},</if>
  160. <if test="pblmType != null and pblmType != ''">PBLM_TYPE = #{pblmType},</if>
  161. <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
  162. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  163. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  164. <if test="intm != null">INTM = #{intm},</if>
  165. <if test="uptm != null">UPTM = #{uptm},</if>
  166. </trim>
  167. <include refid="page_where" />
  168. </update>
  169. <!-- 其他自定义SQL -->
  170. <select id="findListReg" resultType="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisBase"
  171. parameterType="cn.com.goldenwater.dcproj.param.AttJskejianFlkdisBaseParam" >
  172. select r.name,r.ad_code,(case when r.center_x is null then e.center_x else r.center_x end) as center_x,r.obj_id,
  173. (case when r.center_y is null then e.center_y else r.center_y end) as center_y,r.state
  174. from ATT_JSKEJIAN_FLKDIS_BASE e,bis_insp_all_obj o,ATT_JSKEJIAN_FLKDIS_RGSTR r
  175. where e.id=o.code and o.obj_id=r.obj_id
  176. <if test="state !=null and state !=''">
  177. and r.state=#{state}
  178. </if>
  179. <if test="province !=null and province !=''">
  180. and r.ad_code like '${province}%'
  181. </if>
  182. </select>
  183. <select id="getObjJsFlListNotInspGroupId" parameterType="String" resultType="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisBase">
  184. select t.*,C.id groupId,C.PNM groupName,B.obj_id
  185. from ATT_JSKEJIAN_FLKDIS_BASE t
  186. left join BIS_INSP_ALL_OBJ B
  187. on B.CODE = t.ID
  188. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  189. and B.ptype = #{objType}
  190. where 1 = 1
  191. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  192. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  193. <if test="adCode != null and adCode != ''">
  194. and t.AD_CODE like '${adCode}%'
  195. </if>
  196. <choose>
  197. <when test="province != null and province != ''">
  198. and B.AD_CODE LIKE '${province}%'
  199. </when>
  200. <otherwise>
  201. and B.AD_CODE is null
  202. </otherwise>
  203. </choose>
  204. </select>
  205. <!-- 其他自定义SQL -->
  206. <update id="updateList" parameterType="java.util.List">
  207. <foreach collection="list" index="index" item="item" open="begin" close=";end;" separator=";">
  208. UPDATE ATT_JSKEJIAN_FLKDIS_BASE
  209. <set>
  210. GD_X = #{item.gdX},
  211. GD_Y = #{item.gdY}
  212. </set>
  213. <where>
  214. ID = #{item.id}
  215. </where>
  216. </foreach>
  217. </update>
  218. </mapper>