123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <?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.ym.mec.biz.dal.dao.StudentRepairDao">
- <resultMap id="StudentRepair" type="com.ym.mec.biz.dal.entity.StudentRepair">
- <result column="id_" jdbcType="INTEGER" property="id"/>
- <result column="trans_no_" jdbcType="VARCHAR" property="transNo"/>
- <result column="organ_id_" jdbcType="INTEGER" property="organId"/>
- <result column="name_" jdbcType="INTEGER" property="organName"/>
- <result column="student_id_" jdbcType="INTEGER" property="studentId"/>
- <result column="student_name_" jdbcType="VARCHAR" property="studentName"/>
- <result column="student_school_" jdbcType="VARCHAR" property="studentSchool"/>
- <result column="employee_id_" jdbcType="INTEGER" property="employeeId"/>
- <result column="employee_name_" jdbcType="VARCHAR" property="employeeName"/>
- <result column="employee_phone_" jdbcType="VARCHAR" property="employeePhone"/>
- <result column="employee_address_" jdbcType="VARCHAR" property="employeeAddress"/>
- <result column="subject_id_" jdbcType="INTEGER" property="subjectId"/>
- <result column="subject_name_" jdbcType="VARCHAR" property="subjectName"/>
- <result column="type_" jdbcType="INTEGER" property="type"/>
- <result column="instrument_no_" jdbcType="VARCHAR" property="instrumentNo"/>
- <result column="fee_list_" jdbcType="VARCHAR" property="feeList"/>
- <result column="description_" jdbcType="VARCHAR" property="description"/>
- <result column="amount_" jdbcType="DECIMAL" property="amount"/>
- <result column="finish_time_" jdbcType="TIMESTAMP" property="finishTime"/>
- <result column="send_type_" jdbcType="INTEGER" property="sendType"/>
- <result column="contact_name_" jdbcType="VARCHAR" property="contactName"/>
- <result column="contact_mobile_" jdbcType="VARCHAR" property="contactMobile"/>
- <result column="address_" jdbcType="VARCHAR" property="address"/>
- <result column="pay_status_" jdbcType="INTEGER" property="payStatus"/>
- <result column="repair_status_" jdbcType="INTEGER" property="repairStatus"/>
- <result column="create_time_" jdbcType="TIMESTAMP" property="createTime"/>
- <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime"/>
- </resultMap>
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="StudentRepair">
- SELECT *
- FROM student_repair
- WHERE id_ = #{id}
- </select>
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentRepair" useGeneratedKeys="true" keyColumn="id"
- keyProperty="id">
- <!--@mbg.generated-->
- insert into student_repair (id_, trans_no_, organ_id_,
- student_id_, student_name_, student_school_,
- employee_id_, employee_name_, subject_id_,
- subject_name_, type_, instrument_no_,fee_list_,
- description_, amount_, finish_time_,
- send_type_, contact_name_, contact_mobile_,
- address_, pay_status_, create_time_,
- update_time_,repair_status_)
- values (#{id,jdbcType=INTEGER}, #{transNo,jdbcType=VARCHAR}, #{organId,jdbcType=INTEGER},
- #{studentId,jdbcType=INTEGER}, #{studentName,jdbcType=VARCHAR}, #{studentSchool,jdbcType=VARCHAR},
- #{employeeId,jdbcType=INTEGER}, #{employeeName,jdbcType=VARCHAR}, #{subjectId,jdbcType=INTEGER},
- #{subjectName,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{instrumentNo,jdbcType=VARCHAR},
- #{feeList,jdbcType=VARCHAR},#{description,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL},
- #{finishTime,jdbcType=TIMESTAMP},#{sendType,jdbcType=INTEGER}, #{contactName,jdbcType=VARCHAR},
- #{contactMobile,jdbcType=VARCHAR},#{address,jdbcType=VARCHAR}, #{payStatus,jdbcType=INTEGER},
- #{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{repairStatus})
- </insert>
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentRepair">
- UPDATE student_repair
- <set>
- <if test="transNo != null">
- trans_no_ = #{transNo},
- </if>
- <if test="repairStatus != null">
- repair_status_ = #{repairStatus},
- </if>
- <if test="organId != null">
- organ_id_ = #{organId},
- </if>
- <if test="studentId != null">
- student_id_ = #{studentId},
- </if>
- <if test="studentName != null">
- student_name_ = #{studentName},
- </if>
- <if test="studentSchool != null">
- student_school_ = #{studentSchool},
- </if>
- <if test="employeeId != null">
- employee_id_ = #{employeeId},
- </if>
- <if test="employeeName != null">
- employee_name_ = #{employeeName},
- </if>
- <if test="subjectId != null">
- subject_id_ = #{subjectId},
- </if>
- <if test="subjectName != null">
- subject_name_ = #{subjectName},
- </if>
- <if test="type != null">
- type_ = #{type},
- </if>
- <if test="instrumentNo != null">
- instrument_no_ = #{instrumentNo},
- </if>
- <if test="feeList != null">
- fee_list_ = #{feeList},
- </if>
- <if test="description != null">
- description_ = #{description},
- </if>
- <if test="amount != null">
- amount_ = #{amount},
- </if>
- <if test="finishTime != null">
- finish_time_ = #{finishTime},
- </if>
- <if test="sendType != null">
- send_type_ = #{sendType},
- </if>
- <if test="contactName != null">
- contact_name_ = #{contactName},
- </if>
- <if test="contactMobile != null">
- contact_mobile_ = #{contactMobile},
- </if>
- <if test="address != null">
- address_ = #{address},
- </if>
- <if test="payStatus != null">
- pay_status_ = #{payStatus},
- </if>
- <if test="updateTime != null">
- update_time_ = #{updateTime},
- </if>
- </set>
- WHERE id_ = #{id}
- </update>
- <select id="getStudents" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
- SELECT username_ ,id_ user_id_,avatar_ head_url_,gender_,phone_
- FROM sys_user
- WHERE FIND_IN_SET(organ_id_,#{organIdList})
- AND user_type_ LIKE '%STUDENT%'
- <if test="search">
- AND (username_ LIKE CONCAT(#{search},'%') OR phone_ LIKE CONCAT(#{search},'%'))
- </if>
- <include refid="global.limit"/>
- </select>
- <select id="getStudentsCount" resultType="java.lang.Integer">
- SELECT COUNT(*) FROM sys_user
- WHERE FIND_IN_SET(organ_id_,#{organIdList})
- AND user_type_ LIKE '%STUDENT%'
- <if test="search">
- AND (username_ LIKE CONCAT(#{search},'%') OR phone_ LIKE CONCAT(#{search},'%'))
- </if>
- </select>
- <select id="queryPage" resultMap="StudentRepair">
- SELECT sr.*,o.name_ FROM student_repair sr
- LEFT JOIN organization o ON o.id_ = sr.organ_id_
- <include refid="queryPageSql"/>
- ORDER BY id_ DESC
- <include refid="global.limit"/>
- </select>
- <sql id="queryPageSql">
- <where>
- <if test="search != null and search != ''">
- AND (sr.trans_no_ LIKE CONCAT('%',#{search},'%') OR sr.student_id_ = #{search} OR sr.student_name_ LIKE
- CONCAT('%',#{search},'%'))
- </if>
- <if test="employeeId != null">
- AND sr.employee_id_ = #{employeeId}
- </if>
- <if test="studentId != null">
- AND sr.student_id_ = #{studentId}
- </if>
- <if test="organIdList != null and organIdList != ''">
- AND FIND_IN_SET(sr.organ_id_,#{organIdList})
- </if>
- <if test="subjectId != null">
- AND sr.subject_id_ = #{subjectId}
- </if>
- <if test="type != null">
- AND sr.type_ = #{type}
- </if>
- <if test="repairStatus != null">
- AND sr.repair_status_ = #{repairStatus}
- </if>
- <if test="payStatus != null">
- AND sr.pay_status_ = #{payStatus}
- </if>
- <if test="startTime != null">
- AND sr.create_time_ >= #{startTime}
- </if>
- <if test="endTime != null">
- AND sr.create_time_ <= #{endTime}
- </if>
- </where>
- </sql>
- <select id="queryCount" resultType="int">
- SELECT COUNT(id_) FROM student_repair sr
- <include refid="queryPageSql"/>
- </select>
- <select id="getUserMusicGroup" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.MusicGroup">
- SELECT mg.id_,mg.name_,sr.user_id_ repair_user_id_ FROM music_group mg
- LEFT JOIN student_registration sr on sr.music_group_id_ = mg.id_
- WHERE sr.user_id_ IN
- <foreach collection="userIds" item="userId" open="(" close=")" separator=",">
- #{userId}
- </foreach>
- AND mg.status_='PROGRESS'
- ORDER BY id_ DESC
- </select>
- <select id="getStudentInfo" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
- SELECT su.username_,
- su.id_ user_id_,
- su.avatar_ head_url_,
- su.gender_,
- mg.id_ music_group_id_,
- mg.name_ music_group_name_,
- sr.subject_id_
- FROM sys_user su
- LEFT JOIN student_registration sr ON sr.user_id_ = su.id_
- LEFT JOIN music_group mg ON mg.id_ = sr.music_group_id_
- WHERE su.id_ = #{studentId}
- ORDER BY mg.id_ DESC
- LIMIT 1
- </select>
- <select id="getRepairInfo" resultMap="StudentRepair">
- SELECT sr.*, su.phone_ employee_phone_, e.contact_address_ employee_address_
- FROM student_repair sr
- LEFT JOIN sys_user su ON su.id_ = sr.employee_id_
- LEFT JOIN employee e ON sr.employee_id_ = e.user_id_
- WHERE sr.id_ = #{id}
- </select>
- <select id="getStudentMusicGroupRepairer" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
- SELECT repairer.real_name_ username_, repairer.id_ user_id_, repairer.avatar_ head_url_
- FROM music_group mg
- LEFT JOIN student_registration sr on sr.music_group_id_ = mg.id_
- LEFT JOIN sys_user repairer ON repairer.id_ = mg.repair_user_id_
- WHERE sr.user_id_ = #{studentId}
- AND mg.status_ = 'PROGRESS'
- AND mg.repair_user_id_ IS NOT NULL
- ORDER BY mg.id_ DESC
- LIMIT 1
- </select>
- <select id="getStudentOrganRepairer" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
- SELECT su.real_name_ username_, su.id_ user_id_, su.avatar_ head_url_
- FROM employee e
- LEFT JOIN sys_user su ON su.id_ = e.user_id_
- LEFT JOIN sys_user_role sur ON sur.user_id_ = su.id_
- WHERE FIND_IN_SET(#{organId}, e.organ_id_list_)
- AND sur.role_id_ = 37
- ORDER BY RAND()
- LIMIT 1
- </select>
- </mapper>
|