SmartUserMapper.xml 7.1 KB

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