CzrkMapper.xml 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390
  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. <result property="provinceXjd" column="provinceXjd"/>
  55. <result property="cityXjd" column="cityXjd"/>
  56. <result property="regionXjd" column="regionXjd"/>
  57. <result property="villageTownsXjd" column="villageTownsXjd"/>
  58. <result property="villageXjd" column="villageXjd"/>
  59. <result property="nowXjd" column="nowXjd"/>
  60. <collection property="czrkJzdzList" javaType="java.util.List" resultMap="CzrkJzdzResult"/>
  61. </resultMap>
  62. <resultMap type="com.boman.domain.CzrkJzdz" id="CzrkJzdzResult">
  63. <result property="provinceId" column="province_id_jzdz"/>
  64. <result property="province" column="province_jzdz"/>
  65. <result property="cityId" column="city_id_jzdz"/>
  66. <result property="city" column="city_jzdz"/>
  67. <result property="regionId" column="region_id_jzdz"/>
  68. <result property="region" column="region_jzdz"/>
  69. <result property="townId" column="town_id_jzdz"/>
  70. <result property="town" column="town_jzdz"/>
  71. <result property="villageId" column="village_id_jzdz"/>
  72. <result property="village" column="village_jzdz"/>
  73. <result property="nowIn" column="now_in_jzdz"/>
  74. </resultMap>
  75. <resultMap type="com.boman.domain.SysDept" id="SysDeptResult">
  76. <id property="id" column="id"/>
  77. <result property="parentId" column="parent_id"/>
  78. <result property="ancestors" column="ancestors"/>
  79. <result property="deptName" column="dept_name"/>
  80. <result property="orderNum" column="order_num"/>
  81. <result property="leader" column="leader"/>
  82. <result property="phone" column="phone"/>
  83. <result property="email" column="email"/>
  84. <result property="status" column="status"/>
  85. <result property="delFlag" column="del_flag"/>
  86. <result property="parentName" column="parent_name"/>
  87. <result property="num" column="num"/>
  88. <result property="createBy" column="create_by"/>
  89. <result property="createTime" column="create_time"/>
  90. <result property="updateBy" column="update_by"/>
  91. <result property="updateTime" column="update_time"/>
  92. </resultMap>
  93. <resultMap type="com.boman.web.core.domain.ConfirmInfoUser" id="ConfrimInforUserResult">
  94. <result property="confirmInfoUser" column="confirm_info_user"/>
  95. <result property="confirmInfoNikeUser" column="confirm_info_nike_user"/>
  96. <result property="czrkId" column="czrk_id"/>
  97. </resultMap>
  98. <sql id="selectCzrkVo">
  99. select id, user_name, gender, age, birthday,dept_id, id_card, phone_num, code, house_type, rlr,rlr_nike, rl_time, yhzgx
  100. , work_unit, province_id, province, city_id, city, region_id, region, village_towns_id, village_towns
  101. , 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
  102. , update_by, update_time, is_del, delete_reason, is_rl, key_industries from czrk
  103. </sql>
  104. <select id="listByCzrk" resultMap="CzrkResult">
  105. select id, user_name, phone_num, id_card, gender, province, city, region, village_towns, village,
  106. villager_group, grid_id, house_type, code,is_rl,
  107. rlr,rlr_nike,now_in,is_confirm,confirm_info_user,confirm_info_nike_user,confirm_info_user_time
  108. from czrk
  109. <where>
  110. is_del = 'N'
  111. and status = '1'
  112. <!-- 已认领 -->
  113. <if test="isRl != null and isRl != ''">and is_rl = #{isRl}</if>
  114. <if test="userName != null and userName != ''">
  115. and user_name like concat(#{userName}, '%')
  116. </if>
  117. <if test="params.startAge != null and params.startAge != ''">and age &gt;= #{params.startAge}</if>
  118. <if test="params.endAge != null and params.endAge != ''">and age &lt;= #{params.endAge}</if>
  119. <if test="gender != null and gender != ''">and gender = #{gender}</if>
  120. <if test="age != null ">and age = #{age}</if>
  121. <if test="birthday != null ">and birthday = #{birthday}</if>
  122. <if test="idCard != null and idCard != ''">and id_card = #{idCard}</if>
  123. <if test="phoneNum != null and phoneNum != ''">and phone_num = #{phoneNum}</if>
  124. <if test="houseType != null and houseType != ''">and house_type = #{houseType}</if>
  125. <if test="provinceId != null and provinceId != ''">and province_id = #{provinceId}</if>
  126. <if test="province != null and province != ''">and province = #{province}</if>
  127. <if test="cityId != null and cityId != ''">and city_id = #{cityId}</if>
  128. <if test="city != null and city != ''">and city = #{city}</if>
  129. <if test="regionId != null and regionId != ''">and region_id = #{regionId}</if>
  130. <if test="region != null and region != ''">and region = #{region}</if>
  131. <if test="villageTownsId != null and villageTownsId != ''">and village_towns_id = #{villageTownsId}</if>
  132. <if test="villageTowns != null and villageTowns != ''">and village_towns = #{villageTowns}</if>
  133. <if test="villageId != null and villageId != ''">and village_id = #{villageId}</if>
  134. <if test="village != null and village != ''">and village = #{village}</if>
  135. <if test="isConfirm != null and isConfirm != ''">and is_confirm = #{isConfirm}</if>
  136. <if test="gridId != null and gridId != ''">and grid_id = #{gridId}</if>
  137. </where>
  138. order by create_time DESC
  139. </select>
  140. <select id="listCzrkByJzdz" resultMap="CzrkResult">
  141. select c.id, c.user_name, c.phone_num,c.dept_id, c.id_card,
  142. c.province, c.city ,c.region , c.village_towns, c.village ,c.now_in,
  143. c.gender, c.grid_id, c.house_type, c.update_by, c.code,c.is_rl, c.rlr,c.rlr_nike,
  144. c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
  145. from czrk c left join czrk_jzdz z on c.id =z.czrk_id
  146. <where>
  147. c.is_del = 'N'
  148. and c.status = '1'
  149. <if test="isRl != null and isRl != ''">and c.is_rl = #{isRl}</if>
  150. <if test="userName != null and userName != ''">
  151. and c.user_name like concat(#{userName}, '%')
  152. </if>
  153. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  154. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  155. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  156. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  157. <if test="houseType != null and houseType != ''">and c.house_type = #{houseType}</if>
  158. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  159. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  160. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  161. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  162. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  163. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  164. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  165. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  166. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  167. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  168. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  169. </where>
  170. order by c.create_time DESC
  171. </select>
  172. <select id="listByRlryRel" resultType="com.boman.domain.Czrk">
  173. SELECT
  174. czrk.id,
  175. ANY_VALUE(czrk.user_name) userName,
  176. ANY_VALUE(czrk.phone_num) phoneNum,
  177. ANY_VALUE(czrk.id_card) idCard,
  178. ANY_VALUE(czrk.gender) gender,
  179. ANY_VALUE(czrk.province) province,
  180. ANY_VALUE(czrk.is_rl) isRl,
  181. ANY_VALUE(czrk.city) city,
  182. ANY_VALUE(czrk.region) region,
  183. ANY_VALUE(czrk.house_type) houseType,
  184. ANY_VALUE(czrk.update_by) updateBy,
  185. ANY_VALUE(czrk. CODE) CODE,
  186. ANY_VALUE(czrk.rlr) rlr,
  187. ANY_VALUE(czrk.update_time) updateTime,
  188. ANY_VALUE(czrk.delete_reason) deleteReason,
  189. ANY_VALUE(czrk.now_in) nowIn,
  190. ANY_VALUE(jzdz.province) provinceXjd,
  191. ANY_VALUE(jzdz.city) cityXjd,
  192. ANY_VALUE(jzdz.region) regionXjd,
  193. ANY_VALUE(jzdz.town) villageTownsXjd,
  194. ANY_VALUE(jzdz.village) villageXjd,
  195. ANY_VALUE(jzdz.now_in) domicile
  196. from czrk
  197. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  198. <where>
  199. jzdz.status = 'Y'
  200. <!-- 已认领 -->
  201. <if test="isRl != null and isRl != ''">and czrk.is_rl = #{isRl}</if>
  202. <if test="userName != null and userName != ''">
  203. and (czrk.user_name like concat(#{userName}, '%') or czrk.id_card like concat( #{userName}, '%'))
  204. </if>
  205. <if test="params.startAge != null and params.startAge != ''">and czrk.age &gt;= #{params.startAge}</if>
  206. <if test="params.endAge != null and params.endAge != ''">and czrk.age &lt;= #{params.endAge}</if>
  207. <if test="gender != null and gender != ''">and czrk.gender = #{gender}</if>
  208. <if test="age != null ">and czrk.age = #{age}</if>
  209. <if test="birthday != null ">and czrk.birthday = #{birthday}</if>
  210. <if test="idCard != null and idCard != ''">and czrk.id_card = #{idCard}</if>
  211. <if test="phoneNum != null and phoneNum != ''">and czrk.phone_num = #{phoneNum}</if>
  212. <if test="code != null and code != ''">and czrk.code = #{code}</if>
  213. <if test="houseType != null and houseType != ''">and czrk.house_type = #{houseType}</if>
  214. <if test="rlr != null and rlr != ''">and czrk.rlr = #{rlr}</if>
  215. <if test="rlTime != null ">and czrk.rl_time = #{rlTime}</if>
  216. <if test="yhzgx != null and yhzgx != ''">and czrk.yhzgx = #{yhzgx}</if>
  217. <if test="workUnit != null and workUnit != ''">and czrk.work_unit = #{workUnit}</if>
  218. <if test="provinceId != null and provinceId != ''">and czrk.province_id = #{provinceId}</if>
  219. <if test="provinceIdXjd != null and provinceIdXjd != ''">and jzdz.province_id = #{provinceId}</if>
  220. <if test="cityIdXjd != null and cityIdXjd != ''">and jzdz.city_id = #{cityIdXjd}</if>
  221. <if test="regionIdXjd != null and regionIdXjd != ''">and jzdz.region_id = #{regionIdXjd}</if>
  222. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and jzdz.town_id = #{villageTownsIdXjd}
  223. </if>
  224. <if test="villageIdXjd != null and villageIdXjd != ''">and jzdz.village_id = #{villageIdXjd}</if>
  225. <if test="province != null and province != ''">and czrk.province = #{province}</if>
  226. <if test="cityId != null and cityId != ''">and czrk.city_id = #{cityId}</if>
  227. <if test="city != null and city != ''">and czrk.city = #{city}</if>
  228. <if test="regionId != null and regionId != ''">and czrk.region_id = #{regionId}</if>
  229. <if test="region != null and region != ''">and czrk.region = #{region}</if>
  230. <if test="villageTownsId != null and villageTownsId != ''">and czrk.village_towns_id = #{villageTownsId}
  231. </if>
  232. <if test="villageTowns != null and villageTowns != ''">and czrk.village_towns = #{villageTowns}</if>
  233. <if test="villageId != null and villageId != ''">and czrk.village_id = #{villageId}</if>
  234. <if test="village != null and village != ''">and czrk.village = #{village}</if>
  235. <if test="villagerGroupId != null and villagerGroupId != ''">and czrk.villager_group_id =
  236. #{villagerGroupId}
  237. </if>
  238. <if test="villagerGroup != null and villagerGroup != ''">and czrk.villager_group = #{villagerGroup}</if>
  239. <if test="nowIn != null and nowIn != ''">and czrk.now_in = #{nowIn}</if>
  240. <if test="status != null and status != ''">and czrk.status = #{status}</if>
  241. <if test="isDel != null and isDel != ''">and czrk.is_del = #{isDel}</if>
  242. <if test="deleteReason != null and deleteReason != ''">and czrk.delete_reason = #{deleteReason}</if>
  243. <if test="gridId != null and gridId != ''">and czrk.grid_id = #{gridId}</if>
  244. <if test="deptIdList != null and deptIdList.size() > 0">
  245. and czrk.dept_id in
  246. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  247. #{deptId}
  248. </foreach>
  249. </if>
  250. </where>
  251. GROUP BY czrk.id ORDER BY czrk.update_time DESC
  252. </select>
  253. <select id="listByXz" resultMap="CzrkResult">
  254. select vi.id, vi.create_time, vi.update_time, vi.is_del, vi.update_by, vi.user_name, vi.phone_num, vi.id_card
  255. , vi.gender, vi.province, vi.city, vi.region, vi.now_in, vi.house_type, vi.update_by, vi.code,vi.yhzgx
  256. from czrk vi
  257. where vi.status = '1' and is_del = 'N' and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
  258. <if test="userName != null and userName != ''">
  259. and vi.user_name like concat( #{userName}, '%')
  260. </if>
  261. <if test="villageTowns != null and villageTowns != ''">
  262. and vi.village_towns = #{villageTowns}
  263. </if>
  264. <if test="village != null and village != ''">and vi.village = #{village}</if>
  265. <if test="villagerGroup != null and villagerGroup != ''">and vi.villager_group = #{villagerGroup}</if>
  266. <if test="houseType != null and houseType != ''">and vi.house_type = #{houseType}</if>
  267. <if test="province != null and province != ''">and vi.province = #{province}</if>
  268. <if test="city != null and city != ''">and vi.city = #{city}</if>
  269. <if test="regionId != null and regionId != ''">and vi.region_id = #{regionId}</if>
  270. <if test="region != null and region != ''">and vi.region = #{region}</if>
  271. <if test="gender != null and gender != ''">and vi.gender = #{gender}</if>
  272. <if test="idCard != null and idCard != ''">and vi.id_card like concat(#{idCard}, '%')</if>
  273. <if test="phoneNum != null and phoneNum != ''">and vi.phone_num = #{phoneNum}</if>
  274. <!--<if test="params.startAge != null and params.startAge != ''"> and vi.age &gt;= #{params.startAge}</if>
  275. <if test="params.endAge != null and params.endAge != ''"> and vi.age &lt;= #{params.endAge}</if>-->
  276. <if test="status != null and status != ''">and vi.status = #{status}</if>
  277. <if test="code != null and code != ''">and vi.code = #{code}</if>
  278. <if test="birthday != null and birthday != ''">and vi.birthday = #{birthday}</if>
  279. <if test="workUnit != null and workUnit != ''">and vi.work_unit = #{workUnit}</if>
  280. <if test="nowIn != null and nowIn != ''">and vi.now_in = #{nowIn}</if>
  281. <if test="gridId != null and gridId != ''">and vi.grid_id = #{gridId}</if>
  282. </select>
  283. <select id="countByCzXz" resultType="int">
  284. select count(1)
  285. from czrk vi
  286. where vi.is_del = 'N' and vi.create_time &gt;= #{startTime} and vi.create_time &lt;= #{endTime}
  287. <choose>
  288. <when test="type == 1">and vi.province_id = #{areaId}</when>
  289. <when test="type == 2">and vi.city_id = #{areaId}</when>
  290. <when test="type == 3">and vi.region_id = #{areaId}</when>
  291. <when test="type == 4">and vi.village_towns_id = #{areaId}</when>
  292. <when test="type == 5">and vi.village_id = #{areaId}</when>
  293. </choose>
  294. </select>
  295. <select id="listByCzXz" resultMap="CzrkResult">
  296. select vi.id, vi.create_time
  297. from czrk vi
  298. where vi.is_del = 'N' and vi.create_time &gt;= #{startTime} and vi.create_time &lt;= #{endTime}
  299. <choose>
  300. <when test="type == 1">and vi.province_id = #{areaId}</when>
  301. <when test="type == 2">and vi.city_id = #{areaId}</when>
  302. <when test="type == 3">and vi.region_id = #{areaId}</when>
  303. <when test="type == 4">and vi.village_towns_id = #{areaId}</when>
  304. <when test="type == 5">and vi.village_id = #{areaId}</when>
  305. </choose>
  306. </select>
  307. <select id="listByJs" resultMap="CzrkResult">
  308. select vi.id, vi.create_time, vi.update_time, vi.is_del, vi.update_by, vi.user_name, vi.phone_num, vi.id_card
  309. , vi.gender, vi.province, vi.city, vi.region, vi.now_in, vi.house_type, vi.update_by, vi.code,vi.yhzgx
  310. from czrk vi
  311. where vi.status in ('2','3','4') and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
  312. <if test="userName != null and userName != ''">
  313. and vi.user_name like concat(#{userName}, '%')
  314. </if>
  315. <if test="villageTowns != null and villageTowns != ''">
  316. and vi.village_towns = #{villageTowns}
  317. </if>
  318. <if test="village != null and village != ''">and vi.village = #{village}</if>
  319. <if test="villagerGroup != null and villagerGroup != ''">and vi.villager_group = #{villagerGroup}</if>
  320. <if test="houseType != null and houseType != ''">and vi.house_type = #{houseType}</if>
  321. <if test="province != null and province != ''">and vi.province = #{province}</if>
  322. <if test="city != null and city != ''">and vi.city = #{city}</if>
  323. <if test="regionId != null and regionId != ''">and vi.region_id = #{regionId}</if>
  324. <if test="region != null and region != ''">and vi.region = #{region}</if>
  325. <if test="userName != null and userName != ''">and vi.user_name like concat(#{userName}, '%')</if>
  326. <if test="gender != null and gender != ''">and vi.gender = #{gender}</if>
  327. <if test="idCard != null and idCard != ''">and vi.id_card like concat(#{idCard}, '%')</if>
  328. <if test="phoneNum != null and phoneNum != ''">and vi.phone_num = #{phoneNum}</if>
  329. <!--<if test="params.startAge != null and params.startAge != ''"> and vi.age &gt;= #{params.startAge}</if>
  330. <if test="params.endAge != null and params.endAge != ''"> and vi.age &lt;= #{params.endAge}</if>-->
  331. <if test="status != null and status != ''">and vi.status = #{status}</if>
  332. <if test="code != null and code != ''">and vi.code = #{code}</if>
  333. <if test="birthday != null and birthday != ''">and vi.birthday = #{birthday}</if>
  334. <if test="workUnit != null and workUnit != ''">and vi.work_unit = #{workUnit}</if>
  335. <if test="nowIn != null and nowIn != ''">and vi.now_in = #{nowIn}</if>
  336. <if test="gridId != null and gridId != ''">and vi.grid_id = #{gridId}</if>
  337. </select>
  338. <select id="countByCzJs" resultType="int">
  339. select count(1)
  340. from czrk vi
  341. where vi.is_del = 'Y' and vi.update_time &gt;= #{startTime} and vi.update_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="listByCzJs" resultMap="CzrkResult">
  351. select vi.id, vi.update_time
  352. from czrk vi
  353. where vi.is_del = 'Y' and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
  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="listByCode" resultMap="CzrkResult">
  363. select vi.id, vi.user_name, vi.phone_num, vi.id_card, vi.gender, vi.province, vi.city,
  364. vi.region,vi.village_towns,vi.village,vi.villager_group, vi.now_in
  365. , vi.house_type, vi.update_by, vi.code, vi.rlr, vi.yhzgx
  366. from czrk vi
  367. <!--把户主放第一位-->
  368. where vi.is_del = 'N' and vi.code = #{code} and vi.status = '1' order by house_type desc
  369. </select>
  370. <select id="listByCodeSynchronization" resultMap="CzrkResult">
  371. select vi.id, vi.user_name, vi.phone_num, vi.id_card, vi.gender,
  372. vi.province_id,vi.province, vi.city_id, vi.city,vi.region_id, vi.region,
  373. vi.village_towns_id, vi.village_towns, vi.village_id, vi.village, vi.villager_group_id, vi.villager_group,
  374. vi.now_in, vi.code
  375. from czrk vi
  376. <!--把户主放第一位-->
  377. where vi.is_del = 'N' and vi.code = #{code} and vi.status = '1' order by house_type desc
  378. </select>
  379. <select id="countCzrk" resultType="int">
  380. select count(vi.id)
  381. from czrk vi
  382. where vi.is_del = 'N'
  383. <choose>
  384. <when test="type == 1">and vi.province_id = #{areaId}</when>
  385. <when test="type == 2">and vi.city_id = #{areaId}</when>
  386. <when test="type == 3">and vi.region_id = #{areaId}</when>
  387. <when test="type == 4">and vi.village_towns_id = #{areaId}</when>
  388. <when test="type == 5">and vi.village_id = #{areaId}</when>
  389. </choose>
  390. </select>
  391. <select id="countHj1" resultType="int">
  392. select count(vi.id)
  393. from czrk vi
  394. where vi.is_del = 'N'
  395. <if test="deptIdList != null and deptIdList.size() > 0">
  396. and vi.dept_id in
  397. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  398. #{deptId}
  399. </foreach>
  400. </if>
  401. </select>
  402. <select id="countCz1" resultType="int">
  403. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
  404. where jzdz.status = 'Y'
  405. <if test="deptIdList != null and deptIdList.size() > 0">
  406. and jzdz.dept_id in
  407. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  408. #{deptId}
  409. </foreach>
  410. </if>
  411. </select>
  412. <select id="countByCzXz1" resultType="int">
  413. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
  414. where jzdz.status = 'Y' and jzdz.create_time &gt;= #{startTime} and jzdz.create_time &lt;= #{endTime}
  415. <if test="deptIdList != null and deptIdList.size() > 0">
  416. and jzdz.dept_id in
  417. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  418. #{deptId}
  419. </foreach>
  420. </if>
  421. </select>
  422. <select id="listByCzXz1" resultType="com.boman.domain.Czrk">
  423. SELECT ANY_VALUE(jzdz.id_card) idCard,
  424. ANY_VALUE(jzdz.create_time) createTime from czrk_jzdz jzdz
  425. where jzdz.status = 'Y' and jzdz.create_time &gt;= #{startTime} and jzdz.create_time &lt;= #{endTime}
  426. <if test="deptIdList != null and deptIdList.size() > 0">
  427. and jzdz.dept_id in
  428. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  429. #{deptId}
  430. </foreach>
  431. </if>
  432. group by jzdz.id_card
  433. </select>
  434. <select id="countByCzJs1" resultType="int">
  435. SELECT count(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
  436. where jzdz.status = 'N' and jzdz.create_time &gt;= #{startTime} and jzdz.create_time &lt;= #{endTime}
  437. <if test="deptIdList != null and deptIdList.size() > 0">
  438. and jzdz.dept_id in
  439. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  440. #{deptId}
  441. </foreach>
  442. </if>
  443. </select>
  444. <select id="listByCzJs1" resultType="com.boman.domain.Czrk">
  445. SELECT ANY_VALUE(id_card) idCard,
  446. ANY_VALUE(update_time) updateTime from czrk_jzdz jzdz
  447. where jzdz.status = 'N' and jzdz.update_time &gt;= #{startTime} and jzdz.update_time &lt;= #{endTime}
  448. <if test="deptIdList != null and deptIdList.size() > 0">
  449. and jzdz.dept_id in
  450. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  451. #{deptId}
  452. </foreach>
  453. </if>
  454. group by jzdz.id_card
  455. </select>
  456. <select id="countByHjXz1" resultType="int">
  457. select count(vi.id)
  458. from czrk vi
  459. where vi.is_del = 'N' and vi.create_time &gt;= #{startTime} and vi.create_time &lt;= #{endTime}
  460. <if test="deptIdList != null and deptIdList.size() > 0">
  461. and vi.dept_id in
  462. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  463. #{deptId}
  464. </foreach>
  465. </if>
  466. </select>
  467. <select id="listByHjXz1" resultMap="CzrkResult">
  468. select create_time
  469. from czrk vi
  470. where vi.is_del = 'N' and vi.create_time &gt;= #{startTime} and vi.create_time &lt;= #{endTime}
  471. <if test="deptIdList != null and deptIdList.size() > 0">
  472. and vi.dept_id in
  473. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  474. #{deptId}
  475. </foreach>
  476. </if>
  477. </select>
  478. <select id="countByHjJs1" resultType="int">
  479. select count(vi.id)
  480. from czrk vi
  481. where vi.is_del = 'Y' and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
  482. <if test="deptIdList != null and deptIdList.size() > 0">
  483. and vi.dept_id in
  484. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  485. #{deptId}
  486. </foreach>
  487. </if>
  488. </select>
  489. <select id="listByHjJs1" resultMap="CzrkResult">
  490. select vi.update_time
  491. from czrk vi
  492. where vi.is_del = 'Y' and vi.update_time &gt;= #{startTime} and vi.update_time &lt;= #{endTime}
  493. <if test="deptIdList != null and deptIdList.size() > 0">
  494. and vi.dept_id in
  495. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  496. #{deptId}
  497. </foreach>
  498. </if>
  499. </select>
  500. <select id="selectCzrkById" parameterType="Long" resultMap="CzrkResult">
  501. <include refid="selectCzrkVo"/>
  502. where id = #{id} and is_del = 'N' limit 1
  503. </select>
  504. <select id="selectCzrkByIds" parameterType="list" resultMap="CzrkResult">
  505. <include refid="selectCzrkVo"/>
  506. <if test="ids != null and ids.size() > 0">
  507. where id in
  508. <foreach item="id" collection="ids" open="(" separator="," close=")">
  509. #{id}
  510. </foreach>
  511. </if>
  512. </select>
  513. <select id="countIdCard" resultType="int">
  514. select count(vi.id) from czrk vi where vi.is_del = 'N' and id_card = #{idCard}
  515. </select>
  516. <select id="stsByYrl" resultType="int">
  517. select count(1)
  518. from czrk c left join czrk_jzdz z on c.id =z.czrk_id
  519. <where>
  520. c.is_del = 'N'
  521. and c.status = '1'
  522. and c.is_rl = '是'
  523. <if test="userName != null and userName != ''">
  524. and c.user_name like concat(#{userName}, '%')
  525. </if>
  526. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  527. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  528. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  529. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  530. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  531. <if test="houseType != null and houseType != ''">and c.house_type = #{houseType}</if>
  532. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  533. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  534. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  535. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  536. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  537. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  538. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  539. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  540. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  541. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  542. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  543. </where>
  544. </select>
  545. <select id="listIsRl" resultMap="CzrkResult">
  546. SELECT id, is_rl
  547. from czrk
  548. where is_del = 'N'
  549. <if test="idCard != null and idCard != ''">
  550. and id_card like concat(#{idCard}, '%')
  551. </if>
  552. <choose>
  553. <when test="type == 1">and province_id = #{areaId}</when>
  554. <when test="type == 2">and city_id = #{areaId}</when>
  555. <when test="type == 3">and region_id = #{areaId}</when>
  556. <when test="type == 4">and village_towns_id = #{areaId}</when>
  557. <when test="type == 5">and village_id = #{areaId}</when>
  558. </choose>
  559. </select>
  560. <select id="getHzByCode" resultMap="CzrkResult">
  561. SELECT user_name, id_card
  562. from czrk
  563. where house_type = '是' and code = #{code} and is_del = 'N' limit 1;
  564. </select>
  565. <select id="getColumnNamesByIdCard" resultType="com.alibaba.fastjson.JSONObject">
  566. SELECT id, ${columnNames}
  567. from czrk
  568. where id_card = #{idCard} limit 1;
  569. </select>
  570. <select id="stsByWrl" resultType="int">
  571. select count(1)
  572. from czrk c left join czrk_jzdz z on c.id = z.czrk_id
  573. <where>
  574. c.is_del = 'N'
  575. and c.is_rl = '否'
  576. and c.status = '1'
  577. <if test="userName != null and userName != ''">
  578. and c.user_name like concat(#{userName}, '%')
  579. </if>
  580. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  581. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  582. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  583. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  584. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  585. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  586. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  587. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  588. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  589. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  590. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  591. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  592. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  593. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  594. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  595. </where>
  596. </select>
  597. <select id="stsByAll" resultType="int">
  598. select count(1)
  599. from czrk c left join czrk_jzdz z on c.id =z.czrk_id
  600. <where>
  601. c.is_del = 'N'
  602. and c.status = '1'
  603. <if test="isRl != null and isRl != ''">and c.is_rl = #{isRl}</if>
  604. <if test="userName != null and userName != ''">
  605. and c.user_name like concat(#{userName}, '%')
  606. </if>
  607. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  608. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  609. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  610. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  611. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  612. <if test="houseType != null and houseType != ''">and c.house_type = #{houseType}</if>
  613. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  614. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  615. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  616. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  617. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  618. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  619. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  620. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  621. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  622. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  623. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  624. </where>
  625. </select>
  626. <insert id="insertCzrk" useGeneratedKeys="true" keyProperty="id">
  627. insert into czrk
  628. <trim prefix="(" suffix=")" suffixOverrides=",">
  629. <if test="userName != null">user_name,</if>
  630. <if test="gender != null">gender,</if>
  631. <if test="age != null">age,</if>
  632. <if test="birthday != null">birthday,</if>
  633. <if test="deptId != null">dept_id,</if>
  634. <if test="idCard != null">id_card,</if>
  635. <if test="phoneNum != null">phone_num,</if>
  636. <if test="code != null">code,</if>
  637. <if test="keyIndustries != null">key_Industries,</if>
  638. <if test="houseType != null">house_type,</if>
  639. <if test="rlr != null">rlr,</if>
  640. <if test="isRl != null">is_rl,</if>
  641. <if test="rlTime != null">rl_time,</if>
  642. <if test="yhzgx != null">yhzgx,</if>
  643. <if test="workUnit != null">work_unit,</if>
  644. <if test="provinceId != null">province_id,</if>
  645. <if test="province != null">province,</if>
  646. <if test="cityId != null">city_id,</if>
  647. <if test="city != null">city,</if>
  648. <if test="regionId != null">region_id,</if>
  649. <if test="region != null">region,</if>
  650. <if test="villageTownsId != null">village_towns_id,</if>
  651. <if test="villageTowns != null">village_towns,</if>
  652. <if test="villageId != null">village_id,</if>
  653. <if test="village != null">village,</if>
  654. <if test="villagerGroupId != null">villager_group_id,</if>
  655. <if test="villagerGroup != null">villager_group,</if>
  656. <if test="nowIn != null">now_in,</if>
  657. <if test="remark != null">remark,</if>
  658. <if test="gridId != null">grid_id,</if>
  659. <if test="status != null">status,</if>
  660. <if test="isConfirm != null">is_confirm,</if>
  661. <if test="confirmInfoUser != null and confirmInfoUser != ''">confirm_info_user,</if>
  662. <if test="confirmInfoUserTime != null ">confirm_info_user_time,</if>
  663. <if test="createBy != null">create_by,</if>
  664. <if test="updateBy != null">update_by,</if>
  665. <if test="isDel != null and isDel != ''">is_del,</if>
  666. <if test="deleteReason != null">delete_reason,</if>
  667. create_time, update_time
  668. </trim>
  669. <trim prefix="values (" suffix=")" suffixOverrides=",">
  670. <if test="userName != null">#{userName},</if>
  671. <if test="gender != null">#{gender},</if>
  672. <if test="age != null">#{age},</if>
  673. <if test="birthday != null">#{birthday},</if>
  674. <if test="deptId != null">#{deptId},</if>
  675. <if test="idCard != null">#{idCard},</if>
  676. <if test="phoneNum != null">#{phoneNum},</if>
  677. <if test="code != null">#{code},</if>
  678. <if test="keyIndustries != null">#{keyIndustries},</if>
  679. <if test="houseType != null">#{houseType},</if>
  680. <if test="rlr != null">#{rlr},</if>
  681. <if test="isRl != null">#{isRl},</if>
  682. <if test="rlTime != null">#{rlTime},</if>
  683. <if test="yhzgx != null">#{yhzgx},</if>
  684. <if test="workUnit != null">#{workUnit},</if>
  685. <if test="provinceId != null">#{provinceId},</if>
  686. <if test="province != null">#{province},</if>
  687. <if test="cityId != null">#{cityId},</if>
  688. <if test="city != null">#{city},</if>
  689. <if test="regionId != null">#{regionId},</if>
  690. <if test="region != null">#{region},</if>
  691. <if test="villageTownsId != null">#{villageTownsId},</if>
  692. <if test="villageTowns != null">#{villageTowns},</if>
  693. <if test="villageId != null">#{villageId},</if>
  694. <if test="village != null">#{village},</if>
  695. <if test="villagerGroupId != null">#{villagerGroupId},</if>
  696. <if test="villagerGroup != null">#{villagerGroup},</if>
  697. <if test="nowIn != null">#{nowIn},</if>
  698. <if test="remark != null">#{remark},</if>
  699. <if test="gridId != null">#{gridId},</if>
  700. <if test="status != null">#{status},</if>
  701. <if test="isConfirm != null">#{isConfirm},</if>
  702. <if test="confirmInfoUser != null and confirmInfoUser != ''">#{confirmInfoUser},</if>
  703. <if test="confirmInfoUserTime != null ">#{confirmInfoUserTime},</if>
  704. <if test="createBy != null">#{createBy},</if>
  705. <if test="updateBy != null">#{updateBy},</if>
  706. <if test="isDel != null and isDel != ''">#{isDel},</if>
  707. <if test="deleteReason != null">#{deleteReason},</if>
  708. sysdate(), sysdate()
  709. </trim>
  710. </insert>
  711. <update id="updateCzrk">
  712. update czrk
  713. <trim prefix="SET" suffixOverrides=",">
  714. <if test="userName != null">user_name = #{userName},</if>
  715. <if test="gender != null">gender = #{gender},</if>
  716. <if test="age != null">age = #{age},</if>
  717. <if test="birthday != null">birthday = #{birthday},</if>
  718. <if test="idCard != null">id_card = #{idCard},</if>
  719. <if test="phoneNum != null">phone_num = #{phoneNum},</if>
  720. <if test="code != null">code = #{code},</if>
  721. <if test="keyIndustries != null">key_industries = #{keyIndustries},</if>
  722. <if test="houseType != null">house_type = #{houseType},</if>
  723. <if test="rlr != null">rlr = #{rlr},</if>
  724. <if test="rlrNike != null">rlr_nike = #{rlrNike},</if>
  725. <if test="isRl != null">is_rl = #{isRl},</if>
  726. <if test="rlTime != null">rl_time = #{rlTime},</if>
  727. <if test="yhzgx != null">yhzgx = #{yhzgx},</if>
  728. <if test="workUnit != null">work_unit = #{workUnit},</if>
  729. <if test="provinceId != ''">province_id = #{provinceId},</if>
  730. <if test="province != ''">province = #{province},</if>
  731. <if test="cityId != ''">city_id = #{cityId},</if>
  732. <if test="city != ''">city = #{city},</if>
  733. <if test="regionId != ''">region_id = #{regionId},</if>
  734. <if test="region != ''">region = #{region},</if>
  735. <if test="villageTownsId != ''">village_towns_id = #{villageTownsId},</if>
  736. <if test="villageTowns != ''">village_towns = #{villageTowns},</if>
  737. <if test="villageId != ''">village_id = #{villageId},</if>
  738. <if test="village != ''">village = #{village},</if>
  739. <if test="villagerGroupId != ''">villager_group_id = #{villagerGroupId},</if>
  740. <if test="villagerGroup != ''">villager_group = #{villagerGroup},</if>
  741. <if test="nowIn != null">now_in = #{nowIn},</if>
  742. <if test="remark != null">remark = #{remark},</if>
  743. <if test="gridId != null">grid_id = #{gridId},</if>
  744. <if test="changUser != null">chang_user = #{changUser},</if>
  745. <if test="changNikeUser != null">chang_nike_user = #{changNikeUser},</if>
  746. <if test="status != null">status = #{status},</if>
  747. <if test="isConfirm != null">is_confirm = #{isConfirm},</if>
  748. <if test="confirmInfoUser != null ">confirm_info_user = #{confirmInfoUser},</if>
  749. <if test="confirmInfoNikeUser != null">confirm_info_nike_user =
  750. #{confirmInfoNikeUser},
  751. </if>
  752. <if test="confirmInfoUserTime != null ">confirm_info_user_time = #{confirmInfoUserTime},</if>
  753. <if test="createBy != null">create_by = #{createBy},</if>
  754. <if test="createTime != null">create_time = #{createTime},</if>
  755. <if test="updateBy != null">update_by = #{updateBy},</if>
  756. <if test="isDel != null and isDel != ''">is_del = #{isDel},</if>
  757. <if test="deleteReason != null">delete_reason = #{deleteReason},</if>
  758. update_time = sysdate(),
  759. chang_user_time = #{changUserTime}
  760. </trim>
  761. where id = #{id}
  762. </update>
  763. <update id="updateCzrkByNucleicAcid">
  764. update czrk
  765. set is_nucleicAcid = 'Y',nucleicAcid_time = #{nucleicAcidTime}
  766. where id_card = #{idCard}
  767. </update>
  768. <delete id="deleteCzrkById" parameterType="Long">
  769. delete from czrk where id = #{id}
  770. </delete>
  771. <update id="reduction">
  772. update czrk
  773. set is_del = 'N'
  774. , update_by = #{updateBy}
  775. , update_time = sysdate()
  776. ,delete_reason = ''
  777. where id = #{id}
  778. </update>
  779. <!-- <delete id="deleteCzrk" parameterType="String">-->
  780. <!-- delete from czrk where id in -->
  781. <!-- <foreach item="id" collection="array" open="(" separator="," close=")">-->
  782. <!-- #{id}-->
  783. <!-- </foreach>-->
  784. <!-- </delete>-->
  785. <update id="deleteCzrk">
  786. update czrk
  787. set is_del = 'Y'
  788. , delete_reason = #{deleteReason}
  789. , update_by = #{updateBy}
  790. , update_time = sysdate()
  791. where id = #{id}
  792. </update>
  793. <update id="updateHouseholdRegister">
  794. update czrk
  795. set province_id = #{czrk.provinceId},
  796. province = #{czrk.province},
  797. city_id = #{czrk.cityId},
  798. city = #{czrk.city},
  799. region_id = #{czrk.regionId},
  800. region = #{czrk.region},
  801. village_towns_id = #{czrk.villageTownsId},
  802. village_towns = #{czrk.villageTowns},
  803. village_id = #{czrk.villageId},
  804. village = #{czrk.village},
  805. villager_group_id = #{czrk.villagerGroupId},
  806. villager_group = #{czrk.villagerGroup},
  807. now_in = #{czrk.nowIn}
  808. where is_del = 'N' and code = #{czrk.code};
  809. </update>
  810. <select id="findHjInfo" resultMap="CzrkResult">
  811. select c.id, c.user_name ,c.gender,
  812. 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,
  813. c.now_in,c.house_type,c.code,c.yhzgx,c.remark,
  814. cj.province_id as province_id_jzdz,cj.province as province_jzdz,cj.city_id as city_id_jzdz,cj.city as
  815. city_jzdz,cj.region_id as region_id_jzdz,cj.region as region_jzdz,cj.town_id as town_id_jzdz,cj.town as
  816. town_jzdz,cj.village_id as village_id_jzdz,cj.village as village_jzdz,cj.now_in as now_in_jzdz
  817. from czrk c left join czrk_jzdz cj on c.id_card = cj.id_card
  818. <where>
  819. c.is_del = 'N'
  820. and cj.status = 'Y'
  821. <if test="idCard != null and idCard != '' ">and c.id_card = #{idCard}</if>
  822. </where>
  823. </select>
  824. <select id="stsByAppletCz" resultMap="CzrkResult">
  825. SELECT
  826. czrk.id,
  827. czrk.is_rl
  828. from czrk
  829. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  830. <where>
  831. czrk.is_del = 'N' and jzdz.status = 'Y'
  832. <if test="idCard != null and idCard != ''">
  833. and czrk.id_card = #{idCard}
  834. </if>
  835. <if test="houseType != null and houseType != ''">
  836. and czrk.house_type = #{houseType}
  837. </if>
  838. <if test="isConfirm != null and isConfirm != ''">
  839. and czrk.is_confirm = #{isConfirm}
  840. </if>
  841. <if test="userName != null and userName != ''">
  842. and czrk.user_name like concat(#{userName}, '%')
  843. </if>
  844. <choose>
  845. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  846. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  847. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  848. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  849. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  850. </choose>
  851. <!-- <if test="provinceIdXjd != null and provinceIdXjd != ''"> and jzdz.province_id = #{areaId}</if>
  852. <if test="cityIdXjd != null and cityIdXjd != ''"> and jzdz.city_id = #{areaId}</if>
  853. <if test="regionIdXjd != null and regionIdXjd != ''"> and jzdz.region_id = #{areaId}</if>
  854. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''"> and jzdz.town_id = #{areaId}</if>
  855. <if test="villageIdXjd != null and villageIdXjd != ''"> and jzdz.village_id = #{areaId}</if>-->
  856. <!-- <if test="provinceId != null and provinceId != ''"> and czrk.province_id = #{areaId}</if>
  857. <if test="cityId != null and cityId != ''"> and czrk.city_id = #{areaId}</if>
  858. <if test="regionId != null and regionId != ''"> and czrk.region_id = #{areaId}</if>
  859. <if test="villageTownsId != null and villageTownsId != ''"> and czrk.village_towns_id = #{areaId}</if>
  860. <if test="villageId != null and villageId != ''"> and czrk.village_id = #{areaId}</if>
  861. <if test="villagerGroupId != null and villagerGroupId != ''"> and czrk.villager_group_id = #{villagerGroupId}</if>-->
  862. </where>
  863. GROUP BY czrk.id
  864. </select>
  865. <select id="countByHjXz" resultType="int">
  866. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
  867. where jzdz.status = 'Y' and jzdz.create_time &gt;= #{startTime} and jzdz.create_time &lt;= #{endTime}
  868. <!--SELECT czrk.id, czrk.create_time
  869. from czrk
  870. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  871. where czrk.is_del = 'N'
  872. <if test="userName != null and userName != ''">
  873. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  874. </if>-->
  875. <choose>
  876. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  877. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  878. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  879. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  880. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  881. </choose>
  882. <!--GROUP BY czrk.id-->
  883. </select>
  884. <select id="listByHjXz" resultMap="CzrkResult">
  885. SELECT czrk.id, czrk.create_time
  886. where czrk.is_del = 'N' and czrk.create_time &gt;= #{startTime} and czrk.create_time &lt;= #{endTime}
  887. <!-- <if test="userName != null and userName != ''">
  888. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  889. </if>-->
  890. <choose>
  891. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  892. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  893. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  894. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  895. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  896. </choose>
  897. GROUP BY czrk.id
  898. </select>
  899. <select id="countByHjJs" resultType="int">
  900. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
  901. where jzdz.status = 'N' and jzdz.update_time &gt;= #{startTime} and jzdz.update_time &lt;= #{endTime}
  902. <!-- SELECT czrk.id, czrk.update_time
  903. from czrk
  904. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  905. where czrk.is_del = 'Y' and czrk.update_time &gt;= #{startTime} and czrk.update_time &lt;= #{endTime}
  906. <if test="userName != null and userName != ''">
  907. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  908. </if>-->
  909. <choose>
  910. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  911. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  912. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  913. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  914. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  915. </choose>
  916. <!--GROUP BY czrk.id-->
  917. </select>
  918. <select id="listByHjJs" resultMap="CzrkResult">
  919. SELECT czrk.id, czrk.update_time
  920. from czrk
  921. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  922. where czrk.is_del = 'Y' and czrk.update_time &gt;= #{startTime} and czrk.update_time &lt;= #{endTime}
  923. <!-- <if test="userName != null and userName != ''">
  924. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  925. </if>-->
  926. <choose>
  927. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  928. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  929. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  930. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  931. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  932. </choose>
  933. GROUP BY czrk.id
  934. </select>
  935. <select id="countHj" resultType="int">
  936. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz where jzdz.status = 'Y'
  937. <!-- SELECT czrk.id
  938. from czrk
  939. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  940. where czrk.is_del = 'N'
  941. <if test="userName != null and userName != ''">
  942. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  943. </if>-->
  944. <choose>
  945. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  946. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  947. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  948. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  949. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  950. </choose>
  951. <!--GROUP BY czrk.id-->
  952. </select>
  953. <select id="countAll" resultType="int">
  954. select count(1) from czrk where is_del = 'N';
  955. </select>
  956. <select id="selectCzrkListByPage" parameterType="Integer" resultMap="CzrkResult">
  957. select * from czrk where village_id = '' and village_towns_id != '' and dept_id != 1 limit #{startNum}, #{endNum}
  958. </select>
  959. <select id="selectDeptNameById" parameterType="Long" resultMap="SysDeptResult">
  960. select * from sys_dept where id = #{id} limit 1;
  961. </select>
  962. <update id="confirmInfoByIds">
  963. update czrk
  964. <trim prefix="SET" suffixOverrides=",">
  965. is_confirm = 'Y',
  966. <if test="userName != null and userName !=''">confirm_info_user = #{userName},</if>
  967. confirm_info_user_time = sysdate()
  968. </trim>
  969. where id in
  970. <foreach collection="ids" item="id" open="(" separator="," close=")">
  971. #{id}
  972. </foreach>
  973. </update>
  974. <insert id="insertConfirmInfoUser" useGeneratedKeys="true" keyProperty="id">
  975. insert into confim_info_user
  976. <trim prefix="(" suffix=")" suffixOverrides=",">
  977. <if test="confirmInfoUser != null">confirm_info_user,</if>
  978. <if test="confirmInfoNikeUser != null">confirm_info_nike_user,</if>
  979. <if test="czrkId != null">czrk_id,</if>
  980. create_time
  981. </trim>
  982. <trim prefix="values (" suffix=")" suffixOverrides=",">
  983. <if test="confirmInfoUser != null">#{confirmInfoUser},</if>
  984. <if test="confirmInfoNikeUser != null">#{confirmInfoNikeUser},</if>
  985. <if test="czrkId != null">#{czrkId},</if>
  986. sysdate()
  987. </trim>
  988. </insert>
  989. <select id="selectCzrkByCode" resultType="java.lang.Integer" resultMap="CzrkResult">
  990. select id_card from czrk where is_del = 'N' and code = #{code} and house_type = '是' limit 1
  991. </select>
  992. <update id="changeCzrk" parameterType="com.boman.domain.Czrk">
  993. update czrk
  994. set status = #{status},
  995. chang_user = #{changUser},
  996. house_type = #{houseType},
  997. chang_nike_user = #{changNikeUser},
  998. chang_user_time = sysdate(),
  999. update_time = sysdate()
  1000. where id = #{id};
  1001. </update>
  1002. <select id="selectCzrkByIdCard" resultType="java.lang.String" resultMap="CzrkResult">
  1003. <include refid="selectCzrkVo"/>
  1004. where is_del = 'N' and id_card = #{idCard} limit 1
  1005. </select>
  1006. <select id="selectLost" resultMap="CzrkResult">
  1007. <include refid="selectCzrkVo"/>
  1008. where is_confirm = 'Y' and (village_towns is null or village_towns = '') and is_del ='N'
  1009. </select>
  1010. <select id="unusualList" resultMap="CzrkResult">
  1011. select id, user_name, phone_num,dept_id, id_card, province, city, region, village_towns, village,
  1012. villager_group,status, house_type,chang_user,chang_nike_user,chang_user_time from czrk
  1013. <where>
  1014. <if test="userName != null and userName != ''">
  1015. and user_name like concat(#{userName}, '%')
  1016. </if>
  1017. <if test="params.startAge != null and params.startAge != ''">and age &gt;= #{params.startAge}</if>
  1018. <if test="params.endAge != null and params.endAge != ''">and age &lt;= #{params.endAge}</if>
  1019. <if test="status != null and status != ''">and status = #{status}</if>
  1020. <if test="age != null ">and age = #{age}</if>
  1021. <if test="idCard != null and idCard != ''">and id_card = #{idCard}</if>
  1022. <if test="phoneNum != null and phoneNum != ''">and phone_num = #{phoneNum}</if>
  1023. <if test="provinceId != null and provinceId != ''">and province_id = #{provinceId}</if>
  1024. <if test="province != null and province != ''">and province = #{province}</if>
  1025. <if test="cityId != null and cityId != ''">and city_id = #{cityId}</if>
  1026. <if test="city != null and city != ''">and city = #{city}</if>
  1027. <if test="regionId != null and regionId != ''">and region_id = #{regionId}</if>
  1028. <if test="region != null and region != ''">and region = #{region}</if>
  1029. <if test="villageTownsId != null and villageTownsId != ''">and village_towns_id = #{villageTownsId}</if>
  1030. <if test="villageTowns != null and villageTowns != ''">and village_towns = #{villageTowns}</if>
  1031. <if test="villageId != null and villageId != ''">and village_id = #{villageId}</if>
  1032. <if test="village != null and village != ''">and village = #{village}</if>
  1033. <if test="isConfirm != null and isConfirm != ''">and is_confirm = #{isConfirm}</if>
  1034. <if test="isDel != null and isDel != ''">and is_del = #{isDel}</if>
  1035. </where>
  1036. order by chang_user_time DESC
  1037. </select>
  1038. <select id="selectCzrkListByDeptId" resultMap="CzrkResult">
  1039. select id, dept_id, create_time, is_del from czrk
  1040. where 1=1
  1041. <if test="deptIdList != null and deptIdList.size() > 0">
  1042. and dept_id in
  1043. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  1044. #{deptId}
  1045. </foreach>
  1046. </if>
  1047. </select>
  1048. <select id="getAllCzrkRegionId" resultMap="CzrkResult">
  1049. select id, dept_id, region_id, region, village_towns_id, village_towns
  1050. , village_id, village, create_time, update_time, is_del,status from czrk
  1051. where region_id = #{regionId} and is_del = 'N';
  1052. </select>
  1053. <select id="getAllCzrk" resultMap="CzrkResult">
  1054. select
  1055. ANY_VALUE(c.user_name) as user_name,
  1056. ANY_VALUE(c.age) as age,
  1057. <!--ANY_VALUE(STUFF (c.id_card, 7, 8, '********')) AS id_card,-->
  1058. ANY_VALUE(c.id_card) AS id_card,
  1059. ANY_VALUE(c.province) as province,
  1060. ANY_VALUE(c.city) as city,
  1061. ANY_VALUE(c.region) as region,
  1062. ANY_VALUE(c.village_towns) as village_towns,
  1063. ANY_VALUE(c.village) as village,
  1064. ANY_VALUE(c.villager_group) as villager_group,
  1065. ANY_VALUE(REPLACE (c.now_in, '/', '')) AS now_in,
  1066. ANY_VALUE(c.key_industries) as key_industries,
  1067. ANY_VALUE(c.gender) as gender,
  1068. ANY_VALUE(c.phone_num) as phone_num,
  1069. ANY_VALUE(c.CODE) as CODE,
  1070. ANY_VALUE(c.house_type) as house_type,
  1071. ANY_VALUE(c.yhzgx) as yhzgx,
  1072. ANY_VALUE(cj.province) AS provinceXjd,
  1073. ANY_VALUE(cj.city) AS cityXjd,
  1074. ANY_VALUE(cj.region) AS regionXjd,
  1075. ANY_VALUE(cj.town) AS villageTownsXjd,
  1076. ANY_VALUE(cj.village) AS villageXjd,
  1077. ANY_VALUE(REPLACE (cj.now_in, '/', '')) AS nowXjd
  1078. from czrk c
  1079. left join czrk_jzdz cj on c.id =cj.czrk_id
  1080. <where>
  1081. c.is_del = 'N'
  1082. and c.status = '1'
  1083. <!-- 已认领 -->
  1084. <if test="isRl != null and isRl != ''">and c.is_rl = #{isRl}</if>
  1085. <if test="userName != null and userName != ''">
  1086. and c.user_name like concat(#{userName}, '%')
  1087. </if>
  1088. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  1089. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  1090. <if test="gender != null and gender != ''">and c.gender = #{gender}</if>
  1091. <if test="birthday != null ">and c.birthday = #{birthday}</if>
  1092. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  1093. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  1094. <if test="code != null and code != ''">and c.code = #{code}</if>
  1095. <if test="houseType != null and houseType != ''">and c.house_type = #{houseType}</if>
  1096. <if test="rlr != null and rlr != ''">and c.rlr = #{rlr}</if>
  1097. <if test="rlTime != null ">and c.rl_time = #{rlTime}</if>
  1098. <if test="yhzgx != null and yhzgx != ''">and c.yhzgx = #{yhzgx}</if>
  1099. <if test="workUnit != null and workUnit != ''">and c.work_unit = #{workUnit}</if>
  1100. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  1101. <if test="province != null and province != ''">and c.province = #{province}</if>
  1102. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  1103. <if test="city != null and city != ''">and c.city = #{city}</if>
  1104. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  1105. <if test="region != null and region != ''">and c.region = #{region}</if>
  1106. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  1107. <if test="villageTowns != null and villageTowns != ''">and c.village_towns = #{villageTowns}</if>
  1108. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  1109. <if test="village != null and village != ''">and c.village = #{village}</if>
  1110. <!-- <if test="villagerGroupId != null and villagerGroupId != ''"> and villager_group_id = #{villagerGroupId}</if>
  1111. <if test="villagerGroup != null and villagerGroup != ''"> and villager_group = #{villagerGroup}</if>-->
  1112. <if test="nowIn != null and nowIn != ''">and c.now_in = #{nowIn}</if>
  1113. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  1114. <if test="deleteReason != null and deleteReason != ''">and c.delete_reason = #{deleteReason}</if>
  1115. <if test="gridId != null and gridId != ''">and c.grid_id = #{gridId}</if>
  1116. <if test="deptIdList != null and deptIdList.size() > 0">
  1117. and c.dept_id in
  1118. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  1119. #{deptId}
  1120. </foreach>
  1121. </if>
  1122. <if test="idCardList != null and idCardList.size() > 0">
  1123. and c.id_card in
  1124. <foreach item="idCard" collection="idCardList" open="(" separator="," close=")">
  1125. #{idCard}
  1126. </foreach>
  1127. </if>
  1128. <if test="provinceIdXjd != null">and cj.province_id = #{provinceIdXjd}</if>
  1129. <if test="cityIdXjd != null">and cj.city_id = #{cityIdXjd}</if>
  1130. <if test="regionIdXjd != null">and cj.region_id = #{regionIdXjd}</if>
  1131. <if test="villageTownsIdXjd != null">and cj.town_id = #{villageTownsIdXjd}</if>
  1132. <if test="villageIdXjd != null">and cj.village_id = #{villageIdXjd}</if>
  1133. </where>
  1134. order by c.code ,c.house_type desc,c.id_card;
  1135. </select>
  1136. <select id="listByCzrkJzdz" resultMap="CzrkResult">
  1137. select c.id, c.user_name, c.phone_num,c.dept_id, c.id_card,
  1138. z.province as provinceXjd, z.city as cityXjd,z.region as regionXjd, z.town as villageTownsXjd, z.village as
  1139. villageXjd,z.now_in,
  1140. c.gender, c.grid_id, c.house_type, c.update_by, c.code, c.rlr,c.rlr_nike,
  1141. c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
  1142. from czrk c left join czrk_jzdz z on c.id =z.czrk_id
  1143. <where>
  1144. c.is_del = 'N'
  1145. and c.status = '1'
  1146. <if test="isRl != null and isRl != ''">and c.is_rl = #{isRl}</if>
  1147. <if test="userName != null and userName != ''">
  1148. and c.user_name like concat(#{userName}, '%')
  1149. </if>
  1150. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  1151. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  1152. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  1153. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  1154. <if test="houseType != null and houseType != ''">and c.house_type = #{houseType}</if>
  1155. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  1156. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  1157. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  1158. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  1159. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  1160. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  1161. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  1162. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  1163. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  1164. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  1165. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  1166. </where>
  1167. order by c.create_time DESC
  1168. </select>
  1169. <select id="selectCzrkByNotRl" resultMap="CzrkResult">
  1170. select c.id, c.user_name, c.phone_num,c.dept_id, c.id_card, c.gender, c.province, c.city, c.region,
  1171. c.village_towns, c.village, c.villager_group, c.grid_id
  1172. , c.house_type, c.update_by, c.code, c.rlr,c.rlr_nike, c.update_time, c.delete_reason,
  1173. c.now_in,c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
  1174. from czrk c
  1175. <where>
  1176. c.is_del = 'N'
  1177. and c.is_rl = '否'
  1178. and c.is_confirm = 'N'
  1179. and c.status in ('1','2')
  1180. <if test="userName != null and userName != ''">
  1181. and c.user_name like concat(#{userName}, '%')
  1182. </if>
  1183. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  1184. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  1185. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  1186. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  1187. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  1188. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  1189. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  1190. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  1191. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  1192. </where>
  1193. order by c.update_time DESC
  1194. </select>
  1195. <select id="selectCzrkByNotRlCz" resultMap="CzrkResult">
  1196. select c.id, c.user_name, c.phone_num, c.id_card, c.gender,
  1197. z.province as provinceXjd, z.city as cityXjd,z.region as regionXjd, z.town as villageTownsXjd, z.village as
  1198. villageXjd,z.now_in,c.grid_id
  1199. , c.house_type, c.update_by, c.code, c.rlr,c.rlr_nike, c.update_time, c.delete_reason,
  1200. c.now_in,c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
  1201. from czrk c left join czrk_jzdz z on c.id = z.czrk_id
  1202. <where>
  1203. c.is_del = 'N'
  1204. and c.is_rl = '否'
  1205. and c.is_confirm = 'N'
  1206. and c.status in ('1','2')
  1207. <if test="userName != null and userName != ''">
  1208. and c.user_name like concat(#{userName}, '%')
  1209. </if>
  1210. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  1211. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  1212. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  1213. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  1214. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  1215. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  1216. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  1217. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  1218. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  1219. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  1220. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  1221. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  1222. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  1223. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  1224. </where>
  1225. order by c.update_time DESC
  1226. </select>
  1227. <select id="listByIdCard" resultMap="CzrkResult">
  1228. select vi.id, vi.create_time, vi.update_time, vi.is_del, vi.update_by, vi.user_name, vi.phone_num, vi.id_card
  1229. , vi.gender, vi.province, vi.city, vi.region, vi.now_in, vi.house_type, vi.update_by, vi.code
  1230. from czrk vi
  1231. where vi.id_card in
  1232. <foreach item="idCard" collection="czrkIdCardList" open="(" separator="," close=")">
  1233. #{idCard}
  1234. </foreach>
  1235. </select>
  1236. <select id="selectCzrkCount" resultType="long">
  1237. select ifnull(count(1),0)
  1238. from czrk
  1239. <where>
  1240. is_del = 'N'
  1241. and status = '1'
  1242. <!-- 已认领 -->
  1243. <if test="isRl != null and isRl != ''">and is_rl = #{isRl}</if>
  1244. <if test="userName != null and userName != ''">
  1245. and user_name like concat(#{userName}, '%')
  1246. </if>
  1247. <if test="params.startAge != null and params.startAge != ''">and age &gt;= #{params.startAge}</if>
  1248. <if test="params.endAge != null and params.endAge != ''">and age &lt;= #{params.endAge}</if>
  1249. <if test="gender != null and gender != ''">and gender = #{gender}</if>
  1250. <if test="age != null ">and age = #{age}</if>
  1251. <if test="birthday != null ">and birthday = #{birthday}</if>
  1252. <if test="idCard != null and idCard != ''">and id_card = #{idCard}</if>
  1253. <if test="phoneNum != null and phoneNum != ''">and phone_num = #{phoneNum}</if>
  1254. <if test="isConfirm != null and isConfirm != ''">and is_confirm = #{isConfirm}</if>
  1255. <if test="houseType != null and houseType != ''">and house_type = #{houseType}</if>
  1256. <if test="provinceId != null and provinceId != ''">and province_id = #{provinceId}</if>
  1257. <if test="province != null and province != ''">and province = #{province}</if>
  1258. <if test="cityId != null and cityId != ''">and city_id = #{cityId}</if>
  1259. <if test="city != null and city != ''">and city = #{city}</if>
  1260. <if test="regionId != null and regionId != ''">and region_id = #{regionId}</if>
  1261. <if test="region != null and region != ''">and region = #{region}</if>
  1262. <if test="villageTownsId != null and villageTownsId != ''">and village_towns_id = #{villageTownsId}</if>
  1263. <if test="villageTowns != null and villageTowns != ''">and village_towns = #{villageTowns}</if>
  1264. <if test="villageId != null and villageId != ''">and village_id = #{villageId}</if>
  1265. <if test="village != null and village != ''">and village = #{village}</if>
  1266. <if test="isConfirm != null and isConfirm != ''">and is_confirm = #{isConfirm}</if>
  1267. <if test="gridId != null and gridId != ''">and grid_id = #{gridId}</if>
  1268. </where>
  1269. order by create_time DESC
  1270. </select>
  1271. <select id="selectCzrkJzdzCount" resultType="long">
  1272. select ifnull(count(1),0)
  1273. from czrk c left join czrk_jzdz z on c.id =z.czrk_id
  1274. <where>
  1275. c.is_del = 'N'
  1276. and c.status = '1'
  1277. <if test="isRl != null and isRl != ''">and c.is_rl = #{isRl}</if>
  1278. <if test="userName != null and userName != ''">
  1279. and c.user_name like concat(#{userName}, '%')
  1280. </if>
  1281. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  1282. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  1283. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  1284. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  1285. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  1286. <if test="houseType != null and houseType != ''">and c.house_type = #{houseType}</if>
  1287. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  1288. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  1289. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  1290. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  1291. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  1292. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  1293. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  1294. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  1295. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  1296. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  1297. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  1298. </where>
  1299. order by c.create_time DESC
  1300. </select>
  1301. <select id="getCzrkByIdCard" resultMap="CzrkResult">
  1302. select id,id_card,house_type from czrk where is_del = 'N' and id_card = #{idCard}
  1303. </select>
  1304. </mapper>