UserInfoMapper.xml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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.miaxis.user.mapper.UserInfoMapper">
  6. <resultMap type="UserInfo" id="UserInfoResult">
  7. <result property="id" column="id" />
  8. <result property="phone" column="phone" />
  9. <result property="wechar" column="wechar" />
  10. <result property="headImage" column="head_image" />
  11. <result property="nickName" column="nick_name" />
  12. <result property="openid" column="openid" />
  13. <result property="createTime" column="create_time" />
  14. <result property="updateTime" column="update_time" />
  15. <result property="status" column="status" />
  16. <result property="isVip" column="is_vip" />
  17. <result property="unionId" column="union_id" />
  18. </resultMap>
  19. <sql id="selectUserInfoVo">
  20. select * from user_info
  21. </sql>
  22. <select id="selectUserInfoList" parameterType="UserInfo" resultMap="UserInfoResult">
  23. <include refid="selectUserInfoVo"/>
  24. <where>
  25. <if test="phone != null and phone != ''"> and phone = #{phone}</if>
  26. <if test="wechar != null and wechar != ''"> and wechar = #{wechar}</if>
  27. <if test="headImage != null and headImage != ''"> and head_image = #{headImage}</if>
  28. <if test="nickName != null and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
  29. <if test="openid != null and openid != ''"> and openid = #{openid}</if>
  30. <if test="status != null "> and status = #{status}</if>
  31. <if test="isVip != null "> and is_vip = #{isVip}</if>
  32. <if test="unionId != null and unionId != ''"> and union_id = #{unionId}</if>
  33. </where>
  34. </select>
  35. <select id="selectUserByParentOpenid" resultType="com.miaxis.common.core.domain.entity.UserInfo">
  36. SELECT
  37. u.openid,
  38. u.nick_name,
  39. u.head_image,
  40. u.create_time
  41. FROM
  42. user_info u
  43. LEFT JOIN wx_spread_relation sr ON sr.openid = u.openid
  44. WHERE sr.parent_openid = #{openid}
  45. ORDER BY u.create_time desc
  46. </select>
  47. <select id="selectUserByList" resultType="com.miaxis.common.core.domain.entity.UserInfo">
  48. SELECT
  49. u.openid,
  50. u.nick_name,
  51. u.head_image,
  52. u.create_time
  53. FROM
  54. user_info u
  55. WHERE u.openid in
  56. <foreach collection="list" item="openid" open="(" separator="," close=")">
  57. #{openid}
  58. </foreach>
  59. ORDER BY u.create_time desc
  60. </select>
  61. </mapper>