AttGrowBaseDao.xml 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  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.AttGrowBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttGrowBase" id="attGrowBaseResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="wellCode" column="WELL_CODE"/>
  7. <result property="wellName" column="WELL_NAME"/>
  8. <result property="adCode" column="AD_CODE"/>
  9. <result property="adName" column="AD_NAME"/>
  10. <result property="contact" column="CONTACT"/>
  11. <result property="contactTel" column="CONTACT_TEL"/>
  12. <result property="wellTime" column="WELL_TIME"/>
  13. <result property="wellHeight" column="WELL_HEIGHT"/>
  14. <result property="wellType" column="WELL_TYPE"/>
  15. <result property="cardNum" column="CARD_NUM"/>
  16. <result property="filesNum" column="FILES_NUM"/>
  17. <result property="centerX" column="CENTER_X"/>
  18. <result property="centerY" column="CENTER_Y"/>
  19. <result property="gdX" column="GD_X"/>
  20. <result property="gdY" column="GD_Y"/>
  21. <result property="persId" column="PERS_ID"/>
  22. <result property="intm" column="INTM"/>
  23. <result property="uptm" column="UPTM"/>
  24. <result property="dataStat" column="DATA_STAT"/>
  25. </resultMap>
  26. <sql id="table_columns">
  27. ID,
  28. WELL_CODE,
  29. WELL_NAME,
  30. AD_CODE,
  31. AD_NAME,
  32. CONTACT,
  33. CONTACT_TEL,
  34. WELL_TIME,
  35. WELL_HEIGHT,
  36. WELL_TYPE,
  37. CARD_NUM,
  38. FILES_NUM,
  39. CENTER_X,
  40. CENTER_Y,
  41. GD_X,
  42. GD_Y,
  43. PERS_ID,
  44. INTM,
  45. UPTM,
  46. DATA_STAT
  47. </sql>
  48. <sql id="entity_properties">
  49. #{id},
  50. #{wellCode},
  51. #{wellName},
  52. #{adCode},
  53. #{adName},
  54. #{contact},
  55. #{contactTel},
  56. #{wellTime},
  57. #{wellHeight},
  58. #{wellType},
  59. #{cardNum},
  60. #{filesNum},
  61. #{centerX},
  62. #{centerY},
  63. #{gdX},
  64. #{gdY},
  65. #{persId},
  66. #{intm},
  67. #{uptm},
  68. #{dataStat}
  69. </sql>
  70. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  71. <sql id="page_where">
  72. <trim prefix="where" prefixOverrides="and | or ">
  73. <if test="wellCode != null and wellCode != ''">and WELL_CODE = #{wellCode}</if>
  74. <if test="wellName != null and wellName != ''">and WELL_NAME = #{wellName}</if>
  75. <if test="adCode != null and adCode != ''">and AD_CODE like concat(#{adCode},'%')</if>
  76. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  77. <if test="contact != null and contact != ''">and CONTACT = #{contact}</if>
  78. <if test="contactTel != null and contactTel != ''">and CONTACT_TEL = #{contactTel}</if>
  79. <if test="wellTime != null">and WELL_TIME = #{wellTime}</if>
  80. <if test="wellHeight != null and wellHeight != ''">and WELL_HEIGHT = #{wellHeight}</if>
  81. <if test="wellType != null and wellType != ''">and WELL_TYPE = #{wellType}</if>
  82. <if test="cardNum != null and cardNum != ''">and CARD_NUM = #{cardNum}</if>
  83. <if test="filesNum != null and filesNum != ''">and FILES_NUM = #{filesNum}</if>
  84. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  85. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  86. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  87. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  88. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  89. <if test="intm != null">and INTM = #{intm}</if>
  90. <if test="uptm != null">and UPTM = #{uptm}</if>
  91. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  92. </trim>
  93. </sql>
  94. <select id="get" resultMap="attGrowBaseResultMap" parameterType="String" >
  95. select <include refid="table_columns" /> from ATT_GROW_BASE where ID = #{id}
  96. </select>
  97. <select id="getBy" resultMap="attGrowBaseResultMap">
  98. select <include refid="table_columns" /> from ATT_GROW_BASE <include refid="page_where" />
  99. </select>
  100. <select id="findAll" resultMap="attGrowBaseResultMap">
  101. select <include refid="table_columns" /> from ATT_GROW_BASE
  102. </select>
  103. <select id="findList" resultMap="attGrowBaseResultMap">
  104. select <include refid="table_columns" /> from ATT_GROW_BASE <include refid="page_where" />
  105. </select>
  106. <select id="selectCount" resultType="int" >
  107. select count(ID) from ATT_GROW_BASE <include refid="page_where" />
  108. </select>
  109. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttGrowBase">
  110. insert into ATT_GROW_BASE( <include refid="table_columns" /> )
  111. values ( <include refid="entity_properties" /> )
  112. </insert>
  113. <delete id="delete" parameterType="java.lang.String">
  114. update ATT_GROW_BASE set DATA_STAT='9' where ID = #{id}
  115. </delete>
  116. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttGrowBase">
  117. delete from ATT_GROW_BASE <include refid="page_where" />
  118. </delete>
  119. <update id="deleteInFlag" parameterType="java.lang.String">
  120. update ATT_GROW_BASE set flag_valid = 0 where ID = #{id}
  121. </update>
  122. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttGrowBase">
  123. update ATT_GROW_BASE
  124. <trim prefix="set" suffixOverrides=",">
  125. <if test="wellCode != null and wellCode != ''">WELL_CODE = #{wellCode},</if>
  126. <if test="wellName != null and wellName != ''">WELL_NAME = #{wellName},</if>
  127. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  128. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  129. <if test="contact != null and contact != ''">CONTACT = #{contact},</if>
  130. <if test="contactTel != null and contactTel != ''">CONTACT_TEL = #{contactTel},</if>
  131. <if test="wellTime != null">WELL_TIME = #{wellTime},</if>
  132. <if test="wellHeight != null and wellHeight != ''">WELL_HEIGHT = #{wellHeight},</if>
  133. <if test="wellType != null and wellType != ''">WELL_TYPE = #{wellType},</if>
  134. <if test="cardNum != null and cardNum != ''">CARD_NUM = #{cardNum},</if>
  135. <if test="filesNum != null and filesNum != ''">FILES_NUM = #{filesNum},</if>
  136. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  137. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  138. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  139. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  140. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  141. <if test="intm != null">INTM = #{intm},</if>
  142. <if test="uptm != null">UPTM = #{uptm},</if>
  143. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  144. </trim>
  145. <where>ID = #{id}</where>
  146. </update>
  147. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttGrowBase">
  148. update ATT_GROW_BASE
  149. <trim prefix="set" suffixOverrides=",">
  150. <if test="wellCode != null and wellCode != ''">WELL_CODE = #{wellCode},</if>
  151. <if test="wellName != null and wellName != ''">WELL_NAME = #{wellName},</if>
  152. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  153. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  154. <if test="contact != null and contact != ''">CONTACT = #{contact},</if>
  155. <if test="contactTel != null and contactTel != ''">CONTACT_TEL = #{contactTel},</if>
  156. <if test="wellTime != null">WELL_TIME = #{wellTime},</if>
  157. <if test="wellHeight != null and wellHeight != ''">WELL_HEIGHT = #{wellHeight},</if>
  158. <if test="wellType != null and wellType != ''">WELL_TYPE = #{wellType},</if>
  159. <if test="cardNum != null and cardNum != ''">CARD_NUM = #{cardNum},</if>
  160. <if test="filesNum != null and filesNum != ''">FILES_NUM = #{filesNum},</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="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  164. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  165. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  166. <if test="intm != null">INTM = #{intm},</if>
  167. <if test="uptm != null">UPTM = #{uptm},</if>
  168. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  169. </trim>
  170. <include refid="page_where" />
  171. </update>
  172. <!-- 其他自定义SQL -->
  173. <select id="getObjId" resultMap="attGrowBaseResultMap">
  174. SELECT
  175. <include refid="table_columns" />
  176. FROM ATT_GROW_BASE
  177. WHERE ID = (SELECT CODE FROM BIS_INSP_ALL_OBJ WHERE OBJ_ID = #{objId})
  178. </select>
  179. <!-- 其他自定义SQL -->
  180. <update id="updateList" parameterType="java.util.List">
  181. <foreach collection="list" index="index" item="item" open="begin" close=";end;" separator=";">
  182. UPDATE ATT_GROW_BASE
  183. <set>
  184. GD_X = #{item.gdX},
  185. GD_Y = #{item.gdY}
  186. </set>
  187. <where>
  188. ID = #{item.id}
  189. </where>
  190. </foreach>
  191. </update>
  192. </mapper>