|
@@ -0,0 +1,149 @@
|
|
|
+<?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.StudentVisitDao">
|
|
|
+ <resultMap id="StudentVisit" type="com.ym.mec.biz.dal.dto.StudentVisitDto">
|
|
|
+ <id column="id_" property="id"/>
|
|
|
+ <result column="music_group_id_" property="musicGroupId"/>
|
|
|
+ <result column="musicGroupName" property="musicGroupName"/>
|
|
|
+ <result column="organ_id_" property="organId"/>
|
|
|
+ <result column="organName" property="organName"/>
|
|
|
+ <result column="student_id_" property="studentId"/>
|
|
|
+ <result column="studentName" property="studentName"/>
|
|
|
+ <result column="teacher_id_" property="teacherId"/>
|
|
|
+ <result column="teacherName" property="teacherName"/>
|
|
|
+ <result column="visiter_type_" property="visiterType"/>
|
|
|
+ <result column="type_" property="type"/>
|
|
|
+ <result column="purpose_" property="purpose"/>
|
|
|
+ <result column="overview_" property="overview"/>
|
|
|
+ <result column="feedback_" property="feedback"/>
|
|
|
+ <result column="visit_time_" property="visitTime"/>
|
|
|
+ <result column="create_time_" property="createTime"/>
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ id_, music_group_id_, organ_id_, student_id_, teacher_id_, visiter_type_, type_, purpose_, overview_, feedback_,
|
|
|
+ visit_time_, create_time_
|
|
|
+ </sql>
|
|
|
+ <select id="get" parameterType="java.lang.Integer" resultMap="StudentVisit">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ from student_visit
|
|
|
+ where id_ = #{id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+ <delete id="delete" parameterType="java.lang.Integer">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ delete from student_visit
|
|
|
+ where id_ = #{id,jdbcType=INTEGER}
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.StudentVisit"
|
|
|
+ useGeneratedKeys="true">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ insert into student_visit (music_group_id_, organ_id_, student_id_, teacher_id_, visiter_type_,
|
|
|
+ type_, purpose_, overview_,
|
|
|
+ feedback_, visit_time_, create_time_
|
|
|
+ )
|
|
|
+ values (#{musicGroupId,jdbcType=VARCHAR}, #{organId,jdbcType=INTEGER}, #{studentId,jdbcType=INTEGER},
|
|
|
+ #{teacherId,jdbcType=INTEGER},#{visiterType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
|
|
|
+ #{type,jdbcType=VARCHAR}, #{purpose,jdbcType=VARCHAR}, #{overview,jdbcType=VARCHAR},
|
|
|
+ #{feedback,jdbcType=VARCHAR}, #{visitTime}, #{createTime}
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+ <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentVisit">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ update student_visit
|
|
|
+ <set>
|
|
|
+ <if test="musicGroupId != null">
|
|
|
+ music_group_id_ = #{musicGroupId,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="studentId != null">
|
|
|
+ student_id_ = #{studentId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="teacherId != null">
|
|
|
+ teacher_id_ = #{teacherId,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="type != null">
|
|
|
+ type_ = #{type,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="purpose != null">
|
|
|
+ purpose_ = #{purpose,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="overview != null">
|
|
|
+ overview_ = #{overview,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="feedback != null">
|
|
|
+ feedback_ = #{feedback,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="visitTime != null">
|
|
|
+ visit_time_ = #{visitTime},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time_ = #{createTime},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id_ = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="queryPage" resultMap="StudentVisit">
|
|
|
+ SELECT * FROM student_visit sv
|
|
|
+ <include refid="queryPageSql"/>
|
|
|
+ ORDER BY sv.id_ DESC
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getPageList" resultMap="StudentVisit">
|
|
|
+ SELECT sv.*,t.real_name_ teacherName,o.name_ organName,t.username_ studentName,mg.name_ musicGroupName FROM
|
|
|
+ student_visit sv
|
|
|
+ LEFT JOIN sys_user t ON sv.teacher_id_ = t.id_
|
|
|
+ LEFT JOIN organization o ON sv.organ_id_ = o.id_
|
|
|
+ LEFT JOIN sys_user s ON s.id_ = sv.student_id_
|
|
|
+ LEFT JOIN music_group mg ON sv.music_group_id_ = mg.id_
|
|
|
+ <include refid="queryPageSql"/>
|
|
|
+ ORDER BY sv.id_ DESC
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
+ <sql id="queryPageSql">
|
|
|
+ <where>
|
|
|
+ <if test="teacher != null and teacher != ''">
|
|
|
+ AND (t.id_ = #{teacher} OR t.real_name_ LIKE CONCAT('%',#{teacher},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="student != null and student != ''">
|
|
|
+ AND (s.id_ = #{student} OR s.username_ LIKE CONCAT('%',#{student},'%'))
|
|
|
+ </if>
|
|
|
+ <if test="organId != null and organId != ''">
|
|
|
+ AND FIND_IN_SET(sv.organ_id_,#{organId})
|
|
|
+ </if>
|
|
|
+ <if test="visiterType != null">
|
|
|
+ AND sv.visiter_type_ = #{visiterType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
|
|
|
+ </if>
|
|
|
+ <if test="type != null">
|
|
|
+ AND sv.type_ = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="purpose != null">
|
|
|
+ AND sv.purpose_ = #{purpose}
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null">
|
|
|
+ AND sv.visit_time_ >= #{startTime}
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null">
|
|
|
+ AND sv.visit_time_ <= #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+ <select id="queryCount" resultType="int">
|
|
|
+ SELECT COUNT(*) FROM student_visit sv
|
|
|
+ LEFT JOIN sys_user t ON sv.teacher_id_ = t.id_
|
|
|
+ LEFT JOIN sys_user s ON s.id_ = sv.student_id_
|
|
|
+ <include refid="queryPageSql"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getInfo" resultMap="StudentVisit">
|
|
|
+ SELECT sv.*, t.real_name_ teacherName, o.name_ organName, t.username_ studentName, mg.name_ musicGroupName
|
|
|
+ FROM student_visit sv
|
|
|
+ LEFT JOIN sys_user t ON sv.teacher_id_ = t.id_
|
|
|
+ LEFT JOIN organization o ON sv.organ_id_ = o.id_
|
|
|
+ LEFT JOIN sys_user s ON s.id_ = sv.student_id_
|
|
|
+ LEFT JOIN music_group mg ON sv.music_group_id_ = mg.id_
|
|
|
+ WHERE sv.id_ = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|