JlServiceUserMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.ygj.yuemum.dao.maternitymatron.JlServiceUserDao">
  4. <resultMap id="BaseResultMap" type="com.ygj.yuemum.domain.maternitymatron.JlServiceUser">
  5. <id column="id" property="id" jdbcType="INTEGER"/>
  6. <result column="password" property="password" jdbcType="VARCHAR"/>
  7. <result column="truename" property="truename" jdbcType="VARCHAR"/>
  8. <result column="mobile_phone" property="mobile_phone" jdbcType="VARCHAR"/>
  9. <result column="status" property="status" jdbcType="VARCHAR"/>
  10. <result column="last_login_time" property="last_login_time" jdbcType="DATE"/>
  11. <result column="last_login_ip" property="last_login_ip" jdbcType="VARCHAR"/>
  12. <result column="salt" property="salt" jdbcType="VARCHAR"/>
  13. <result column="token" property="token" jdbcType="VARCHAR"/>
  14. <result column="zone_code" property="zone_code" jdbcType="VARCHAR"/>
  15. <result column="updated_at" property="updated_at" jdbcType="DATE"/>
  16. <result column="stock_status" property="stock_status" jdbcType="INTEGER"/>
  17. <result column="usertype" property="usertype" jdbcType="VARCHAR"/>
  18. <!--list add-->
  19. <result column="age" property="age" jdbcType="VARCHAR"/>
  20. <result column="idcard" property="idcard" jdbcType="VARCHAR"/>
  21. <result column="cityname" property="cityname" jdbcType="VARCHAR"/>
  22. <result column="np" property="np" jdbcType="VARCHAR"/>
  23. <!--query add-->
  24. <result column="experience" property="experience" jdbcType="VARCHAR"/>
  25. <result column="gender" property="gender" jdbcType="VARCHAR"/>
  26. </resultMap>
  27. <resultMap id="ListResultMap" type="com.ygj.yuemum.domain.maternitymatron.JlServiceUser">
  28. <id column="id" property="id" jdbcType="INTEGER"/>
  29. <result column="truename" property="truename" jdbcType="VARCHAR"/>
  30. <result column="status" property="status" jdbcType="VARCHAR"/>
  31. <!--list add-->
  32. <result column="age" property="age" jdbcType="VARCHAR"/>
  33. <result column="idcard" property="idcard" jdbcType="VARCHAR"/>
  34. <result column="cityname" property="cityname" jdbcType="VARCHAR"/>
  35. <result column="np" property="np" jdbcType="VARCHAR"/>
  36. </resultMap>
  37. <sql id="Base_Column_List">
  38. id, password, truename,mobile_phone,status,last_login_time,last_login_ip,salt,token,zone_code,updated_at,stock_status,usertype
  39. </sql>
  40. <!--获取所有数据-->
  41. <select id="getcount" resultType="java.lang.Integer" >
  42. select
  43. count(1)
  44. from jl_service_user
  45. </select>
  46. <!--获取主键-->
  47. <select id="getpmid" resultType="java.lang.Integer" >
  48. SELECT auto_increment
  49. FROM information_schema.tables
  50. where table_schema="yuemum"
  51. and table_name="jl_service_user";
  52. </select>
  53. <select id="getquerycount" resultType="java.lang.Integer" parameterType="com.ygj.yuemum.domain.maternitymatron.QueryServiceUser">
  54. select count(1) from jl_service_user where 2=2
  55. <if test="id != null">
  56. and jl_service_user.id = #{id,jdbcType=INTEGER}
  57. </if>
  58. <if test="truename != null">
  59. and jl_service_user.truename = #{truename,jdbcType=VARCHAR}
  60. </if>
  61. <if test="status != null">
  62. and status = #{status,jdbcType=VARCHAR}
  63. </if>
  64. <if test="idcard != null">
  65. and idcard = #{idcard,jdbcType=VARCHAR}
  66. </if>
  67. <if test="cityname != null">
  68. and cityname = #{cityname,jdbcType=VARCHAR}
  69. </if>
  70. <if test="np != null">
  71. and np = #{np,jdbcType=VARCHAR}
  72. </if>
  73. <if test="experience != null">
  74. and experience = #{experience,jdbcType=VARCHAR}
  75. </if>
  76. <if test="gender != null">
  77. and gender = #{gender,jdbcType=VARCHAR}
  78. </if>
  79. </select>
  80. <!--getList-->
  81. <select id="getMMList" resultMap="ListResultMap">
  82. select
  83. jl_service_user.id,
  84. jl_service_user.truename,
  85. year(CURDATE())-substring(jl_service_user_info.idcard,7,4) age,
  86. jl_service_user_info.idcard,
  87. city.cityname,
  88. fgetcityname(CONCAT(substring(jl_service_user_info.idcard,1,4),'00')) np,
  89. jl_service_user.status
  90. from jl_service_user
  91. LEFT JOIN jl_service_user_info on jl_service_user.id = jl_service_user_info.id
  92. LEFT JOIN (select service_id,GROUP_CONCAT(jl_region.`name`) cityname from jl_store_service LEFT JOIN jl_region
  93. on jl_store_service.store_id = jl_region.`code` group by service_id) as
  94. city ON jl_service_user.id = city.service_id
  95. order by id
  96. </select>
  97. <select id="queryMMList" resultMap="ListResultMap" parameterType="com.ygj.yuemum.domain.maternitymatron.QueryServiceUser">
  98. select
  99. jl_service_user.id,
  100. jl_service_user.truename,
  101. year(CURDATE())-substring(jl_service_user_info.idcard,7,4) age,
  102. jl_service_user_info.idcard,
  103. city.cityname,
  104. fgetcityname(CONCAT(substring(jl_service_user_info.idcard,1,4),'00')) np,
  105. jl_service_user.status
  106. from jl_service_user
  107. LEFT JOIN jl_service_user_info on jl_service_user.id = jl_service_user_info.id
  108. LEFT JOIN (select service_id,GROUP_CONCAT(jl_region.`name`) cityname from jl_store_service LEFT JOIN jl_region
  109. on jl_store_service.store_id = jl_region.`code` where jl_store_service.service_id = 3 group by service_id) as
  110. city ON jl_service_user.id = city.service_id
  111. where 1=1
  112. <if test="id != null">
  113. and jl_service_user.id = #{id,jdbcType=INTEGER}
  114. </if>
  115. <if test="truename != null">
  116. and jl_service_user.truename = #{truename,jdbcType=VARCHAR}
  117. </if>
  118. <if test="status != null">
  119. and status = #{status,jdbcType=VARCHAR}
  120. </if>
  121. <if test="idcard != null">
  122. and idcard = #{idcard,jdbcType=VARCHAR}
  123. </if>
  124. <if test="cityname != null">
  125. and cityname = #{cityname,jdbcType=VARCHAR}
  126. </if>
  127. <if test="np != null">
  128. and np = #{np,jdbcType=VARCHAR}
  129. </if>
  130. <if test="experience != null">
  131. and experience = #{experience,jdbcType=VARCHAR}
  132. </if>
  133. <if test="gender != null">
  134. and gender = #{gender,jdbcType=VARCHAR}
  135. </if>
  136. order by id
  137. </select>
  138. <!-- 得到所有的月嫂信息 -->
  139. <select id="getAll" resultMap="BaseResultMap">
  140. select
  141. <include refid="Base_Column_List"/>
  142. from jl_service_user
  143. </select>
  144. <!-- 根据id查找某个月嫂信息 -->
  145. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
  146. select
  147. <include refid="Base_Column_List"/>
  148. from jl_service_user
  149. where id = #{id,jdbcType=INTEGER}
  150. </select>
  151. <!-- 根据id删除某个月嫂信息 -->
  152. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  153. delete from jl_service_user
  154. where id = #{id,jdbcType=INTEGER}
  155. </delete>
  156. <!-- 插入一条月嫂信息 -->
  157. <insert id="insertSelective" parameterType="com.ygj.yuemum.domain.maternitymatron.JlServiceUser">
  158. insert into jl_service_user
  159. <trim prefix="(" suffix=")" suffixOverrides=",">
  160. <if test="password != null">
  161. password,
  162. </if>
  163. <if test="truename != null">
  164. truename,
  165. </if>
  166. <if test="mobile_phone != null">
  167. mobile_phone,
  168. </if>
  169. <if test="status != null">
  170. status,
  171. </if>
  172. <if test="last_login_time != null">
  173. last_login_time,
  174. </if>
  175. <if test="last_login_ip != null">
  176. last_login_ip,
  177. </if>
  178. <if test="salt != null">
  179. salt,
  180. </if>
  181. <if test="token != null">
  182. token,
  183. </if>
  184. <if test="zone_code != null">
  185. zone_code,
  186. </if>
  187. <if test="updated_at != null">
  188. updated_at,
  189. </if>
  190. <if test="stock_status != null">
  191. stock_status,
  192. </if>
  193. <if test="usertype != null">
  194. usertype
  195. </if>
  196. </trim>
  197. <trim prefix="values (" suffix=")" suffixOverrides=",">
  198. <if test="password != null">
  199. #{password,jdbcType=VARCHAR},
  200. </if>
  201. <if test="truename != null">
  202. #{truename,jdbcType=VARCHAR},
  203. </if>
  204. <if test="mobile_phone != null">
  205. #{mobile_phone,jdbcType=VARCHAR},
  206. </if>
  207. <if test="status != null">
  208. #{status,jdbcType=VARCHAR},
  209. </if>
  210. <if test="last_login_time != null">
  211. #{last_login_time,jdbcType=DATE},
  212. </if>
  213. <if test="last_login_ip != null">
  214. #{last_login_ip,jdbcType=VARCHAR},
  215. </if>
  216. <if test="salt != null">
  217. #{salt,jdbcType=VARCHAR},
  218. </if>
  219. <if test="token != null">
  220. #{token,jdbcType=VARCHAR},
  221. </if>
  222. <if test="zone_code != null">
  223. #{zone_code,jdbcType=VARCHAR},
  224. </if>
  225. <if test="updated_at != null">
  226. #{updated_at,jdbcType=DATE},
  227. </if>
  228. <if test="stock_status != null">
  229. #{stock_status,jdbcType=INTEGER},
  230. </if>
  231. <if test="usertype != null">
  232. #{usertype,jdbcType=VARCHAR}
  233. </if>
  234. </trim>
  235. </insert>
  236. <!-- 根据id更新一条月嫂信息 -->
  237. <update id="updateByPrimaryKeySelective" parameterType="com.ygj.yuemum.domain.maternitymatron.JlServiceUser">
  238. update jl_service_user
  239. <set>
  240. <if test="password != null">
  241. password = #{password,jdbcType=VARCHAR},
  242. </if>
  243. <if test="truename != null">
  244. truename = #{truename,jdbcType=VARCHAR},
  245. </if>
  246. <if test="mobile_phone != null">
  247. mobile_phone = #{mobile_phone,jdbcType=VARCHAR},
  248. </if>
  249. <if test="status != null">
  250. status = #{status,jdbcType=VARCHAR},
  251. </if>
  252. <if test="last_login_time != null">
  253. last_login_time = #{last_login_time,jdbcType=DATE},
  254. </if>
  255. <if test="last_login_ip != null">
  256. last_login_ip = #{last_login_ip,jdbcType=VARCHAR},
  257. </if>
  258. <if test="salt != null">
  259. salt = #{salt,jdbcType=VARCHAR},
  260. </if>
  261. <if test="token != null">
  262. token = #{token,jdbcType=VARCHAR},
  263. </if>
  264. <if test="zone_code != null">
  265. zone_code = #{zone_code,jdbcType=VARCHAR},
  266. </if>
  267. <if test="updated_at != null">
  268. updated_at = #{updated_at,jdbcType=DATE},
  269. </if>
  270. <if test="stock_status != null">
  271. stock_status = #{stock_status,jdbcType=INTEGER},
  272. </if>
  273. <if test="usertype != null">
  274. usertype = #{usertype,jdbcType=VARCHAR}
  275. </if>
  276. </set>
  277. where id = #{id,jdbcType=INTEGER}
  278. </update>
  279. </mapper>