SmartUserMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. <resultMap type="com.template.model.pojo.SmartUser" id="smartUsersMap">
  39. <result property="cardNo" column="card_no"/>
  40. <result property="name" column="name"/>
  41. <result property="identityId" column="identity_id"/>
  42. <result property="idCard" column="id_card"/>
  43. <result property="sexId" column="sex_id"/>
  44. <result property="departmentId" column="department_id"/>
  45. <result property="headImage" column="head_image"/>
  46. <result property="grade" column="grade"/>
  47. <result property="college" column="college"/>
  48. <result property="speciality" column="speciality"/>
  49. <result property="schoolClass" column="school_class"/>
  50. <result property="campus" column="campus"/>
  51. <result property="dormitoryNumber" column="dormitory_number"/>
  52. <result property="phone" column="phone"/>
  53. <result property="affiliate" column="affiliate"/>
  54. <result property="title" column="title"/>
  55. <result property="address" column="address"/>
  56. <result property="nation" column="nation"/>
  57. <result property="ofStudent" column="of_student"/>
  58. <result property="graduate" column="graduate"/>
  59. <result property="duties" column="duties"/>
  60. </resultMap>
  61. <select id="querySmartUsers" resultType="com.template.model.pojo.SmartUser" resultMap="smartUsersMap">
  62. select card_no,name,identity_id,id_card,sex_id,department_id,head_image,grade,college,speciality,school_class,campus,dormitory_number,
  63. phone,affiliate,title,address,nation,of_student,graduate,duties from smart_user
  64. where deleted = 0 and is_cancel = 0
  65. <if test="departmentIds != null and departmentIds.size() > 0">
  66. and department_id in
  67. <foreach collection="departmentIds" item="departmentId" index="index" open="(" close=")" separator=",">
  68. ${departmentId}
  69. </foreach>
  70. </if>
  71. <if test="name != null and name != ''">
  72. and name like '%' #{name} '%'
  73. </if>
  74. </select>
  75. <resultMap type="com.template.model.vo.GradeVo" id="smartSecordUserPageMap">
  76. <result property="id" column="id"/>
  77. <result property="name" column="name"/>
  78. <result property="grade" column="grade"/>
  79. <result property="schoolClass" column="school_class"/>
  80. <result property="cardNo" column="card_no"/>
  81. </resultMap>
  82. <select id="querySmartSecordPage" resultType="com.template.model.vo.GradeVo" resultMap="smartSecordUserPageMap">
  83. select id,name,grade,school_class,card_no from smart_user
  84. where deleted = 0 and identity_id = 2
  85. <if test="name != null and name != ''">
  86. and name like '%' #{name} '%'
  87. </if>
  88. </select>
  89. </mapper>