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.TrackerProjectMapper"> |
| 6 | |
| 7 | <resultMap type="TrackerProject" id="TrackerProjectResult"> |
| 8 | <result property="projectId" column="project_id" /> |
| 9 | <result property="projectName" column="project_name" /> |
| 10 | <result property="description" column="description" /> |
| 11 | <result property="status" column="status" /> |
| 12 | <result property="createBy" column="create_by" /> |
| 13 | <result property="createTime" column="create_time" /> |
| 14 | <result property="updateBy" column="update_by" /> |
| 15 | <result property="updateTime" column="update_time" /> |
| 16 | </resultMap> |
| 17 | |
| 18 | <sql id="selectTrackerProjectVo"> |
| 19 | select project_id, project_name, description, status, create_by, create_time, update_by, update_time from tracker_project |
| 20 | </sql> |
| 21 | |
| 22 | <select id="selectTrackerProjectList" parameterType="TrackerProject" resultMap="TrackerProjectResult"> |
| 23 | <include refid="selectTrackerProjectVo"/> |
| 24 | <where> |
| 25 | <if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if> |
| 26 | <if test="description != null and description != ''"> and description = #{description}</if> |
| 27 | <if test="status != null and status != ''"> and status = #{status}</if> |
| 28 | </where> |
| 29 | </select> |
| 30 | |
| 31 | <select id="selectTrackerProjectByProjectId" parameterType="Long" resultMap="TrackerProjectResult"> |
| 32 | <include refid="selectTrackerProjectVo"/> |
| 33 | where project_id = #{projectId} |
| 34 | </select> |
| 35 | |
| 36 | <insert id="insertTrackerProject" parameterType="TrackerProject" useGeneratedKeys="true" keyProperty="projectId"> |
| 37 | insert into tracker_project |
| 38 | <trim prefix="(" suffix=")" suffixOverrides=","> |
| 39 | <if test="projectName != null and projectName != ''">project_name,</if> |
| 40 | <if test="description != null">description,</if> |
| 41 | <if test="status != null">status,</if> |
| 42 | <if test="createBy != null">create_by,</if> |
| 43 | <if test="createTime != null">create_time,</if> |
| 44 | <if test="updateBy != null">update_by,</if> |
| 45 | <if test="updateTime != null">update_time,</if> |
| 46 | </trim> |
| 47 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 48 | <if test="projectName != null and projectName != ''">#{projectName},</if> |
| 49 | <if test="description != null">#{description},</if> |
| 50 | <if test="status != null">#{status},</if> |
| 51 | <if test="createBy != null">#{createBy},</if> |
| 52 | <if test="createTime != null">#{createTime},</if> |
| 53 | <if test="updateBy != null">#{updateBy},</if> |
| 54 | <if test="updateTime != null">#{updateTime},</if> |
| 55 | </trim> |
| 56 | </insert> |
| 57 | |
| 58 | <update id="updateTrackerProject" parameterType="TrackerProject"> |
| 59 | update tracker_project |
| 60 | <trim prefix="SET" suffixOverrides=","> |
| 61 | <if test="projectName != null and projectName != ''">project_name = #{projectName},</if> |
| 62 | <if test="description != null">description = #{description},</if> |
| 63 | <if test="status != null">status = #{status},</if> |
| 64 | <if test="createBy != null">create_by = #{createBy},</if> |
| 65 | <if test="createTime != null">create_time = #{createTime},</if> |
| 66 | <if test="updateBy != null">update_by = #{updateBy},</if> |
| 67 | <if test="updateTime != null">update_time = #{updateTime},</if> |
| 68 | </trim> |
| 69 | where project_id = #{projectId} |
| 70 | </update> |
| 71 | |
| 72 | <delete id="deleteTrackerProjectByProjectId" parameterType="Long"> |
| 73 | delete from tracker_project where project_id = #{projectId} |
| 74 | </delete> |
| 75 | |
| 76 | <delete id="deleteTrackerProjectByProjectIds" parameterType="String"> |
| 77 | delete from tracker_project where project_id in |
| 78 | <foreach item="projectId" collection="array" open="(" separator="," close=")"> |
| 79 | #{projectId} |
| 80 | </foreach> |
| 81 | </delete> |
| 82 | </mapper> |