SmartUserMapper.xml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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.template.mapper.SmartUserMapper">
  4. <resultMap type="com.template.model.vo.AffiliateUserVo" id="affiliateUserMap">
  5. <result property="id" column="id"/>
  6. <result property="name" column="name"/>
  7. <result property="cardNo" column="card_no"/>
  8. <result property="departmentId" column="department_id"/>
  9. </resultMap>
  10. <select id="queryAffiliateUserById" resultType="com.template.model.vo.AffiliateUserVo" resultMap="affiliateUserMap">
  11. select id,name,card_no,department_id from smart_user
  12. where find_in_set(id,(select affiliate from smart_user where
  13. deleted = 0
  14. <if test="id != null and id != ''">
  15. and id = #{id}
  16. </if>
  17. )) and deleted = 0
  18. </select>
  19. <resultMap type="com.template.model.vo.UserVo" id="smartUserPageMap">
  20. <result property="id" column="id"/>
  21. <result property="name" column="name"/>
  22. <result property="cardNo" column="card_no"/>
  23. <result property="headImage" column="head_image"/>
  24. </resultMap>
  25. <select id="querySmartUserPages" resultType="com.template.model.vo.UserVo" resultMap="smartUserPageMap">
  26. select id,name,card_no,head_image from smart_user
  27. where deleted = 0 and is_cancel = 0
  28. <if test="departmentIds != null and departmentIds.size() > 0">
  29. and department_id in
  30. <foreach collection="departmentIds" item="departmentId" index="index" open="(" close=")" separator=",">
  31. ${departmentId}
  32. </foreach>
  33. </if>
  34. <if test="name != null and name != ''">
  35. and name like '%' #{name} '%'
  36. </if>
  37. </select>
  38. </mapper>