BisInspVillgdVillWtspDao.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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.BisInspVillgdVillWtspDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspVillgdVillWtsp" id="bisInspVillgdVillWtspResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="rgstrId" column="RGSTR_ID"/>
  7. <result property="villType" column="VILL_TYPE"/>
  8. <result property="villId" column="VILL_ID"/>
  9. <result property="nm" column="NM"/>
  10. <result property="popTotal" column="POP_TOTAL"/>
  11. <result property="popAut" column="POP_AUT"/>
  12. <result property="designWaterSupply" column="DESIGN_WATER_SUPPLY"/>
  13. <result property="persId" column="PERS_ID"/>
  14. <result property="intm" column="INTM"/>
  15. <result property="uptm" column="UPTM"/>
  16. <result property="note" column="NOTE"/>
  17. <result property="dataStat" column="DATA_STAT"/>
  18. </resultMap>
  19. <sql id="table_columns">
  20. ID,
  21. RGSTR_ID,
  22. VILL_TYPE,
  23. VILL_ID,
  24. NM,
  25. POP_TOTAL,
  26. POP_AUT,
  27. DESIGN_WATER_SUPPLY,
  28. PERS_ID,
  29. INTM,
  30. UPTM,
  31. NOTE,
  32. DATA_STAT
  33. </sql>
  34. <sql id="entity_properties">
  35. #{id},
  36. #{rgstrId},
  37. #{villType},
  38. #{villId},
  39. #{nm},
  40. #{popTotal},
  41. #{popAut},
  42. #{designWaterSupply},
  43. #{persId},
  44. #{intm},
  45. #{uptm},
  46. #{note},
  47. #{dataStat}
  48. </sql>
  49. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  50. <sql id="page_where">
  51. <trim prefix="where" prefixOverrides="and | or ">
  52. <if test="rgstrId != null and rgstrId != ''">
  53. and RGSTR_ID = #{rgstrId}
  54. </if>
  55. <if test="villType != null and villType != ''">
  56. and VILL_TYPE = #{villType}
  57. </if>
  58. <if test="villId != null and villId != ''">
  59. and VILL_ID = #{villId}
  60. </if>
  61. <if test="nm != null and nm != ''">
  62. and NM = #{nm}
  63. </if>
  64. <if test="popTotal != null and popTotal != ''">
  65. and POP_TOTAL = #{popTotal}
  66. </if>
  67. <if test="popAut != null and popAut != ''">
  68. and POP_AUT = #{popAut}
  69. </if>
  70. <if test="designWaterSupply != null and designWaterSupply != ''">
  71. and DESIGN_WATER_SUPPLY = #{designWaterSupply}
  72. </if>
  73. <if test="persId != null and persId != ''">
  74. and PERS_ID = #{persId}
  75. </if>
  76. <if test="intm != null">
  77. and INTM = #{intm}
  78. </if>
  79. <if test="uptm != null">
  80. and UPTM = #{uptm}
  81. </if>
  82. <if test="note != null and note != ''">
  83. and NOTE = #{note}
  84. </if>
  85. <if test="dataStat != null and dataStat != ''">
  86. and DATA_STAT = #{dataStat}
  87. </if>
  88. and DATA_STAT='0'
  89. </trim>
  90. </sql>
  91. <select id="get" resultMap="bisInspVillgdVillWtspResultMap" parameterType="String">
  92. select
  93. <include refid="table_columns"/>
  94. from BIS_INSP_VILLGD_VILL_WTSP where ID = #{id}
  95. </select>
  96. <select id="getBy" resultMap="bisInspVillgdVillWtspResultMap">
  97. select
  98. <include refid="table_columns"/>
  99. from BIS_INSP_VILLGD_VILL_WTSP
  100. <include refid="page_where"/>
  101. </select>
  102. <select id="findAll" resultMap="bisInspVillgdVillWtspResultMap">
  103. select
  104. <include refid="table_columns"/>
  105. from BIS_INSP_VILLGD_VILL_WTSP
  106. </select>
  107. <select id="findList" resultMap="bisInspVillgdVillWtspResultMap">
  108. select
  109. <include refid="table_columns"/>
  110. from BIS_INSP_VILLGD_VILL_WTSP
  111. <include refid="page_where"/>
  112. </select>
  113. <select id="selectCount" resultType="int">
  114. select count(ID) from BIS_INSP_VILLGD_VILL_WTSP where DATA_STAT='0'
  115. <include refid="page_where"/>
  116. </select>
  117. <select id="selectCountByVill" resultType="int">
  118. select count(W.ID)
  119. from BIS_INSP_VILLGD_VILL_WTSP W
  120. JOIN BIS_INSP_VILLGD_VILL V ON V.ID = W.VILL_ID
  121. <where>
  122. W.DATA_STAT='0'
  123. <if test="rgstrId != null and rgstrId != ''">
  124. and V.RGSTR_ID = #{rgstrId}
  125. </if>
  126. <if test="villId != null and villId != ''">
  127. and V.ID = #{villId}
  128. </if>
  129. </where>
  130. </select>
  131. <select id="selectCountByNvill" resultType="int">
  132. select count(W.ID)
  133. from BIS_INSP_VILLGD_VILL_WTSP W
  134. JOIN BIS_INSP_VILLGD_NVILL NV ON NV.ID = W.VILL_ID
  135. JOIN BIS_INSP_VILLGD_VILL V ON V.ID = NV.VILL_ID
  136. <where>
  137. W.DATA_STAT='0'
  138. <if test="rgstrId != null and rgstrId != ''">
  139. and V.RGSTR_ID = #{rgstrId}
  140. </if>
  141. <if test="villId != null and villId != ''">
  142. and V.ID = #{villId}
  143. </if>
  144. </where>
  145. </select>
  146. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspVillgdVillWtsp">
  147. insert into BIS_INSP_VILLGD_VILL_WTSP(
  148. <include refid="table_columns"/>
  149. )
  150. values (
  151. <include refid="entity_properties"/>
  152. )
  153. </insert>
  154. <delete id="delete" parameterType="java.lang.String">
  155. update BIS_INSP_VILLGD_VILL_WTSP set DATA_STAT='9' where ID = #{id}
  156. </delete>
  157. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspVillgdVillWtsp">
  158. update BIS_INSP_VILLGD_VILL_WTSP set DATA_STAT='9'
  159. <include refid="page_where"/>
  160. </delete>
  161. <update id="deleteInFlag" parameterType="java.lang.String">
  162. update BIS_INSP_VILLGD_VILL_WTSP set DATA_STAT = '9' where ID = #{id}
  163. </update>
  164. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspVillgdVillWtsp">
  165. update BIS_INSP_VILLGD_VILL_WTSP
  166. <trim prefix="set" suffixOverrides=",">
  167. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID
  168. = #{rgstrId},
  169. </if>
  170. <if test="villType != null and villType != ''">VILL_TYPE
  171. = #{villType},
  172. </if>
  173. <if test="villId != null and villId != ''">VILL_ID
  174. = #{villId},
  175. </if>
  176. <if test="nm != null and nm != ''">NM
  177. = #{nm},
  178. </if>
  179. <if test="popTotal != null and popTotal != ''">POP_TOTAL
  180. = #{popTotal},
  181. </if>
  182. <if test="popAut != null and popAut != ''">POP_AUT
  183. = #{popAut},
  184. </if>
  185. <if test="designWaterSupply != null and designWaterSupply != ''">DESIGN_WATER_SUPPLY
  186. = #{designWaterSupply},
  187. </if>
  188. <if test="persId != null and persId != ''">PERS_ID
  189. = #{persId},
  190. </if>
  191. <if test="intm != null">INTM
  192. = #{intm},
  193. </if>
  194. <if test="uptm != null">UPTM
  195. = #{uptm},
  196. </if>
  197. <if test="note != null and note != ''">NOTE
  198. = #{note},
  199. </if>
  200. <if test="dataStat != null and dataStat != ''">DATA_STAT
  201. = #{dataStat},
  202. </if>
  203. </trim>
  204. <where>ID = #{id}</where>
  205. </update>
  206. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspVillgdVillWtsp">
  207. update BIS_INSP_VILLGD_VILL_WTSP
  208. <trim prefix="set" suffixOverrides=",">
  209. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID
  210. = #{rgstrId},
  211. </if>
  212. <if test="villType != null and villType != ''">VILL_TYPE
  213. = #{villType},
  214. </if>
  215. <if test="villId != null and villId != ''">VILL_ID
  216. = #{villId},
  217. </if>
  218. <if test="nm != null and nm != ''">NM
  219. = #{nm},
  220. </if>
  221. <if test="popTotal != null and popTotal != ''">POP_TOTAL
  222. = #{popTotal},
  223. </if>
  224. <if test="popAut != null and popAut != ''">POP_AUT
  225. = #{popAut},
  226. </if>
  227. <if test="designWaterSupply != null and designWaterSupply != ''">DESIGN_WATER_SUPPLY
  228. = #{designWaterSupply},
  229. </if>
  230. <if test="persId != null and persId != ''">PERS_ID
  231. = #{persId},
  232. </if>
  233. <if test="intm != null">INTM
  234. = #{intm},
  235. </if>
  236. <if test="uptm != null">UPTM
  237. = #{uptm},
  238. </if>
  239. <if test="note != null and note != ''">NOTE
  240. = #{note},
  241. </if>
  242. <if test="dataStat != null and dataStat != ''">DATA_STAT
  243. = #{dataStat},
  244. </if>
  245. </trim>
  246. <include refid="page_where"/>
  247. </update>
  248. <!-- 其他自定义SQL -->
  249. </mapper>