86133 | aaa3f5d | 2025-04-20 21:33:29 +0800 | [diff] [blame^] | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <!DOCTYPE mapper |
| 3 | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 4 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 5 | <mapper namespace="com.ruoyi.tracker.mapper.TrackerTaskMapper"> |
| 6 | |
| 7 | <resultMap type="TrackerTask" id="TrackerTaskResult"> |
| 8 | <result property="taskId" column="task_id" /> |
| 9 | <result property="projectId" column="project_id" /> |
| 10 | <result property="taskName" column="task_name" /> |
| 11 | <result property="description" column="description" /> |
| 12 | <result property="assignedTo" column="assigned_to" /> |
| 13 | <result property="status" column="status" /> |
| 14 | <result property="priority" column="priority" /> |
| 15 | <result property="createTime" column="create_time" /> |
| 16 | <result property="updateTime" column="update_time" /> |
| 17 | </resultMap> |
| 18 | |
| 19 | <sql id="selectTrackerTaskVo"> |
| 20 | select task_id, project_id, task_name, description, assigned_to, status, priority, create_time, update_time from tracker_task |
| 21 | </sql> |
| 22 | |
| 23 | <select id="selectTrackerTaskList" parameterType="TrackerTask" resultMap="TrackerTaskResult"> |
| 24 | <include refid="selectTrackerTaskVo"/> |
| 25 | <where> |
| 26 | <if test="projectId != null "> and project_id = #{projectId}</if> |
| 27 | <if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if> |
| 28 | <if test="description != null and description != ''"> and description = #{description}</if> |
| 29 | <if test="assignedTo != null "> and assigned_to = #{assignedTo}</if> |
| 30 | <if test="status != null and status != ''"> and status = #{status}</if> |
| 31 | <if test="priority != null and priority != ''"> and priority = #{priority}</if> |
| 32 | </where> |
| 33 | </select> |
| 34 | |
| 35 | <select id="selectTrackerTaskByTaskId" parameterType="Long" resultMap="TrackerTaskResult"> |
| 36 | <include refid="selectTrackerTaskVo"/> |
| 37 | where task_id = #{taskId} |
| 38 | </select> |
| 39 | |
| 40 | <insert id="insertTrackerTask" parameterType="TrackerTask" useGeneratedKeys="true" keyProperty="taskId"> |
| 41 | insert into tracker_task |
| 42 | <trim prefix="(" suffix=")" suffixOverrides=","> |
| 43 | <if test="projectId != null">project_id,</if> |
| 44 | <if test="taskName != null and taskName != ''">task_name,</if> |
| 45 | <if test="description != null">description,</if> |
| 46 | <if test="assignedTo != null">assigned_to,</if> |
| 47 | <if test="status != null">status,</if> |
| 48 | <if test="priority != null">priority,</if> |
| 49 | <if test="createTime != null">create_time,</if> |
| 50 | <if test="updateTime != null">update_time,</if> |
| 51 | </trim> |
| 52 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 53 | <if test="projectId != null">#{projectId},</if> |
| 54 | <if test="taskName != null and taskName != ''">#{taskName},</if> |
| 55 | <if test="description != null">#{description},</if> |
| 56 | <if test="assignedTo != null">#{assignedTo},</if> |
| 57 | <if test="status != null">#{status},</if> |
| 58 | <if test="priority != null">#{priority},</if> |
| 59 | <if test="createTime != null">#{createTime},</if> |
| 60 | <if test="updateTime != null">#{updateTime},</if> |
| 61 | </trim> |
| 62 | </insert> |
| 63 | |
| 64 | <update id="updateTrackerTask" parameterType="TrackerTask"> |
| 65 | update tracker_task |
| 66 | <trim prefix="SET" suffixOverrides=","> |
| 67 | <if test="projectId != null">project_id = #{projectId},</if> |
| 68 | <if test="taskName != null and taskName != ''">task_name = #{taskName},</if> |
| 69 | <if test="description != null">description = #{description},</if> |
| 70 | <if test="assignedTo != null">assigned_to = #{assignedTo},</if> |
| 71 | <if test="status != null">status = #{status},</if> |
| 72 | <if test="priority != null">priority = #{priority},</if> |
| 73 | <if test="createTime != null">create_time = #{createTime},</if> |
| 74 | <if test="updateTime != null">update_time = #{updateTime},</if> |
| 75 | </trim> |
| 76 | where task_id = #{taskId} |
| 77 | </update> |
| 78 | |
| 79 | <delete id="deleteTrackerTaskByTaskId" parameterType="Long"> |
| 80 | delete from tracker_task where task_id = #{taskId} |
| 81 | </delete> |
| 82 | |
| 83 | <delete id="deleteTrackerTaskByTaskIds" parameterType="String"> |
| 84 | delete from tracker_task where task_id in |
| 85 | <foreach item="taskId" collection="array" open="(" separator="," close=")"> |
| 86 | #{taskId} |
| 87 | </foreach> |
| 88 | </delete> |
| 89 | </mapper> |