CzrkMapper.xml 62 KB

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