TUserProfileMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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.ruoyi.system.mapper.TUserProfileMapper">
  6. <resultMap type="TUserProfile" id="TUserProfileResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="gender" column="gender" />
  10. <result property="sfzid" column="sfzid" />
  11. <result property="telOne" column="tel_one" />
  12. <result property="telTwo" column="tel_two" />
  13. <result property="telThree" column="tel_three" />
  14. <result property="birthday" column="birthday" />
  15. <result property="age" column="age" />
  16. <result property="marrStatus" column="marr_status" />
  17. <result property="national" column="national" />
  18. <result property="local" column="local" />
  19. <result property="clientType" column="client_type" />
  20. <result property="liveStatus" column="live_status" />
  21. <result property="familyAddress" column="family_address" />
  22. <result property="detailAddress" column="detail_address" />
  23. <result property="houseAddress" column="house_address" />
  24. <result property="houseDetailAddress" column="house_detail_address" />
  25. <result property="serviceid" column="serviceid" />
  26. <result property="oldmenStatus" column="oldmen_status" />
  27. <result property="changeContent" column="change_content" />
  28. <result property="loseMonth" column="lose_month" />
  29. <result property="treatMonth" column="treat_month" />
  30. <result property="isTreat" column="is_treat" />
  31. <result property="serviceType" column="service_type" />
  32. <result property="treateSure" column="treate_sure" />
  33. <result property="moneyCome" column="money_come" />
  34. <result property="moneyMonth" column="money_month" />
  35. <result property="cardCode" column="card_code" />
  36. <result property="slowIllness" column="slow_illness" />
  37. <result property="bloodType" column="blood_type" />
  38. <result property="shiStatus" column="shi_status" />
  39. <result property="disablityStatus" column="disablity_status" />
  40. <result property="disablityEntry" column="disablity_entry" />
  41. <result property="educaLevel" column="educa_level" />
  42. <result property="special" column="special" />
  43. <result property="title" column="title" />
  44. <result property="unity" column="unity" />
  45. <result property="natureHeart" column="nature_heart" />
  46. <result property="eatPoint" column="eat_point" />
  47. <result property="speciality" column="speciality" />
  48. <result property="hobby" column="hobby" />
  49. <result property="photo" column="photo" />
  50. <result property="otherPhoto" column="other_photo" />
  51. <result property="remarks" column="remarks" />
  52. <result property="createTime" column="createtime" />
  53. </resultMap>
  54. <resultMap id="TUserProfileTEmergentPeopleResult" type="TUserProfile" extends="TUserProfileResult">
  55. <collection property="tEmergentPeopleList" notNullColumn="sub_id" javaType="java.util.List" resultMap="TEmergentPeopleResult" />
  56. </resultMap>
  57. <resultMap type="TEmergentPeople" id="TEmergentPeopleResult">
  58. <result property="id" column="sub_id" />
  59. <result property="profileId" column="sub_profile_id" />
  60. <result property="name" column="sub_name" />
  61. <result property="telno" column="sub_telno" />
  62. <result property="relation" column="sub_relation" />
  63. <result property="isConn" column="sub_is_conn" />
  64. </resultMap>
  65. <sql id="selectTUserProfileVo">
  66. select id, name, gender, sfzid, tel_one, tel_two, tel_three, birthday, age, marr_status, national, local, client_type, live_status, family_address, detail_address, house_address, house_detail_address, serviceid, oldmen_status, change_content, lose_month, treat_month, is_treat, service_type, treate_sure, money_come, money_month, card_code, slow_illness, blood_type, shi_status, disablity_status, disablity_entry, educa_level, special, title, unity, nature_heart, eat_point, speciality, hobby, photo, other_photo, remarks, createtime from t_user_profile
  67. </sql>
  68. <select id="selectTUserProfileList" parameterType="TUserProfile" resultMap="TUserProfileResult">
  69. <include refid="selectTUserProfileVo"/>
  70. <where>
  71. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  72. <if test="gender != null "> and gender = #{gender}</if>
  73. <if test="sfzid != null and sfzid != ''"> and sfzid = #{sfzid}</if>
  74. <if test="telOne != null and telOne != ''"> and tel_one = #{telOne}</if>
  75. <if test="telTwo != null and telTwo != ''"> and tel_two = #{telTwo}</if>
  76. <if test="telThree != null and telThree != ''"> and tel_three = #{telThree}</if>
  77. <if test="birthday != null and birthday != ''"> and birthday = #{birthday}</if>
  78. <if test="age != null "> and age = #{age}</if>
  79. <if test="marrStatus != null "> and marr_status = #{marrStatus}</if>
  80. <if test="national != null "> and national = #{national}</if>
  81. <if test="local != null "> and local = #{local}</if>
  82. <if test="clientType != null "> and client_type = #{clientType}</if>
  83. <if test="liveStatus != null "> and live_status = #{liveStatus}</if>
  84. <if test="familyAddress != null and familyAddress != ''"> and family_address = #{familyAddress}</if>
  85. <if test="detailAddress != null and detailAddress != ''"> and detail_address = #{detailAddress}</if>
  86. <if test="houseAddress != null and houseAddress != ''"> and house_address = #{houseAddress}</if>
  87. <if test="houseDetailAddress != null and houseDetailAddress != ''"> and house_detail_address = #{houseDetailAddress}</if>
  88. <if test="serviceid != null "> and serviceid = #{serviceid}</if>
  89. <if test="oldmenStatus != null and oldmenStatus != ''"> and oldmen_status = #{oldmenStatus}</if>
  90. <if test="changeContent != null and changeContent != ''"> and change_content = #{changeContent}</if>
  91. <if test="loseMonth != null and loseMonth != ''"> and lose_month = #{loseMonth}</if>
  92. <if test="treatMonth != null and treatMonth != ''"> and treat_month = #{treatMonth}</if>
  93. <if test="isTreat != null "> and is_treat = #{isTreat}</if>
  94. <if test="serviceType != null "> and service_type = #{serviceType}</if>
  95. <if test="treateSure != null "> and treate_sure = #{treateSure}</if>
  96. <if test="moneyCome != null "> and money_come = #{moneyCome}</if>
  97. <if test="moneyMonth != null and moneyMonth != ''"> and money_month = #{moneyMonth}</if>
  98. <if test="cardCode != null and cardCode != ''"> and card_code = #{cardCode}</if>
  99. <if test="slowIllness != null and slowIllness != ''"> and slow_illness = #{slowIllness}</if>
  100. <if test="bloodType != null "> and blood_type = #{bloodType}</if>
  101. <if test="shiStatus != null "> and shi_status = #{shiStatus}</if>
  102. <if test="disablityStatus != null "> and disablity_status = #{disablityStatus}</if>
  103. <if test="disablityEntry != null "> and disablity_entry = #{disablityEntry}</if>
  104. <if test="educaLevel != null "> and educa_level = #{educaLevel}</if>
  105. <if test="special != null and special != ''"> and special = #{special}</if>
  106. <if test="title != null and title != ''"> and title = #{title}</if>
  107. <if test="unity != null and unity != ''"> and unity = #{unity}</if>
  108. <if test="natureHeart != null and natureHeart != ''"> and nature_heart = #{natureHeart}</if>
  109. <if test="eatPoint != null and eatPoint != ''"> and eat_point = #{eatPoint}</if>
  110. <if test="speciality != null and speciality != ''"> and speciality = #{speciality}</if>
  111. <if test="hobby != null and hobby != ''"> and hobby = #{hobby}</if>
  112. <if test="photo != null and photo != ''"> and photo = #{photo}</if>
  113. <if test="otherPhoto != null and otherPhoto != ''"> and other_photo = #{otherPhoto}</if>
  114. <if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
  115. <if test="createTime != null "> and createtime = #{createTime}</if>
  116. </where>
  117. </select>
  118. <select id="selectTUserProfileById" parameterType="Integer" resultMap="TUserProfileTEmergentPeopleResult">
  119. select a.id, a.name, a.gender, a.sfzid, a.tel_one, a.tel_two, a.tel_three, a.birthday, a.age, a.marr_status, a.national, a.local, a.client_type, a.live_status, a.family_address, a.detail_address, a.house_address, a.house_detail_address, a.serviceid, a.oldmen_status, a.change_content, a.lose_month, a.treat_month, a.is_treat, a.service_type, a.treate_sure, a.money_come, a.money_month, a.card_code, a.slow_illness, a.blood_type, a.shi_status, a.disablity_status, a.disablity_entry, a.educa_level, a.special, a.title, a.unity, a.nature_heart, a.eat_point, a.speciality, a.hobby, a.photo, a.other_photo, a.remarks, a.createtime,
  120. b.id as sub_id, b.profile_id as sub_profile_id, b.name as sub_name, b.telno as sub_telno, b.relation as sub_relation, b.is_conn as sub_is_conn
  121. from t_user_profile a
  122. left join t_emergent_people b on b.profile_id = a.id
  123. where a.id = #{id}
  124. </select>
  125. <select id="selectTUserProfileListByDevice" resultType="com.ruoyi.system.domain.dto.TUserProfileDto">
  126. select id, name, gender, sfzid, tel_one, age, family_address from t_user_profile
  127. <where>
  128. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  129. <if test="gender != null "> and gender = #{gender}</if>
  130. <if test="sfzid != null and sfzid != ''"> and sfzid = #{sfzid}</if>
  131. <if test="telOne != null and telOne != ''"> and tel_one = #{telOne}</if>
  132. <if test="age != null "> and age = #{age}</if>
  133. <if test="familyAddress != null and familyAddress != ''"> and family_address = #{familyAddress}</if>
  134. </where>
  135. </select>
  136. <select id="selectTUserProfileBySfzId" resultType="com.ruoyi.system.domain.TUserProfile">
  137. select * from t_user_profile
  138. where sfzid = #{sfzid}
  139. </select>
  140. <select id="selectuserAgeDto" resultType="com.ruoyi.system.domain.dto.UserAgeDto">
  141. SELECT
  142. CASE
  143. WHEN age IS NULL THEN
  144. '未知'
  145. WHEN age &gt;= 10
  146. AND age &lt; 20 THEN
  147. '10'
  148. WHEN age &gt;= 20
  149. AND age &lt; 30 THEN
  150. '20'
  151. WHEN age &gt;= 30
  152. AND age &lt; 40 THEN
  153. '30'
  154. WHEN age &gt;= 40
  155. AND age &lt; 50 THEN
  156. '40'
  157. WHEN age &gt;= 50
  158. AND age &lt; 60 THEN
  159. '50'
  160. WHEN age &gt;= 60
  161. AND age &lt; 70 THEN
  162. '60'
  163. WHEN age &gt;= 70
  164. AND age &lt; 80 THEN
  165. '70'
  166. WHEN age &gt;= 80
  167. AND age &lt; 90 THEN
  168. '80'
  169. WHEN age &gt; 90 THEN
  170. '100以上'
  171. END AS age,
  172. count(*) AS count
  173. FROM
  174. t_user_profile
  175. GROUP BY
  176. CASE
  177. WHEN age IS NULL THEN
  178. '未知'
  179. WHEN age &gt;= 10
  180. AND age &lt; 20 THEN
  181. '10'
  182. WHEN age &gt;= 20
  183. AND age &lt; 30 THEN
  184. '20'
  185. WHEN age &gt;= 30
  186. AND age &lt; 40 THEN
  187. '30'
  188. WHEN age &gt;= 40
  189. AND age &lt; 50 THEN
  190. '40'
  191. WHEN age &gt;= 50
  192. AND age &lt; 60 THEN
  193. '50'
  194. WHEN age &gt;= 60
  195. AND age &lt; 70 THEN
  196. '60'
  197. WHEN age &gt;= 70
  198. AND age &lt; 80 THEN
  199. '70'
  200. WHEN age &gt;= 80
  201. AND age &lt; 90 THEN
  202. '80'
  203. WHEN age &gt; 90 THEN
  204. '100以上'
  205. END;
  206. </select>
  207. <select id="selectuserAgeCount" resultType="java.lang.Integer">
  208. select IFNULL(count(*),0) from t_user_profile
  209. </select>
  210. <select id="selectAddUser" resultType="com.ruoyi.system.domain.dto.AddUserDto">
  211. SELECT DATE_FORMAT(createtime, '%Y-%m') AS month, COUNT(*) AS count FROM t_user_profile GROUP BY month;
  212. </select>
  213. <insert id="insertTUserProfile" parameterType="TUserProfile" useGeneratedKeys="true" keyProperty="id">
  214. insert into t_user_profile
  215. <trim prefix="(" suffix=")" suffixOverrides=",">
  216. <if test="name != null">name,</if>
  217. <if test="gender != null">gender,</if>
  218. <if test="sfzid != null">sfzid,</if>
  219. <if test="telOne != null">tel_one,</if>
  220. <if test="telTwo != null">tel_two,</if>
  221. <if test="telThree != null">tel_three,</if>
  222. <if test="birthday != null">birthday,</if>
  223. <if test="age != null">age,</if>
  224. <if test="marrStatus != null">marr_status,</if>
  225. <if test="national != null">national,</if>
  226. <if test="local != null">local,</if>
  227. <if test="clientType != null">client_type,</if>
  228. <if test="liveStatus != null">live_status,</if>
  229. <if test="familyAddress != null">family_address,</if>
  230. <if test="detailAddress != null">detail_address,</if>
  231. <if test="houseAddress != null">house_address,</if>
  232. <if test="houseDetailAddress != null">house_detail_address,</if>
  233. <if test="serviceid != null">serviceid,</if>
  234. <if test="oldmenStatus != null">oldmen_status,</if>
  235. <if test="changeContent != null">change_content,</if>
  236. <if test="loseMonth != null">lose_month,</if>
  237. <if test="treatMonth != null">treat_month,</if>
  238. <if test="isTreat != null">is_treat,</if>
  239. <if test="serviceType != null">service_type,</if>
  240. <if test="treateSure != null">treate_sure,</if>
  241. <if test="moneyCome != null">money_come,</if>
  242. <if test="moneyMonth != null">money_month,</if>
  243. <if test="cardCode != null">card_code,</if>
  244. <if test="slowIllness != null">slow_illness,</if>
  245. <if test="bloodType != null">blood_type,</if>
  246. <if test="shiStatus != null">shi_status,</if>
  247. <if test="disablityStatus != null">disablity_status,</if>
  248. <if test="disablityEntry != null">disablity_entry,</if>
  249. <if test="educaLevel != null">educa_level,</if>
  250. <if test="special != null">special,</if>
  251. <if test="title != null">title,</if>
  252. <if test="unity != null">unity,</if>
  253. <if test="natureHeart != null">nature_heart,</if>
  254. <if test="eatPoint != null">eat_point,</if>
  255. <if test="speciality != null">speciality,</if>
  256. <if test="hobby != null">hobby,</if>
  257. <if test="photo != null">photo,</if>
  258. <if test="otherPhoto != null">other_photo,</if>
  259. <if test="remarks != null">remarks,</if>
  260. <if test="createTime != null">createtime,</if>
  261. </trim>
  262. <trim prefix="values (" suffix=")" suffixOverrides=",">
  263. <if test="name != null">#{name},</if>
  264. <if test="gender != null">#{gender},</if>
  265. <if test="sfzid != null">#{sfzid},</if>
  266. <if test="telOne != null">#{telOne},</if>
  267. <if test="telTwo != null">#{telTwo},</if>
  268. <if test="telThree != null">#{telThree},</if>
  269. <if test="birthday != null">#{birthday},</if>
  270. <if test="age != null">#{age},</if>
  271. <if test="marrStatus != null">#{marrStatus},</if>
  272. <if test="national != null">#{national},</if>
  273. <if test="local != null">#{local},</if>
  274. <if test="clientType != null">#{clientType},</if>
  275. <if test="liveStatus != null">#{liveStatus},</if>
  276. <if test="familyAddress != null">#{familyAddress},</if>
  277. <if test="detailAddress != null">#{detailAddress},</if>
  278. <if test="houseAddress != null">#{houseAddress},</if>
  279. <if test="houseDetailAddress != null">#{houseDetailAddress},</if>
  280. <if test="serviceid != null">#{serviceid},</if>
  281. <if test="oldmenStatus != null">#{oldmenStatus},</if>
  282. <if test="changeContent != null">#{changeContent},</if>
  283. <if test="loseMonth != null">#{loseMonth},</if>
  284. <if test="treatMonth != null">#{treatMonth},</if>
  285. <if test="isTreat != null">#{isTreat},</if>
  286. <if test="serviceType != null">#{serviceType},</if>
  287. <if test="treateSure != null">#{treateSure},</if>
  288. <if test="moneyCome != null">#{moneyCome},</if>
  289. <if test="moneyMonth != null">#{moneyMonth},</if>
  290. <if test="cardCode != null">#{cardCode},</if>
  291. <if test="slowIllness != null">#{slowIllness},</if>
  292. <if test="bloodType != null">#{bloodType},</if>
  293. <if test="shiStatus != null">#{shiStatus},</if>
  294. <if test="disablityStatus != null">#{disablityStatus},</if>
  295. <if test="disablityEntry != null">#{disablityEntry},</if>
  296. <if test="educaLevel != null">#{educaLevel},</if>
  297. <if test="special != null">#{special},</if>
  298. <if test="title != null">#{title},</if>
  299. <if test="unity != null">#{unity},</if>
  300. <if test="natureHeart != null">#{natureHeart},</if>
  301. <if test="eatPoint != null">#{eatPoint},</if>
  302. <if test="speciality != null">#{speciality},</if>
  303. <if test="hobby != null">#{hobby},</if>
  304. <if test="photo != null">#{photo},</if>
  305. <if test="otherPhoto != null">#{otherPhoto},</if>
  306. <if test="remarks != null">#{remarks},</if>
  307. <if test="createTime != null">#{createTime},</if>
  308. </trim>
  309. </insert>
  310. <update id="updateTUserProfile" parameterType="TUserProfile">
  311. update t_user_profile
  312. <trim prefix="SET" suffixOverrides=",">
  313. <if test="name != null">name = #{name},</if>
  314. <if test="gender != null">gender = #{gender},</if>
  315. <if test="sfzid != null">sfzid = #{sfzid},</if>
  316. <if test="telOne != null">tel_one = #{telOne},</if>
  317. <if test="telTwo != null">tel_two = #{telTwo},</if>
  318. <if test="telThree != null">tel_three = #{telThree},</if>
  319. <if test="birthday != null">birthday = #{birthday},</if>
  320. <if test="age != null">age = #{age},</if>
  321. <if test="marrStatus != null">marr_status = #{marrStatus},</if>
  322. <if test="national != null">national = #{national},</if>
  323. <if test="local != null">local = #{local},</if>
  324. <if test="clientType != null">client_type = #{clientType},</if>
  325. <if test="liveStatus != null">live_status = #{liveStatus},</if>
  326. <if test="familyAddress != null">family_address = #{familyAddress},</if>
  327. <if test="detailAddress != null">detail_address = #{detailAddress},</if>
  328. <if test="houseAddress != null">house_address = #{houseAddress},</if>
  329. <if test="houseDetailAddress != null">house_detail_address = #{houseDetailAddress},</if>
  330. <if test="serviceid != null">serviceid = #{serviceid},</if>
  331. <if test="oldmenStatus != null">oldmen_status = #{oldmenStatus},</if>
  332. <if test="changeContent != null">change_content = #{changeContent},</if>
  333. <if test="loseMonth != null">lose_month = #{loseMonth},</if>
  334. <if test="treatMonth != null">treat_month = #{treatMonth},</if>
  335. <if test="isTreat != null">is_treat = #{isTreat},</if>
  336. <if test="serviceType != null">service_type = #{serviceType},</if>
  337. <if test="treateSure != null">treate_sure = #{treateSure},</if>
  338. <if test="moneyCome != null">money_come = #{moneyCome},</if>
  339. <if test="moneyMonth != null">money_month = #{moneyMonth},</if>
  340. <if test="cardCode != null">card_code = #{cardCode},</if>
  341. <if test="slowIllness != null">slow_illness = #{slowIllness},</if>
  342. <if test="bloodType != null">blood_type = #{bloodType},</if>
  343. <if test="shiStatus != null">shi_status = #{shiStatus},</if>
  344. <if test="disablityStatus != null">disablity_status = #{disablityStatus},</if>
  345. <if test="disablityEntry != null">disablity_entry = #{disablityEntry},</if>
  346. <if test="educaLevel != null">educa_level = #{educaLevel},</if>
  347. <if test="special != null">special = #{special},</if>
  348. <if test="title != null">title = #{title},</if>
  349. <if test="unity != null">unity = #{unity},</if>
  350. <if test="natureHeart != null">nature_heart = #{natureHeart},</if>
  351. <if test="eatPoint != null">eat_point = #{eatPoint},</if>
  352. <if test="speciality != null">speciality = #{speciality},</if>
  353. <if test="hobby != null">hobby = #{hobby},</if>
  354. <if test="photo != null">photo = #{photo},</if>
  355. <if test="otherPhoto != null">other_photo = #{otherPhoto},</if>
  356. <if test="remarks != null">remarks = #{remarks},</if>
  357. <if test="createTime != null">createtime = #{createTime},</if>
  358. </trim>
  359. where id = #{id}
  360. </update>
  361. <delete id="deleteTUserProfileById" parameterType="Integer">
  362. delete from t_user_profile where id = #{id}
  363. </delete>
  364. <delete id="deleteTUserProfileByIds" parameterType="String">
  365. delete from t_user_profile where id in
  366. <foreach item="id" collection="array" open="(" separator="," close=")">
  367. #{id}
  368. </foreach>
  369. </delete>
  370. <delete id="deleteTEmergentPeopleByProfileIds" parameterType="String">
  371. delete from t_emergent_people where profile_id in
  372. <foreach item="profileId" collection="array" open="(" separator="," close=")">
  373. #{profileId}
  374. </foreach>
  375. </delete>
  376. <delete id="deleteTEmergentPeopleByProfileId" parameterType="Integer">
  377. delete from t_emergent_people where profile_id = #{profileId}
  378. </delete>
  379. <insert id="batchTEmergentPeople">
  380. insert into t_emergent_people( id, profile_id, name, telno, relation, is_conn) values
  381. <foreach item="item" index="index" collection="list" separator=",">
  382. ( #{item.id}, #{item.profileId}, #{item.name}, #{item.telno}, #{item.relation}, #{item.isConn})
  383. </foreach>
  384. </insert>
  385. </mapper>