BisInspVillgdWtspDao.xml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  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.BisInspVillgdWtspDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspVillgdWtsp" id="bisInspVillgdWtspResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="rgstrId" column="RGSTR_ID"/>
  7. <result property="objId" column="OBJ_ID"/>
  8. <result property="nm" column="NM"/>
  9. <result property="designWaterSupply" column="DESIGN_WATER_SUPPLY"/>
  10. <result property="loc" column="LOC"/>
  11. <result property="runDep" column="RUN_DEP"/>
  12. <result property="mngSize" column="MNG_SIZE"/>
  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. OBJ_ID,
  23. NM,
  24. DESIGN_WATER_SUPPLY,
  25. LOC,
  26. RUN_DEP,
  27. MNG_SIZE,
  28. PERS_ID,
  29. INTM,
  30. UPTM,
  31. NOTE,
  32. DATA_STAT
  33. </sql>
  34. <sql id="entity_properties">
  35. #{id},
  36. #{rgstrId},
  37. #{objId},
  38. #{nm},
  39. #{designWaterSupply},
  40. #{loc},
  41. #{runDep},
  42. #{mngSize},
  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="objId != null and objId != ''">
  56. and OBJ_ID = #{objId}
  57. </if>
  58. <if test="nm != null and nm != ''">
  59. and NM = #{nm}
  60. </if>
  61. <if test="designWaterSupply != null and designWaterSupply != ''">
  62. and DESIGN_WATER_SUPPLY = #{designWaterSupply}
  63. </if>
  64. <if test="loc != null and loc != ''">
  65. and LOC = #{loc}
  66. </if>
  67. <if test="runDep != null and runDep != ''">
  68. and RUN_DEP = #{runDep}
  69. </if>
  70. <if test="mngSize != null and mngSize != ''">
  71. and MNG_SIZE = #{mngSize}
  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="bisInspVillgdWtspResultMap" parameterType="String">
  92. select
  93. W.*,
  94. C.STATE AS CASE_STATE,
  95. O.STATE AS OTHR_STATE,
  96. R.STATE AS RUN_STATE,
  97. S.STATE AS SRC_STATE
  98. from BIS_INSP_VILLGD_WTSP W
  99. LEFT JOIN BIS_INSP_VILLGD_WTSP_CASE C on W.ID = C.WTSP_ID
  100. LEFT JOIN BIS_INSP_VILLGD_WTSP_OTHR O on W.ID = O.WTSP_ID
  101. LEFT JOIN BIS_INSP_VILLGD_WTSP_RUN R on W.ID = R.WTSP_ID
  102. LEFT JOIN BIS_INSP_VILLGD_WTSP_SRC S on W.ID = S.WTSP_ID
  103. where W.ID = #{id}
  104. </select>
  105. <select id="getBy" resultMap="bisInspVillgdWtspResultMap">
  106. select
  107. <include refid="table_columns"/>
  108. from BIS_INSP_VILLGD_WTSP
  109. <include refid="page_where"/>
  110. </select>
  111. <select id="findAll" resultMap="bisInspVillgdWtspResultMap">
  112. select
  113. <include refid="table_columns"/>
  114. from BIS_INSP_VILLGD_WTSP
  115. </select>
  116. <select id="findList" resultMap="bisInspVillgdWtspResultMap">
  117. select
  118. W.*,
  119. C.STATE AS CASE_STATE,
  120. O.STATE AS OTHR_STATE,
  121. R.STATE AS RUN_STATE,
  122. S.STATE AS SRC_STATE
  123. FROM (SELECT * FROM BIS_INSP_VILLGD_WTSP <include refid="page_where"/>) W
  124. LEFT JOIN BIS_INSP_VILLGD_WTSP_CASE C on W.ID = C.WTSP_ID
  125. LEFT JOIN BIS_INSP_VILLGD_WTSP_OTHR O on W.ID = O.WTSP_ID
  126. LEFT JOIN BIS_INSP_VILLGD_WTSP_RUN R on W.ID = R.WTSP_ID
  127. LEFT JOIN BIS_INSP_VILLGD_WTSP_SRC S on W.ID = S.WTSP_ID
  128. </select>
  129. <select id="selectCount" resultType="int">
  130. select count(ID) from BIS_INSP_VILLGD_WTSP
  131. <include refid="page_where"/>
  132. </select>
  133. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspVillgdWtsp">
  134. insert into BIS_INSP_VILLGD_WTSP(
  135. <include refid="table_columns"/>
  136. )
  137. values (
  138. <include refid="entity_properties"/>
  139. )
  140. </insert>
  141. <delete id="delete" parameterType="java.lang.String">
  142. update BIS_INSP_VILLGD_WTSP set DATA_STAT='9' where ID = #{id}
  143. </delete>
  144. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspVillgdWtsp">
  145. update BIS_INSP_VILLGD_WTSP set DATA_STAT='9'
  146. <include refid="page_where"/>
  147. </delete>
  148. <update id="deleteInFlag" parameterType="java.lang.String">
  149. update BIS_INSP_VILLGD_WTSP set DATA_STAT = '9' where ID = #{id}
  150. </update>
  151. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspVillgdWtsp">
  152. update BIS_INSP_VILLGD_WTSP
  153. <trim prefix="set" suffixOverrides=",">
  154. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID
  155. = #{rgstrId},
  156. </if>
  157. <if test="objId != null and objId != ''">OBJ_ID
  158. = #{objId},
  159. </if>
  160. <if test="nm != null and nm != ''">NM
  161. = #{nm},
  162. </if>
  163. <if test="designWaterSupply != null and designWaterSupply != ''">DESIGN_WATER_SUPPLY
  164. = #{designWaterSupply},
  165. </if>
  166. <if test="loc != null and loc != ''">LOC
  167. = #{loc},
  168. </if>
  169. <if test="runDep != null and runDep != ''">RUN_DEP
  170. = #{runDep},
  171. </if>
  172. <if test="mngSize != null and mngSize != ''">MNG_SIZE
  173. = #{mngSize},
  174. </if>
  175. <if test="persId != null and persId != ''">PERS_ID
  176. = #{persId},
  177. </if>
  178. <if test="intm != null">INTM
  179. = #{intm},
  180. </if>
  181. <if test="uptm != null">UPTM
  182. = #{uptm},
  183. </if>
  184. <if test="note != null and note != ''">NOTE
  185. = #{note},
  186. </if>
  187. <if test="dataStat != null and dataStat != ''">DATA_STAT
  188. = #{dataStat},
  189. </if>
  190. </trim>
  191. <where>ID = #{id}</where>
  192. </update>
  193. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspVillgdWtsp">
  194. update BIS_INSP_VILLGD_WTSP
  195. <trim prefix="set" suffixOverrides=",">
  196. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID
  197. = #{rgstrId},
  198. </if>
  199. <if test="objId != null and objId != ''">OBJ_ID
  200. = #{objId},
  201. </if>
  202. <if test="nm != null and nm != ''">NM
  203. = #{nm},
  204. </if>
  205. <if test="designWaterSupply != null and designWaterSupply != ''">DESIGN_WATER_SUPPLY
  206. = #{designWaterSupply},
  207. </if>
  208. <if test="loc != null and loc != ''">LOC
  209. = #{loc},
  210. </if>
  211. <if test="runDep != null and runDep != ''">RUN_DEP
  212. = #{runDep},
  213. </if>
  214. <if test="mngSize != null and mngSize != ''">MNG_SIZE
  215. = #{mngSize},
  216. </if>
  217. <if test="persId != null and persId != ''">PERS_ID
  218. = #{persId},
  219. </if>
  220. <if test="intm != null">INTM
  221. = #{intm},
  222. </if>
  223. <if test="uptm != null">UPTM
  224. = #{uptm},
  225. </if>
  226. <if test="note != null and note != ''">NOTE
  227. = #{note},
  228. </if>
  229. <if test="dataStat != null and dataStat != ''">DATA_STAT
  230. = #{dataStat},
  231. </if>
  232. </trim>
  233. <include refid="page_where"/>
  234. </update>
  235. <!-- 其他自定义SQL -->
  236. </mapper>