BisInspVillgdVillUsrDao.xml 7.8 KB

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