| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.template.mapper.SmartUserMapper">
- <resultMap type="com.template.model.vo.AffiliateUserVo" id="affiliateUserMap">
- <result property="id" column="id"/>
- <result property="name" column="name"/>
- <result property="cardNo" column="card_no"/>
- <result property="departmentId" column="department_id"/>
- <result property="headImage" column="head_image"/>
- </resultMap>
- <select id="queryAffiliateUserById" resultType="com.template.model.vo.AffiliateUserVo" resultMap="affiliateUserMap">
- select id,name,card_no,department_id,head_image from smart_user
- where find_in_set(id,(select affiliate from smart_user where
- deleted = 0
- <if test="id != null and id != ''">
- and id = #{id}
- </if>
- )) and deleted = 0
- </select>
- <resultMap type="com.template.model.vo.UserVo" id="smartUserPageMap">
- <result property="id" column="id"/>
- <result property="cardNo" column="card_no"/>
- <result property="name" column="name"/>
- <result property="identityId" column="identity_id"/>
- <result property="idCard" column="id_card"/>
- <result property="sexId" column="sex_id"/>
- <result property="departmentId" column="department_id"/>
- <result property="headImage" column="head_image"/>
- <result property="grade" column="grade"/>
- <result property="college" column="college"/>
- <result property="speciality" column="speciality"/>
- <result property="schoolClass" column="school_class"/>
- <result property="campus" column="campus"/>
- <result property="dormitoryNumber" column="dormitory_number"/>
- <result property="phone" column="phone"/>
- <result property="affiliate" column="affiliate"/>
- <result property="title" column="title"/>
- <result property="address" column="address"/>
- <result property="nation" column="nation"/>
- <result property="ofStudent" column="of_student"/>
- <result property="graduate" column="graduate"/>
- <result property="duties" column="duties"/>
- <result property="timeGroupId" column="time_group_id"/>
- </resultMap>
- <select id="querySmartUserPages" resultType="com.template.model.vo.UserVo" resultMap="smartUserPageMap">
- select
- id,card_no,name,identity_id,id_card,sex_id,department_id,head_image,grade,college,speciality,school_class,campus,dormitory_number,
- phone,affiliate,title,address,nation,of_student,graduate,duties,time_group_id
- from smart_user
- where deleted = 0 and is_cancel = 0
- <if test="departmentIds != null and departmentIds.size() > 0">
- and department_id in
- <foreach collection="departmentIds" item="departmentId" index="index" open="(" close=")" separator=",">
- ${departmentId}
- </foreach>
- </if>
- <if test="name != null and name != ''">
- and (name like '%' #{name} '%' or card_no like '%' #{name} '%')
- </if>
- </select>
- <resultMap type="com.template.model.pojo.SmartUser" id="smartUsersMap">
- <result property="cardNo" column="card_no"/>
- <result property="name" column="name"/>
- <result property="identityId" column="identity_id"/>
- <result property="idCard" column="id_card"/>
- <result property="sexId" column="sex_id"/>
- <result property="departmentId" column="department_id"/>
- <result property="headImage" column="head_image"/>
- <result property="grade" column="grade"/>
- <result property="college" column="college"/>
- <result property="speciality" column="speciality"/>
- <result property="schoolClass" column="school_class"/>
- <result property="campus" column="campus"/>
- <result property="dormitoryNumber" column="dormitory_number"/>
- <result property="phone" column="phone"/>
- <result property="affiliate" column="affiliate"/>
- <result property="title" column="title"/>
- <result property="address" column="address"/>
- <result property="nation" column="nation"/>
- <result property="ofStudent" column="of_student"/>
- <result property="graduate" column="graduate"/>
- <result property="duties" column="duties"/>
- </resultMap>
- <select id="querySmartUsers" resultType="com.template.model.pojo.SmartUser" resultMap="smartUsersMap">
- select
- card_no,name,identity_id,id_card,sex_id,department_id,head_image,grade,college,speciality,school_class,campus,dormitory_number,
- phone,affiliate,title,address,nation,of_student,graduate,duties from smart_user
- where deleted = 0 and is_cancel = 0
- <if test="departmentIds != null and departmentIds.size() > 0">
- and department_id in
- <foreach collection="departmentIds" item="departmentId" index="index" open="(" close=")" separator=",">
- ${departmentId}
- </foreach>
- </if>
- <if test="name != null and name != ''">
- and name like '%' #{name} '%'
- </if>
- </select>
- <resultMap type="com.template.model.vo.GradeVo" id="smartSecordUserPageMap">
- <result property="id" column="id"/>
- <result property="name" column="name"/>
- <result property="grade" column="grade"/>
- <result property="schoolClass" column="school_class"/>
- <result property="cardNo" column="card_no"/>
- </resultMap>
- <select id="querySmartSecordPage" resultType="com.template.model.vo.GradeVo" resultMap="smartSecordUserPageMap">
- select id,name,grade,school_class,card_no from smart_user
- where deleted = 0 and is_cancel = 0 and identity_id = 2
- <if test="name != null and name != ''">
- and name like '%' #{name} '%'
- </if>
- <if test="userId != null and userId != '' and userId != 0">
- and id != #{userId}
- </if>
- </select>
- <select id="warningUserList" resultType="com.template.model.dto.WarningUserDto">
- SELECT
- su.id AS id,
- su.`name` AS `name`,
- su.card_no AS cardNo,
- sd.`name` AS departmentName
- FROM
- `smart_user` su
- LEFT JOIN smart_department sd ON sd.id = su.department_id and sd.deleted=0
- where su.deleted = 0 and su.is_cancel = 0
- <if test="name != null and name != ''">
- and su.`name` like '%' #{name} '%'
- </if>
- </select>
- <select id="warningPushList" resultType="com.template.model.dto.WarningUserDto">
- SELECT su.id AS id,
- su.`name` AS `name`,
- su.card_no AS cardNo,
- sd.`name` AS departmentName
- FROM `smart_user` su
- LEFT JOIN smart_department sd ON sd.id = su.department_id and sd.deleted = 0
- WHERE su.is_push = 1
- and su.is_cancel = 0
- and su.deleted = 0
- </select>
- <resultMap type="com.template.model.vo.AffiliateParentVo" id="affiliateParentMap">
- <result property="id" column="id"/>
- <result property="name" column="name"/>
- </resultMap>
- <select id="queryAffiliateParents" resultType="com.template.model.vo.AffiliateParentVo"
- resultMap="affiliateParentMap">
- SELECT id,name FROM `smart_user`
- where deleted = 0 and is_cancel=0
- <if test="userId != null and userId != ''">
- and FIND_IN_SET(#{userId},affiliate)
- </if>
- </select>
- <select id="getAffiliateList" resultType="com.template.model.pojo.SmartUser">
- SELECT * FROM `smart_user`
- where deleted = 0 and is_cancel=0
- <if test="id != null and id != ''">
- and FIND_IN_SET(#{id},affiliate)
- </if>
- </select>
- <resultMap type="com.template.model.vo.SmartUserVo" id="smartUserMap">
- <result property="id" column="id"/>
- <result property="grade" column="grade"/>
- <result property="gradeId" column="grade_id"/>
- <result property="schoolClass" column="school_class"/>
- <result property="schoolClassId" column="school_class_id"/>
- <result property="name" column="name"/>
- <result property="cardNo" column="card_no"/>
- </resultMap>
- <select id="querySmartUserById" resultType="com.template.model.vo.SmartUserVo" resultMap="smartUserMap">
- select su.id,sg.name as grade,sg.id as grade_id,sc.name as school_class,sc.id as school_class_id,su.name,su.card_no
- from smart_user su
- left join smart_grade sg on sg.id = su.grade and sg.deleted = 0
- left join smart_class sc on sc.id = su.school_class and sc.deleted = 0
- where su.deleted = 0
- <if test="userId != null and userId != '' and userId != 0">
- and su.id = #{userId}
- </if>
- </select>
- <update id="deleteUserBatch" parameterType="com.template.model.vo.deleteUserVo">
- <foreach collection="list" item="item" index="index" open="" close="" separator=";">
- update smart_user
- <set>
- delete_reason=#{item.reason}
- </set>
- where id = ${item.id}
- </foreach>
- </update>
- <resultMap type="com.template.model.vo.UserDeleteVo" id="smartUserDeletePageMap">
- <result property="id" column="id"/>
- <result property="name" column="name"/>
- <result property="identityId" column="identity_id"/>
- <result property="departmentId" column="department_id"/>
- <result property="cardNo" column="card_no"/>
- <result property="headImage" column="head_image"/>
- <result property="deleteReason" column="delete_reason"/>
- </resultMap>
- <select id="queryUserDeletePage" resultType="com.template.model.vo.UserDeleteVo" resultMap="smartUserDeletePageMap">
- select id,name,identity_id,department_id,card_no,head_image,delete_reason from smart_user
- where delete_reason != '' or delete_reason != null
- order by update_time desc
- </select>
- <resultMap type="com.template.model.vo.SmartStudentVo" id="smartStudentMap">
- <result property="id" column="id"/>
- <result property="identityId" column="identity_id"/>
- <result property="bsStudentNo" column="bs_student_no"/>
- <result property="bsGradeNo" column="bs_grade_no"/>
- <result property="bsClassNo" column="bs_class_no"/>
- </resultMap>
- <select id="querySmartStudentById" resultType="com.template.model.vo.SmartStudentVo" resultMap="smartStudentMap">
- SELECT su.id,su.identity_id,su.bs_student_no,sg.bs_grade_no,sc.bs_class_no FROM smart_user su
- left join smart_grade sg on sg.deleted = 0 and sg.id = su.grade
- left join smart_class sc on sc.deleted = 0 and sc.id = su.school_class
- where su.deleted = 0
- <if test="userId != null and userId != '' and userId != 0">
- and su.id = #{userId}
- </if>
- </select>
- <select id="getAffiliateUser" resultType="com.template.model.pojo.SmartUser">
- SELECT * FROM `smart_user`
- where deleted = 0 and is_cancel=0
- <if test="affiliate != null and affiliate != ''">
- and FIND_IN_SET(id,#{affiliate})
- </if>
- </select>
- </mapper>
|