| <?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.tracker.mapper.TrackerTaskMapper"> |
| |
| <resultMap type="TrackerTask" id="TrackerTaskResult"> |
| <result property="taskId" column="task_id" /> |
| <result property="projectId" column="project_id" /> |
| <result property="taskName" column="task_name" /> |
| <result property="description" column="description" /> |
| <result property="assignedTo" column="assigned_to" /> |
| <result property="status" column="status" /> |
| <result property="priority" column="priority" /> |
| <result property="createTime" column="create_time" /> |
| <result property="updateTime" column="update_time" /> |
| </resultMap> |
| |
| <sql id="selectTrackerTaskVo"> |
| select task_id, project_id, task_name, description, assigned_to, status, priority, create_time, update_time from tracker_task |
| </sql> |
| |
| <select id="selectTrackerTaskList" parameterType="TrackerTask" resultMap="TrackerTaskResult"> |
| <include refid="selectTrackerTaskVo"/> |
| <where> |
| <if test="projectId != null "> and project_id = #{projectId}</if> |
| <if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if> |
| <if test="description != null and description != ''"> and description = #{description}</if> |
| <if test="assignedTo != null "> and assigned_to = #{assignedTo}</if> |
| <if test="status != null and status != ''"> and status = #{status}</if> |
| <if test="priority != null and priority != ''"> and priority = #{priority}</if> |
| </where> |
| </select> |
| |
| <select id="selectTrackerTaskByTaskId" parameterType="Long" resultMap="TrackerTaskResult"> |
| <include refid="selectTrackerTaskVo"/> |
| where task_id = #{taskId} |
| </select> |
| |
| <insert id="insertTrackerTask" parameterType="TrackerTask" useGeneratedKeys="true" keyProperty="taskId"> |
| insert into tracker_task |
| <trim prefix="(" suffix=")" suffixOverrides=","> |
| <if test="projectId != null">project_id,</if> |
| <if test="taskName != null and taskName != ''">task_name,</if> |
| <if test="description != null">description,</if> |
| <if test="assignedTo != null">assigned_to,</if> |
| <if test="status != null">status,</if> |
| <if test="priority != null">priority,</if> |
| <if test="createTime != null">create_time,</if> |
| <if test="updateTime != null">update_time,</if> |
| </trim> |
| <trim prefix="values (" suffix=")" suffixOverrides=","> |
| <if test="projectId != null">#{projectId},</if> |
| <if test="taskName != null and taskName != ''">#{taskName},</if> |
| <if test="description != null">#{description},</if> |
| <if test="assignedTo != null">#{assignedTo},</if> |
| <if test="status != null">#{status},</if> |
| <if test="priority != null">#{priority},</if> |
| <if test="createTime != null">#{createTime},</if> |
| <if test="updateTime != null">#{updateTime},</if> |
| </trim> |
| </insert> |
| |
| <update id="updateTrackerTask" parameterType="TrackerTask"> |
| update tracker_task |
| <trim prefix="SET" suffixOverrides=","> |
| <if test="projectId != null">project_id = #{projectId},</if> |
| <if test="taskName != null and taskName != ''">task_name = #{taskName},</if> |
| <if test="description != null">description = #{description},</if> |
| <if test="assignedTo != null">assigned_to = #{assignedTo},</if> |
| <if test="status != null">status = #{status},</if> |
| <if test="priority != null">priority = #{priority},</if> |
| <if test="createTime != null">create_time = #{createTime},</if> |
| <if test="updateTime != null">update_time = #{updateTime},</if> |
| </trim> |
| where task_id = #{taskId} |
| </update> |
| |
| <delete id="deleteTrackerTaskByTaskId" parameterType="Long"> |
| delete from tracker_task where task_id = #{taskId} |
| </delete> |
| |
| <delete id="deleteTrackerTaskByTaskIds" parameterType="String"> |
| delete from tracker_task where task_id in |
| <foreach item="taskId" collection="array" open="(" separator="," close=")"> |
| #{taskId} |
| </foreach> |
| </delete> |
| </mapper> |