CzrkMapper.xml 71 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292
  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="houseType != null and houseType != ''">and c.house_type = #{houseType}</if>
  531. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  532. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  533. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  534. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  535. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  536. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  537. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  538. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  539. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  540. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  541. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  542. </where>
  543. </select>
  544. <select id="listIsRl" resultMap="CzrkResult">
  545. SELECT id, is_rl
  546. from czrk
  547. where is_del = 'N'
  548. <if test="idCard != null and idCard != ''">
  549. and id_card like concat(#{idCard}, '%')
  550. </if>
  551. <choose>
  552. <when test="type == 1">and province_id = #{areaId}</when>
  553. <when test="type == 2">and city_id = #{areaId}</when>
  554. <when test="type == 3">and region_id = #{areaId}</when>
  555. <when test="type == 4">and village_towns_id = #{areaId}</when>
  556. <when test="type == 5">and village_id = #{areaId}</when>
  557. </choose>
  558. </select>
  559. <select id="getHzByCode" resultMap="CzrkResult">
  560. SELECT user_name, id_card
  561. from czrk
  562. where house_type = '是' and code = #{code} and is_del = 'N' limit 1;
  563. </select>
  564. <select id="getColumnNamesByIdCard" resultType="com.alibaba.fastjson.JSONObject">
  565. SELECT id, ${columnNames}
  566. from czrk
  567. where id_card = #{idCard} limit 1;
  568. </select>
  569. <select id="stsByWrl" resultType="int">
  570. select count(1)
  571. from czrk c left join czrk_jzdz z on c.id = z.czrk_id
  572. <where>
  573. c.is_del = 'N'
  574. and c.is_rl = '否'
  575. and c.is_confirm = 'N'
  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="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  585. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  586. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  587. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  588. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  589. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  590. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  591. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  592. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  593. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  594. </where>
  595. </select>
  596. <select id="stsByAll" resultType="int">
  597. select count(1)
  598. from czrk c left join czrk_jzdz z on c.id =z.czrk_id
  599. <where>
  600. c.is_del = 'N'
  601. and c.status = '1'
  602. <if test="isRl != null and isRl != ''">and c.is_rl = #{isRl}</if>
  603. <if test="userName != null and userName != ''">
  604. and c.user_name like concat(#{userName}, '%')
  605. </if>
  606. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  607. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  608. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  609. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  610. <if test="houseType != null and houseType != ''">and c.house_type = #{houseType}</if>
  611. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  612. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  613. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  614. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  615. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  616. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  617. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  618. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  619. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  620. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  621. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  622. </where>
  623. </select>
  624. <insert id="insertCzrk" useGeneratedKeys="true" keyProperty="id">
  625. insert into czrk
  626. <trim prefix="(" suffix=")" suffixOverrides=",">
  627. <if test="userName != null">user_name,</if>
  628. <if test="gender != null">gender,</if>
  629. <if test="age != null">age,</if>
  630. <if test="birthday != null">birthday,</if>
  631. <if test="deptId != null">dept_id,</if>
  632. <if test="idCard != null">id_card,</if>
  633. <if test="phoneNum != null">phone_num,</if>
  634. <if test="code != null">code,</if>
  635. <if test="keyIndustries != null">key_Industries,</if>
  636. <if test="houseType != null">house_type,</if>
  637. <if test="rlr != null">rlr,</if>
  638. <if test="isRl != null">is_rl,</if>
  639. <if test="rlTime != null">rl_time,</if>
  640. <if test="yhzgx != null">yhzgx,</if>
  641. <if test="workUnit != null">work_unit,</if>
  642. <if test="provinceId != null">province_id,</if>
  643. <if test="province != null">province,</if>
  644. <if test="cityId != null">city_id,</if>
  645. <if test="city != null">city,</if>
  646. <if test="regionId != null">region_id,</if>
  647. <if test="region != null">region,</if>
  648. <if test="villageTownsId != null">village_towns_id,</if>
  649. <if test="villageTowns != null">village_towns,</if>
  650. <if test="villageId != null">village_id,</if>
  651. <if test="village != null">village,</if>
  652. <if test="villagerGroupId != null">villager_group_id,</if>
  653. <if test="villagerGroup != null">villager_group,</if>
  654. <if test="nowIn != null">now_in,</if>
  655. <if test="remark != null">remark,</if>
  656. <if test="gridId != null">grid_id,</if>
  657. <if test="status != null">status,</if>
  658. <if test="isConfirm != null">is_confirm,</if>
  659. <if test="confirmInfoUser != null and confirmInfoUser != ''">confirm_info_user,</if>
  660. <if test="confirmInfoUserTime != null ">confirm_info_user_time,</if>
  661. <if test="createBy != null">create_by,</if>
  662. <if test="updateBy != null">update_by,</if>
  663. <if test="isDel != null and isDel != ''">is_del,</if>
  664. <if test="deleteReason != null">delete_reason,</if>
  665. create_time, update_time
  666. </trim>
  667. <trim prefix="values (" suffix=")" suffixOverrides=",">
  668. <if test="userName != null">#{userName},</if>
  669. <if test="gender != null">#{gender},</if>
  670. <if test="age != null">#{age},</if>
  671. <if test="birthday != null">#{birthday},</if>
  672. <if test="deptId != null">#{deptId},</if>
  673. <if test="idCard != null">#{idCard},</if>
  674. <if test="phoneNum != null">#{phoneNum},</if>
  675. <if test="code != null">#{code},</if>
  676. <if test="keyIndustries != null">#{keyIndustries},</if>
  677. <if test="houseType != null">#{houseType},</if>
  678. <if test="rlr != null">#{rlr},</if>
  679. <if test="isRl != null">#{isRl},</if>
  680. <if test="rlTime != null">#{rlTime},</if>
  681. <if test="yhzgx != null">#{yhzgx},</if>
  682. <if test="workUnit != null">#{workUnit},</if>
  683. <if test="provinceId != null">#{provinceId},</if>
  684. <if test="province != null">#{province},</if>
  685. <if test="cityId != null">#{cityId},</if>
  686. <if test="city != null">#{city},</if>
  687. <if test="regionId != null">#{regionId},</if>
  688. <if test="region != null">#{region},</if>
  689. <if test="villageTownsId != null">#{villageTownsId},</if>
  690. <if test="villageTowns != null">#{villageTowns},</if>
  691. <if test="villageId != null">#{villageId},</if>
  692. <if test="village != null">#{village},</if>
  693. <if test="villagerGroupId != null">#{villagerGroupId},</if>
  694. <if test="villagerGroup != null">#{villagerGroup},</if>
  695. <if test="nowIn != null">#{nowIn},</if>
  696. <if test="remark != null">#{remark},</if>
  697. <if test="gridId != null">#{gridId},</if>
  698. <if test="status != null">#{status},</if>
  699. <if test="isConfirm != null">#{isConfirm},</if>
  700. <if test="confirmInfoUser != null and confirmInfoUser != ''">#{confirmInfoUser},</if>
  701. <if test="confirmInfoUserTime != null ">#{confirmInfoUserTime},</if>
  702. <if test="createBy != null">#{createBy},</if>
  703. <if test="updateBy != null">#{updateBy},</if>
  704. <if test="isDel != null and isDel != ''">#{isDel},</if>
  705. <if test="deleteReason != null">#{deleteReason},</if>
  706. sysdate(), sysdate()
  707. </trim>
  708. </insert>
  709. <update id="updateCzrk">
  710. update czrk
  711. <trim prefix="SET" suffixOverrides=",">
  712. <if test="userName != null">user_name = #{userName},</if>
  713. <if test="gender != null">gender = #{gender},</if>
  714. <if test="age != null">age = #{age},</if>
  715. <if test="birthday != null">birthday = #{birthday},</if>
  716. <if test="idCard != null">id_card = #{idCard},</if>
  717. <if test="phoneNum != null">phone_num = #{phoneNum},</if>
  718. <if test="code != null">code = #{code},</if>
  719. <if test="keyIndustries != null">key_industries = #{keyIndustries},</if>
  720. <if test="houseType != null">house_type = #{houseType},</if>
  721. <if test="rlr != null">rlr = #{rlr},</if>
  722. <if test="rlrNike != null">rlr_nike = #{rlrNike},</if>
  723. <if test="isRl != null">is_rl = #{isRl},</if>
  724. <if test="rlTime != null">rl_time = #{rlTime},</if>
  725. <if test="yhzgx != null">yhzgx = #{yhzgx},</if>
  726. <if test="workUnit != null">work_unit = #{workUnit},</if>
  727. <if test="provinceId != ''">province_id = #{provinceId},</if>
  728. <if test="province != ''">province = #{province},</if>
  729. <if test="cityId != ''">city_id = #{cityId},</if>
  730. <if test="city != ''">city = #{city},</if>
  731. <if test="regionId != ''">region_id = #{regionId},</if>
  732. <if test="region != ''">region = #{region},</if>
  733. <if test="villageTownsId != ''">village_towns_id = #{villageTownsId},</if>
  734. <if test="villageTowns != ''">village_towns = #{villageTowns},</if>
  735. <if test="villageId != ''">village_id = #{villageId},</if>
  736. <if test="village != ''">village = #{village},</if>
  737. <if test="villagerGroupId != ''">villager_group_id = #{villagerGroupId},</if>
  738. <if test="villagerGroup != ''">villager_group = #{villagerGroup},</if>
  739. <if test="nowIn != null">now_in = #{nowIn},</if>
  740. <if test="remark != null">remark = #{remark},</if>
  741. <if test="gridId != null">grid_id = #{gridId},</if>
  742. <if test="changUser != null">chang_user = #{changUser},</if>
  743. <if test="changNikeUser != null">chang_nike_user = #{changNikeUser},</if>
  744. <if test="status != null">status = #{status},</if>
  745. <if test="isConfirm != null">is_confirm = #{isConfirm},</if>
  746. <if test="confirmInfoUser != null ">confirm_info_user = #{confirmInfoUser},</if>
  747. <if test="confirmInfoNikeUser != null">confirm_info_nike_user =
  748. #{confirmInfoNikeUser},
  749. </if>
  750. <if test="confirmInfoUserTime != null ">confirm_info_user_time = #{confirmInfoUserTime},</if>
  751. <if test="createBy != null">create_by = #{createBy},</if>
  752. <if test="createTime != null">create_time = #{createTime},</if>
  753. <if test="updateBy != null">update_by = #{updateBy},</if>
  754. <if test="isDel != null and isDel != ''">is_del = #{isDel},</if>
  755. <if test="deleteReason != null">delete_reason = #{deleteReason},</if>
  756. update_time = sysdate(),
  757. chang_user_time = #{changUserTime}
  758. </trim>
  759. where id = #{id}
  760. </update>
  761. <delete id="deleteCzrkById" parameterType="Long">
  762. delete from czrk where id = #{id}
  763. </delete>
  764. <update id="reduction">
  765. update czrk
  766. set is_del = 'N'
  767. , update_by = #{updateBy}
  768. , update_time = sysdate()
  769. ,delete_reason = ''
  770. where id = #{id}
  771. </update>
  772. <!-- <delete id="deleteCzrk" parameterType="String">-->
  773. <!-- delete from czrk where id in -->
  774. <!-- <foreach item="id" collection="array" open="(" separator="," close=")">-->
  775. <!-- #{id}-->
  776. <!-- </foreach>-->
  777. <!-- </delete>-->
  778. <update id="deleteCzrk">
  779. update czrk
  780. set is_del = 'Y'
  781. , delete_reason = #{deleteReason}
  782. , update_by = #{updateBy}
  783. , update_time = sysdate()
  784. where id = #{id}
  785. </update>
  786. <update id="updateHouseholdRegister">
  787. update czrk
  788. set province_id = #{czrk.provinceId},
  789. province = #{czrk.province},
  790. city_id = #{czrk.cityId},
  791. city = #{czrk.city},
  792. region_id = #{czrk.regionId},
  793. region = #{czrk.region},
  794. village_towns_id = #{czrk.villageTownsId},
  795. village_towns = #{czrk.villageTowns},
  796. village_id = #{czrk.villageId},
  797. village = #{czrk.village},
  798. villager_group_id = #{czrk.villagerGroupId},
  799. villager_group = #{czrk.villagerGroup},
  800. now_in = #{czrk.nowIn}
  801. where is_del = 'N' and code = #{czrk.code};
  802. </update>
  803. <select id="findHjInfo" resultMap="CzrkResult">
  804. select c.id, c.user_name ,c.gender,
  805. 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,
  806. c.now_in,c.house_type,c.code,c.yhzgx,c.remark,
  807. cj.province_id as province_id_jzdz,cj.province as province_jzdz,cj.city_id as city_id_jzdz,cj.city as
  808. city_jzdz,cj.region_id as region_id_jzdz,cj.region as region_jzdz,cj.town_id as town_id_jzdz,cj.town as
  809. town_jzdz,cj.village_id as village_id_jzdz,cj.village as village_jzdz,cj.now_in as now_in_jzdz
  810. from czrk c left join czrk_jzdz cj on c.id_card = cj.id_card
  811. <where>
  812. c.is_del = 'N'
  813. and cj.status = 'Y'
  814. <if test="idCard != null and idCard != '' ">and c.id_card = #{idCard}</if>
  815. </where>
  816. </select>
  817. <select id="stsByAppletCz" resultMap="CzrkResult">
  818. SELECT
  819. czrk.id,
  820. czrk.is_rl
  821. from czrk
  822. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  823. <where>
  824. czrk.is_del = 'N' and jzdz.status = 'Y'
  825. <if test="idCard != null and idCard != ''">
  826. and czrk.id_card = #{idCard}
  827. </if>
  828. <if test="houseType != null and houseType != ''">
  829. and czrk.house_type = #{houseType}
  830. </if>
  831. <if test="isConfirm != null and isConfirm != ''">
  832. and czrk.is_confirm = #{isConfirm}
  833. </if>
  834. <if test="userName != null and userName != ''">
  835. and czrk.user_name like concat(#{userName}, '%')
  836. </if>
  837. <choose>
  838. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  839. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  840. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  841. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  842. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  843. </choose>
  844. <!-- <if test="provinceIdXjd != null and provinceIdXjd != ''"> and jzdz.province_id = #{areaId}</if>
  845. <if test="cityIdXjd != null and cityIdXjd != ''"> and jzdz.city_id = #{areaId}</if>
  846. <if test="regionIdXjd != null and regionIdXjd != ''"> and jzdz.region_id = #{areaId}</if>
  847. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''"> and jzdz.town_id = #{areaId}</if>
  848. <if test="villageIdXjd != null and villageIdXjd != ''"> and jzdz.village_id = #{areaId}</if>-->
  849. <!-- <if test="provinceId != null and provinceId != ''"> and czrk.province_id = #{areaId}</if>
  850. <if test="cityId != null and cityId != ''"> and czrk.city_id = #{areaId}</if>
  851. <if test="regionId != null and regionId != ''"> and czrk.region_id = #{areaId}</if>
  852. <if test="villageTownsId != null and villageTownsId != ''"> and czrk.village_towns_id = #{areaId}</if>
  853. <if test="villageId != null and villageId != ''"> and czrk.village_id = #{areaId}</if>
  854. <if test="villagerGroupId != null and villagerGroupId != ''"> and czrk.villager_group_id = #{villagerGroupId}</if>-->
  855. </where>
  856. GROUP BY czrk.id
  857. </select>
  858. <select id="countByHjXz" resultType="int">
  859. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
  860. where jzdz.status = 'Y' and jzdz.create_time &gt;= #{startTime} and jzdz.create_time &lt;= #{endTime}
  861. <!--SELECT czrk.id, czrk.create_time
  862. from czrk
  863. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  864. where czrk.is_del = 'N'
  865. <if test="userName != null and userName != ''">
  866. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  867. </if>-->
  868. <choose>
  869. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  870. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  871. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  872. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  873. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  874. </choose>
  875. <!--GROUP BY czrk.id-->
  876. </select>
  877. <select id="listByHjXz" resultMap="CzrkResult">
  878. SELECT czrk.id, czrk.create_time
  879. where czrk.is_del = 'N' and czrk.create_time &gt;= #{startTime} and czrk.create_time &lt;= #{endTime}
  880. <!-- <if test="userName != null and userName != ''">
  881. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  882. </if>-->
  883. <choose>
  884. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  885. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  886. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  887. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  888. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  889. </choose>
  890. GROUP BY czrk.id
  891. </select>
  892. <select id="countByHjJs" resultType="int">
  893. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz
  894. where jzdz.status = 'N' and jzdz.update_time &gt;= #{startTime} and jzdz.update_time &lt;= #{endTime}
  895. <!-- SELECT czrk.id, czrk.update_time
  896. from czrk
  897. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  898. where czrk.is_del = 'Y' and czrk.update_time &gt;= #{startTime} and czrk.update_time &lt;= #{endTime}
  899. <if test="userName != null and userName != ''">
  900. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  901. </if>-->
  902. <choose>
  903. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  904. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  905. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  906. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  907. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  908. </choose>
  909. <!--GROUP BY czrk.id-->
  910. </select>
  911. <select id="listByHjJs" resultMap="CzrkResult">
  912. SELECT czrk.id, czrk.update_time
  913. from czrk
  914. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  915. where czrk.is_del = 'Y' and czrk.update_time &gt;= #{startTime} and czrk.update_time &lt;= #{endTime}
  916. <!-- <if test="userName != null and userName != ''">
  917. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  918. </if>-->
  919. <choose>
  920. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  921. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  922. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  923. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  924. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  925. </choose>
  926. GROUP BY czrk.id
  927. </select>
  928. <select id="countHj" resultType="int">
  929. SELECT COUNT(DISTINCT(jzdz.id_card)) from czrk_jzdz jzdz where jzdz.status = 'Y'
  930. <!-- SELECT czrk.id
  931. from czrk
  932. left join czrk_jzdz jzdz on czrk.id = jzdz.czrk_id
  933. where czrk.is_del = 'N'
  934. <if test="userName != null and userName != ''">
  935. and (czrk.user_name like concat('%', #{userName}, '%') or czrk.id_card like concat('%', #{userName}, '%'))
  936. </if>-->
  937. <choose>
  938. <when test="type == 1">and jzdz.province_id = #{areaId}</when>
  939. <when test="type == 2">and jzdz.city_id = #{areaId}</when>
  940. <when test="type == 3">and jzdz.region_id = #{areaId}</when>
  941. <when test="type == 4">and jzdz.town_id = #{areaId}</when>
  942. <when test="type == 5">and jzdz.village_id = #{areaId}</when>
  943. </choose>
  944. <!--GROUP BY czrk.id-->
  945. </select>
  946. <select id="countAll" resultType="int">
  947. select count(1) from czrk where is_del = 'N';
  948. </select>
  949. <select id="selectCzrkListByPage" parameterType="Integer" resultMap="CzrkResult">
  950. select * from czrk where village_id = '' and village_towns_id != '' and dept_id != 1 limit #{startNum}, #{endNum}
  951. </select>
  952. <select id="selectDeptNameById" parameterType="Long" resultMap="SysDeptResult">
  953. select * from sys_dept where id = #{id} limit 1;
  954. </select>
  955. <update id="confirmInfoByIds">
  956. update czrk
  957. <trim prefix="SET" suffixOverrides=",">
  958. is_confirm = 'Y',
  959. <if test="userName != null and userName !=''">confirm_info_user = #{userName},</if>
  960. confirm_info_user_time = sysdate()
  961. </trim>
  962. where id in
  963. <foreach collection="ids" item="id" open="(" separator="," close=")">
  964. #{id}
  965. </foreach>
  966. </update>
  967. <insert id="insertConfirmInfoUser" useGeneratedKeys="true" keyProperty="id">
  968. insert into confim_info_user
  969. <trim prefix="(" suffix=")" suffixOverrides=",">
  970. <if test="confirmInfoUser != null">confirm_info_user,</if>
  971. <if test="confirmInfoNikeUser != null">confirm_info_nike_user,</if>
  972. <if test="czrkId != null">czrk_id,</if>
  973. create_time
  974. </trim>
  975. <trim prefix="values (" suffix=")" suffixOverrides=",">
  976. <if test="confirmInfoUser != null">#{confirmInfoUser},</if>
  977. <if test="confirmInfoNikeUser != null">#{confirmInfoNikeUser},</if>
  978. <if test="czrkId != null">#{czrkId},</if>
  979. sysdate()
  980. </trim>
  981. </insert>
  982. <select id="selectCzrkByCode" resultType="java.lang.Integer" resultMap="CzrkResult">
  983. select id_card from czrk where is_del = 'N' and code = #{code} and house_type = '是' limit 1
  984. </select>
  985. <update id="changeCzrk" parameterType="com.boman.domain.Czrk">
  986. update czrk
  987. set status = #{status},
  988. chang_user = #{changUser},
  989. house_type = #{houseType},
  990. chang_nike_user = #{changNikeUser},
  991. chang_user_time = sysdate(),
  992. update_time = sysdate()
  993. where id = #{id};
  994. </update>
  995. <select id="selectCzrkByIdCard" resultType="java.lang.String" resultMap="CzrkResult">
  996. <include refid="selectCzrkVo"/>
  997. where is_del = 'N' and id_card = #{idCard} limit 1
  998. </select>
  999. <select id="selectLost" resultMap="CzrkResult">
  1000. <include refid="selectCzrkVo"/>
  1001. where is_confirm = 'Y' and (village_towns is null or village_towns = '') and is_del ='N'
  1002. </select>
  1003. <select id="unusualList" resultMap="CzrkResult">
  1004. select id, user_name, phone_num,dept_id, id_card, province, city, region, village_towns, village,
  1005. villager_group,status, house_type,chang_user,chang_nike_user,chang_user_time from czrk
  1006. <where>
  1007. <if test="userName != null and userName != ''">
  1008. and user_name like concat(#{userName}, '%')
  1009. </if>
  1010. <if test="params.startAge != null and params.startAge != ''">and age &gt;= #{params.startAge}</if>
  1011. <if test="params.endAge != null and params.endAge != ''">and age &lt;= #{params.endAge}</if>
  1012. <if test="status != null and status != ''">and status = #{status}</if>
  1013. <if test="age != null ">and age = #{age}</if>
  1014. <if test="idCard != null and idCard != ''">and id_card = #{idCard}</if>
  1015. <if test="phoneNum != null and phoneNum != ''">and phone_num = #{phoneNum}</if>
  1016. <if test="provinceId != null and provinceId != ''">and province_id = #{provinceId}</if>
  1017. <if test="province != null and province != ''">and province = #{province}</if>
  1018. <if test="cityId != null and cityId != ''">and city_id = #{cityId}</if>
  1019. <if test="city != null and city != ''">and city = #{city}</if>
  1020. <if test="regionId != null and regionId != ''">and region_id = #{regionId}</if>
  1021. <if test="region != null and region != ''">and region = #{region}</if>
  1022. <if test="villageTownsId != null and villageTownsId != ''">and village_towns_id = #{villageTownsId}</if>
  1023. <if test="villageTowns != null and villageTowns != ''">and village_towns = #{villageTowns}</if>
  1024. <if test="villageId != null and villageId != ''">and village_id = #{villageId}</if>
  1025. <if test="village != null and village != ''">and village = #{village}</if>
  1026. <if test="isConfirm != null and isConfirm != ''">and is_confirm = #{isConfirm}</if>
  1027. <if test="isDel != null and isDel != ''">and is_del = #{isDel}</if>
  1028. </where>
  1029. order by create_time DESC
  1030. </select>
  1031. <select id="selectCzrkListByDeptId" resultMap="CzrkResult">
  1032. select id, dept_id, create_time, is_del from czrk
  1033. where 1=1
  1034. <if test="deptIdList != null and deptIdList.size() > 0">
  1035. and dept_id in
  1036. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  1037. #{deptId}
  1038. </foreach>
  1039. </if>
  1040. </select>
  1041. <select id="getAllCzrkRegionId" resultMap="CzrkResult">
  1042. select id, dept_id, region_id, region, village_towns_id, village_towns
  1043. , village_id, village, create_time, update_time, is_del,status from czrk
  1044. where region_id = #{regionId} and is_del = 'N';
  1045. </select>
  1046. <select id="getAllCzrk" resultMap="CzrkResult">
  1047. select c.user_name,c.age, STUFF(c.id_card,7,8,'********') as id_card, c.province, c.city, c.region,
  1048. c.village_towns, c.village, c.villager_group,replace(c.now_in,'/','') as now_in,c.key_industries,
  1049. c.user_name, c.gender,c.phone_num, c.code, c.house_type, c.yhzgx,
  1050. cj.province as provinceXjd,cj.city as cityXjd,
  1051. cj.region as regionXjd,cj.town as villageTownsXjd,
  1052. cj.village as villageXjd,replace(cj.now_in,'/','') as nowXjd
  1053. from czrk c left join czrk_jzdz cj on c.id =cj.czrk_id
  1054. <where>
  1055. <!-- 已认领 -->
  1056. <if test="isRl != null and isRl != ''">and c.is_rl = #{isRl}</if>
  1057. <if test="userName != null and userName != ''">
  1058. and c.user_name like concat(#{userName}, '%')
  1059. </if>
  1060. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  1061. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  1062. <if test="gender != null and gender != ''">and c.gender = #{gender}</if>
  1063. <if test="birthday != null ">and c.birthday = #{birthday}</if>
  1064. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  1065. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  1066. <if test="code != null and code != ''">and c.code = #{code}</if>
  1067. <if test="houseType != null and houseType != ''">and c.house_type = #{houseType}</if>
  1068. <if test="rlr != null and rlr != ''">and c.rlr = #{rlr}</if>
  1069. <if test="rlTime != null ">and c.rl_time = #{rlTime}</if>
  1070. <if test="yhzgx != null and yhzgx != ''">and c.yhzgx = #{yhzgx}</if>
  1071. <if test="workUnit != null and workUnit != ''">and c.work_unit = #{workUnit}</if>
  1072. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  1073. <if test="province != null and province != ''">and c.province = #{province}</if>
  1074. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  1075. <if test="city != null and city != ''">and c.city = #{city}</if>
  1076. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  1077. <if test="region != null and region != ''">and c.region = #{region}</if>
  1078. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  1079. <if test="villageTowns != null and villageTowns != ''">and c.village_towns = #{villageTowns}</if>
  1080. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  1081. <if test="village != null and village != ''">and c.village = #{village}</if>
  1082. <!-- <if test="villagerGroupId != null and villagerGroupId != ''"> and villager_group_id = #{villagerGroupId}</if>
  1083. <if test="villagerGroup != null and villagerGroup != ''"> and villager_group = #{villagerGroup}</if>-->
  1084. <if test="nowIn != null and nowIn != ''">and c.now_in = #{nowIn}</if>
  1085. <if test="status != null and status != ''">and c.status = #{status}</if>
  1086. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  1087. <if test="isDel != null and isDel != ''">and c.is_del = #{isDel}</if>
  1088. <if test="deleteReason != null and deleteReason != ''">and c.delete_reason = #{deleteReason}</if>
  1089. <if test="gridId != null and gridId != ''">and c.grid_id = #{gridId}</if>
  1090. <if test="deptIdList != null and deptIdList.size() > 0">
  1091. and c.dept_id in
  1092. <foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
  1093. #{deptId}
  1094. </foreach>
  1095. </if>
  1096. <if test="idCardList != null and idCardList.size() > 0">
  1097. and c.id_card in
  1098. <foreach item="idCard" collection="idCardList" open="(" separator="," close=")">
  1099. #{idCard}
  1100. </foreach>
  1101. </if>
  1102. <if test="provinceIdXjd != null">and cj.province_id = #{provinceIdXjd}</if>
  1103. <if test="cityIdXjd != null">and cj.city_id = #{cityIdXjd}</if>
  1104. <if test="regionIdXjd != null">and cj.region_id = #{regionIdXjd}</if>
  1105. <if test="villageTownsIdXjd != null">and cj.town_id = #{villageTownsIdXjd}</if>
  1106. <if test="villageIdXjd != null">and cj.village_id = #{villageIdXjd}</if>
  1107. </where>
  1108. order by c.create_time DESC
  1109. </select>
  1110. <select id="listByCzrkJzdz" resultMap="CzrkResult">
  1111. select c.id, c.user_name, c.phone_num,c.dept_id, c.id_card,
  1112. z.province as provinceXjd, z.city as cityXjd,z.region as regionXjd, z.town as villageTownsXjd, z.village as
  1113. villageXjd,z.now_in,
  1114. c.gender, c.grid_id, c.house_type, c.update_by, c.code, c.rlr,c.rlr_nike,
  1115. c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
  1116. from czrk c left join czrk_jzdz z on c.id =z.czrk_id
  1117. <where>
  1118. c.is_del = 'N'
  1119. and c.status = '1'
  1120. <if test="isRl != null and isRl != ''">and c.is_rl = #{isRl}</if>
  1121. <if test="userName != null and userName != ''">
  1122. and c.user_name like concat(#{userName}, '%')
  1123. </if>
  1124. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  1125. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  1126. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  1127. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  1128. <if test="houseType != null and houseType != ''">and c.house_type = #{houseType}</if>
  1129. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  1130. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  1131. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  1132. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  1133. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  1134. <if test="isConfirm != null and isConfirm != ''">and c.is_confirm = #{isConfirm}</if>
  1135. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  1136. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  1137. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  1138. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  1139. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  1140. </where>
  1141. order by c.create_time DESC
  1142. </select>
  1143. <select id="selectCzrkByNotRl" resultMap="CzrkResult">
  1144. select c.id, c.user_name, c.phone_num,c.dept_id, c.id_card, c.gender, c.province, c.city, c.region,
  1145. c.village_towns, c.village, c.villager_group, c.grid_id
  1146. , c.house_type, c.update_by, c.code, c.rlr,c.rlr_nike, c.update_time, c.delete_reason,
  1147. c.now_in,c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
  1148. from czrk c
  1149. <where>
  1150. c.is_del = 'N'
  1151. and c.is_rl = '否'
  1152. and c.is_confirm = 'N'
  1153. and c.status in ('1','2')
  1154. <if test="userName != null and userName != ''">
  1155. and c.user_name like concat(#{userName}, '%')
  1156. </if>
  1157. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  1158. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  1159. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  1160. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  1161. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  1162. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  1163. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  1164. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  1165. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  1166. </where>
  1167. order by c.update_time DESC
  1168. </select>
  1169. <select id="selectCzrkByNotRlCz" resultMap="CzrkResult">
  1170. select c.id, c.user_name, c.phone_num, c.id_card, c.gender,
  1171. z.province as provinceXjd, z.city as cityXjd,z.region as regionXjd, z.town as villageTownsXjd, z.village as
  1172. villageXjd,z.now_in,c.grid_id
  1173. , c.house_type, c.update_by, c.code, c.rlr,c.rlr_nike, c.update_time, c.delete_reason,
  1174. c.now_in,c.is_confirm,c.confirm_info_user,c.confirm_info_nike_user,c.confirm_info_user_time
  1175. from czrk c left join czrk_jzdz z on c.id = z.czrk_id
  1176. <where>
  1177. c.is_del = 'N'
  1178. and c.is_rl = '否'
  1179. and c.is_confirm = 'N'
  1180. and c.status in ('1','2')
  1181. <if test="userName != null and userName != ''">
  1182. and c.user_name like concat(#{userName}, '%')
  1183. </if>
  1184. <if test="params.startAge != null and params.startAge != ''">and c.age &gt;= #{params.startAge}</if>
  1185. <if test="params.endAge != null and params.endAge != ''">and c.age &lt;= #{params.endAge}</if>
  1186. <if test="idCard != null and idCard != ''">and c.id_card = #{idCard}</if>
  1187. <if test="phoneNum != null and phoneNum != ''">and c.phone_num = #{phoneNum}</if>
  1188. <if test="provinceId != null and provinceId != ''">and c.province_id = #{provinceId}</if>
  1189. <if test="cityId != null and cityId != ''">and c.city_id = #{cityId}</if>
  1190. <if test="regionId != null and regionId != ''">and c.region_id = #{regionId}</if>
  1191. <if test="villageTownsId != null and villageTownsId != ''">and c.village_towns_id = #{villageTownsId}</if>
  1192. <if test="villageId != null and villageId != ''">and c.village_id = #{villageId}</if>
  1193. <if test="provinceIdXjd != null and provinceIdXjd != ''">and z.province_id = #{provinceIdXjd}</if>
  1194. <if test="cityIdXjd != null and cityIdXjd != ''">and z.city_id = #{cityIdXjd}</if>
  1195. <if test="regionIdXjd != null and regionIdXjd != ''">and z.region_id = #{regionIdXjd}</if>
  1196. <if test="villageTownsIdXjd != null and villageTownsIdXjd != ''">and z.town_id = #{villageTownsIdXjd}</if>
  1197. <if test="villageIdXjd != null and villageIdXjd != ''">and z.village_id = #{villageIdXjd}</if>
  1198. </where>
  1199. order by c.update_time DESC
  1200. </select>
  1201. <select id="listByIdCard" resultMap="CzrkResult">
  1202. select vi.id, vi.create_time, vi.update_time, vi.is_del, vi.update_by, vi.user_name, vi.phone_num, vi.id_card
  1203. , vi.gender, vi.province, vi.city, vi.region, vi.now_in, vi.house_type, vi.update_by, vi.code
  1204. from czrk vi
  1205. where vi.id_card in
  1206. <foreach item="idCard" collection="czrkIdCardList" open="(" separator="," close=")">
  1207. #{idCard}
  1208. </foreach>
  1209. </select>
  1210. </mapper>