CzrkJzdzMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.boman.web.core.mapper.CzrkJzdzMapper">
  6. <resultMap type="com.boman.domain.CzrkJzdz" id="CzrkJzdzResult">
  7. <result property="id" column="id" />
  8. <result property="czrkId" column="czrk_id" />
  9. <result property="idCard" column="id_card" />
  10. <result property="userName" column="user_name" />
  11. <result property="sort" column="sort" />
  12. <result property="deptId" column="dept_id" />
  13. <result property="provinceId" column="province_id" />
  14. <result property="province" column="province" />
  15. <result property="cityId" column="city_id" />
  16. <result property="city" column="city" />
  17. <result property="regionId" column="region_id" />
  18. <result property="region" column="region" />
  19. <result property="townId" column="town_id" />
  20. <result property="town" column="town" />
  21. <result property="villageId" column="village_id" />
  22. <result property="village" column="village" />
  23. <result property="nowIn" column="now_in" />
  24. <result property="createBy" column="create_by" />
  25. <result property="createTime" column="create_time" />
  26. <result property="updateBy" column="update_by" />
  27. <result property="updateTime" column="update_time" />
  28. <result property="status" column="status" />
  29. </resultMap>
  30. <sql id="selectCzrkJzdzVo">
  31. select id, czrk_id, id_card, user_name, sort, dept_id, province_id, province, city_id, city, region_id, region, town_id, town, village_id, village, now_in, create_by, create_time, update_by, update_time, status from czrk_jzdz
  32. </sql>
  33. <select id="selectCzrkJzdzList" resultMap="CzrkJzdzResult">
  34. <include refid="selectCzrkJzdzVo"/>
  35. <where>
  36. <if test="czrkId != null "> and czrk_id = #{czrkId}</if>
  37. <if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
  38. <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
  39. <if test="sort != null "> and sort = #{sort}</if>
  40. <if test="deptId != null "> and dept_id = #{deptId}</if>
  41. <if test="provinceId != null and provinceId != ''"> and province_id = #{provinceId}</if>
  42. <if test="province != null and province != ''"> and province = #{province}</if>
  43. <if test="cityId != null and cityId != ''"> and city_id = #{cityId}</if>
  44. <if test="city != null and city != ''"> and city = #{city}</if>
  45. <if test="regionId != null and regionId != ''"> and region_id = #{regionId}</if>
  46. <if test="region != null and region != ''"> and region = #{region}</if>
  47. <if test="townId != null and townId != ''"> and town_id = #{townId}</if>
  48. <if test="town != null and town != ''"> and town = #{town}</if>
  49. <if test="villageId != null and villageId != ''"> and village_id = #{villageId}</if>
  50. <if test="village != null and village != ''"> and village = #{village}</if>
  51. <if test="nowIn != null and nowIn != ''"> and now_in = #{nowIn}</if>
  52. <if test="status != null and status != ''"> and status = #{status}</if>
  53. </where>
  54. </select>
  55. <select id="selectCzrkJzdzById" parameterType="Long" resultMap="CzrkJzdzResult">
  56. <include refid="selectCzrkJzdzVo"/>
  57. where id = #{id}
  58. </select>
  59. <select id="listByIdCard" resultMap="CzrkJzdzResult">
  60. <include refid="selectCzrkJzdzVo"/>
  61. where id_card in
  62. <foreach item="idCard" collection="idCardList" open="(" separator="," close=")">
  63. #{idCard}
  64. </foreach>
  65. </select>
  66. <insert id="insertCzrkJzdz" useGeneratedKeys="true" keyProperty="id">
  67. insert into czrk_jzdz
  68. <trim prefix="(" suffix=")" suffixOverrides=",">
  69. <if test="czrkId != null">czrk_id,</if>
  70. <if test="idCard != null">id_card,</if>
  71. <if test="userName != null">user_name,</if>
  72. <if test="sort != null">sort,</if>
  73. <if test="deptId != null">dept_id,</if>
  74. <if test="provinceId != null">province_id,</if>
  75. <if test="province != null">province,</if>
  76. <if test="cityId != null">city_id,</if>
  77. <if test="city != null">city,</if>
  78. <if test="regionId != null">region_id,</if>
  79. <if test="region != null">region,</if>
  80. <if test="townId != null">town_id,</if>
  81. <if test="town != null">town,</if>
  82. <if test="villageId != null">village_id,</if>
  83. <if test="village != null">village,</if>
  84. <if test="nowIn != null">now_in,</if>
  85. <if test="createBy != null">create_by,</if>
  86. <if test="updateBy != null">update_by,</if>
  87. <if test="updateTime != null">update_time,</if>
  88. <if test="status != null">status,</if>
  89. create_time
  90. </trim>
  91. <trim prefix="values (" suffix=")" suffixOverrides=",">
  92. <if test="czrkId != null">#{czrkId},</if>
  93. <if test="idCard != null">#{idCard},</if>
  94. <if test="userName != null">#{userName},</if>
  95. <if test="sort != null">#{sort},</if>
  96. <if test="deptId != null">#{deptId},</if>
  97. <if test="provinceId != null">#{provinceId},</if>
  98. <if test="province != null">#{province},</if>
  99. <if test="cityId != null">#{cityId},</if>
  100. <if test="city != null">#{city},</if>
  101. <if test="regionId != null">#{regionId},</if>
  102. <if test="region != null">#{region},</if>
  103. <if test="townId != null">#{townId},</if>
  104. <if test="town != null">#{town},</if>
  105. <if test="villageId != null">#{villageId},</if>
  106. <if test="village != null">#{village},</if>
  107. <if test="nowIn != null">#{nowIn},</if>
  108. <if test="createBy != null">#{createBy},</if>
  109. <if test="updateBy != null">#{updateBy},</if>
  110. <if test="updateTime != null">#{updateTime},</if>
  111. <if test="status != null">#{status},</if>
  112. sysdate()
  113. </trim>
  114. </insert>
  115. <update id="updateCzrkJzdz" >
  116. update czrk_jzdz
  117. <trim prefix="SET" suffixOverrides=",">
  118. <if test="czrkId != null">czrk_id = #{czrkId},</if>
  119. <if test="idCard != null">id_card = #{idCard},</if>
  120. <if test="userName != null">user_name = #{userName},</if>
  121. <if test="sort != null">sort = #{sort},</if>
  122. <if test="deptId != null">dept_id = #{deptId},</if>
  123. <if test="provinceId != null">province_id = #{provinceId},</if>
  124. <if test="province != null">province = #{province},</if>
  125. <if test="cityId != null">city_id = #{cityId},</if>
  126. <if test="city != null">city = #{city},</if>
  127. <if test="regionId != null">region_id = #{regionId},</if>
  128. <if test="region != null">region = #{region},</if>
  129. <if test="townId != null">town_id = #{townId},</if>
  130. <if test="town != null">town = #{town},</if>
  131. <if test="villageId != null">village_id = #{villageId},</if>
  132. <if test="village != null">village = #{village},</if>
  133. <if test="nowIn != null">now_in = #{nowIn},</if>
  134. <if test="createBy != null">create_by = #{createBy},</if>
  135. <if test="createTime != null">create_time = #{createTime},</if>
  136. <if test="updateBy != null">update_by = #{updateBy},</if>
  137. <if test="updateTime != null">update_time = sysdate(),</if>
  138. <if test="status != null">status = #{status},</if>
  139. </trim>
  140. where id = #{id}
  141. </update>
  142. <update id="updateByIdCard" >
  143. update czrk_jzdz
  144. <trim prefix="SET" suffixOverrides=",">
  145. <if test="czrkId != null">czrk_id = #{czrkId},</if>
  146. <if test="idCard != null">id_card = #{idCard},</if>
  147. <if test="userName != null">user_name = #{userName},</if>
  148. <if test="sort != null">sort = #{sort},</if>
  149. <if test="deptId != null">dept_id = #{deptId},</if>
  150. <if test="provinceId != null">province_id = #{provinceId},</if>
  151. <if test="province != null">province = #{province},</if>
  152. <if test="cityId != null">city_id = #{cityId},</if>
  153. <if test="city != null">city = #{city},</if>
  154. <if test="regionId != null">region_id = #{regionId},</if>
  155. <if test="region != null">region = #{region},</if>
  156. <if test="townId != null">town_id = #{townId},</if>
  157. <if test="town != null">town = #{town},</if>
  158. <if test="villageId != null">village_id = #{villageId},</if>
  159. <if test="village != null">village = #{village},</if>
  160. <if test="nowIn != null">now_in = #{nowIn},</if>
  161. <if test="createBy != null">create_by = #{createBy},</if>
  162. <if test="createTime != null">create_time = #{createTime},</if>
  163. <if test="updateBy != null">update_by = #{updateBy},</if>
  164. <if test="updateTime != null">update_time = sysdate(),</if>
  165. <if test="status != null">status = #{status},</if>
  166. </trim>
  167. where id_card = #{idCard}
  168. </update>
  169. <delete id="deleteCzrkJzdzById" parameterType="Long">
  170. delete from czrk_jzdz where id = #{id}
  171. </delete>
  172. <delete id="deleteByCzrkId" parameterType="Long">
  173. delete from czrk_jzdz where czrk_id = #{czrkId}
  174. </delete>
  175. <delete id="deleteCzrkJzdzByIds" parameterType="String">
  176. delete from czrk_jzdz where id in
  177. <foreach item="id" collection="array" open="(" separator="," close=")">
  178. #{id}
  179. </foreach>
  180. </delete>
  181. <select id="listCzrkIdByTypeAreaIdUserName" resultType="java.lang.Long">
  182. SELECT jzdz.czrk_id
  183. FROM czrk
  184. LEFT JOIN czrk_jzdz jzdz ON czrk.id = jzdz.czrk_id
  185. where czrk.is_del = 'N'
  186. <if test="userName != null and userName != ''">
  187. and jzdz.user_name like concat('%', #{userName}, '%')
  188. </if>
  189. <choose>
  190. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  191. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  192. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  193. <when test="type == 4">and jzdz.village_towns_id = #{areaId}</when>
  194. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  195. </choose>
  196. GROUP BY czrk.id
  197. </select>
  198. </mapper>