SmartUserMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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="cardNo" column="card_no"/>
  22. <result property="name" column="name"/>
  23. <result property="identityId" column="identity_id"/>
  24. <result property="idCard" column="id_card"/>
  25. <result property="sexId" column="sex_id"/>
  26. <result property="departmentId" column="department_id"/>
  27. <result property="headImage" column="head_image"/>
  28. <result property="grade" column="grade"/>
  29. <result property="college" column="college"/>
  30. <result property="speciality" column="speciality"/>
  31. <result property="schoolClass" column="school_class"/>
  32. <result property="campus" column="campus"/>
  33. <result property="dormitoryNumber" column="dormitory_number"/>
  34. <result property="phone" column="phone"/>
  35. <result property="affiliate" column="affiliate"/>
  36. <result property="title" column="title"/>
  37. <result property="address" column="address"/>
  38. <result property="nation" column="nation"/>
  39. <result property="ofStudent" column="of_student"/>
  40. <result property="graduate" column="graduate"/>
  41. <result property="duties" column="duties"/>
  42. </resultMap>
  43. <select id="querySmartUserPages" resultType="com.template.model.vo.UserVo" resultMap="smartUserPageMap">
  44. select id,card_no,name,identity_id,id_card,sex_id,department_id,head_image,grade,college,speciality,school_class,campus,dormitory_number,
  45. phone,affiliate,title,address,nation,of_student,graduate,duties
  46. from smart_user
  47. where deleted = 0 and is_cancel = 0
  48. <if test="departmentIds != null and departmentIds.size() > 0">
  49. and department_id in
  50. <foreach collection="departmentIds" item="departmentId" index="index" open="(" close=")" separator=",">
  51. ${departmentId}
  52. </foreach>
  53. </if>
  54. <if test="name != null and name != ''">
  55. and (name like '%' #{name} '%' or card_no like '%' #{name} '%')
  56. </if>
  57. </select>
  58. <resultMap type="com.template.model.pojo.SmartUser" id="smartUsersMap">
  59. <result property="cardNo" column="card_no"/>
  60. <result property="name" column="name"/>
  61. <result property="identityId" column="identity_id"/>
  62. <result property="idCard" column="id_card"/>
  63. <result property="sexId" column="sex_id"/>
  64. <result property="departmentId" column="department_id"/>
  65. <result property="headImage" column="head_image"/>
  66. <result property="grade" column="grade"/>
  67. <result property="college" column="college"/>
  68. <result property="speciality" column="speciality"/>
  69. <result property="schoolClass" column="school_class"/>
  70. <result property="campus" column="campus"/>
  71. <result property="dormitoryNumber" column="dormitory_number"/>
  72. <result property="phone" column="phone"/>
  73. <result property="affiliate" column="affiliate"/>
  74. <result property="title" column="title"/>
  75. <result property="address" column="address"/>
  76. <result property="nation" column="nation"/>
  77. <result property="ofStudent" column="of_student"/>
  78. <result property="graduate" column="graduate"/>
  79. <result property="duties" column="duties"/>
  80. </resultMap>
  81. <select id="querySmartUsers" resultType="com.template.model.pojo.SmartUser" resultMap="smartUsersMap">
  82. select card_no,name,identity_id,id_card,sex_id,department_id,head_image,grade,college,speciality,school_class,campus,dormitory_number,
  83. phone,affiliate,title,address,nation,of_student,graduate,duties from smart_user
  84. where deleted = 0 and is_cancel = 0
  85. <if test="departmentIds != null and departmentIds.size() > 0">
  86. and department_id in
  87. <foreach collection="departmentIds" item="departmentId" index="index" open="(" close=")" separator=",">
  88. ${departmentId}
  89. </foreach>
  90. </if>
  91. <if test="name != null and name != ''">
  92. and name like '%' #{name} '%'
  93. </if>
  94. </select>
  95. <resultMap type="com.template.model.vo.GradeVo" id="smartSecordUserPageMap">
  96. <result property="id" column="id"/>
  97. <result property="name" column="name"/>
  98. <result property="grade" column="grade"/>
  99. <result property="schoolClass" column="school_class"/>
  100. <result property="cardNo" column="card_no"/>
  101. </resultMap>
  102. <select id="querySmartSecordPage" resultType="com.template.model.vo.GradeVo" resultMap="smartSecordUserPageMap">
  103. select id,name,grade,school_class,card_no from smart_user
  104. where deleted = 0 and is_cancel = 0 and identity_id = 2
  105. <if test="name != null and name != ''">
  106. and name like '%' #{name} '%'
  107. </if>
  108. </select>
  109. <select id="warningUserList" resultType="com.template.model.vo.UserVo">
  110. select *
  111. from smart_user
  112. where deleted = 0 and is_cancel = 0
  113. <if test="departmentIds != null and departmentIds.size() > 0">
  114. and department_id in
  115. <foreach collection="departmentIds" item="departmentId" index="index" open="(" close=")" separator=",">
  116. ${departmentId}
  117. </foreach>
  118. </if>
  119. <if test="name != null and name != ''">
  120. and name like '%' #{name} '%'
  121. </if>
  122. </select>
  123. <select id="warningPushList" resultType="com.template.model.pojo.SmartUser">
  124. SELECT * FROM `smart_user` WHERE is_push=1 and is_cancel=0
  125. </select>
  126. </mapper>