2025-01-16 16:16:53 +08:00
|
|
|
<?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.bonus.project.mapper.ProMaterialManagementMapper">
|
|
|
|
|
<insert id="insertProMaterial">
|
|
|
|
|
insert into pt_pro_material
|
|
|
|
|
(pro_id, material_name, material_size, material_type, create_name, create_user , create_time, is_active,material_path)
|
|
|
|
|
values (#{proId}, #{materialName}, #{materialSize}, #{materialType}, #{createName}, #{createUser} ,now(), '1', #{materialPath})
|
|
|
|
|
</insert>
|
|
|
|
|
<delete id="del">
|
|
|
|
|
UPDATE pt_pro_material SET is_active = '0' WHERE id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<select id="selectProMaterialList" resultType="com.bonus.project.domain.ProMaterialManagement">
|
|
|
|
|
select
|
|
|
|
|
(@rowNum := @rowNum + 1) as exportId,
|
|
|
|
|
ppi.pro_id as proId,
|
|
|
|
|
ppi.pro_name as proName,
|
|
|
|
|
ppi.pro_user_name as proLeader,
|
|
|
|
|
sdd.dict_label as proType,
|
|
|
|
|
sdd1.dict_label as proStatus,
|
|
|
|
|
ppi.plan_start_time as startDate,
|
|
|
|
|
ppi.plan_end_time as endDate,
|
|
|
|
|
IFNULL(ppm.jdMaterialNum, 0) as jdMaterialNum,
|
2025-01-17 17:23:45 +08:00
|
|
|
IFNULL(ppm.rcMaterialNum, 0) as rcMaterialNum,
|
|
|
|
|
IFNULL(ppm.otherMaterialNum, 0) as otherMaterialNum
|
|
|
|
|
|
2025-01-16 16:16:53 +08:00
|
|
|
from (select @rowNum := 0) r,pt_project_info ppi
|
|
|
|
|
left join sys_dict_data sdd on sdd.dict_value = ppi.pro_type and sdd.dict_type = 'sys_pro_type' and
|
|
|
|
|
sdd.status = '0'
|
|
|
|
|
left join sys_dict_data sdd1 on sdd1.dict_value = ppi.pro_status and sdd1.dict_type = 'sys_pro_status' and
|
|
|
|
|
sdd1.status = '0'
|
|
|
|
|
left join (
|
|
|
|
|
SELECT
|
|
|
|
|
sum( IF ( material_type = 1, 1, 0 )) AS jdMaterialNum,
|
|
|
|
|
sum( IF ( material_type = 2, 1, 0 )) AS rcMaterialNum,
|
2025-01-17 17:23:45 +08:00
|
|
|
sum( IF ( material_type = 3, 1, 0 )) AS otherMaterialNum,
|
2025-01-16 16:16:53 +08:00
|
|
|
pro_id
|
|
|
|
|
FROM
|
|
|
|
|
pt_pro_material
|
|
|
|
|
where is_active = '1'
|
|
|
|
|
group by pro_id
|
|
|
|
|
) ppm on ppm.pro_id = ppi.pro_id
|
|
|
|
|
where ppi.is_active = '1'
|
|
|
|
|
|
|
|
|
|
<if test="proName != null and proName != ''">
|
|
|
|
|
and ppi.pro_name like concat('%', #{proName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="proLeader != null and proLeader != ''">
|
|
|
|
|
and ppi.pro_user_name like concat('%', #{proLeader}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="proType != null and proType != ''">
|
|
|
|
|
and ppi.pro_type = #{proType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="proStatus != null and proStatus != ''">
|
|
|
|
|
and ppi.pro_status = #{proStatus}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startDate != null and startDate != '' ">
|
|
|
|
|
and DATE(ppi.create_time) between #{startDate} and #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
order by ppi.create_time desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectSpecificProMaterial" resultType="com.bonus.project.domain.ProMaterialManagement">
|
|
|
|
|
SELECT (@rowNum := @rowNum + 1) AS exportId,
|
|
|
|
|
ppm.id AS id,
|
|
|
|
|
ppm.pro_id AS proId,
|
|
|
|
|
ppm.material_name AS materialName,
|
|
|
|
|
CONCAT(ppm.material_size, 'KB') AS materialSize,
|
|
|
|
|
sdd.dict_label AS materialType,
|
|
|
|
|
ppm.create_name AS createName,
|
|
|
|
|
date(ppm.create_time) AS commitTime,
|
|
|
|
|
ppm.material_path AS materialPath,
|
|
|
|
|
ppi.plan_start_time AS startDate,
|
|
|
|
|
ppi.plan_end_time AS endDate
|
|
|
|
|
FROM (SELECT @rowNum := 0) r,
|
|
|
|
|
pt_pro_material ppm
|
|
|
|
|
LEFT JOIN sys_dict_data sdd ON sdd.dict_value = ppm.material_type
|
|
|
|
|
AND sdd.dict_type = 'sys_pro_material_type'
|
|
|
|
|
AND sdd.STATUS = '0'
|
|
|
|
|
LEFT JOIN pt_project_info ppi ON ppi.pro_id = ppm.pro_id
|
|
|
|
|
WHERE ppm.is_active = '1' and ppm.pro_id = #{proId}
|
|
|
|
|
|
|
|
|
|
<if test="materialName != null and materialName != ''">
|
|
|
|
|
and ppm.material_name like concat('%', #{materialName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="createName != null and createName != ''">
|
|
|
|
|
and ppm.create_name like concat('%', #{createName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startDate != null and startDate != '' ">
|
|
|
|
|
and DATE(ppm.create_time) between #{startDate} and #{endDate}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
order by ppm.create_time desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</mapper>
|