AttJskejianWaterBaseDao.xml 9.0 KB

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