114 lines
3.8 KiB
XML
114 lines
3.8 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="cn.iocoder.yudao.module.knowledge.mapper.TTrainUserMapper">
|
|
|
|
<resultMap type="cn.iocoder.yudao.module.knowledge.entity.TTrainUser" id="tTrainUserMap">
|
|
<result property="id" column="id"/>
|
|
<result property="username" column="username"/>
|
|
<result property="trainId" column="train_id"/>
|
|
<result property="teachCode" column="teach_code"/>
|
|
</resultMap>
|
|
|
|
<resultMap type="cn.iocoder.yudao.module.knowledge.entity.TTrainUser" id="tTrainUserMaps">
|
|
<result property="id" column="id"/>
|
|
<result property="username" column="username"/>
|
|
<result property="paperInfoId" column="paper_info_id"/>
|
|
<result property="teachCode" column="teach_code"/>
|
|
</resultMap>
|
|
|
|
<!-- 用于select查询公用抽取的列 -->
|
|
<sql id="columns">
|
|
id
|
|
,username,usercode,teach_code
|
|
</sql>
|
|
<select id="paperInfList" resultMap="tTrainUserMaps">
|
|
select
|
|
<include refid="columns"/>
|
|
from t_train_user
|
|
<where>
|
|
<if test="params.id != null">
|
|
id = #{params.id}
|
|
</if>
|
|
<if test="params.username != null and params.username != ''">
|
|
username = #{params.username}
|
|
</if>
|
|
<if test="params.usercode != null and params.usercode != ''">
|
|
usercode = #{params.usercode}
|
|
</if>
|
|
<if test="params.teachCode != null and params.teachCode != ''">
|
|
teach_code = #{params.teachCode}
|
|
</if>
|
|
<if test="params.paperInfoId != null">
|
|
paper_info_id = #{params.paperInfoId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="findList" resultMap="tTrainUserMap">
|
|
select
|
|
<include refid="columns"/>
|
|
from t_train_user
|
|
<where>
|
|
<if test="params.id != null">
|
|
id = #{params.id}
|
|
</if>
|
|
<if test="params.username != null and params.username != ''">
|
|
username = #{params.username}
|
|
</if>
|
|
<if test="params.usercode != null and params.usercode != ''">
|
|
usercode = #{params.usercode}
|
|
</if>
|
|
<if test="params.teachCode != null and params.teachCode != ''">
|
|
teach_code = #{params.teachCode}
|
|
</if>
|
|
<if test="params.trainId != null">
|
|
train_id = #{params.trainId}
|
|
</if>
|
|
<if test="params.trainIdList != null and params.trainIdList.size() > 0">
|
|
train_id in
|
|
<foreach collection="params.trainIdList" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getOneByTrainId" resultType="cn.iocoder.yudao.module.knowledge.entity.TTrainUser">
|
|
select *
|
|
from t_train_user
|
|
<where>
|
|
train_id = #{id}
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getOneByPaperInfoId" resultType="cn.iocoder.yudao.module.knowledge.entity.TTrainUser">
|
|
select *
|
|
from t_train_user
|
|
<where>
|
|
paper_info_id = #{id}
|
|
</where>
|
|
</select>
|
|
<select id="findListByUserId" resultType="cn.iocoder.yudao.module.knowledge.entity.TTrainUser">
|
|
select *
|
|
from t_train_user
|
|
where deleted = 0
|
|
and usercode = #{userId}
|
|
</select>
|
|
|
|
<delete id="deleteByTrainId"
|
|
parameterType="java.lang.Long">
|
|
delete
|
|
from t_train_user
|
|
where train_id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteBypaperInfId"
|
|
parameterType="java.lang.Long">
|
|
delete
|
|
from t_train_user
|
|
where paper_info_id = #{id}
|
|
</delete>
|
|
|
|
</mapper>
|