CzrkMapper.xml 80 KB

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