123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <?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.TTrainingrecordsMapper">
- <resultMap type="TTrainingrecords" id="TTrainingrecordsResult">
- <result property="id" column="id" />
- <result property="plantCode" column="plant_code" />
- <result property="year" column="year" />
- <result property="name" column="name" />
- <result property="employeeid" column="employeeid" />
- <result property="classes" column="classes" />
- <result property="companysafe" column="companysafe" />
- <result property="plantsafe" column="plantsafe" />
- <result property="teamsafe" column="teamsafe" />
- <result property="sub" column="sub" />
- <result property="cracking" column="cracking" />
- <result property="hotarea" column="hotarea" />
- <result property="coldarea" column="coldarea" />
- <result property="aeupgu" column="aeupgu" />
- <result property="upscore" column="upscore" />
- <result property="downscore" column="downscore" />
- <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="remarks" column="remarks" />
- <result property="deptId" column="dept_id" />
- <result property="deptName" column="dept_name" />
- <result property="onboard" column="onboard" />
- <result property="tds" column="tds" />
- <result property="postCard" column="post_card" />
- <result property="craft" column="craft" />
- <result property="staffId" column="staff_id" />
- <result property="company" column="company" />
- <result property="device" column="device" />
- </resultMap>
- <sql id="selectTTrainingrecordsVo">
- select d.id, d.plant_code,d.onboard, d.company, d.device, d.staff_id, d.tds,d.post_card,d.craft, d.year, d.name, d.employeeid, d.classes, d.companysafe, d.plantsafe, d.teamsafe, d.sub, d.cracking, d.hotarea, d.coldarea, d.aeupgu, d.upscore, d.downscore, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.remarks, d.dept_id ,s.dept_name from t_trainingrecords d
- left join sys_dept s on s.dept_id = d.dept_id
- </sql>
- <select id="selectTTrainingrecordsList" parameterType="TTrainingrecords" resultMap="TTrainingrecordsResult">
- <include refid="selectTTrainingrecordsVo"/>
- LEFT JOIN t_staffmgr t on d.employeeid = t.staffid and t.del_flag = 0
- LEFT JOIN SYS_DICT_DATA sdd on t.ACTUALPOST = sdd.DICT_VALUE and sdd.DICT_TYPE = 'ACTUALPOST'
- LEFT JOIN SYS_DICT_DATA sdd2 on d.classes = sdd2.DICT_VALUE and sdd2.DICT_TYPE = 'TEAM_DIVIDE'
- <where>
- <if test="year != null "> and year = #{year}</if>
- <if test="name != null and name != ''"> and d.name like concat(concat('%', #{name}), '%')</if>
- <if test="employeeid != null and employeeid != ''"> and employeeid like concat(concat('%', #{employeeid}), '%')</if>
- <if test="classes != null and classes != ''"> and classes = #{classes}</if>
- <if test="onboard != null and onboard != ''"> and onboard = #{onboard}</if>
- <if test="tds != null and tds != ''"> and tds = #{tds}</if>
- <if test="postCard != null and postCard != ''"> and post_card = #{postCard}</if>
- <if test="craft != null and craft != ''"> and craft = #{craft}</if>
- <!-- 王子文 2022年8月15日 -->
- <!-- 新增检索条件:公司级培训、装置级培训 -->
- <if test="company != null and company != ''"> and company = #{company}</if>
- <if test="device != null and device != ''"> and device = #{device}</if>
- and d.del_flag = 0
- </where>
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- order by sdd2.DICT_SORT ,sdd.DICT_SORT
- <!-- <if test="sortOrder == 'desc'">
- <if test="sortDate == 'companysafe'"> ORDER BY companysafe desc</if>
- <if test="sortDate == 'plantsafe'"> ORDER BY plantsafe desc</if>
- <if test="sortDate == 'teamsafe'"> ORDER BY teamsafe desc</if>
- </if>
- <if test="sortOrder == 'asc'">
- <if test="sortDate == 'companysafe'"> ORDER BY companysafe asc</if>
- <if test="sortDate == 'plantsafe'"> ORDER BY plantsafe asc</if>
- <if test="sortDate == 'teamsafe'"> ORDER BY teamsafe asc</if>
- </if>-->
- </select>
- <select id="selectList" parameterType="TTrainingrecords" resultMap="TTrainingrecordsResult">
- <include refid="selectTTrainingrecordsVo"/>
- <where>
- d.del_flag = 0
- </where>
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- </select>
- <select id="selectTTrainingrecordsById" parameterType="Long" resultMap="TTrainingrecordsResult">
- <include refid="selectTTrainingrecordsVo"/>
- where id = #{id}
- </select>
- <select id="selectTTrainingrecordsBystaffId" parameterType="Long" resultMap="TTrainingrecordsResult">
- <include refid="selectTTrainingrecordsVo"/>
- where d.staff_id = #{id} and rownum <![CDATA[ <= ]]> 1
- </select>
- <insert id="insertTTrainingrecords" parameterType="TTrainingrecords">
- <selectKey keyProperty="id" resultType="long" order="BEFORE">
- SELECT seq_t_trainingrecords.NEXTVAL as id FROM DUAL
- </selectKey>
- insert into t_trainingrecords
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="plantCode != null and plantCode != ''">plant_code,</if>
- <if test="year != null">year,</if>
- <if test="name != null">name,</if>
- <if test="employeeid != null">employeeid,</if>
- <if test="classes != null">classes,</if>
- <if test="companysafe != null">companysafe,</if>
- <if test="plantsafe != null">plantsafe,</if>
- <if test="teamsafe != null">teamsafe,</if>
- <if test="sub == 'true'">boiler,</if>
- <if test="cracking == 'true'">cracking,</if>
- <if test="hotarea == 'true'">hotarea,</if>
- <if test="coldarea == 'true'">coldarea,</if>
- <if test="aeupgu == 'true'">aromatic,</if>
- <if test="upscore != null">upscore,</if>
- <if test="downscore != null">downscore,</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="remarks != null">remarks,</if>
- <if test="deptId != null">dept_id,</if>
- <if test="onboard != null">onboard,</if>
- <if test="tds != null">tds,</if>
- <if test="postCard != null">post_card ,</if>
- <if test="craft != null">craft,</if>
- <if test="company != null">company,</if>
- <if test="device != null">device,</if>
- <if test="staffId != null">staff_id,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="plantCode != null and plantCode != ''">#{plantCode},</if>
- <if test="year != null">#{year},</if>
- <if test="name != null">#{name},</if>
- <if test="employeeid != null">#{employeeid},</if>
- <if test="classes != null">#{classes},</if>
- <if test="companysafe != null">#{companysafe},</if>
- <if test="plantsafe != null">#{plantsafe},</if>
- <if test="teamsafe != null">#{teamsafe},</if>
- <if test="sub == 'true'">10,</if>
- <if test="cracking == 'true'">10,</if>
- <if test="hotarea == 'true'">10,</if>
- <if test="coldarea == 'true'">10,</if>
- <if test="aeupgu == 'true'">10,</if>
- <if test="upscore != null">#{upscore},</if>
- <if test="downscore != null">#{downscore},</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="remarks != null">#{remarks},</if>
- <if test="deptId != null">#{deptId},</if>
- <if test="onboard != null">#{onboard},</if>
- <if test="tds != null">#{tds},</if>
- <if test="postCard != null">#{postCard },</if>
- <if test="craft != null">#{craft},</if>
- <if test="company != null">#{company},</if>
- <if test="device != null">#{device},</if>
- <if test="staffId != null">#{staffId},</if>
- </trim>
- </insert>
- <update id="updateTTrainingrecords" parameterType="TTrainingrecords">
- update t_trainingrecords
- <trim prefix="SET" suffixOverrides=",">
- <if test="plantCode != null and plantCode != ''">plant_code = #{plantCode},</if>
- <if test="year != null">year = #{year},</if>
- <if test="name != null">name = #{name},</if>
- <if test="employeeid != null">employeeid = #{employeeid},</if>
- <if test="classes != null">classes = #{classes},</if>
- <if test="companysafe != null">companysafe = #{companysafe},</if>
- <if test="plantsafe != null">plantsafe = #{plantsafe},</if>
- <if test="teamsafe != null">teamsafe = #{teamsafe},</if>
- <if test="sub == 'true'">sub = 10,</if>
- <if test="cracking == 'true'">cracking = 10,</if>
- <if test="hotarea == 'true'">hotarea = 10,</if>
- <if test="coldarea == 'true'">coldarea = 10,</if>
- <if test="aeupgu == 'true'">aeupgu = 10,</if>
- <if test="sub == 'false'">sub = NULL,</if>
- <if test="cracking == 'false'">cracking = NULL,</if>
- <if test="hotarea == 'false'">hotarea = NULL,</if>
- <if test="coldarea == 'false'">coldarea = NULL,</if>
- <if test="aeupgu == 'false'">aeupgu = NULL,</if>
- <if test="upscore != null">upscore = #{upscore},</if>
- <if test="downscore != null">downscore = #{downscore},</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="remarks != null">remarks = #{remarks},</if>
- <if test="deptId != null">dept_id = #{deptId},</if>
- <if test="onboard != null">onboard = #{onboard},</if>
- <if test="tds != null">tds = #{tds},</if>
- <if test="postCard != null">post_card = #{postCard },</if>
- <if test="craft != null">craft = #{craft},</if>
- <if test="company != null">company = #{company},</if>
- <if test="device != null">device = #{device},</if>
- <if test="staffId != null">staff_id = #{staffId},</if>
- </trim>
- where id = #{id}
- </update>
- <update id="deleteTTrainingrecordsById" parameterType="Long">
- update t_trainingrecords set del_flag = 2 where id = #{id}
- </update>
- <update id="deleteTTrainingrecordsByIds" parameterType="String">
- update t_trainingrecords set del_flag = 2 where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <select id="queryNeedDeleteIds" resultType="String">
- SELECT b.EMPLOYEEID from t_trainingrecords b where b.del_flag = 0
- minus
- SELECT a.STAFFID FROM "T_STAFFMGR" a where a.del_flag = 0 and unit in (10,20,30)
- </select>
- <select id="queryNeedInsertIds" resultType="String">
- SELECT a.STAFFID FROM "T_STAFFMGR" a where a.del_flag = 0 and unit in (10,20,30)
- minus
- SELECT b.EMPLOYEEID from t_trainingrecords b where b.del_flag = 0
- </select>
- </mapper>
|