123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <?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.fs.qw.mapper.HyWorkTaskMapper">
- <resultMap type="QwWorkTask" id="HyWorkTaskResult">
- <result property="id" column="id" />
- <result property="extId" column="ext_id" />
- <result property="qwUserId" column="qw_user_id" />
- <result property="type" column="type" />
- <result property="status" column="status" />
- <result property="remark" column="remark" />
- <result property="score" column="score" />
- <result property="sopId" column="sop_id" />
- <result property="companyId" column="company_id" />
- <result property="companyUserId" column="company_user_id" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="title" column="title" />
- </resultMap>
- <sql id="selectHyWorkTaskVo">
- select id, ext_id, qw_user_id, type,title, status, remark, score, sop_id, company_id, company_user_id, create_time, update_time from hy_work_task
- </sql>
- <select id="selectHyWorkTaskList" parameterType="QwWorkTask" resultMap="HyWorkTaskResult">
- <include refid="selectHyWorkTaskVo"/>
- <where>
- <if test="extId != null "> and ext_id = #{extId}</if>
- <if test="qwUserId != null "> and qw_user_id = #{qwUserId}</if>
- <if test="type != null "> and type = #{type}</if>
- <if test="status != null "> and status = #{status}</if>
- <if test="score != null "> and score = #{score}</if>
- <if test="sopId != null and sopId != ''"> and sop_id = #{sopId}</if>
- <if test="companyId != null "> and company_id = #{companyId}</if>
- <if test="companyUserId != null "> and company_user_id = #{companyUserId}</if>
- </where>
- </select>
- <select id="selectHyWorkTaskById" parameterType="Long" resultMap="HyWorkTaskResult">
- <include refid="selectHyWorkTaskVo"/>
- where id = #{id}
- </select>
- <select id="selectHyWorkTaskListVONew" resultType="com.fs.qw.vo.QwWorkTaskListVO">
- SELECT t.*
- FROM hy_work_task t
- INNER JOIN (
- SELECT t_inner.id
- FROM qw_work_task t_inner
- <where>
- DATE(t_inner.create_time) = CURDATE()
- <if test="extId != null "> and t_inner.ext_id = #{extId}</if>
- <if test="qwUserId != null "> and t_inner.qw_user_id = #{qwUserId}</if>
- <if test="type != null "> and t_inner.type = #{type}</if>
- <if test="status != null "> and t_inner.status = #{status}</if>
- <if test="score != null "> and t_inner.score = #{score}</if>
- <if test="sopId != null and sopId != ''"> and t_inner.sop_id = #{sopId}</if>
- <if test="companyId != null "> and t_inner.company_id = #{companyId}</if>
- <if test="companyUserId != null "> and t_inner.company_user_id = #{companyUserId}</if>
- </where>
- ORDER BY t_inner.score DESC, t_inner.id DESC
- LIMIT ${(pageNum-1)*pageSize}, ${pageSize}
- ) AS filtered_ids ON t.id = filtered_ids.id
- ORDER BY t.score DESC, t.id DESC
- </select>
- <select id="selectHyWorkTaskListByMap" resultType="com.fs.qw.domain.QwWorkTask">
- select
- qwt.*
- from hy_work_task qwt
- where qwt.qw_user_id = #{params.qwUserId}
- and date(qwt.create_time) = #{params.date}
- and qwt.company_id = #{params.companyId}
- and qwt.company_user_id = #{params.companyUserId}
- and qwt.status = 0
- </select>
- <select id="selectHyWorkTaskListVONewCount" resultType="java.lang.Long">
- select count(1) from hy_work_task t
- <where>
- DATE(t.create_time) = CURDATE()
- <if test="extId != null "> and t.ext_id = #{extId}</if>
- <if test="qwUserId != null "> and t.qw_user_id = #{qwUserId}</if>
- <if test="type != null "> and t.type = #{type}</if>
- <if test="status != null "> and t.status = #{status}</if>
- <if test="score != null "> and t.score = #{score}</if>
- <if test="sopId != null and sopId != ''"> and t.sop_id = #{sopId}</if>
- <if test="companyId != null "> and t.company_id = #{companyId}</if>
- <if test="companyUserId != null "> and t.company_user_id = #{companyUserId}</if>
- </where>
- order by t.score desc,t.id desc
- </select>
- <insert id="insertHyWorkTask" parameterType="QwWorkTask" useGeneratedKeys="true" keyProperty="id">
- insert into hy_work_task
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="extId != null">ext_id,</if>
- <if test="qwUserId != null">qw_user_id,</if>
- <if test="type != null">type,</if>
- <if test="status != null">status,</if>
- <if test="remark != null">remark,</if>
- <if test="score != null">score,</if>
- <if test="sopId != null">sop_id,</if>
- <if test="companyId != null">company_id,</if>
- <if test="companyUserId != null">company_user_id,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="title != null">title,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="extId != null">#{extId},</if>
- <if test="qwUserId != null">#{qwUserId},</if>
- <if test="type != null">#{type},</if>
- <if test="status != null">#{status},</if>
- <if test="remark != null">#{remark},</if>
- <if test="score != null">#{score},</if>
- <if test="sopId != null">#{sopId},</if>
- <if test="companyId != null">#{companyId},</if>
- <if test="companyUserId != null">#{companyUserId},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="title != null">#{title},</if>
- </trim>
- </insert>
- <update id="updateHyWorkTask" parameterType="QwWorkTask">
- update hy_work_task
- <trim prefix="SET" suffixOverrides=",">
- <if test="extId != null">ext_id = #{extId},</if>
- <if test="qwUserId != null">qw_user_id = #{qwUserId},</if>
- <if test="type != null">type = #{type},</if>
- <if test="status != null">status = #{status},</if>
- <if test="remark != null">remark = #{remark},</if>
- <if test="score != null">score = #{score},</if>
- <if test="sopId != null">sop_id = #{sopId},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="title != null">title = #{title},</if>
- </trim>
- where id = #{id}
- </update>
- <insert id="insertQwWorkTaskBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
- INSERT INTO hy_work_task (
- ext_id,
- qw_user_id,
- status,
- type,
- title,
- remark,
- score,
- sop_id,
- company_id,
- company_user_id,
- create_time,
- update_time
- )
- VALUES
- <foreach collection="qwWorkTasks" item="log" separator=",">
- (
- #{log.extId},
- #{log.qwUserId},
- #{log.status},
- #{log.type},
- #{log.title},
- #{log.remark},
- #{log.score},
- #{log.sopId},
- #{log.companyId},
- #{log.companyUserId},
- #{log.createTime},
- #{log.updateTime}
- )
- </foreach>
- </insert>
- <delete id="deleteHyWorkTaskById" parameterType="Long">
- delete from hy_work_task where id = #{id}
- </delete>
- <delete id="deleteHyWorkTaskByIds" parameterType="String">
- delete from hy_work_task where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|