周箭河 5 anni fa
parent
commit
6bb626d97b

+ 27 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentVisitDao.java

@@ -0,0 +1,27 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.dto.StudentVisitDto;
+import com.ym.mec.biz.dal.entity.StudentVisit;
+import com.ym.mec.common.dal.BaseDAO;
+
+import java.util.List;
+import java.util.Map;
+
+
+public interface StudentVisitDao extends BaseDAO<Integer, StudentVisit> {
+
+    /**
+     * 获取访问详情
+     *
+     * @param id
+     * @return
+     */
+    StudentVisitDto getInfo(Integer id);
+
+    /**
+     * 获取访问列表
+     * @param params
+     * @return
+     */
+    List<StudentVisitDto> getPageList(Map<String, Object> params);
+}

+ 191 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentVisit.java

@@ -0,0 +1,191 @@
+package com.ym.mec.biz.dal.entity;
+
+import com.ym.mec.common.enums.BaseEnum;
+
+import java.util.Date;
+
+public class StudentVisit {
+
+    public enum VisiterTypeEnum implements BaseEnum<String, com.ym.mec.biz.dal.enums.TeachModeEnum> {
+        TEACHER("TEACHER", "指导老师"), EDU_TEACHER("EDU_TEACHER", "教务老师");
+
+        private String code;
+
+        private String msg;
+
+        VisiterTypeEnum(String code, String msg) {
+            this.code = code;
+            this.msg = msg;
+        }
+
+        public void setCode(String code) {
+            this.code = code;
+        }
+
+        public String getMsg() {
+            return msg;
+        }
+
+        public void setMsg(String msg) {
+            this.msg = msg;
+        }
+
+        @Override
+        public String getCode() {
+            return this.code;
+        }
+    }
+
+    private Integer id;
+
+    /**
+    * 乐团id
+    */
+    private String musicGroupId;
+
+    /**
+     * 分部id
+     */
+    private Integer organId;
+
+    /**
+    * 学生id
+    */
+    private Integer studentId;
+
+    /**
+    * 老师id
+    */
+    private Integer teacherId;
+
+    /**
+     * 老师类型
+     */
+    private VisiterTypeEnum visiterType;
+
+    /**
+    * 回访类型
+    */
+    private String type;
+
+    /**
+    * 回访目的
+    */
+    private String purpose;
+
+    /**
+    * 学生情况
+    */
+    private String overview;
+
+    /**
+    * 家长反馈
+    */
+    private String feedback;
+
+    /**
+    * 回访日期
+    */
+    private Date visitTime;
+
+    /**
+    * 添加时间
+    */
+    private Date createTime;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getMusicGroupId() {
+        return musicGroupId;
+    }
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
+    public void setMusicGroupId(String musicGroupId) {
+        this.musicGroupId = musicGroupId;
+    }
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public Integer getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Integer teacherId) {
+        this.teacherId = teacherId;
+    }
+
+    public VisiterTypeEnum getVisiterType() {
+        return visiterType;
+    }
+
+    public void setVisiterType(VisiterTypeEnum visiterType) {
+        this.visiterType = visiterType;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getPurpose() {
+        return purpose;
+    }
+
+    public void setPurpose(String purpose) {
+        this.purpose = purpose;
+    }
+
+    public String getOverview() {
+        return overview;
+    }
+
+    public void setOverview(String overview) {
+        this.overview = overview;
+    }
+
+    public String getFeedback() {
+        return feedback;
+    }
+
+    public void setFeedback(String feedback) {
+        this.feedback = feedback;
+    }
+
+    public Date getVisitTime() {
+        return visitTime;
+    }
+
+    public void setVisitTime(Date visitTime) {
+        this.visitTime = visitTime;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 149 - 0
mec-biz/src/main/resources/config/mybatis/StudentVisitMapper.xml

@@ -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="organIdList != null and organIdList != ''">
+                AND FIND_IN_SET(sv.organ_id_,#{organIdList})
+            </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_ &lt;= #{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>