Files
railwaysystem/RuoYi-Vue/ruoyi-device/src/main/resources/mapper/device/TrainReadingAlternateProgressMapper.xml
T

108 lines
6.0 KiB
XML

<?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.device.mapper.TrainReadingAlternateProgressMapper">
<resultMap type="TrainReadingAlternateProgress" id="TrainReadingAlternateProgressResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="bookId" column="book_id" />
<result property="mode" column="mode" />
<result property="bookVersion" column="book_version" />
<result property="pageNo" column="page_no" />
<result property="sentenceIndex" column="sentence_index" />
<result property="progress" column="progress" />
<result property="sourceRecordId" column="source_record_id" />
<result property="sourceSessionId" column="source_session_id" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectTrainReadingAlternateProgressVo">
select id, user_id, book_id, mode, book_version, page_no, sentence_index, progress, source_record_id, source_session_id, create_time from train_reading_alternate_progress
</sql>
<select id="selectTrainReadingAlternateProgressList" parameterType="TrainReadingAlternateProgress" resultMap="TrainReadingAlternateProgressResult">
<include refid="selectTrainReadingAlternateProgressVo"/>
<where>
<if test="userId != null"> and user_id = #{userId}</if>
<if test="bookId != null and bookId != ''"> and book_id = #{bookId}</if>
<if test="mode != null and mode != ''"> and mode = #{mode}</if>
<if test="bookVersion != null and bookVersion != ''"> and book_version = #{bookVersion}</if>
<if test="sourceRecordId != null and sourceRecordId != ''"> and source_record_id = #{sourceRecordId}</if>
<if test="sourceSessionId != null and sourceSessionId != ''"> and source_session_id = #{sourceSessionId}</if>
<if test="params.beginTime != null and params.beginTime != ''"> and create_time &gt;= #{params.beginTime}</if>
<if test="params.endTime != null and params.endTime != ''"> and create_time &lt;= #{params.endTime}</if>
</where>
order by create_time desc
</select>
<select id="selectTrainReadingAlternateProgressById" parameterType="Long" resultMap="TrainReadingAlternateProgressResult">
<include refid="selectTrainReadingAlternateProgressVo"/>
where id = #{id}
</select>
<insert id="insertTrainReadingAlternateProgress" parameterType="TrainReadingAlternateProgress">
insert into train_reading_alternate_progress
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userId != null">user_id,</if>
<if test="bookId != null and bookId != ''">book_id,</if>
<if test="mode != null and mode != ''">mode,</if>
<if test="bookVersion != null and bookVersion != ''">book_version,</if>
<if test="pageNo != null">page_no,</if>
<if test="sentenceIndex != null">sentence_index,</if>
<if test="progress != null">progress,</if>
<if test="sourceRecordId != null and sourceRecordId != ''">source_record_id,</if>
<if test="sourceSessionId != null and sourceSessionId != ''">source_session_id,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userId != null">#{userId},</if>
<if test="bookId != null and bookId != ''">#{bookId},</if>
<if test="mode != null and mode != ''">#{mode},</if>
<if test="bookVersion != null and bookVersion != ''">#{bookVersion},</if>
<if test="pageNo != null">#{pageNo},</if>
<if test="sentenceIndex != null">#{sentenceIndex},</if>
<if test="progress != null">#{progress},</if>
<if test="sourceRecordId != null and sourceRecordId != ''">#{sourceRecordId},</if>
<if test="sourceSessionId != null and sourceSessionId != ''">#{sourceSessionId},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateTrainReadingAlternateProgress" parameterType="TrainReadingAlternateProgress">
update train_reading_alternate_progress
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="bookId != null and bookId != ''">book_id = #{bookId},</if>
<if test="mode != null and mode != ''">mode = #{mode},</if>
<if test="bookVersion != null and bookVersion != ''">book_version = #{bookVersion},</if>
<if test="pageNo != null">page_no = #{pageNo},</if>
<if test="sentenceIndex != null">sentence_index = #{sentenceIndex},</if>
<if test="progress != null">progress = #{progress},</if>
<if test="sourceRecordId != null and sourceRecordId != ''">source_record_id = #{sourceRecordId},</if>
<if test="sourceSessionId != null and sourceSessionId != ''">source_session_id = #{sourceSessionId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTrainReadingAlternateProgressById" parameterType="Long">
delete from train_reading_alternate_progress where id = #{id}
</delete>
<delete id="deleteTrainReadingAlternateProgressByIds" parameterType="Long">
delete from train_reading_alternate_progress where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectListByUserBookMode" resultMap="TrainReadingAlternateProgressResult">
<include refid="selectTrainReadingAlternateProgressVo"/>
where user_id = #{userId} and book_id = #{bookId} and mode = #{mode}
order by create_time desc
</select>
</mapper>