<?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.ycl.jxkg.mapper.EducationResourceMapper">
|
|
<select id="page" resultType="com.ycl.jxkg.domain.vo.admin.education.EducationResourceVO">
|
SELECT
|
ter.id,
|
ter.content_type,
|
ter.content_url as contentUrlString,
|
ter.subject_id,
|
ter.introduction,
|
ter.create_time,
|
ter.update_time,
|
ter.attachment as attachmentString,
|
ts.name as typeName,
|
ter.class_id,
|
tc.class_name
|
FROM
|
t_education_resource ter
|
INNER JOIN t_subject ts ON ts.id = ter.subject_id
|
INNER JOIN t_classes tc ON tc.id = ter.class_id
|
<where>
|
AND ter.deleted = 0
|
<if test="query.introduction != null and query.introduction != ''">
|
AND ter.introduction like concat('%', #{query.introduction}, '%')
|
</if>
|
<if test="query.subjectId != null">
|
AND ter.subject_id = #{query.subjectId}
|
</if>
|
<if test="query.classId != null">
|
AND ter.class_id = #{query.classId}
|
</if>
|
<if test="query.contentType != null and query.contentType != '' ">
|
AND ter.content_type = #{query.contentType}
|
</if>
|
</where>
|
ORDER BY
|
ter.create_time DESC
|
</select>
|
|
<select id="studentPage" resultType="com.ycl.jxkg.domain.vo.admin.education.EducationResourceVO">
|
SELECT
|
ter.id,
|
ter.content_type,
|
ter.content_url as contentUrlString,
|
ter.subject_id,
|
ter.introduction,
|
ter.create_time,
|
ter.update_time,
|
ter.attachment as attachmentString,
|
ts.name as typeName,
|
ter.class_id,
|
tc.class_name
|
FROM
|
t_education_resource ter
|
INNER JOIN t_subject ts ON ts.id = ter.subject_id
|
INNER JOIN t_classes tc ON tc.id = ter.class_id
|
<where>
|
AND ter.deleted = 0 and ter.class_id in
|
<foreach collection="query.classIds" item="classId" separator="," open="(" close=")">
|
#{classId}
|
</foreach>
|
<if test="query.introduction != null and query.introduction != ''">
|
AND ter.introduction like concat('%', #{query.introduction}, '%')
|
</if>
|
<if test="query.subjectId != null">
|
AND ter.subject_id = #{query.subjectId}
|
</if>
|
<if test="query.contentType != null and query.contentType != '' ">
|
AND ter.content_type = #{query.contentType}
|
</if>
|
</where>
|
ORDER BY
|
ter.create_time DESC
|
</select>
|
|
<insert id="add" keyColumn="id" useGeneratedKeys="true">
|
INSERT INTO t_education_resource(content_type, content_url, subject_id, introduction, create_time, update_time,
|
attachment,create_user,class_id)
|
values (#{form.contentType}, #{form.contentUrl}, #{form.subjectId}, #{form.introduction}, #{form.createTime}, #{form.updateTime}, #{form.attachment},#{form.createUser},#{form.classId})
|
</insert>
|
|
<update id="update">
|
UPDATE
|
t_education_resource
|
<set>
|
<if test="form.contentType != null and form.contentType != ''">content_type = #{form.contentType},</if>
|
<if test="form.contentUrl != null and form.contentUrl != ''">content_url = #{form.contentUrl},</if>
|
<if test="form.subjectId != null">subject_id = #{form.subjectId},</if>
|
<if test="form.classId != null">class_id = #{form.classId},</if>
|
<if test="form.introduction != null and form.introduction != ''">introduction = #{form.introduction},</if>
|
<if test="form.updateTime != null">update_time = #{form.updateTime},</if>
|
attachment = #{form.attachment}
|
</set>
|
WHERE
|
id = #{form.id}
|
</update>
|
|
<update id="remove">
|
UPDATE t_education_resource SET deleted = 1 WHERE id IN
|
<foreach collection="ids" open="(" separator="," close=")" item="id">#{id}</foreach>
|
</update>
|
|
|
</mapper>
|