|
|
|
|
<?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.ruoyi.system.mapper.colums.SysTeacherMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="SysTeacher" id="SysTeacherResult">
|
|
|
|
|
<result property="userId" column="user_id" />
|
|
|
|
|
<result property="teacherName" column="teacher_name" />
|
|
|
|
|
<result property="avatarImg" column="avatar_img" />
|
|
|
|
|
<result property="intro" column="intro" />
|
|
|
|
|
<result property="context" column="context" />
|
|
|
|
|
<result property="url" column="url" />
|
|
|
|
|
<result property="introduce" column="introduce" />
|
|
|
|
|
<result property="releases" column="releases" />
|
|
|
|
|
<result property="sort" column="sort" />
|
|
|
|
|
<result property="createBy" column="create_by" />
|
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
<result property="nickName" column="nick_name" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectSysTeacherVo">
|
|
|
|
|
select sys_teacher.user_id, teacher_name, avatar_img, intro, context, url,introduce, releases, sort, sys_teacher.create_by, sys_teacher.create_time, sys_teacher.update_by, sys_teacher.update_time
|
|
|
|
|
,sys_user.nick_name
|
|
|
|
|
from sys_teacher
|
|
|
|
|
join sys_user on sys_teacher.user_id =sys_user.user_id
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectSysTeacherList" parameterType="SysTeacher" resultMap="SysTeacherResult">
|
|
|
|
|
<include refid="selectSysTeacherVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="teacherName != null and teacherName != ''"> and teacher_name like concat('%', #{teacherName}, '%')</if>
|
|
|
|
|
<if test="avatarImg != null and avatarImg != ''"> and avatar_img = #{avatarImg}</if>
|
|
|
|
|
<if test="intro != null and intro != ''"> and intro = #{intro}</if>
|
|
|
|
|
<if test="context != null and context != ''"> and context = #{context}</if>
|
|
|
|
|
<if test="url != null and url != ''"> and url = #{url}</if>
|
|
|
|
|
<if test="introduce != null and introduce != ''"> and introduce = #{introduce}</if>
|
|
|
|
|
<if test="releases != null "> and releases = #{releases}</if>
|
|
|
|
|
<if test="sort != null "> and sort = #{sort}</if>
|
|
|
|
|
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getUserForTeacher" parameterType="SysTeacher" resultType="SysUser">
|
|
|
|
|
SELECT * from sys_user u
|
|
|
|
|
WHERE u.delete_flag=0 and u.tenant_id=#{tenantId} and u.teacher= 1
|
|
|
|
|
and u.user_id not in ( select user_id FROM sys_teacher WHERE u.tenant_id = #{tenantId})
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectSysTeacherByUserId" parameterType="Long" resultMap="SysTeacherResult">
|
|
|
|
|
<include refid="selectSysTeacherVo"/>
|
|
|
|
|
where sys_teacher.user_id = #{userId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertSysTeacher" parameterType="SysTeacher">
|
|
|
|
|
insert into sys_teacher
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="userId != null">user_id,</if>
|
|
|
|
|
<if test="teacherName != null and teacherName != ''">teacher_name,</if>
|
|
|
|
|
<if test="avatarImg != null">avatar_img,</if>
|
|
|
|
|
<if test="intro != null">intro,</if>
|
|
|
|
|
<if test="context != null">context,</if>
|
|
|
|
|
<if test="url != null">url,</if>
|
|
|
|
|
<if test="
|
|
|
|
|
introduce != null">
|
|
|
|
|
introduce,</if>
|
|
|
|
|
<if test="releases != null">releases,</if>
|
|
|
|
|
<if test="sort != null">sort,</if>
|
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="userId != null">#{userId},</if>
|
|
|
|
|
<if test="teacherName != null and teacherName != ''">#{teacherName},</if>
|
|
|
|
|
<if test="avatarImg != null">#{avatarImg},</if>
|
|
|
|
|
<if test="intro != null">#{intro},</if>
|
|
|
|
|
<if test="context != null">#{context},</if>
|
|
|
|
|
<if test="url != null">#{url},</if>
|
|
|
|
|
<if test="
|
|
|
|
|
introduce != null">#{
|
|
|
|
|
introduce},</if>
|
|
|
|
|
<if test="releases != null">#{releases},</if>
|
|
|
|
|
<if test="sort != null">#{sort},</if>
|
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateSysTeacher" parameterType="SysTeacher">
|
|
|
|
|
update sys_teacher
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="teacherName != null and teacherName != ''">teacher_name = #{teacherName},</if>
|
|
|
|
|
<if test="avatarImg != null">avatar_img = #{avatarImg},</if>
|
|
|
|
|
<if test="intro != null">intro = #{intro},</if>
|
|
|
|
|
<if test="context != null">context = #{context},</if>
|
|
|
|
|
<if test="url != null">url = #{url},</if>
|
|
|
|
|
<if test="
|
|
|
|
|
introduce != null">
|
|
|
|
|
introduce = #{
|
|
|
|
|
introduce},</if>
|
|
|
|
|
<if test="releases != null">releases = #{releases},</if>
|
|
|
|
|
<if test="sort != null">sort = #{sort},</if>
|
|
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where user_id = #{userId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteSysTeacherByUserId" parameterType="Long">
|
|
|
|
|
delete from sys_teacher where user_id = #{userId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteSysTeacherByUserIds" parameterType="String">
|
|
|
|
|
delete from sys_teacher where user_id in
|
|
|
|
|
<foreach item="userId" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{userId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|