123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220 |
- <?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.TTrainingbccDeviceMapper">
- <resultMap type="TTrainingbccDevice" id="TTrainingbccDeviceResult">
- <result property="id" column="id" />
- <result property="staffId" column="staff_id" />
- <result property="regularId" column="regular_id" />
- <result property="startDate" column="start_date" />
- <result property="remarks" column="remarks" />
- <result property="delFlag" column="del_flag" />
- <result property="createrCode" column="creater_code" />
- <result property="createdate" column="createdate" />
- <result property="updaterCode" column="updater_code" />
- <result property="updatedate" column="updatedate" />
- <result property="supplementary" column="supplementary" />
- <result property="learnState" column="learn_state" />
- <result property="examState" column="exam_state" />
- <result property="examId" column="exam_id" />
- <result property="examNum" column="exam_num" />
- <result property="learnTime" column="learn_time" />
- <result property="finishDate" column="finish_date" />
- <result property="deptName" column="dept_name" />
- <result property="team" column="team" />
- </resultMap>
- <sql id="selectTTrainingbccDeviceVo">
- select d.id,s.name , d.staff_id, d.regular_id, d.start_date, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.supplementary, d.learn_state, d.exam_state, d.exam_id,d.exam_num, d.learn_time, d.finish_date from t_trainingbcc_device d
- left join t_staffmgr s on s.staffid = d.staff_id
- </sql>
- <select id="selectTTrainingbccDeviceList" parameterType="TTrainingbccDevice" resultMap="TTrainingbccDeviceResult">
- select d.id,s.name , d.staff_id, d.regular_id, d.start_date, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.supplementary, d.learn_state, d.exam_state, d.exam_id,d.exam_num, d.learn_time, s.team from t_trainingbcc_device d
- left join t_staffmgr s on s.staffid = d.staff_id
- left join t_trainingbcc t on t.id = d.regular_id and t.DEL_FLAG = 0
- <where>
- <if test="staffId != null and staffId != ''"> and d.staff_id = #{staffId} and d.exam_state != 1 and ((ADD_MONTHS(TRUNC(SYSDATE, 'MM'), 1) > t.course_startdate and t.course_enddate >= SYSDATE) or (d.supplementary = 1 and d.exam_state = 0)) </if>
- <if test="regularId != null "> and d.regular_id = #{regularId}</if>
- <if test="startDate != null "> and d.start_date = #{startDate}</if>
- <if test="team != null and team != ''"> and s.team = #{team}</if>
- <if test="remarks != null and remarks != ''"> and d.remarks = #{remarks}</if>
- <if test="createrCode != null and createrCode != ''"> and d.creater_code = #{createrCode}</if>
- <if test="createdate != null "> and d.createdate = #{createdate}</if>
- <if test="updaterCode != null and updaterCode != ''"> and d.updater_code = #{updaterCode}</if>
- <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
- <if test="supplementary != null and supplementary != ''"> and d.supplementary = #{supplementary}</if>
- <if test="learnState != null "> and d.learn_state = #{learnState}</if>
- <if test="examState != null "> and d.exam_state = #{examState}</if>
- <if test="examId != null "> and d.exam_id = #{examId}</if>
- <if test="learnTime != null "> and d.learn_time = #{learnTime}</if>
- <if test="trainingType != null and trainingType != ''">and t.training_type = #{trainingType}</if>
- and d.del_flag = 0
- </where>
- order by d.exam_state, d.start_date
- </select>
- <select id="selectTTrainingbccDeviceByReguar" parameterType="TTrainingbccDevice" resultMap="TTrainingbccDeviceResult">
- select d.id,s.name , d.staff_id, d.regular_id, d.start_date, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.supplementary, d.learn_state, d.exam_state, d.exam_id,d.exam_num, d.learn_time, d.finish_date, s.team from t_trainingbcc_device d
- left join t_staffmgr s on s.staffid = d.staff_id
- left join t_trainingbcc t on t.id = d.regular_id and t.DEL_FLAG = 0
- <where>
- <if test="staffId != null and staffId != ''"> and d.staff_id = #{staffId} </if>
- <if test="regularId != null "> and d.regular_id = #{regularId}</if>
- <if test="startDate != null "> and d.start_date = #{startDate}</if>
- <if test="team != null and team != ''"> and s.team = #{team}</if>
- <if test="remarks != null and remarks != ''"> and d.remarks = #{remarks}</if>
- <if test="createrCode != null and createrCode != ''"> and d.creater_code = #{createrCode}</if>
- <if test="createdate != null "> and d.createdate = #{createdate}</if>
- <if test="updaterCode != null and updaterCode != ''"> and d.updater_code = #{updaterCode}</if>
- <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
- <if test="supplementary != null and supplementary != ''"> and d.supplementary = #{supplementary}</if>
- <if test="learnState != null "> and d.learn_state = #{learnState}</if>
- <if test="examState != null "> and d.exam_state = #{examState}</if>
- <if test="examId != null "> and d.exam_id = #{examId}</if>
- <if test="learnTime != null "> and d.learn_time = #{learnTime}</if>
- <if test="trainingType != null and trainingType != ''">and t.training_type = #{trainingType}</if>
- and d.del_flag = 0
- </where>
- order by d.exam_state, d.start_date
- </select>
- <select id="sortSelectTTrainingbccDeviceList" parameterType="TTrainingbccDevice" resultMap="TTrainingbccDeviceResult">
- select d.id,s.name , d.staff_id, d.regular_id, d.start_date, d.remarks, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.supplementary, d.learn_state, d.exam_state, d.exam_id,d.exam_num, d.learn_time, d.finish_date from t_trainingbcc_device d
- left join t_staffmgr s on s.staffid = d.staff_id
- left join t_trainingbcc t on t.id = d.regular_id and t.DEL_FLAG = 0
- Left join SYS_DICT_DATA s0 on s.UNIT = s0.DICT_VALUE and s0.DICT_TYPE ='STAFF_UNIT'
- LEFT JOIN SYS_DICT_DATA s2 on s.ACTUALPOST = s2.DICT_VALUE and s2.DICT_TYPE = 'ACTUALPOST'
- LEFT JOIN SYS_DICT_DATA s1 on s.team = s1.DICT_VALUE and s1.DICT_TYPE = 'TEAM_DIVIDE'
- <where>
- <if test="staffId != null and staffId != ''"> and d.staff_id = #{staffId} and d.exam_state != 1 and ((ADD_MONTHS(TRUNC(SYSDATE, 'MM'), 1) > t.course_startdate and t.course_enddate >= SYSDATE) or (d.supplementary = 1 and d.exam_state = 0)) </if>
- <if test="regularId != null "> and d.regular_id = #{regularId}</if>
- <if test="startDate != null "> and d.start_date = #{startDate}</if>
- <if test="remarks != null and remarks != ''"> and d.remarks = #{remarks}</if>
- <if test="createrCode != null and createrCode != ''"> and d.creater_code = #{createrCode}</if>
- <if test="createdate != null "> and d.createdate = #{createdate}</if>
- <if test="updaterCode != null and updaterCode != ''"> and d.updater_code = #{updaterCode}</if>
- <if test="updatedate != null "> and d.updatedate = #{updatedate}</if>
- <if test="supplementary != null and supplementary != ''"> and d.supplementary = #{supplementary}</if>
- <if test="learnState != null "> and d.learn_state = #{learnState}</if>
- <if test="examState != null "> and d.exam_state = #{examState}</if>
- <if test="examId != null "> and d.exam_id = #{examId}</if>
- <if test="learnTime != null "> and d.learn_time = #{learnTime}</if>
- <if test="trainingType != null and trainingType != ''">and t.training_type = #{trainingType}</if>
- and d.del_flag = 0
- </where>
- ORDER BY d.del_flag, s0.DICT_SORT, s1.DICT_SORT ,s2.DICT_SORT
- </select>
- <select id="selectTTrainingbccDeviceById" parameterType="Long" resultMap="TTrainingbccDeviceResult">
- <include refid="selectTTrainingbccDeviceVo"/>
- where d.id = #{id}
- </select>
- <insert id="insertTTrainingbccDevice" parameterType="TTrainingbccDevice">
- <selectKey keyProperty="id" resultType="long" order="BEFORE">
- SELECT seq_t_trainingbcc_device.NEXTVAL as id FROM DUAL
- </selectKey>
- insert into t_trainingbcc_device
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="staffId != null">staff_id,</if>
- <if test="regularId != null">regular_id,</if>
- <if test="startDate != null">start_date,</if>
- <if test="remarks != null">remarks,</if>
- <if test="delFlag != null">del_flag,</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="supplementary != null">supplementary,</if>
- <if test="learnState != null">learn_state,</if>
- <if test="examState != null">exam_state,</if>
- <if test="examId != null">exam_id,</if>
- <if test="learnTime != null">learn_time,</if>
- <if test="finishDate != null">finish_date,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="staffId != null">#{staffId},</if>
- <if test="regularId != null">#{regularId},</if>
- <if test="startDate != null">#{startDate},</if>
- <if test="remarks != null">#{remarks},</if>
- <if test="delFlag != null">#{delFlag},</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="supplementary != null">#{supplementary},</if>
- <if test="learnState != null">#{learnState},</if>
- <if test="examState != null">#{examState},</if>
- <if test="examId != null">#{examId},</if>
- <if test="learnTime != null">#{learnTime},</if>
- <if test="finishDate != null">#{finishDate},</if>
- </trim>
- </insert>
- <update id="updateTTrainingbccDevice" parameterType="TTrainingbccDevice">
- update t_trainingbcc_device
- <trim prefix="SET" suffixOverrides=",">
- <if test="staffId != null">staff_id = #{staffId},</if>
- <if test="regularId != null">regular_id = #{regularId},</if>
- <if test="startDate != null">start_date = #{startDate},</if>
- <if test="remarks != null">remarks = #{remarks},</if>
- <if test="delFlag != null">del_flag = #{delFlag},</if>
- <if test="createrCode != null">creater_code = #{createrCode},</if>
- <if test="createdate != null">createdate = #{createdate},</if>
- <if test="updaterCode != null">updater_code = #{updaterCode},</if>
- <if test="updatedate != null">updatedate = #{updatedate},</if>
- <if test="supplementary != null">supplementary = #{supplementary},</if>
- <if test="learnState != null">learn_state = #{learnState},</if>
- <if test="examState != null">exam_state = #{examState},</if>
- <if test="examId != null">exam_id = #{examId},</if>
- <if test="examNum != null">exam_num = #{examNum},</if>
- <if test="learnTime != null">learn_time = #{learnTime},</if>
- <if test="finishDate != null">finish_date = #{finishDate},</if>
- </trim>
- where id = #{id}
- </update>
- <update id="deleteTTrainingbccDeviceById" parameterType="Long">
- update t_trainingbcc_device set del_flag = 2 where id = #{id}
- </update>
- <update id="deleteTTrainingbccDeviceByStaff" parameterType="TTrainingbccDevice">
- update t_trainingbcc_device set del_flag = 2 where staff_id = #{staffId} and regular_id = #{regularId}
- </update>
- <update id="deleteTTrainingbccDeviceByIds" parameterType="String">
- update t_trainingbcc_device set del_flag = 2 where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <update id="deleteTTrainingbccDeviceByTrainingbcc" parameterType="String">
- update t_trainingbcc_device set del_flag = 2 where regular_id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <select id="countTraining" parameterType="TTrainingbccDevice" resultType="int">
- select count(1) from t_trainingbcc_device
- <where>
- <if test="regularId != null "> and regular_id = #{regularId}</if>
- <if test="examState != null "> and exam_state = #{examState}</if>
- and del_flag = 0
- </where>
- </select>
- </mapper>
|