225 lines
8.1 KiB
XML
225 lines
8.1 KiB
XML
<?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="tech.unissense.pms.business.demand.mapper.ProjectDemandMapper">
|
|
|
|
<resultMap type="tech.unissense.pms.business.demand.domain.ProjectDemand" id="ProjectDemandMap">
|
|
<result property="id" column="id"/>
|
|
<result property="title" column="title"/>
|
|
<result property="versionId" column="version_id"/>
|
|
<result property="demandStatus" column="demand_status"/>
|
|
<result property="responsiblePerson" column="responsible_person"/>
|
|
<result property="estimatedWorkHours" column="estimated_work_hours"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="endTime" column="end_time"/>
|
|
<result property="priority" column="priority"/>
|
|
<result property="projectId" column="project_id"/>
|
|
</resultMap>
|
|
|
|
<!-- 基本字段 -->
|
|
<sql id="Base_Column_List">
|
|
id, title, version_id, demand_status, responsible_person, estimated_work_hours, create_time, end_time, priority,project_id
|
|
</sql>
|
|
|
|
<!--通过实体作为筛选条件查询-->
|
|
<select id="queryAll" resultMap="ProjectDemandMap">
|
|
select
|
|
t1.id, t1.title, t1.version_id, t1.demand_status, t1.responsible_person
|
|
, t1.estimated_work_hours, t1.create_time, t1.end_time, t1.priority,t1.project_id
|
|
,t2.version_number,t3.nick_name responsible_person_name
|
|
from pms_project_demand t1
|
|
left join pms_project_version t2 on t1.version_id = t2.id
|
|
left join sys_user t3 on t1.responsible_person = t3.user_id
|
|
<where>
|
|
<if test="id != null">
|
|
and t1.id = #{id}
|
|
</if>
|
|
<if test="title != null and title != ''">
|
|
and t1.title like concat(#{title},'%')
|
|
</if>
|
|
<if test="versionId != null and versionId != ''">
|
|
and t1.version_id = #{versionId}
|
|
</if>
|
|
<if test="demandStatus != null and demandStatus != ''">
|
|
and t1.demand_status = #{demandStatus}
|
|
</if>
|
|
<if test="responsiblePerson != null and responsiblePerson != ''">
|
|
and t1.responsible_person = #{responsiblePerson}
|
|
</if>
|
|
<if test="estimatedWorkHours != null and estimatedWorkHours != ''">
|
|
and t1.estimated_work_hours = #{estimatedWorkHours}
|
|
</if>
|
|
<if test="createTime != null">
|
|
and t1.create_time = #{createTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and t1.end_time = #{endTime}
|
|
</if>
|
|
<if test="priority != null and priority != ''">
|
|
and t1.priority = #{priority}
|
|
</if>
|
|
<if test="projectId != null and projectId != ''">
|
|
and t1.project_id = #{projectId}
|
|
</if>
|
|
<if test="responsiblePersonName != null and responsiblePersonName != ''">
|
|
and t3.nick_name like concat(#{responsiblePersonName},"%")
|
|
</if>
|
|
<if test="demandStatusList!=null and demandStatusList.size>0">
|
|
and t1.demand_status in
|
|
<foreach collection="demandStatusList" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<!--根据ID查详情-->
|
|
<select id="queryById" parameterType="Integer" resultMap="ProjectDemandMap">
|
|
SELECT id,
|
|
title,
|
|
version_id,
|
|
demand_status,
|
|
responsible_person,
|
|
estimated_work_hours,
|
|
create_time,
|
|
end_time,
|
|
priority,
|
|
project_id
|
|
FROM pms_project_demand
|
|
WHERE id = #{id}
|
|
LIMIT 1
|
|
</select>
|
|
<select id="listByVersionIdList" resultMap="ProjectDemandMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from pms_project_demand
|
|
where version_id in
|
|
<foreach collection="list" close=")" open="(" item="versionId" separator=",">
|
|
#{versionId}
|
|
</foreach>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<!--新增所有列-->
|
|
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
INSERT INTO pms_project_demand
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="title != null and title != ''">
|
|
title,
|
|
</if>
|
|
<if test="versionId != null and versionId != ''">
|
|
version_id,
|
|
</if>
|
|
<if test="demandStatus != null and demandStatus != ''">
|
|
demand_status,
|
|
</if>
|
|
<if test="responsiblePerson != null and responsiblePerson != ''">
|
|
responsible_person,
|
|
</if>
|
|
<if test="estimatedWorkHours != null and estimatedWorkHours != ''">
|
|
estimated_work_hours,
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time,
|
|
</if>
|
|
<if test="endTime != null">
|
|
end_time,
|
|
</if>
|
|
<if test="priority != null and priority != ''">
|
|
priority,
|
|
</if>
|
|
<if test="projectId != null and projectId != ''">
|
|
project_id,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="title != null and title != ''">
|
|
#{title},
|
|
</if>
|
|
<if test="versionId != null and versionId != ''">
|
|
#{versionId},
|
|
</if>
|
|
<if test="demandStatus != null and demandStatus != ''">
|
|
#{demandStatus},
|
|
</if>
|
|
<if test="responsiblePerson != null and responsiblePerson != ''">
|
|
#{responsiblePerson},
|
|
</if>
|
|
<if test="estimatedWorkHours != null and estimatedWorkHours != ''">
|
|
#{estimatedWorkHours},
|
|
</if>
|
|
<if test="createTime != null">
|
|
#{createTime},
|
|
</if>
|
|
<if test="endTime != null">
|
|
#{endTime},
|
|
</if>
|
|
<if test="priority != null and priority != ''">
|
|
#{priority},
|
|
</if>
|
|
<if test="projectId != null and projectId != ''">
|
|
#{projectId},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<!--通过主键修改数据-->
|
|
<update id="update">
|
|
UPDATE pms_project_demand
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="title != null and title != ''">
|
|
title = #{title},
|
|
</if>
|
|
<if test="versionId != null and versionId != ''">
|
|
version_id = #{versionId},
|
|
</if>
|
|
<if test="demandStatus != null and demandStatus != ''">
|
|
demand_status = #{demandStatus},
|
|
</if>
|
|
<if test="responsiblePerson != null and responsiblePerson != ''">
|
|
responsible_person = #{responsiblePerson},
|
|
</if>
|
|
<if test="estimatedWorkHours != null and estimatedWorkHours != ''">
|
|
estimated_work_hours = #{estimatedWorkHours},
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time = #{createTime},
|
|
</if>
|
|
<if test="endTime != null">
|
|
end_time = #{endTime},
|
|
</if>
|
|
<if test="priority != null and priority != ''">
|
|
priority = #{priority},
|
|
</if>
|
|
</trim>
|
|
WHERE id = #{id}
|
|
</update>
|
|
<update id="scheduleUpdateDemandStatus">
|
|
update pms_project_demand
|
|
set demand_status = '3'
|
|
where end_time <![CDATA[<=]]> now()
|
|
</update>
|
|
|
|
<!--通过主键删除-->
|
|
<delete id="deleteById">
|
|
DELETE
|
|
FROM pms_project_demand
|
|
WHERE id = #{id}
|
|
</delete>
|
|
|
|
<!--通过id批量删除-->
|
|
<delete id="batchRemove">
|
|
delete from pms_project_demand where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
</mapper>
|
|
|
|
|
|
|