2024-11-09 18:37:24 +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.gzgqj.business.plan.mapper.PlanApplicationMapper" >
|
|
|
|
|
<select id="findByPage" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean">
|
|
|
|
|
SELECT
|
|
|
|
|
plan.id,
|
|
|
|
|
plan.CODE,pro.name proName ,
|
|
|
|
|
plan.project_id projectId,
|
|
|
|
|
plan.project_part projectPart,
|
|
|
|
|
plan.project_content projectContent,
|
|
|
|
|
plan.need_time needTime,
|
|
|
|
|
plan.creator,
|
|
|
|
|
plan.create_time createTime,
|
|
|
|
|
plan.remark,
|
|
|
|
|
plan.STATUS,
|
|
|
|
|
plan.updater,
|
|
|
|
|
plan.status_type statusType
|
|
|
|
|
FROM
|
|
|
|
|
t_plan_apply plan
|
|
|
|
|
left join bm_project pro on plan.project_id=pro.ID
|
|
|
|
|
<where>
|
2024-11-09 20:20:53 +08:00
|
|
|
<if test="keyWord !=null and keyWord !=''">
|
2024-11-09 18:37:24 +08:00
|
|
|
and (
|
2024-11-09 20:20:53 +08:00
|
|
|
pro.name like concat('%',#{keyWord},'%') or
|
|
|
|
|
plan.creator like concat('%',#{keyWord},'%') or
|
|
|
|
|
plan.CODE like concat('%',#{keyWord},'%') or
|
|
|
|
|
plan.need_time like concat('%',#{keyWord},'%') or
|
|
|
|
|
plan.project_part like concat('%',#{keyWord},'%') or
|
|
|
|
|
plan.project_content like concat('%',#{keyWord},'%') or
|
|
|
|
|
plan.remark like concat('%',#{keyWord},'%')
|
2024-11-09 18:37:24 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
</if>
|
2024-11-09 20:20:53 +08:00
|
|
|
<if test="auditStatus !=null and auditStatus !=''">
|
2024-11-09 18:37:24 +08:00
|
|
|
and plan.STATUS=#{param.auditStatus}
|
|
|
|
|
</if>
|
2024-11-09 20:20:53 +08:00
|
|
|
<if test="proId !=null and proId !=''">
|
|
|
|
|
and plan.project_id=#{proId}
|
|
|
|
|
</if>
|
2024-11-09 18:37:24 +08:00
|
|
|
</where>
|
|
|
|
|
order by plan.update_time DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getDevTreeList" parameterType="com.bonus.gzgqj.business.plan.entity.PlanDevBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanDevBean">
|
|
|
|
|
SELECT mt.ID id ,mt.PARENT_ID pId,mt.`LEVEL` level,mt.UNIT unit,mt.NUM num ,mt.`NAME` name ,mt1.`NAME` pName ,
|
|
|
|
|
mt2.`NAME` ppName
|
|
|
|
|
from mm_type mt
|
|
|
|
|
LEFT JOIN mm_type mt1 on mt.PARENT_ID=mt1.id and mt.`LEVEL`=4 and mt1.`LEVEL`=3 and mt1.IS_ACTIVE=1
|
|
|
|
|
LEFT JOIN mm_type mt2 on mt1.PARENT_ID=mt2.id and mt1.`LEVEL`=3 and mt2.IS_ACTIVE=1
|
|
|
|
|
WHERE mt.IS_ACTIVE=1
|
2024-11-14 16:52:08 +08:00
|
|
|
ORDER BY mt.`NAME` desc
|
2024-11-09 18:37:24 +08:00
|
|
|
</select>
|
|
|
|
|
<select id="getTodayPlanNum" resultType="java.lang.Integer" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean">
|
|
|
|
|
select count(1)
|
|
|
|
|
from t_plan_apply
|
|
|
|
|
where DATE_FORMAT(create_time, '%Y-%m-%d')=CURRENT_DATE
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 插入数据 -->
|
|
|
|
|
<insert id="insertData" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into t_plan_apply(
|
|
|
|
|
code,project_id, project_part,project_content,
|
|
|
|
|
need_time, creator,create_time,remark,updater,
|
|
|
|
|
status,update_time,status_type
|
|
|
|
|
)values(
|
|
|
|
|
#{code},#{projectId},#{projectPart},#{projectContent},
|
|
|
|
|
#{needTime},#{creator},now(),#{remark},#{updater},
|
|
|
|
|
1,now(),2
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--修改计划 -->
|
|
|
|
|
<update id="updatePlan" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" >
|
|
|
|
|
update t_plan_apply
|
|
|
|
|
set project_id=#{projectId},project_part=#{projectPart},project_content=#{projectContent}
|
|
|
|
|
need_time=#{needTime},updater=#{updater},update_time=now()
|
|
|
|
|
where id=#{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<!-- 删除数据 -->
|
|
|
|
|
<delete id="deleteDetails" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean">
|
|
|
|
|
DELETE FROM t_plan_details WHERE apply_id=#{id};
|
|
|
|
|
</delete>
|
|
|
|
|
<!-- 修改计划-并提交 -->
|
|
|
|
|
<update id="updatePlanAndSub" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" >
|
|
|
|
|
update t_plan_apply
|
2025-01-24 15:19:29 +08:00
|
|
|
set project_id=#{projectId},project_part=#{projectPart},project_content=#{projectContent},
|
2024-11-09 18:37:24 +08:00
|
|
|
need_time=#{needTime},updater=#{updater},update_time=now(),status=1,status_type=2
|
|
|
|
|
where id=#{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<!-- 插入数据详情 -->
|
|
|
|
|
<insert id="insertDetail">
|
|
|
|
|
insert INTO t_plan_details(
|
|
|
|
|
apply_id,model_id,need_num,
|
|
|
|
|
need_day,remark,type,
|
2025-03-17 13:40:13 +08:00
|
|
|
name,module,unit,back_date
|
2024-11-09 18:37:24 +08:00
|
|
|
) VALUES
|
|
|
|
|
<foreach collection="list" item="item" separator=",">
|
|
|
|
|
(
|
|
|
|
|
#{param.id},#{item.moduleId},#{item.needNum},
|
|
|
|
|
#{item.times},#{item.remarks},#{item.type},
|
2025-03-17 13:40:13 +08:00
|
|
|
#{item.typeName},#{item.module},#{item.unit},#{item.backDate}
|
2024-11-09 18:37:24 +08:00
|
|
|
)
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
<!-- 依据id 查询详情 -->
|
|
|
|
|
<select id="getPlanDetailsbyId" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean">
|
|
|
|
|
SELECT
|
|
|
|
|
plan.id,
|
|
|
|
|
plan.CODE code ,pro.name proName ,
|
|
|
|
|
plan.project_id projectId,
|
|
|
|
|
plan.project_part projectPart,
|
|
|
|
|
plan.project_content projectContent,
|
|
|
|
|
plan.need_time needTime,
|
|
|
|
|
plan.creator,
|
|
|
|
|
plan.create_time createTime,
|
|
|
|
|
plan.remark,
|
|
|
|
|
plan.STATUS,
|
|
|
|
|
plan.updater,
|
|
|
|
|
plan.status_type statusType
|
|
|
|
|
FROM
|
|
|
|
|
t_plan_apply plan
|
|
|
|
|
left join bm_project pro on plan.project_id=pro.ID
|
|
|
|
|
where plan.id=#{id}
|
|
|
|
|
</select>
|
|
|
|
|
<!-- 审核记录差寻-->
|
|
|
|
|
<select id="getAuditList" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" resultType="com.bonus.gzgqj.business.plan.entity.AuditBean">
|
|
|
|
|
select tpr.id,
|
|
|
|
|
tpr.apply_id applyId,
|
|
|
|
|
tpr.auditor auditor,
|
|
|
|
|
tpr.audit_time auditTime,
|
|
|
|
|
tpr.audit_status auditStatus,
|
|
|
|
|
tpr.audit_remark auditRemarks,
|
|
|
|
|
tpr.updater updater,
|
|
|
|
|
tpr.update_time updateTime,
|
|
|
|
|
tpr.audit_type auditType,
|
|
|
|
|
tpr.audit_name auditUser,
|
|
|
|
|
tpa.create_time statrtTime ,
|
|
|
|
|
FLOOR(TIME_TO_SEC(TIMEDIFF(tpr.audit_time, tpa.create_time)) / 60/60) AS hours,
|
|
|
|
|
ROUND(MOD(TIME_TO_SEC(TIMEDIFF(tpr.audit_time, tpa.create_time)), 3600) / 60) AS minutes,
|
|
|
|
|
pu.TELPHONE phone
|
|
|
|
|
FROM t_plan_record tpr
|
|
|
|
|
left join pm_user pu on tpr.auditor=pu.id
|
|
|
|
|
LEFT JOIN t_plan_apply tpa on tpr.apply_id=tpa.id
|
|
|
|
|
where apply_id=#{id}
|
|
|
|
|
ORDER BY tpr.audit_time DESC
|
|
|
|
|
</select>
|
|
|
|
|
<!-- 查询 内容集合-->
|
2024-11-16 14:36:52 +08:00
|
|
|
<select id="getDetailsList" parameterType="com.bonus.gzgqj.business.plan.entity.PlanDataDetailBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanDataDetailBean">
|
2025-03-04 09:19:30 +08:00
|
|
|
SELECT
|
|
|
|
|
tpd.id,
|
|
|
|
|
tpd.apply_id applyId,
|
|
|
|
|
tpd.model_id moduleId,
|
|
|
|
|
tpd.need_num needNum,
|
|
|
|
|
tpd.need_day times,
|
2025-03-17 13:40:13 +08:00
|
|
|
tpd.back_date backDate,
|
2025-03-04 09:19:30 +08:00
|
|
|
tpd.remark remarks,
|
|
|
|
|
tpd.type,
|
|
|
|
|
tpd.NAME typeName,
|
|
|
|
|
tpd.module,
|
|
|
|
|
tpd.unit,
|
|
|
|
|
pro.`NAME` as proName
|
|
|
|
|
FROM
|
|
|
|
|
t_plan_details tpd
|
|
|
|
|
LEFT JOIN t_plan_apply tpa on tpa.id=tpd.apply_id
|
|
|
|
|
LEFT JOIN bm_project pro on tpa.project_id=pro.ID
|
|
|
|
|
where tpd.apply_id=#{id}
|
2024-11-16 14:36:52 +08:00
|
|
|
<if test="type!=null and type !=''">
|
2025-03-04 09:19:30 +08:00
|
|
|
and tpd.type like concat('%',#{type},'%')
|
2024-11-16 14:36:52 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="name!=null and name !=''">
|
2025-03-04 09:19:30 +08:00
|
|
|
and tpd.name like concat('%',#{name},'%')
|
2024-11-16 14:36:52 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="model!=null and model !=''">
|
2025-03-04 09:19:30 +08:00
|
|
|
and tpd.module like concat('%',#{model},'%')
|
2024-11-16 14:36:52 +08:00
|
|
|
</if>
|
2025-03-04 09:19:30 +08:00
|
|
|
ORDER BY tpd.id asc
|
2024-11-09 18:37:24 +08:00
|
|
|
</select>
|
|
|
|
|
<!-- 查询 工程集合-->
|
|
|
|
|
<select id="getProList" parameterType="com.bonus.gzgqj.business.plan.entity.PlanDevBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanProBean">
|
|
|
|
|
select id,name
|
|
|
|
|
from bm_project
|
|
|
|
|
where IS_ACTIVE=1
|
|
|
|
|
ORDER BY TIME desc
|
|
|
|
|
</select>
|
2024-11-14 16:52:08 +08:00
|
|
|
<select id="getTypeList" resultType="com.bonus.gzgqj.business.plan.entity.PlanDevBean">
|
2025-03-04 09:19:30 +08:00
|
|
|
SELECT mt.ID id ,mt.PARENT_ID pId,mt.`LEVEL` level,mt.UNIT unit,mt.NUM num ,mt.`NAME` name ,mt1.`NAME` pName ,
|
|
|
|
|
mt2.`NAME` ppName,"" needNum,"" times,"" remarks
|
|
|
|
|
from mm_type mt
|
|
|
|
|
LEFT JOIN mm_type mt1 on mt.PARENT_ID=mt1.id and mt1.IS_ACTIVE=1
|
|
|
|
|
LEFT JOIN mm_type mt2 on mt1.PARENT_ID=mt2.id and mt2.IS_ACTIVE=1
|
|
|
|
|
WHERE mt.IS_ACTIVE=1
|
2025-03-19 09:18:21 +08:00
|
|
|
and mt.IS_LABEL=1
|
|
|
|
|
-- and mt.ID not in (
|
|
|
|
|
-- SELECT
|
|
|
|
|
-- ID
|
|
|
|
|
-- FROM
|
|
|
|
|
-- mm_type
|
|
|
|
|
-- WHERE
|
|
|
|
|
-- PARENT_ID IN (
|
|
|
|
|
-- SELECT
|
|
|
|
|
-- ID
|
|
|
|
|
-- FROM
|
|
|
|
|
-- mm_type
|
|
|
|
|
-- WHERE
|
|
|
|
|
-- PARENT_ID IN ( SELECT ID FROM mm_type WHERE PARENT_ID = ( SELECT ID FROM mm_type WHERE NAME = '外租资产类' AND
|
|
|
|
|
-- PARENT_ID = 0 AND LEVEL = 1 ) )
|
|
|
|
|
-- )
|
|
|
|
|
-- )
|
2025-03-04 09:19:30 +08:00
|
|
|
and mt.`LEVEL`=4
|
|
|
|
|
<if test="name!=null and name !=''">
|
|
|
|
|
and mt.name like concat('%',#{name},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pName!=null and pName !=''">
|
|
|
|
|
and mt1.name like concat('%',#{pName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="ppName!=null and ppName !=''">
|
|
|
|
|
and mt2.name like concat('%',#{ppName},'%')
|
|
|
|
|
</if>
|
2024-11-14 16:53:47 +08:00
|
|
|
|
|
|
|
|
|
2024-11-14 16:52:08 +08:00
|
|
|
ORDER BY mt.`NAME` desc
|
|
|
|
|
</select>
|
2024-11-09 20:20:53 +08:00
|
|
|
|
2024-11-09 18:37:24 +08:00
|
|
|
</mapper>
|