添加“task”相关CRUD代码

This commit is contained in:
longbinbin
2024-12-02 14:28:29 +08:00
parent ccaeada98b
commit c62d2c2f70
16 changed files with 282 additions and 3 deletions

View File

@ -0,0 +1,48 @@
<?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.ycwl.basic.mapper.pc.TaskMapper">
<insert id="add">
insert into task(id, worker_id, member_id, template_id, scenic_id, task_params, video_url, `status`, result)
values (#{id}, #{workerId}, #{memberId}, #{templateId}, #{scenicId}, #{taskParams}, #{videoUrl}, #{status}, #{result})
</insert>
<update id="update">
update task
<set>
<if test="workerId!= null">worker_id = #{workerId}, </if>
<if test="memberId!= null">member_id = #{memberId}, </if>
<if test="templateId!= null">template_id = #{templateId}, </if>
<if test="scenicId!= null">scenic_id = #{scenicId}, </if>
<if test="taskParams!= null">task_params = #{taskParams}, </if>
<if test="videoUrl!= null">video_url = #{videoUrl}, </if>
<if test="status!= null">status = #{status}, </if>
<if test="result!= null">result = #{result}, </if>
</set>
where id = #{id}
</update>
<update id="updateStatus">
update task
set status = #{status}
where id = #{id}
</update>
<delete id="deleteById">
delete from task where id = #{id}
</delete>
<select id="list" resultType="com.ycwl.basic.model.pc.task.resp.TaskRespVO">
select id, worker_id, member_id, template_id, scenic_id, task_params, video_url, `status`, result, create_time, update_time
from task
<where>
<if test="workerId!= null">and worker_id = #{workerId} </if>
<if test="memberId!= null">and member_id = #{memberId} </if>
<if test="templateId!= null">and template_id = #{templateId} </if>
<if test="scenicId!= null">and scenic_id = #{scenicId} </if>
<if test="status!= null">and `status` = #{status} </if>
<if test="startTime!= null">and create_time &gt;= #{startTime} </if>
<if test="endTime!= null">and create_time &lt;= #{endTime} </if>
</where>
</select>
<select id="getById" resultType="com.ycwl.basic.model.pc.task.resp.TaskRespVO">
select id, worker_id, member_id, template_id, scenic_id, task_params, video_url, `status`, result, create_time, update_time
from task
where id = #{id}
</select>
</mapper>