unis_sip/ruoyi-sip/src/main/resources/mapper/sip/ProjectWorkProgressMapper.xml

87 lines
3.9 KiB
XML
Raw Normal View History

<?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.sip.mapper.ProjectWorkProgressMapper">
<resultMap type="ProjectWorkProgress" id="ProjectWorkProgressResult">
<result property="id" column="id" />
<result property="workContent" column="work_content" />
<result property="workUser" column="work_user" />
<result property="workTime" column="work_time" />
<result property="projectId" column="project_id" />
</resultMap>
<sql id="selectProjectWorkProgressVo">
select id, work_content, work_user, work_time, project_id from project_work_progress
</sql>
<select id="selectProjectWorkProgressList" parameterType="ProjectWorkProgress" resultMap="ProjectWorkProgressResult">
<include refid="selectProjectWorkProgressVo"/>
<where>
<if test="workContent != null and workContent != ''"> and work_content = #{workContent}</if>
<if test="workUser != null and workUser != ''"> and work_user = #{workUser}</if>
<if test="workTime != null "> and work_time = #{workTime}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
</where>
</select>
<select id="selectProjectWorkProgressById" parameterType="Long" resultMap="ProjectWorkProgressResult">
<include refid="selectProjectWorkProgressVo"/>
where id = #{id}
</select>
<select id="selectProjectWorkProgressListByProjectId"
resultMap="ProjectWorkProgressResult">
select t1.id, t1.work_content, t1.work_user, t1.work_time, t1.project_id,
t2.user_name
from project_work_progress t1
left join sys_user t2 on t1.work_user = t2.user_id
where t1.project_id = #{projectId}
order by t1.work_time
</select>
<insert id="insertProjectWorkProgress" parameterType="ProjectWorkProgress" useGeneratedKeys="true" keyProperty="id">
insert into project_work_progress
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="workContent != null">work_content,</if>
<if test="workUser != null">work_user,</if>
<if test="workTime != null">work_time,</if>
<if test="projectId != null">project_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workContent != null">#{workContent},</if>
<if test="workUser != null">#{workUser},</if>
<if test="workTime != null">#{workTime},</if>
<if test="projectId != null">#{projectId},</if>
</trim>
</insert>
<insert id="insertIgnoreBatch">
insert ignore into project_work_progress (work_content, work_user, work_time, project_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.workContent}, #{item.workUser}, #{item.workTime}, #{item.projectId})
</foreach>
</insert>
<update id="updateProjectWorkProgress" parameterType="ProjectWorkProgress">
update project_work_progress
<trim prefix="SET" suffixOverrides=",">
<if test="workContent != null">work_content = #{workContent},</if>
<if test="workUser != null">work_user = #{workUser},</if>
<if test="workTime != null">work_time = #{workTime},</if>
<if test="projectId != null">project_id = #{projectId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteProjectWorkProgressById" parameterType="Long">
delete from project_work_progress where id = #{id}
</delete>
<delete id="deleteProjectWorkProgressByIds" parameterType="String">
delete from project_work_progress where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>