123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <?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.project.training.mapper.TrainingSnapshotMapper">
- <resultMap type="TrainingSnapshot" id="TrainingSnapshotResult">
- <result property="id" column="ID" />
- <result property="snapshotName" column="SNAPSHOT_NAME" />
- <result property="description" column="DESCRIPTION" />
- <result property="snapshotYear" column="SNAPSHOT_YEAR" />
- <result property="trainingType" column="TRAINING_TYPE" />
- <result property="snapshotData" column="SNAPSHOT_DATA" />
- <result property="queryParams" column="QUERY_PARAMS" />
- <result property="createrCode" column="CREATER_CODE" />
- <result property="createdate" column="CREATEDATE" />
- <result property="updaterCode" column="UPDATER_CODE" />
- <result property="updatedate" column="UPDATEDATE" />
- <result property="delFlag" column="DEL_FLAG" />
- </resultMap>
- <sql id="selectTrainingSnapshotVo">
- select ID, SNAPSHOT_NAME, DESCRIPTION, SNAPSHOT_YEAR, TRAINING_TYPE, SNAPSHOT_DATA, QUERY_PARAMS, CREATER_CODE, CREATEDATE, UPDATER_CODE, UPDATEDATE, DEL_FLAG from t_training_snapshot
- </sql>
- <select id="selectTrainingSnapshotList" parameterType="TrainingSnapshot" resultMap="TrainingSnapshotResult">
- <include refid="selectTrainingSnapshotVo"/>
- <where>
- <if test="snapshotName != null and snapshotName != ''"> and SNAPSHOT_NAME like '%' || #{snapshotName} || '%'</if>
- <if test="snapshotYear != null and snapshotYear != ''"> and SNAPSHOT_YEAR = #{snapshotYear}</if>
- <if test="trainingType != null and trainingType != ''"> and TRAINING_TYPE = #{trainingType}</if>
- and DEL_FLAG = 0
- </where>
- order by CREATEDATE desc
- </select>
-
- <select id="selectTrainingSnapshotById" parameterType="Long" resultMap="TrainingSnapshotResult">
- <include refid="selectTrainingSnapshotVo"/>
- where ID = #{id}
- </select>
- <select id="selectTrainingSnapshotByYearAndType" resultMap="TrainingSnapshotResult">
- SELECT * FROM (
- <include refid="selectTrainingSnapshotVo"/>
- where SNAPSHOT_YEAR = #{snapshotYear} and TRAINING_TYPE = #{trainingType} and DEL_FLAG = 0
- order by CREATEDATE desc
- ) WHERE ROWNUM = 1
- </select>
- <select id="selectTrainingSnapshotByYear" resultMap="TrainingSnapshotResult">
- SELECT * FROM (
- <include refid="selectTrainingSnapshotVo"/>
- where SNAPSHOT_YEAR = #{snapshotYear} and DEL_FLAG = 0
- order by CREATEDATE desc
- ) WHERE ROWNUM = 1
- </select>
-
- <insert id="insertTrainingSnapshot" parameterType="TrainingSnapshot">
- <selectKey keyProperty="id" resultType="long" order="BEFORE">
- SELECT seq_t_training_snapshot.NEXTVAL as id FROM DUAL
- </selectKey>
- insert into t_training_snapshot
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">ID,</if>
- <if test="snapshotName != null">SNAPSHOT_NAME,</if>
- <if test="description != null">DESCRIPTION,</if>
- <if test="snapshotYear != null">SNAPSHOT_YEAR,</if>
- <if test="trainingType != null">TRAINING_TYPE,</if>
- <if test="snapshotData != null">SNAPSHOT_DATA,</if>
- <if test="queryParams != null">QUERY_PARAMS,</if>
- <if test="createrCode != null">CREATER_CODE,</if>
- <if test="createdate != null">CREATEDATE,</if>
- <if test="updaterCode != null">UPDATER_CODE,</if>
- <if test="updatedate != null">UPDATEDATE,</if>
- <if test="delFlag != null">DEL_FLAG,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="snapshotName != null">#{snapshotName},</if>
- <if test="description != null">#{description},</if>
- <if test="snapshotYear != null">#{snapshotYear},</if>
- <if test="trainingType != null">#{trainingType},</if>
- <if test="snapshotData != null">#{snapshotData},</if>
- <if test="queryParams != null">#{queryParams},</if>
- <if test="createrCode != null">#{createrCode},</if>
- <if test="createdate != null">#{createdate},</if>
- <if test="updaterCode != null">#{updaterCode},</if>
- <if test="updatedate != null">#{updatedate},</if>
- <if test="delFlag != null">#{delFlag},</if>
- </trim>
- </insert>
- <update id="updateTrainingSnapshot" parameterType="TrainingSnapshot">
- update t_training_snapshot
- <trim prefix="SET" suffixOverrides=",">
- <if test="snapshotName != null">SNAPSHOT_NAME = #{snapshotName},</if>
- <if test="description != null">DESCRIPTION = #{description},</if>
- <if test="snapshotYear != null">SNAPSHOT_YEAR = #{snapshotYear},</if>
- <if test="trainingType != null">TRAINING_TYPE = #{trainingType},</if>
- <if test="snapshotData != null">SNAPSHOT_DATA = #{snapshotData},</if>
- <if test="queryParams != null">QUERY_PARAMS = #{queryParams},</if>
- <if test="updaterCode != null">UPDATER_CODE = #{updaterCode},</if>
- <if test="updatedate != null">UPDATEDATE = #{updatedate},</if>
- <if test="delFlag != null">DEL_FLAG = #{delFlag},</if>
- </trim>
- where ID = #{id}
- </update>
- <delete id="deleteTrainingSnapshotById" parameterType="Long">
- update t_training_snapshot set DEL_FLAG = 2 where ID = #{id}
- </delete>
- <delete id="deleteTrainingSnapshotByIds" parameterType="String">
- update t_training_snapshot set DEL_FLAG = 2 where ID in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|