|
|
@@ -0,0 +1,125 @@
|
|
|
+<?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.ygtx.worklog.mapper.WorkProjectMapper">
|
|
|
+
|
|
|
+ <resultMap type="WorkProject" id="WorkProjectResult">
|
|
|
+ <result property="projectId" column="project_id" />
|
|
|
+ <result property="parentId" column="parent_id" />
|
|
|
+ <result property="ancestors" column="ancestors" />
|
|
|
+ <result property="projectName" column="project_name" />
|
|
|
+ <result property="projectCode" column="project_code" />
|
|
|
+ <result property="level" column="level" />
|
|
|
+ <result property="managerId" column="manager_id" />
|
|
|
+ <result property="deptId" column="dept_id" />
|
|
|
+ <result property="startDate" column="start_date" />
|
|
|
+ <result property="endDate" column="end_date" />
|
|
|
+ <result property="status" column="status" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ <result property="delFlag" column="del_flag" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectWorkProjectVo">
|
|
|
+ select project_id, parent_id, ancestors, project_name, project_code, level, manager_id, dept_id, start_date, end_date, status, remark, del_flag, create_by, create_time, update_by, update_time from work_project
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectWorkProjectList" parameterType="WorkProject" resultMap="WorkProjectResult">
|
|
|
+ <include refid="selectWorkProjectVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="parentId != null "> and parent_id = #{parentId}</if>
|
|
|
+ <if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
|
|
|
+ <if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
|
|
|
+ <if test="projectCode != null and projectCode != ''"> and project_code = #{projectCode}</if>
|
|
|
+ <if test="level != null and level != ''"> and level = #{level}</if>
|
|
|
+ <if test="managerId != null "> and manager_id = #{managerId}</if>
|
|
|
+ <if test="deptId != null "> and dept_id = #{deptId}</if>
|
|
|
+ <if test="startDate != null "> and start_date = #{startDate}</if>
|
|
|
+ <if test="endDate != null "> and end_date = #{endDate}</if>
|
|
|
+ <if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectWorkProjectByProjectId" parameterType="Long" resultMap="WorkProjectResult">
|
|
|
+ <include refid="selectWorkProjectVo"/>
|
|
|
+ where project_id = #{projectId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertWorkProject" parameterType="WorkProject" useGeneratedKeys="true" keyProperty="projectId">
|
|
|
+ insert into work_project
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="parentId != null">parent_id,</if>
|
|
|
+ <if test="ancestors != null">ancestors,</if>
|
|
|
+ <if test="projectName != null and projectName != ''">project_name,</if>
|
|
|
+ <if test="projectCode != null">project_code,</if>
|
|
|
+ <if test="level != null">level,</if>
|
|
|
+ <if test="managerId != null">manager_id,</if>
|
|
|
+ <if test="deptId != null">dept_id,</if>
|
|
|
+ <if test="startDate != null">start_date,</if>
|
|
|
+ <if test="endDate != null">end_date,</if>
|
|
|
+ <if test="status != null">status,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ <if test="delFlag != null">del_flag,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="parentId != null">#{parentId},</if>
|
|
|
+ <if test="ancestors != null">#{ancestors},</if>
|
|
|
+ <if test="projectName != null and projectName != ''">#{projectName},</if>
|
|
|
+ <if test="projectCode != null">#{projectCode},</if>
|
|
|
+ <if test="level != null">#{level},</if>
|
|
|
+ <if test="managerId != null">#{managerId},</if>
|
|
|
+ <if test="deptId != null">#{deptId},</if>
|
|
|
+ <if test="startDate != null">#{startDate},</if>
|
|
|
+ <if test="endDate != null">#{endDate},</if>
|
|
|
+ <if test="status != null">#{status},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ <if test="delFlag != null">#{delFlag},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateWorkProject" parameterType="WorkProject">
|
|
|
+ update work_project
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="parentId != null">parent_id = #{parentId},</if>
|
|
|
+ <if test="ancestors != null">ancestors = #{ancestors},</if>
|
|
|
+ <if test="projectName != null and projectName != ''">project_name = #{projectName},</if>
|
|
|
+ <if test="projectCode != null">project_code = #{projectCode},</if>
|
|
|
+ <if test="level != null">level = #{level},</if>
|
|
|
+ <if test="managerId != null">manager_id = #{managerId},</if>
|
|
|
+ <if test="deptId != null">dept_id = #{deptId},</if>
|
|
|
+ <if test="startDate != null">start_date = #{startDate},</if>
|
|
|
+ <if test="endDate != null">end_date = #{endDate},</if>
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ where project_id = #{projectId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteWorkProjectByProjectId" parameterType="Long">
|
|
|
+ delete from work_project where project_id = #{projectId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteWorkProjectByProjectIds" parameterType="String">
|
|
|
+ delete from work_project where project_id in
|
|
|
+ <foreach item="projectId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{projectId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|