CzrkMapper.xml 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940
  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.CzrkMapper">
  6. <resultMap type="com.boman.domain.Czrk" id="CzrkResult">
  7. <result property="id" column="id" />
  8. <result property="userName" column="user_name" />
  9. <result property="gender" column="gender" />
  10. <result property="age" column="age" />
  11. <result property="birthday" column="birthday" />
  12. <result property="deptId" column="dept_id" />
  13. <result property="idCard" column="id_card" />
  14. <result property="phoneNum" column="phone_num" />
  15. <result property="code" column="code" />
  16. <result property="houseType" column="house_type" />
  17. <result property="rlr" column="rlr" />
  18. <result property="rlTime" column="rl_time" />
  19. <result property="keyIndustries" column="key_industries" />
  20. <result property="yhzgx" column="yhzgx" />
  21. <result property="workUnit" column="work_unit" />
  22. <result property="provinceId" column="province_id" />
  23. <result property="province" column="province" />
  24. <result property="cityId" column="city_id" />
  25. <result property="city" column="city" />
  26. <result property="regionId" column="region_id" />
  27. <result property="isRl" column="is_rl" />
  28. <result property="region" column="region" />
  29. <result property="villageTownsId" column="village_towns_id" />
  30. <result property="villageTowns" column="village_towns" />
  31. <result property="villageId" column="village_id" />
  32. <result property="village" column="village" />
  33. <result property="villagerGroupId" column="villager_group_id" />
  34. <result property="villagerGroup" column="villager_group" />
  35. <result property="nowIn" column="now_in" />
  36. <result property="remark" column="remark" />
  37. <result property="gridId" column="grid_id" />
  38. <result property="status" column="status" />
  39. <result property="isConfirm" column="is_confirm" />
  40. <result property="confirmInfoUser" column="confirm_info_user" />
  41. <result property="confirmInfoUserTime" column="confirm_info_user_time" />
  42. <result property="createBy" column="create_by" />
  43. <result property="createTime" column="create_time" />
  44. <result property="updateBy" column="update_by" />
  45. <result property="updateTime" column="update_time" />
  46. <result property="isDel" column="is_del" />
  47. <result property="deleteReason" column="delete_reason" />
  48. <collection property="czrkJzdzList" javaType="java.util.List" resultMap="CzrkJzdzResult" />
  49. </resultMap>
  50. <resultMap type="com.boman.domain.CzrkJzdz" id="CzrkJzdzResult">
  51. <result property="provinceId" column="province_id_jzdz" />
  52. <result property="province" column="province_jzdz" />
  53. <result property="cityId" column="city_id_jzdz" />
  54. <result property="city" column="city_jzdz" />
  55. <result property="regionId" column="region_id_jzdz" />
  56. <result property="region" column="region_jzdz" />
  57. <result property="townId" column="town_id_jzdz" />
  58. <result property="town" column="town_jzdz" />
  59. <result property="villageId" column="village_id_jzdz" />
  60. <result property="village" column="village_jzdz" />
  61. <result property="nowIn" column="now_in_jzdz" />
  62. </resultMap>
  63. <resultMap type="com.boman.domain.SysDept" id="SysDeptResult">
  64. <id property="id" column="id" />
  65. <result property="parentId" column="parent_id" />
  66. <result property="ancestors" column="ancestors" />
  67. <result property="deptName" column="dept_name" />
  68. <result property="orderNum" column="order_num" />
  69. <result property="leader" column="leader" />
  70. <result property="phone" column="phone" />
  71. <result property="email" column="email" />
  72. <result property="status" column="status" />
  73. <result property="delFlag" column="del_flag" />
  74. <result property="parentName" column="parent_name" />
  75. <result property="num" column="num" />
  76. <result property="createBy" column="create_by" />
  77. <result property="createTime" column="create_time" />
  78. <result property="updateBy" column="update_by" />
  79. <result property="updateTime" column="update_time" />
  80. </resultMap>
  81. <resultMap type="com.boman.web.core.domain.ConfirmInfoUser" id="ConfrimInforUserResult">
  82. <result property="confirmInfoUser" column="confirm_info_user" />
  83. <result property="czrkId" column="czrk_id" />
  84. </resultMap>
  85. <sql id="selectCzrkVo">
  86. select id, user_name, gender, age, birthday,dept_id, id_card, phone_num, code, house_type, rlr, rl_time, yhzgx
  87. , work_unit, province_id, province, city_id, city, region_id, region, village_towns_id, village_towns
  88. , village_id, village, villager_group_id, villager_group, now_in, remark,grid_id, status,is_confirm,confirm_info_user,confirm_info_user_time, create_by, create_time
  89. , update_by, update_time, is_del, delete_reason, dept_id, is_rl, key_industries from czrk
  90. </sql>
  91. <select id="listByRlry" resultMap="CzrkResult">
  92. select id, user_name, phone_num,dept_id, id_card, gender, province, city, region, village_towns, village, villager_group, grid_id
  93. , house_type, update_by, code, rlr, update_time, delete_reason, now_in,is_confirm,confirm_info_user,confirm_info_user_time
  94. from czrk
  95. <where>
  96. <!-- 已认领 -->
  97. <if test="isRl != null and isRl != ''">and is_rl = #{isRl}</if>
  98. <if test="userName != null and userName != ''">
  99. and (user_name like concat('%', #{userName}, '%') or id_card like concat('%', #{userName}, '%'))
  100. </if>
  101. <if test="params.startAge != null and params.startAge != ''">and age &gt;= #{params.startAge}</if>
  102. <if test="params.endAge != null and params.endAge != ''">and age &lt;= #{params.endAge}</if>
  103. <if test="gender != null and gender != ''"> and gender = #{gender}</if>
  104. <if test="age != null "> and age = #{age}</if>
  105. <if test="birthday != null "> and birthday = #{birthday}</if>
  106. <if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
  107. <if test="phoneNum != null and phoneNum != ''"> and phone_num = #{phoneNum}</if>
  108. <if test="code != null and code != ''"> and code = #{code}</if>
  109. <if test="houseType != null and houseType != ''"> and house_type = #{houseType}</if>
  110. <if test="rlr != null and rlr != ''"> and rlr = #{rlr}</if>
  111. <if test="rlTime != null "> and rl_time = #{rlTime}</if>
  112. <if test="yhzgx != null and yhzgx != ''"> and yhzgx = #{yhzgx}</if>
  113. <if test="workUnit != null and workUnit != ''"> and work_unit = #{workUnit}</if>
  114. <if test="provinceId != null and provinceId != ''"> and province_id = #{provinceId}</if>
  115. <if test="province != null and province != ''"> and province = #{province}</if>
  116. <if test="cityId != null and cityId != ''"> and city_id = #{cityId}</if>
  117. <if test="city != null and city != ''"> and city = #{city}</if>
  118. <if test="regionId != null and regionId != ''"> and region_id = #{regionId}</if>
  119. <if test="region != null and region != ''"> and region = #{region}</if>
  120. <if test="villageTownsId != null and villageTownsId != ''"> and village_towns_id = #{villageTownsId}</if>
  121. <if test="villageTowns != null and villageTowns != ''"> and village_towns = #{villageTowns}</if>
  122. <if test="villageId != null and villageId != ''"> and village_id = #{villageId}</if>
  123. <if test="village != null and village != ''"> and village = #{village}</if>
  124. <!-- <if test="villagerGroupId != null and villagerGroupId != ''"> and villager_group_id = #{villagerGroupId}</if>
  125. <if test="villagerGroup != null and villagerGroup != ''"> and villager_group = #{villagerGroup}</if>-->
  126. <if test="nowIn != null and nowIn != ''"> and now_in = #{nowIn}</if>
  127. <if test="status != null and status != ''"> and status = #{status}</if>
  128. <if test="isConfirm != null and isConfirm != ''"> and is_confirm = #{isConfirm}</if>
  129. <if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
  130. <if test="deleteReason != null and deleteReason != ''"> and delete_reason = #{deleteReason}</if>
  131. <if test="gridId != null and gridId != ''"> and grid_id = #{gridId}</if>
  132. <if test="deptIdList != null and deptIdList.size() > 0">
  133. and dept_id in
  134. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  135. #{deptId}
  136. </foreach>
  137. </if>
  138. <if test="idCardList != null and idCardList.size() > 0">
  139. and id_card in
  140. <foreach item="idCard" collection="idCardList" open="(" separator="," close=")">
  141. #{idCard}
  142. </foreach>
  143. </if>
  144. </where>
  145. order by create_time DESC
  146. </select>
  147. <select id="listByRlryRel" resultType="com.boman.domain.Czrk">
  148. SELECT
  149. czrk.id,
  150. ANY_VALUE(czrk.user_name) userName,
  151. ANY_VALUE(czrk.phone_num) phoneNum,
  152. ANY_VALUE(czrk.id_card) idCard,
  153. ANY_VALUE(czrk.gender) gender,
  154. ANY_VALUE(czrk.province) province,
  155. ANY_VALUE(czrk.is_rl) isRl,
  156. ANY_VALUE(czrk.city) city,
  157. ANY_VALUE(czrk.region) region,
  158. ANY_VALUE(czrk.house_type) houseType,
  159. ANY_VALUE(czrk.update_by) updateBy,
  160. ANY_VALUE(czrk. CODE) CODE,
  161. ANY_VALUE(czrk.rlr) rlr,
  162. ANY_VALUE(czrk.update_time) updateTime,
  163. ANY_VALUE(czrk.delete_reason) deleteReason,
  164. ANY_VALUE(czrk.now_in) nowIn,
  165. ANY_VALUE(jzdz.province) provinceXjd,
  166. ANY_VALUE(jzdz.city) cityXjd,
  167. ANY_VALUE(jzdz.region) regionXjd,
  168. ANY_VALUE(jzdz.town) villageTownsXjd,
  169. ANY_VALUE(jzdz.village) villageXjd,
  170. ANY_VALUE(jzdz.now_in) domicile
  171. from czrk
  172. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  173. <where>
  174. jzdz.status = 'Y'
  175. <!-- 已认领 -->
  176. <if test="isRl != null and isRl != ''">and czrk.is_rl = #{isRl}</if>
  177. <if test="userName != null and userName != ''">
  178. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  179. </if>
  180. <if test="params.startAge != null and params.startAge != ''">and czrk.age &gt;= #{params.startAge}</if>
  181. <if test="params.endAge != null and params.endAge != ''">and czrk.age &lt;= #{params.endAge}</if>
  182. <if test="gender != null and gender != ''"> and czrk.gender = #{gender}</if>
  183. <if test="age != null "> and czrk.age = #{age}</if>
  184. <if test="birthday != null "> and czrk.birthday = #{birthday}</if>
  185. <if test="idCard != null and idCard != ''"> and czrk.id_card = #{idCard}</if>
  186. <if test="phoneNum != null and phoneNum != ''"> and czrk.phone_num = #{phoneNum}</if>
  187. <if test="code != null and code != ''"> and czrk.code = #{code}</if>
  188. <if test="houseType != null and houseType != ''"> and czrk.house_type = #{houseType}</if>
  189. <if test="rlr != null and rlr != ''"> and czrk.rlr = #{rlr}</if>
  190. <if test="rlTime != null "> and czrk.rl_time = #{rlTime}</if>
  191. <if test="yhzgx != null and yhzgx != ''"> and czrk.yhzgx = #{yhzgx}</if>
  192. <if test="workUnit != null and workUnit != ''"> and czrk.work_unit = #{workUnit}</if>
  193. <if test="provinceId != null and provinceId != ''"> and czrk.province_id = #{provinceId}</if>
  194. <if test="provinceIdXjd != null and provinceIdXjd != ''"> and jzdz.province_id = #{provinceId}</if>
  195. <if test="cityIdXjd != null and cityIdXjd != ''"> and jzdz.city_id = #{cityIdXjd}</if>
  196. <if test="regionIdXjd != null and regionIdXjd != ''"> and jzdz.region_id = #{regionIdXjd}</if>
  197. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''"> and jzdz.town_id = #{villageTownsIdXjd}</if>
  198. <if test="villageIdXjd != null and villageIdXjd != ''"> and jzdz.village_id = #{villageIdXjd}</if>
  199. <if test="province != null and province != ''"> and czrk.province = #{province}</if>
  200. <if test="cityId != null and cityId != ''"> and czrk.city_id = #{cityId}</if>
  201. <if test="city != null and city != ''"> and czrk.city = #{city}</if>
  202. <if test="regionId != null and regionId != ''"> and czrk.region_id = #{regionId}</if>
  203. <if test="region != null and region != ''"> and czrk.region = #{region}</if>
  204. <if test="villageTownsId != null and villageTownsId != ''"> and czrk.village_towns_id = #{villageTownsId}</if>
  205. <if test="villageTowns != null and villageTowns != ''"> and czrk.village_towns = #{villageTowns}</if>
  206. <if test="villageId != null and villageId != ''"> and czrk.village_id = #{villageId}</if>
  207. <if test="village != null and village != ''"> and czrk.village = #{village}</if>
  208. <if test="villagerGroupId != null and villagerGroupId != ''"> and czrk.villager_group_id = #{villagerGroupId}</if>
  209. <if test="villagerGroup != null and villagerGroup != ''"> and czrk.villager_group = #{villagerGroup}</if>
  210. <if test="nowIn != null and nowIn != ''"> and czrk.now_in = #{nowIn}</if>
  211. <if test="status != null and status != ''"> and czrk.status = #{status}</if>
  212. <if test="isDel != null and isDel != ''"> and czrk.is_del = #{isDel}</if>
  213. <if test="deleteReason != null and deleteReason != ''"> and czrk.delete_reason = #{deleteReason}</if>
  214. <if test="gridId != null and gridId != ''"> and czrk.grid_id = #{gridId}</if>
  215. <if test="deptIdList != null and deptIdList.size() > 0">
  216. and czrk.dept_id in
  217. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  218. #{deptId}
  219. </foreach>
  220. </if>
  221. </where>
  222. GROUP BY czrk.id ORDER BY czrk.update_time DESC
  223. </select>
  224. <select id="listByXz" resultMap="CzrkResult">
  225. select vi.id, vi.create_time, vi.update_time, vi.is_del, vi.update_by, vi.user_name, vi.phone_num, vi.id_card
  226. , vi.gender, vi.province, vi.city, vi.region, vi.now_in, vi.house_type, vi.update_by, vi.code
  227. from czrk vi
  228. where vi.is_del = 'N' and vi.create_time &gt;= #{startTime} and vi.create_time &lt;= #{endTime}
  229. <if test="userName != null and userName != ''">
  230. and (vi.user_name like concat('%', #{userName}, '%') or vi.id_card like concat('%', #{userName}, '%'))
  231. </if>
  232. <if test="villageTowns != null and villageTowns != ''">
  233. and vi.village_towns = #{villageTowns}
  234. </if>
  235. <if test="village != null and village != ''"> and vi.village = #{village}</if>
  236. <if test="villagerGroup != null and villagerGroup != ''"> and vi.villager_group = #{villagerGroup}</if>
  237. <if test="houseType != null and houseType != ''"> and vi.house_type = #{houseType}</if>
  238. <if test="province != null and province != ''"> and vi.province = #{province}</if>
  239. <if test="city != null and city != ''"> and vi.city = #{city}</if>
  240. <if test="region != null and region != ''"> and vi.region = #{region}</if>
  241. <if test="gender != null and gender != ''"> and vi.gender = #{gender}</if>
  242. <if test="idCard != null and idCard != ''"> and vi.id_card like concat('%', #{idCard}, '%')</if>
  243. <if test="phoneNum != null and phoneNum != ''"> and vi.phone_num = #{phoneNum}</if>
  244. <!--<if test="params.startAge != null and params.startAge != ''"> and vi.age &gt;= #{params.startAge}</if>
  245. <if test="params.endAge != null and params.endAge != ''"> and vi.age &lt;= #{params.endAge}</if>-->
  246. <if test="status != null and status != ''"> and vi.status = #{status}</if>
  247. <if test="code != null and code != ''"> and vi.code = #{code}</if>
  248. <if test="birthday != null and birthday != ''"> and vi.birthday = #{birthday}</if>
  249. <if test="workUnit != null and workUnit != ''"> and vi.work_unit = #{workUnit}</if>
  250. <if test="nowIn != null and nowIn != ''"> and vi.now_in = #{nowIn}</if>
  251. <if test="gridId != null and gridId != ''"> and vi.grid_id = #{gridId}</if>
  252. <if test="deptIdList != null and deptIdList.size() > 0">
  253. and vi.dept_id in
  254. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  255. #{deptId}
  256. </foreach>
  257. </if>
  258. </select>
  259. <select id="countByCzXz" resultType="int">
  260. select count(1)
  261. from czrk vi
  262. where vi.is_del = 'N' and vi.create_time &gt;= #{startTime} and vi.create_time &lt;= #{endTime}
  263. <choose>
  264. <when test="type == 1">and vi.province_id = #{areaId}</when>
  265. <when test="type == 2">and vi.city_id = #{areaId}</when>
  266. <when test="type == 3">and vi.region_id = #{areaId}</when>
  267. <when test="type == 4">and vi.village_towns_id = #{areaId}</when>
  268. <when test="type == 5">and vi.village_id = #{areaId}</when>
  269. </choose>
  270. </select>
  271. <select id="listByCzXz" resultMap="CzrkResult">
  272. select vi.id, vi.create_time
  273. from czrk vi
  274. where vi.is_del = 'N' and vi.create_time &gt;= #{startTime} and vi.create_time &lt;= #{endTime}
  275. <choose>
  276. <when test="type == 1">and vi.province_id = #{areaId}</when>
  277. <when test="type == 2">and vi.city_id = #{areaId}</when>
  278. <when test="type == 3">and vi.region_id = #{areaId}</when>
  279. <when test="type == 4">and vi.village_towns_id = #{areaId}</when>
  280. <when test="type == 5">and vi.village_id = #{areaId}</when>
  281. </choose>
  282. </select>
  283. <select id="listByJs" resultMap="CzrkResult">
  284. select vi.id, vi.create_time, vi.update_time, vi.is_del, vi.update_by, vi.user_name, vi.phone_num, vi.id_card
  285. , vi.gender, vi.province, vi.city, vi.region, vi.now_in, vi.house_type, vi.update_by, vi.code
  286. from czrk vi
  287. where vi.is_del = 'Y' and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
  288. <if test="userName != null and userName != ''">
  289. and (vi.user_name like concat('%', #{userName}, '%') or vi.id_card like concat('%', #{userName}, '%'))
  290. </if>
  291. <if test="villageTowns != null and villageTowns != ''">
  292. and vi.village_towns = #{villageTowns}
  293. </if>
  294. <if test="village != null and village != ''"> and vi.village = #{village}</if>
  295. <if test="villagerGroup != null and villagerGroup != ''"> and vi.villager_group = #{villagerGroup}</if>
  296. <if test="houseType != null and houseType != ''"> and vi.house_type = #{houseType}</if>
  297. <if test="province != null and province != ''"> and vi.province = #{province}</if>
  298. <if test="city != null and city != ''"> and vi.city = #{city}</if>
  299. <if test="region != null and region != ''"> and vi.region = #{region}</if>
  300. <if test="userName != null and userName != ''"> and vi.user_name like concat('%', #{userName}, '%')</if>
  301. <if test="gender != null and gender != ''"> and vi.gender = #{gender}</if>
  302. <if test="idCard != null and idCard != ''"> and vi.id_card like concat('%', #{idCard}, '%')</if>
  303. <if test="phoneNum != null and phoneNum != ''"> and vi.phone_num = #{phoneNum}</if>
  304. <!--<if test="params.startAge != null and params.startAge != ''"> and vi.age &gt;= #{params.startAge}</if>
  305. <if test="params.endAge != null and params.endAge != ''"> and vi.age &lt;= #{params.endAge}</if>-->
  306. <if test="status != null and status != ''"> and vi.status = #{status}</if>
  307. <if test="code != null and code != ''"> and vi.code = #{code}</if>
  308. <if test="birthday != null and birthday != ''"> and vi.birthday = #{birthday}</if>
  309. <if test="workUnit != null and workUnit != ''"> and vi.work_unit = #{workUnit}</if>
  310. <if test="nowIn != null and nowIn != ''"> and vi.now_in = #{nowIn}</if>
  311. <if test="gridId != null and gridId != ''"> and vi.grid_id = #{gridId}</if>
  312. <if test="deptIdList != null and deptIdList.size() > 0">
  313. and vi.dept_id in
  314. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  315. #{deptId}
  316. </foreach>
  317. </if>
  318. </select>
  319. <select id="countByCzJs" resultType="int">
  320. select count(1)
  321. from czrk vi
  322. where vi.is_del = 'Y' and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
  323. <choose>
  324. <when test="type == 1">and vi.province_id = #{areaId}</when>
  325. <when test="type == 2">and vi.city_id = #{areaId}</when>
  326. <when test="type == 3">and vi.region_id = #{areaId}</when>
  327. <when test="type == 4">and vi.village_towns_id = #{areaId}</when>
  328. <when test="type == 5">and vi.village_id = #{areaId}</when>
  329. </choose>
  330. </select>
  331. <select id="listByCzJs" resultMap="CzrkResult">
  332. select vi.id, vi.update_time
  333. from czrk vi
  334. where vi.is_del = 'Y' and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
  335. <choose>
  336. <when test="type == 1">and vi.province_id = #{areaId}</when>
  337. <when test="type == 2">and vi.city_id = #{areaId}</when>
  338. <when test="type == 3">and vi.region_id = #{areaId}</when>
  339. <when test="type == 4">and vi.village_towns_id = #{areaId}</when>
  340. <when test="type == 5">and vi.village_id = #{areaId}</when>
  341. </choose>
  342. </select>
  343. <select id="listByCode" resultMap="CzrkResult">
  344. select vi.id, vi.user_name, vi.phone_num, vi.id_card, vi.gender, vi.province, vi.city, vi.region, vi.now_in
  345. , vi.house_type, vi.update_by, vi.code, vi.rlr, vi.yhzgx
  346. from czrk vi
  347. <!--把户主放第一位-->
  348. where vi.is_del = 'N' and code = #{code} order by house_type desc;
  349. </select>
  350. <select id="countCzrk" resultType="int">
  351. select count(vi.id)
  352. from czrk vi
  353. where vi.is_del = 'N'
  354. <choose>
  355. <when test="type == 1">and vi.province_id = #{areaId}</when>
  356. <when test="type == 2">and vi.city_id = #{areaId}</when>
  357. <when test="type == 3">and vi.region_id = #{areaId}</when>
  358. <when test="type == 4">and vi.village_towns_id = #{areaId}</when>
  359. <when test="type == 5">and vi.village_id = #{areaId}</when>
  360. </choose>
  361. </select>
  362. <select id="countHj1" resultType="int">
  363. select count(vi.id)
  364. from czrk vi
  365. where vi.is_del = 'N'
  366. <if test="deptIdList != null and deptIdList.size() > 0">
  367. and vi.dept_id in
  368. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  369. #{deptId}
  370. </foreach>
  371. </if>
  372. </select>
  373. <select id="countCz1" resultType="int">
  374. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
  375. where jzdz.status = 'Y'
  376. <if test="deptIdList != null and deptIdList.size() > 0">
  377. and jzdz.dept_id in
  378. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  379. #{deptId}
  380. </foreach>
  381. </if>
  382. </select>
  383. <select id="countByCzXz1" resultType="int">
  384. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
  385. where jzdz.status = 'Y' and jzdz.create_time &gt;= #{startTime} and jzdz.create_time &lt;= #{endTime}
  386. <if test="deptIdList != null and deptIdList.size() > 0">
  387. and jzdz.dept_id in
  388. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  389. #{deptId}
  390. </foreach>
  391. </if>
  392. </select>
  393. <select id="listByCzXz1" resultType="com.boman.domain.Czrk">
  394. SELECT ANY_VALUE(jzdz.id_card) idCard,
  395. ANY_VALUE(jzdz.create_time) createTime from czrk_jzdz jzdz
  396. where jzdz.status = 'Y' and jzdz.create_time &gt;= #{startTime} and jzdz.create_time &lt;= #{endTime}
  397. <if test="deptIdList != null and deptIdList.size() > 0">
  398. and jzdz.dept_id in
  399. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  400. #{deptId}
  401. </foreach>
  402. </if>
  403. group by jzdz.id_card
  404. </select>
  405. <select id="countByCzJs1" resultType="int">
  406. SELECT count(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
  407. where jzdz.status = 'N' and jzdz.update_time &gt;= #{startTime} and jzdz.update_time &lt;= #{endTime}
  408. <if test="deptIdList != null and deptIdList.size() > 0">
  409. and jzdz.dept_id in
  410. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  411. #{deptId}
  412. </foreach>
  413. </if>
  414. </select>
  415. <select id="listByCzJs1" resultType="com.boman.domain.Czrk">
  416. SELECT ANY_VALUE(id_card) idCard,
  417. ANY_VALUE(update_time) updateTime from czrk_jzdz jzdz
  418. where jzdz.status = 'N' and jzdz.update_time &gt;= #{startTime} and jzdz.update_time &lt;= #{endTime}
  419. <if test="deptIdList != null and deptIdList.size() > 0">
  420. and jzdz.dept_id in
  421. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  422. #{deptId}
  423. </foreach>
  424. </if>
  425. group by jzdz.id_card
  426. </select>
  427. <select id="countByHjXz1" resultType="int">
  428. select count(vi.id)
  429. from czrk vi
  430. where vi.is_del = 'N' and vi.create_time &gt;= #{startTime} and vi.create_time &lt;= #{endTime}
  431. <if test="deptIdList != null and deptIdList.size() > 0">
  432. and vi.dept_id in
  433. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  434. #{deptId}
  435. </foreach>
  436. </if>
  437. </select>
  438. <select id="listByHjXz1" resultMap="CzrkResult">
  439. select create_time
  440. from czrk vi
  441. where vi.is_del = 'N' and vi.create_time &gt;= #{startTime} and vi.create_time &lt;= #{endTime}
  442. <if test="deptIdList != null and deptIdList.size() > 0">
  443. and vi.dept_id in
  444. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  445. #{deptId}
  446. </foreach>
  447. </if>
  448. </select>
  449. <select id="countByHjJs1" resultType="int">
  450. select count(vi.id)
  451. from czrk vi
  452. where vi.is_del = 'Y' and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
  453. <if test="deptIdList != null and deptIdList.size() > 0">
  454. and vi.dept_id in
  455. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  456. #{deptId}
  457. </foreach>
  458. </if>
  459. </select>
  460. <select id="listByHjJs1" resultMap="CzrkResult">
  461. select vi.update_time
  462. from czrk vi
  463. where vi.is_del = 'Y' and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
  464. <if test="deptIdList != null and deptIdList.size() > 0">
  465. and vi.dept_id in
  466. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  467. #{deptId}
  468. </foreach>
  469. </if>
  470. </select>
  471. <select id="selectCzrkById" parameterType="Long" resultMap="CzrkResult">
  472. <include refid="selectCzrkVo"/>
  473. where id = #{id} limit 1
  474. </select>
  475. <select id="countIdCard" resultType="int">
  476. select count(vi.id) from czrk vi where vi.is_del = 'N' and id_card = #{idCard}
  477. </select>
  478. <select id="stsByYrl" resultType="int">
  479. select count(vi.id)
  480. from czrk vi
  481. where vi.is_del = 'N'
  482. <!-- 已认领 -->
  483. and vi.is_rl = '是'
  484. <if test="userName != null and userName != ''">
  485. and (vi.user_name like concat('%', #{userName}, '%') or vi.id_card like concat('%', #{userName}, '%'))
  486. </if>
  487. <if test="houseType != null and houseType != ''">
  488. and vi.house_type = #{houseType}
  489. </if>
  490. <if test="isConfirm != null and isConfirm != ''">
  491. and vi.is_confirm = #{isConfirm}
  492. </if>
  493. <choose>
  494. <when test="type == 1">and vi.province_id = #{areaId}</when>
  495. <when test="type == 2">and vi.city_id = #{areaId}</when>
  496. <when test="type == 3">and vi.region_id = #{areaId}</when>
  497. <when test="type == 4">and vi.village_towns_id = #{areaId}</when>
  498. <when test="type == 5">and vi.village_id = #{areaId}</when>
  499. </choose>
  500. </select>
  501. <select id="listIsRl" resultMap="CzrkResult">
  502. SELECT id, is_rl
  503. from czrk
  504. where is_del = 'N'
  505. <if test="userName != null and userName != ''">
  506. and user_name like concat('%', #{userName}, '%')
  507. </if>
  508. <choose>
  509. <when test="type == 1">and province_id = #{areaId}</when>
  510. <when test="type == 2">and city_id = #{areaId}</when>
  511. <when test="type == 3">and region_id = #{areaId}</when>
  512. <when test="type == 4">and village_towns_id = #{areaId}</when>
  513. <when test="type == 5">and village_id = #{areaId}</when>
  514. </choose>
  515. </select>
  516. <select id="getHzByCode" resultMap="CzrkResult">
  517. SELECT user_name, id_card
  518. from czrk
  519. where house_type = '是' and code = #{code} limit 1;
  520. </select>
  521. <select id="getColumnNamesByIdCard" resultType="com.alibaba.fastjson.JSONObject">
  522. SELECT id, ${columnNames}
  523. from czrk
  524. where id_card = #{idCard} limit 1;
  525. </select>
  526. <select id="stsByWrl" resultType="int">
  527. select count(vi.id)
  528. from czrk vi
  529. where vi.is_del = 'N'
  530. <!-- 未认领 -->
  531. and vi.is_rl = '否'
  532. <if test="userName != null and userName != ''">
  533. and (vi.user_name like concat('%', #{userName}, '%') or vi.id_card like concat('%', #{userName}, '%'))
  534. </if>
  535. <if test="houseType != null and houseType != ''">
  536. and vi.house_type = #{houseType}
  537. </if>
  538. <if test="isConfirm != null and isConfirm != ''">
  539. and vi.is_confirm = #{isConfirm}
  540. </if>
  541. <choose>
  542. <when test="type == 1">and vi.province_id = #{areaId}</when>
  543. <when test="type == 2">and vi.city_id = #{areaId}</when>
  544. <when test="type == 3">and vi.region_id = #{areaId}</when>
  545. <when test="type == 4">and vi.village_towns_id = #{areaId}</when>
  546. <when test="type == 5">and vi.village_id = #{areaId}</when>
  547. </choose>
  548. </select>
  549. <insert id="insertCzrk" useGeneratedKeys="true" keyProperty="id">
  550. insert into czrk
  551. <trim prefix="(" suffix=")" suffixOverrides=",">
  552. <if test="userName != null">user_name,</if>
  553. <if test="gender != null">gender,</if>
  554. <if test="age != null">age,</if>
  555. <if test="birthday != null">birthday,</if>
  556. <if test="deptId != null">dept_id,</if>
  557. <if test="idCard != null">id_card,</if>
  558. <if test="phoneNum != null">phone_num,</if>
  559. <if test="code != null">code,</if>
  560. <if test="keyIndustries != null">key_Industries,</if>
  561. <if test="houseType != null">house_type,</if>
  562. <if test="rlr != null">rlr,</if>
  563. <if test="isRl != null">is_rl,</if>
  564. <if test="rlTime != null">rl_time,</if>
  565. <if test="yhzgx != null">yhzgx,</if>
  566. <if test="workUnit != null">work_unit,</if>
  567. <if test="provinceId != null">province_id,</if>
  568. <if test="province != null">province,</if>
  569. <if test="cityId != null">city_id,</if>
  570. <if test="city != null">city,</if>
  571. <if test="regionId != null">region_id,</if>
  572. <if test="region != null">region,</if>
  573. <if test="villageTownsId != null">village_towns_id,</if>
  574. <if test="villageTowns != null">village_towns,</if>
  575. <if test="villageId != null">village_id,</if>
  576. <if test="village != null">village,</if>
  577. <if test="villagerGroupId != null">villager_group_id,</if>
  578. <if test="villagerGroup != null">villager_group,</if>
  579. <if test="nowIn != null">now_in,</if>
  580. <if test="remark != null">remark,</if>
  581. <if test="gridId != null">grid_id,</if>
  582. <if test="status != null">status,</if>
  583. <if test="isConfirm != null">is_confirm,</if>
  584. <if test="confirmInfoUser != null and confirmInfoUser != ''">confirm_info_user,</if>
  585. <if test="confirmInfoUserTime != null ">confirm_info_user_time,</if>
  586. <if test="createBy != null">create_by,</if>
  587. <if test="updateBy != null">update_by,</if>
  588. <if test="isDel != null and isDel != ''">is_del,</if>
  589. <if test="deleteReason != null">delete_reason,</if>
  590. create_time, update_time
  591. </trim>
  592. <trim prefix="values (" suffix=")" suffixOverrides=",">
  593. <if test="userName != null">#{userName},</if>
  594. <if test="gender != null">#{gender},</if>
  595. <if test="age != null">#{age},</if>
  596. <if test="birthday != null">#{birthday},</if>
  597. <if test="deptId != null">#{deptId},</if>
  598. <if test="idCard != null">#{idCard},</if>
  599. <if test="phoneNum != null">#{phoneNum},</if>
  600. <if test="code != null">#{code},</if>
  601. <if test="keyIndustries != null">#{keyIndustries},</if>
  602. <if test="houseType != null">#{houseType},</if>
  603. <if test="rlr != null">#{rlr},</if>
  604. <if test="isRl != null">#{isRl},</if>
  605. <if test="rlTime != null">#{rlTime},</if>
  606. <if test="yhzgx != null">#{yhzgx},</if>
  607. <if test="workUnit != null">#{workUnit},</if>
  608. <if test="provinceId != null">#{provinceId},</if>
  609. <if test="province != null">#{province},</if>
  610. <if test="cityId != null">#{cityId},</if>
  611. <if test="city != null">#{city},</if>
  612. <if test="regionId != null">#{regionId},</if>
  613. <if test="region != null">#{region},</if>
  614. <if test="villageTownsId != null">#{villageTownsId},</if>
  615. <if test="villageTowns != null">#{villageTowns},</if>
  616. <if test="villageId != null">#{villageId},</if>
  617. <if test="village != null">#{village},</if>
  618. <if test="villagerGroupId != null">#{villagerGroupId},</if>
  619. <if test="villagerGroup != null">#{villagerGroup},</if>
  620. <if test="nowIn != null">#{nowIn},</if>
  621. <if test="remark != null">#{remark},</if>
  622. <if test="gridId != null">#{gridId},</if>
  623. <if test="status != null">#{status},</if>
  624. <if test="isConfirm != null">#{isConfirm},</if>
  625. <if test="confirmInfoUser != null and confirmInfoUser != ''">#{confirmInfoUser},</if>
  626. <if test="confirmInfoUserTime != null ">#{confirmInfoUserTime},</if>
  627. <if test="createBy != null">#{createBy},</if>
  628. <if test="updateBy != null">#{updateBy},</if>
  629. <if test="isDel != null and isDel != ''">#{isDel},</if>
  630. <if test="deleteReason != null">#{deleteReason},</if>
  631. sysdate(), sysdate()
  632. </trim>
  633. </insert>
  634. <update id="updateCzrk" >
  635. update czrk
  636. <trim prefix="SET" suffixOverrides=",">
  637. <if test="userName != null">user_name = #{userName},</if>
  638. <if test="gender != null">gender = #{gender},</if>
  639. <if test="age != null">age = #{age},</if>
  640. <if test="birthday != null">birthday = #{birthday},</if>
  641. <if test="idCard != null">id_card = #{idCard},</if>
  642. <if test="phoneNum != null">phone_num = #{phoneNum},</if>
  643. <if test="code != null">code = #{code},</if>
  644. <if test="keyIndustries != null">key_industries = #{keyIndustries},</if>
  645. <if test="houseType != null">house_type = #{houseType},</if>
  646. <if test="rlr != null">rlr = #{rlr},</if>
  647. <if test="isRl != null">is_rl = #{isRl},</if>
  648. <if test="rlTime != null">rl_time = #{rlTime},</if>
  649. <if test="yhzgx != null">yhzgx = #{yhzgx},</if>
  650. <if test="workUnit != null">work_unit = #{workUnit},</if>
  651. <if test="provinceId != null">province_id = #{provinceId},</if>
  652. <if test="province != null">province = #{province},</if>
  653. <if test="cityId != null">city_id = #{cityId},</if>
  654. <if test="city != null">city = #{city},</if>
  655. <if test="regionId != null">region_id = #{regionId},</if>
  656. <if test="region != null">region = #{region},</if>
  657. <if test="villageTownsId != null">village_towns_id = #{villageTownsId},</if>
  658. <if test="villageTowns != null">village_towns = #{villageTowns},</if>
  659. <if test="villageId != null">village_id = #{villageId},</if>
  660. <if test="village != null">village = #{village},</if>
  661. <if test="villagerGroupId != null">villager_group_id = #{villagerGroupId},</if>
  662. <if test="villagerGroup != null">villager_group = #{villagerGroup},</if>
  663. <if test="nowIn != null">now_in = #{nowIn},</if>
  664. <if test="remark != null">remark = #{remark},</if>
  665. <if test="gridId != null">grid_id = #{gridId},</if>
  666. <if test="status != null">status = #{status},</if>
  667. <if test="isConfirm != null and isConfirm != ''">is_confirm = #{isConfirm},</if>
  668. <if test="confirmInfoUser != null and confirmInfoUser != ''">confirm_info_user = #{confirmInfoUser},</if>
  669. <if test="confirmInfoUserTime != null ">confirm_info_user_time = #{confirmInfoUserTime},</if>
  670. <if test="createBy != null">create_by = #{createBy},</if>
  671. <if test="createTime != null">create_time = #{createTime},</if>
  672. <if test="updateBy != null">update_by = #{updateBy},</if>
  673. <if test="updateTime != null">update_time = sysdate(),</if>
  674. <if test="isDel != null and isDel != ''">is_del = #{isDel},</if>
  675. <if test="deleteReason != null">delete_reason = #{deleteReason},</if>
  676. </trim>
  677. where id = #{id}
  678. </update>
  679. <delete id="deleteCzrkById" parameterType="Long">
  680. delete from czrk where id = #{id}
  681. </delete>
  682. <update id="reduction">
  683. update czrk
  684. set is_del = 'N'
  685. , update_by = #{updateBy}
  686. , update_time = sysdate()
  687. where id = #{id}
  688. </update>
  689. <!-- <delete id="deleteCzrk" parameterType="String">-->
  690. <!-- delete from czrk where id in -->
  691. <!-- <foreach item="id" collection="array" open="(" separator="," close=")">-->
  692. <!-- #{id}-->
  693. <!-- </foreach>-->
  694. <!-- </delete>-->
  695. <update id="deleteCzrk">
  696. update czrk
  697. set is_del = 'Y'
  698. , delete_reason = #{deleteReason}
  699. , update_by = #{updateBy}
  700. , update_time = sysdate()
  701. where id = #{id}
  702. </update>
  703. <select id="findHjInfo" resultMap="CzrkResult">
  704. select c.id, c.user_name ,c.gender, c.birthday,c.age,c.code,c.phone_num,c.key_industries,c.province_id,c.province,c.city_id,c.city,c.region_id,c.region,c.village_towns_id,c.village_towns,c.village_id,c.village,c.villager_group_id,c.villager_group,
  705. c.now_in,c.house_type,c.code,c.yhzgx,c.remark,
  706. cj.province_id as province_id_jzdz,cj.province as province_jzdz,cj.city_id as city_id_jzdz,cj.city as city_jzdz,cj.region_id as region_id_jzdz,cj.region as region_jzdz,cj.town_id as town_id_jzdz,cj.town as town_jzdz,cj.village_id as village_id_jzdz,cj.village as village_jzdz,cj.now_in as now_in_jzdz
  707. from czrk c left join czrk_jzdz cj on c.id_card = cj.id_card
  708. <where>
  709. c.is_del = 'N'
  710. and cj.status = 'Y'
  711. <if test="idCard != null and idCard != '' "> and c.id_card = #{idCard}</if>
  712. </where>
  713. </select>
  714. <select id="stsByAppletCz" resultMap="CzrkResult">
  715. SELECT
  716. czrk.id,
  717. czrk.is_rl
  718. from czrk
  719. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  720. <where>
  721. czrk.is_del = 'N' and jzdz.status = 'Y'
  722. <if test="userName != null and userName != ''">
  723. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  724. </if>
  725. <if test="houseType != null and houseType != ''">
  726. and czrk.house_type = #{houseType}
  727. </if>
  728. <if test="isConfirm != null and isConfirm != ''">
  729. and czrk.is_confirm = #{isConfirm}
  730. </if>
  731. <choose>
  732. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  733. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  734. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  735. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  736. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  737. </choose>
  738. <!-- <if test="provinceIdXjd != null and provinceIdXjd != ''"> and jzdz.province_id = #{areaId}</if>
  739. <if test="cityIdXjd != null and cityIdXjd != ''"> and jzdz.city_id = #{areaId}</if>
  740. <if test="regionIdXjd != null and regionIdXjd != ''"> and jzdz.region_id = #{areaId}</if>
  741. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''"> and jzdz.town_id = #{areaId}</if>
  742. <if test="villageIdXjd != null and villageIdXjd != ''"> and jzdz.village_id = #{areaId}</if>-->
  743. <!-- <if test="provinceId != null and provinceId != ''"> and czrk.province_id = #{areaId}</if>
  744. <if test="cityId != null and cityId != ''"> and czrk.city_id = #{areaId}</if>
  745. <if test="regionId != null and regionId != ''"> and czrk.region_id = #{areaId}</if>
  746. <if test="villageTownsId != null and villageTownsId != ''"> and czrk.village_towns_id = #{areaId}</if>
  747. <if test="villageId != null and villageId != ''"> and czrk.village_id = #{areaId}</if>
  748. <if test="villagerGroupId != null and villagerGroupId != ''"> and czrk.villager_group_id = #{villagerGroupId}</if>-->
  749. </where>
  750. GROUP BY czrk.id
  751. </select>
  752. <select id="countByHjXz" resultType="int">
  753. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
  754. where jzdz.status = 'Y' and jzdz.create_time &gt;= #{startTime} and jzdz.create_time &lt;= #{endTime}
  755. <!--SELECT czrk.id, czrk.create_time
  756. from czrk
  757. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  758. where czrk.is_del = 'N'
  759. <if test="userName != null and userName != ''">
  760. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  761. </if>-->
  762. <choose>
  763. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  764. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  765. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  766. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  767. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  768. </choose>
  769. <!--GROUP BY czrk.id-->
  770. </select>
  771. <select id="listByHjXz" resultMap="CzrkResult">
  772. SELECT czrk.id, czrk.create_time
  773. where czrk.is_del = 'N' and czrk.create_time &gt;= #{startTime} and czrk.create_time &lt;= #{endTime}
  774. <!-- <if test="userName != null and userName != ''">
  775. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  776. </if>-->
  777. <choose>
  778. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  779. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  780. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  781. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  782. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  783. </choose>
  784. GROUP BY czrk.id
  785. </select>
  786. <select id="countByHjJs" resultType="int">
  787. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
  788. where jzdz.status = 'N' and jzdz.update_time &gt;= #{startTime} and jzdz.update_time &lt;= #{endTime}
  789. <!-- SELECT czrk.id, czrk.update_time
  790. from czrk
  791. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  792. where czrk.is_del = 'Y' and czrk.update_time &gt;= #{startTime} and czrk.update_time &lt;= #{endTime}
  793. <if test="userName != null and userName != ''">
  794. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  795. </if>-->
  796. <choose>
  797. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  798. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  799. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  800. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  801. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  802. </choose>
  803. <!--GROUP BY czrk.id-->
  804. </select>
  805. <select id="listByHjJs" resultMap="CzrkResult">
  806. SELECT czrk.id, czrk.update_time
  807. from czrk
  808. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  809. where czrk.is_del = 'Y' and czrk.update_time &gt;= #{startTime} and czrk.update_time &lt;= #{endTime}
  810. <!-- <if test="userName != null and userName != ''">
  811. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  812. </if>-->
  813. <choose>
  814. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  815. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  816. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  817. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  818. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  819. </choose>
  820. GROUP BY czrk.id
  821. </select>
  822. <select id="countHj" resultType="int">
  823. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz where jzdz.status = 'Y'
  824. <!-- SELECT czrk.id
  825. from czrk
  826. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  827. where czrk.is_del = 'N'
  828. <if test="userName != null and userName != ''">
  829. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  830. </if>-->
  831. <choose>
  832. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  833. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  834. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  835. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  836. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  837. </choose>
  838. <!--GROUP BY czrk.id-->
  839. </select>
  840. <select id="countAll" resultType="int">
  841. select count(1) from czrk where is_del = 'N';
  842. </select>
  843. <select id="selectCzrkListByPage" parameterType="Integer" resultMap="CzrkResult">
  844. select * from czrk where village_id = '' and village_towns_id != '' and dept_id != 1 limit #{startNum}, #{endNum}
  845. </select>
  846. <select id="selectDeptNameById" parameterType="Long" resultMap="SysDeptResult">
  847. select * from sys_dept where id = #{id} limit 1;
  848. </select>
  849. <update id="confirmInfoByIds">
  850. update czrk
  851. <trim prefix="SET" suffixOverrides=",">
  852. is_confirm = 'Y',
  853. <if test="userName != null and userName !=''"> confirm_info_user = #{userName},</if>
  854. confirm_info_user_time = sysdate()
  855. </trim>
  856. where id in
  857. <foreach collection="ids" item="id" open="(" separator="," close=")">
  858. #{id}
  859. </foreach>
  860. </update>
  861. <insert id="insertConfirmInfoUser" useGeneratedKeys="true" keyProperty="id">
  862. insert into confim_info_user
  863. <trim prefix="(" suffix=")" suffixOverrides=",">
  864. <if test="confirmInfoUser != null">confirm_info_user,</if>
  865. <if test="czrkId != null">czrk_id,</if>
  866. create_time
  867. </trim>
  868. <trim prefix="values (" suffix=")" suffixOverrides=",">
  869. <if test="confirmInfoUser != null">#{confirmInfoUser},</if>
  870. <if test="czrkId != null">#{czrkId},</if>
  871. sysdate()
  872. </trim>
  873. </insert>
  874. </mapper>