You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1082 lines
35 KiB

<?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.tc.mapper.AssetTaskMapper">
<resultMap type="com.ruoyi.tc.entity.AssetTask" id="AssetTaskMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="taskName" column="task_name" jdbcType="VARCHAR"/>
<result property="taskTime" column="task_time" jdbcType="TIMESTAMP"/>
<result property="taskDeadline" column="task_deadline" jdbcType="VARCHAR"/>
<result property="taskFinishTime" column="task_finish_time" jdbcType="TIMESTAMP"/>
<result property="taskStatus" column="task_status" jdbcType="VARCHAR"/>
<result property="dwmc" column="dwmc" jdbcType="VARCHAR"/>
<result property="createId" column="create_id" jdbcType="INTEGER"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateId" column="update_id" jdbcType="INTEGER"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="deptId" column="dept_id" jdbcType="INTEGER"/>
<result property="version" column="version" jdbcType="VARCHAR"/>
<result property="reamark" column="reamark" jdbcType="VARCHAR"/>
5 months ago
<result property="type" column="type" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultType="com.ruoyi.tc.entity.response.AssetTaskResponse">
select a.id,
a.task_name,
a.task_time,
a.task_deadline,
a.task_finish_time,
a.task_status,
a.dwmc,
a.create_id,
a.create_by,
a.create_time,
a.update_id,
a.update_by,
a.update_time,
a.user_id,
a.dept_id,
a.version,
5 months ago
a.reamark,
a.type
from asset_task a
where a.id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="AssetTaskMap">
select
id,task_name,task_time,task_deadline,task_finish_time,task_status,dwmc,create_id,create_by,create_time,update_id,update_by,update_time,user_id,dept_id,version,reamark
from asset_task
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="taskName != null and taskName != ''">
and task_name = #{taskName}
</if>
<if test="taskTime != null">
and task_time = #{taskTime}
</if>
<if test="taskDeadline != null and taskDeadline != ''">
and task_deadline = #{taskDeadline}
</if>
<if test="taskFinishTime != null">
and task_finish_time = #{taskFinishTime}
</if>
<if test="taskStatus != null and taskStatus != ''">
and task_status = #{taskStatus}
</if>
<if test="dwmc != null">
and dwmc = #{dwmc}
</if>
<if test="createId != null">
and create_id = #{createId}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateId != null">
and update_id = #{updateId}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="deptId != null">
and dept_id = #{deptId}
</if>
<if test="version != null and version != ''">
and version = #{version}
</if>
<if test="reamark != null and reamark != ''">
and reamark = #{reamark}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>
<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from asset_task
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="taskName != null and taskName != ''">
and task_name = #{taskName}
</if>
<if test="taskTime != null">
and task_time = #{taskTime}
</if>
<if test="taskDeadline != null and taskDeadline != ''">
and task_deadline = #{taskDeadline}
</if>
<if test="taskFinishTime != null">
and task_finish_time = #{taskFinishTime}
</if>
<if test="taskStatus != null and taskStatus != ''">
and task_status = #{taskStatus}
</if>
<if test="dwmc != null">
and dwmc = #{dwmc}
</if>
<if test="createId != null">
and create_id = #{createId}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateId != null">
and update_id = #{updateId}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="deptId != null">
and dept_id = #{deptId}
</if>
<if test="version != null and version != ''">
and version = #{version}
</if>
<if test="reamark != null and reamark != ''">
and reamark = #{reamark}
</if>
</where>
</select>
<select id="queryByPage" resultType="com.ruoyi.tc.entity.AssetTask">
select
id,task_name,task_time,task_deadline,task_finish_time,task_status,dwmc,create_id,create_by,create_time,update_id,update_by,update_time,user_id,dept_id,version,reamark
from asset_task
<where>
<if test="req.taskName != null and req.taskName != ''">
and task_name = #{req.taskName}
</if>
<if test="req.dwmc != null and req.dwmc != ''">
and dwmc like concat('%',#{req.dwmc},'%')
</if>
<if test="req.begainTime != null">
and task_finish_time &gt;= #{req.begainTime}
</if>
<if test="req.endTime != null">
and task_finish_time &lt;= #{req.endTime}
</if>
<if test="req.taskStatus != null and req.taskStatus != ''">
and task_status = #{req.taskStatus}
</if>
<if test="req.id != null ">
and id = #{req.id}
</if>
</where>
order by task_time desc
</select>
<select id="findByDwmcAssetCurrent" resultType="com.ruoyi.tc.entity.po.AssetCurrentCpPo">
select * from asset_current
<where>
del_flag = '0' and isbf = '0'
<if test="dwmc!=null and dwmc!='' ">
and dwmc like concat('%',#{dwmc},'%')
</if>
</where>
</select>
<select id="zcHc" resultType="com.ruoyi.tc.entity.response.AssestTaskXqresponse">
select b.xtlx,
b.xtmc,
b.dwmc as zcdwmc,
b.status,
b.id ,
5 months ago
b.task_id,
b.btgyy
from asset_task a
LEFT JOIN
asset_current_cp b ON FIND_IN_SET(b.dwmc, a.dwmc)
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
and b.dwmc like concat('%',#{req.dwmc},'%')
</if>
<if test="req.taskId !=null ">
and a.id = #{req.taskId}
</if>
<if test="req.taskId !=null ">
and b.task_id=#{req.taskId}
</if>
<if test="req.status!=null ">
and b.status =#{req.status}
</if>
<if test="req.xtlx!=null and req.xtlx!='' ">
and b.xtlx = #{req.xtlx}
</if>
</where>
order by b.current_id desc
</select>
<select id="findBytaskIdandAssestId" resultType="com.ruoyi.tc.entity.po.AssetCurrentCpPo">
select *
from asset_current_cp
where task_id = #{taskId}
and id = #{assetId}
</select>
<select id="dwHc" resultType="com.ruoyi.tc.entity.response.AssetdwHcResponse">
SELECT
5 months ago
s.dwmc,
s.task_id,
5 months ago
CURRENT_TIMESTAMP AS latest_create_time, -- 使用当前时间
5 months ago
b.task_deadline,
5 months ago
SUM(s.total) AS total,
SUM(s.checked) AS checked,
COALESCE(SUM(s.returned), 0) AS shthcs,
ROUND(
CASE
5 months ago
WHEN SUM(s.total) > 0 THEN
SUM(s.checked) * 100.0 / SUM(s.total)
5 months ago
ELSE 0
5 months ago
END,
2
) AS checkedRatio,
5 months ago
CASE
5 months ago
WHEN ROUND(
CASE
WHEN SUM(s.total) > 0 THEN
SUM(s.checked) * 100.0 / SUM(s.total)
ELSE 0
5 months ago
END,
2
) = 100
AND CURRENT_TIMESTAMP &lt; b.task_deadline THEN 2
WHEN ROUND(
CASE
WHEN SUM(s.total) > 0 THEN
SUM(s.checked) * 100.0 / SUM(s.total)
5 months ago
ELSE 0
5 months ago
END,
2
) = 100
AND CURRENT_TIMESTAMP >= b.task_deadline THEN 3
5 months ago
ELSE 1
END AS taskStatus
5 months ago
FROM
(
5 months ago
SELECT
5 months ago
dwmc,
5 months ago
COUNT(*) AS total,
5 months ago
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
FROM
asset_current_cp
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
and dwmc like concat('%',#{req.dwmc},'%')
</if>
<if test="req.taskId!=null and req.taskId!='' ">
5 months ago
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
5 months ago
dwmc,
task_id
5 months ago
UNION ALL
SELECT
ssdw AS dwmc,
COUNT(*) AS total,
5 months ago
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
5 months ago
FROM
asset_mini_programs_cp
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
5 months ago
and ssdw like concat('%',#{req.dwmc},'%')
5 months ago
</if>
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
5 months ago
ssdw,
task_id
5 months ago
UNION ALL
SELECT
ssdw AS dwmc,
COUNT(*) AS total,
5 months ago
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
5 months ago
FROM
asset_app_cp
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
5 months ago
and ssdw like concat('%',#{req.dwmc},'%')
5 months ago
</if>
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
5 months ago
ssdw ,task_id
5 months ago
UNION ALL
5 months ago
SELECT ssdw AS dwmc,
5 months ago
COUNT(*) AS total,
5 months ago
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
5 months ago
FROM
asset_official_account_cp
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
5 months ago
and ssdw like concat('%',#{req.dwmc},'%')
5 months ago
</if>
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
5 months ago
ssdw,
task_id
5 months ago
UNION ALL
SELECT
ssdw AS dwmc,
COUNT(*) AS total,
5 months ago
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
5 months ago
FROM
asset_email_cp
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
5 months ago
and ssdw like concat('%',#{req.dwmc},'%')
5 months ago
</if>
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
5 months ago
ssdw,
task_id
) AS s left join asset_task b on s.task_id=b.id
<where>
<if test="req.taskStatus != null and req.taskStatus != ''">
b.task_status = #{req.taskStatus}
</if>
</where>
5 months ago
GROUP BY
5 months ago
s.dwmc ,
5 months ago
s.task_id
5 months ago
</select>
<select id="findByTaskId" resultType="com.ruoyi.tc.entity.response.AssetTaskStatusResponse">
SELECT
a.STATUS,
CASE
WHEN DATE ( a.update_time ) > b.task_deadline THEN
'6' ELSE '7'
END AS deadstatus
FROM
asset_current_cp a
LEFT JOIN asset_task b ON a.task_id = b.id
<where>
<if test="taskId!=null ">
and a.task_id =#{taskId}
</if>
</where>
</select>
5 months ago
<select id="taskList" resultType="com.ruoyi.tc.entity.AssetTask">
select * from asset_task
<where>
<if test="dwmc!=null and dwmc !=''">
and dwmc =#{dwmc}
</if>
and task_status=1
</where>
</select>
5 months ago
<select id="xcxZcHc" resultType="com.ruoyi.tc.entity.response.AssestTaskXqresponse">
select
b.xcxmc as xtmc,
b.ssdw as zcdwmc,
b.status,
b.asset_id as id ,
b.task_id,
b.btgyy
from asset_task a
LEFT JOIN
asset_mini_programs_cp b ON FIND_IN_SET(b.ssdw, a.dwmc)
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
and b.ssdw like concat('%',#{req.dwmc},'%')
</if>
<if test="req.taskId !=null ">
and a.id = #{req.taskId}
</if>
<if test="req.taskId !=null ">
and b.task_id=#{req.taskId}
</if>
<if test="req.status!=null ">
and b.status =#{req.status}
</if>
</where>
order by b.mini_id desc
</select>
<select id="gzhZcHc" resultType="com.ruoyi.tc.entity.response.AssestTaskXqresponse">
select
b.gzhmc as xtmc,
b.ssdw as zcdwmc,
b.status,
b.asset_id as id ,
b.task_id,
b.btgyy
from asset_task a
LEFT JOIN
asset_official_account_cp b ON FIND_IN_SET(b.ssdw, a.dwmc)
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
and b.ssdw like concat('%',#{req.dwmc},'%')
</if>
<if test="req.taskId !=null ">
and a.id = #{req.taskId}
</if>
<if test="req.taskId !=null ">
and b.task_id=#{req.taskId}
</if>
<if test="req.status!=null ">
and b.status =#{req.status}
</if>
</where>
order by b.account_id desc
</select>
<select id="emailZcHc" resultType="com.ruoyi.tc.entity.response.AssestTaskXqresponse">
select
b.dzyxhz as xtmc,
b.ssdw as zcdwmc,
b.status,
b.asset_id as id,
b.task_id,
b.btgyy
from asset_task a
LEFT JOIN
asset_email_cp b ON FIND_IN_SET(b.ssdw, a.dwmc)
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
and b.ssdw like concat('%',#{req.dwmc},'%')
</if>
<if test="req.taskId !=null ">
and a.id = #{req.taskId}
</if>
<if test="req.taskId !=null ">
and b.task_id=#{req.taskId}
</if>
<if test="req.status!=null ">
and b.status =#{req.status}
</if>
</where>
order by b.email_id desc
</select>
<select id="appZcHc" resultType="com.ruoyi.tc.entity.response.AssestTaskXqresponse">
select
b.app_name as xtmc,
b.ssdw as zcdwmc,
b.status,
b.asset_id as id,
b.task_id,
b.btgyy
from asset_task a
LEFT JOIN
asset_app_cp b ON FIND_IN_SET(b.ssdw, a.dwmc)
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
and b.ssdw like concat('%',#{req.dwmc},'%')
</if>
<if test="req.taskId !=null ">
and a.id = #{req.taskId}
</if>
<if test="req.taskId !=null ">
and b.task_id=#{req.taskId}
</if>
<if test="req.status!=null ">
and b.status =#{req.status}
</if>
</where>
order by b.app_id desc
</select>
<select id="getByTaskId" resultType="com.ruoyi.tc.entity.AssetTask" parameterType="int">
select * from asset_task where id=#{taskId}
</select>
5 months ago
<select id="export" resultType="com.ruoyi.tc.entity.response.AssetdwHcResponse"
parameterType="com.ruoyi.tc.entity.request.AssetdwHcRequest">
SELECT
s.dwmc,
s.task_id,
5 months ago
CURRENT_TIMESTAMP AS latest_create_time, -- 使用当前时间
5 months ago
b.task_deadline,
5 months ago
SUM(s.total) AS total,
SUM(s.checked) AS checked,
COALESCE(SUM(s.returned), 0) AS shthcs,
ROUND(
5 months ago
CASE
5 months ago
WHEN SUM(s.total) > 0 THEN
SUM(s.checked) * 100.0 / SUM(s.total)
5 months ago
ELSE 0
5 months ago
END,
2
) AS checkedRatio,
5 months ago
CASE
5 months ago
WHEN ROUND(
CASE
WHEN SUM(s.total) > 0 THEN
SUM(s.checked) * 100.0 / SUM(s.total)
5 months ago
ELSE 0
5 months ago
END,
2
) = 100
AND CURRENT_TIMESTAMP &lt; b.task_deadline THEN 2
WHEN ROUND(
CASE
WHEN SUM(s.total) > 0 THEN
SUM(s.checked) * 100.0 / SUM(s.total)
5 months ago
ELSE 0
5 months ago
END,
2
) = 100
AND CURRENT_TIMESTAMP >= b.task_deadline THEN 3
5 months ago
ELSE 1
END AS taskStatus
5 months ago
FROM
(
5 months ago
SELECT
dwmc,
COUNT(*) AS total,
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
FROM
asset_current_cp
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
and dwmc like concat('%',#{req.dwmc},'%')
</if>
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
dwmc,
task_id
UNION ALL
SELECT
ssdw AS dwmc,
COUNT(*) AS total,
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
FROM
asset_mini_programs_cp
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
and ssdw like concat('%',#{req.ssdw},'%')
</if>
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
ssdw,
task_id
UNION ALL
SELECT
ssdw AS dwmc,
COUNT(*) AS total,
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
FROM
asset_app_cp
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
and ssdw like concat('%',#{req.ssdw},'%')
</if>
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
ssdw ,
task_id
UNION ALL
SELECT ssdw AS dwmc,
COUNT(*) AS total,
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
FROM
asset_official_account_cp
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
and ssdw like concat('%',#{req.ssdw},'%')
</if>
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
ssdw,
task_id
UNION ALL
SELECT
ssdw AS dwmc,
COUNT(*) AS total,
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
FROM
asset_email_cp
<where>
<if test="req.dwmc!=null and req.dwmc!='' ">
and ssdw like concat('%',#{req.ssdw},'%')
</if>
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
ssdw,
task_id
) AS s left join asset_task b on s.task_id=b.id
<where>
<if test="req.taskStatus != null and req.taskStatus != ''">
b.task_status = #{req.taskStatus}
</if>
</where>
GROUP BY
s.dwmc ,
s.task_id,
s.latest_create_time
</select>
<select id="dwHcBl" resultType="com.ruoyi.tc.entity.response.AssetdwHcBlResponse"
parameterType="com.ruoyi.tc.entity.request.AssetdwHcRequest">
5 months ago
select count(*) as count ,taskStatus from (
5 months ago
SELECT
5 months ago
count(*) AS count,
g.taskStatus
FROM
( SELECT
5 months ago
s.dwmc,
s.task_id,
5 months ago
CURRENT_TIMESTAMP AS latest_create_time, -- 使用当前时间
5 months ago
b.task_deadline,
5 months ago
SUM(s.total) AS total,
SUM(s.checked) AS checked,
COALESCE(SUM(s.returned), 0) AS shthcs,
ROUND(
5 months ago
CASE
5 months ago
WHEN SUM(s.total) > 0 THEN
SUM(s.checked) * 100.0 / SUM(s.total)
5 months ago
ELSE 0
5 months ago
END,
2
) AS checkedRatio,
5 months ago
CASE
5 months ago
WHEN ROUND(
CASE
WHEN SUM(s.total) > 0 THEN
SUM(s.checked) * 100.0 / SUM(s.total)
5 months ago
ELSE 0
5 months ago
END,
2
) = 100
AND CURRENT_TIMESTAMP &lt; b.task_deadline THEN 2
WHEN ROUND(
CASE
WHEN SUM(s.total) > 0 THEN
SUM(s.checked) * 100.0 / SUM(s.total)
5 months ago
ELSE 0
5 months ago
END,
2
) = 100
AND CURRENT_TIMESTAMP >= b.task_deadline THEN 3
5 months ago
ELSE 1
END AS taskStatus
5 months ago
FROM
(
5 months ago
SELECT
dwmc,
COUNT(*) AS total,
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
FROM
asset_current_cp
<where>
5 months ago
<if test="req.dwmc!=null and req.dwmc!='' ">
and dwmc like concat('%',#{req.dwmc},'%')
</if>
5 months ago
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
dwmc,
task_id
UNION ALL
SELECT
ssdw AS dwmc,
COUNT(*) AS total,
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
FROM
asset_mini_programs_cp
<where>
5 months ago
<if test="req.dwmc!=null and req.dwmc!='' ">
and ssdw like concat('%',#{req.dwmc},'%')
</if>
5 months ago
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
ssdw,
task_id
UNION ALL
SELECT
ssdw AS dwmc,
COUNT(*) AS total,
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
FROM
asset_app_cp
<where>
5 months ago
<if test="req.dwmc!=null and req.dwmc!='' ">
and ssdw like concat('%',#{req.dwmc},'%')
</if>
5 months ago
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
ssdw ,task_id
UNION ALL
SELECT ssdw AS dwmc,
COUNT(*) AS total,
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
FROM
asset_official_account_cp
<where>
5 months ago
<if test="req.dwmc!=null and req.dwmc!='' ">
and ssdw like concat('%',#{req.dwmc},'%')
</if>
5 months ago
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
ssdw,
task_id
UNION ALL
SELECT
ssdw AS dwmc,
COUNT(*) AS total,
task_id,
MAX(create_time) AS latest_create_time,
SUM(CASE WHEN STATUS = 0 THEN 1 ELSE 0 END) AS notChecked,
SUM(CASE WHEN STATUS = 3 OR STATUS = 5 THEN 1 ELSE 0 END) AS checked,
SUM(count) AS returned
FROM
asset_email_cp
<where>
5 months ago
<if test="req.dwmc!=null and req.dwmc!='' ">
and ssdw like concat('%',#{req.dwmc},'%')
</if>
5 months ago
<if test="req.taskId!=null and req.taskId!='' ">
and task_id =#{req.taskId}
</if>
</where>
GROUP BY
ssdw,
task_id
) AS s left join asset_task b on s.task_id=b.id
5 months ago
<where>
<if test="req.taskStatus != null and req.taskStatus != ''">
b.task_status = #{req.taskStatus}
</if>
</where>
5 months ago
GROUP BY
s.dwmc ,
5 months ago
s.task_id
) g
5 months ago
GROUP BY
5 months ago
dwmc,
5 months ago
taskStatus
5 months ago
)f group by taskStatus
5 months ago
</select>
5 months ago
<update id="xcxsh"
parameterType="com.ruoyi.tc.entity.request.AssetCurrentShRequest">
update asset_mini_programs_cp
<set>
<if test="req.status != null ">
status = #{req.status},
</if>
update_time=now()
</set>
where asset_id = #{req.assetId} and task_id = #{req.taskId}
</update>
<update id="gzhsh"
parameterType="com.ruoyi.tc.entity.request.AssetCurrentShRequest">
update asset_official_account_cp
<set>
<if test="req.status != null ">
status = #{req.status},
</if>
update_time=now()
</set>
where asset_id = #{req.assetId} and task_id = #{req.taskId}
</update>
<update id="emailsh"
parameterType="com.ruoyi.tc.entity.request.AssetCurrentShRequest">
update asset_email_cp
<set>
<if test="req.status != null ">
status = #{req.status},
</if>
update_time=now()
</set>
where asset_id = #{req.assetId} and task_id = #{req.taskId}
</update>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into asset_task(task_name, task_time, task_deadline, task_finish_time, task_status, dwmc,
create_id, create_by, create_time, update_id, update_by, update_time, user_id, dept_id,
5 months ago
version, reamark,type,total_count,count,deadline_count,ygt)
values (#{taskName}, #{taskTime}, #{taskDeadline}, #{taskFinishTime}, #{taskStatus}, #{dwmc},
#{createId}, #{createBy}, #{createTime}, #{updateId}, #{updateBy}, #{updateTime}, #{userId}, #{deptId},
5 months ago
#{version}, #{reamark},#{type},#{totalCount},#{count},#{deadlineCount},#{ygt})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into
asset_task(task_name,task_time,task_deadline,task_finish_time,task_status,dwmc,create_id,create_by,create_time,update_id,update_by,update_time,user_id,dept_id,version,reamark)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.taskName},#{entity.taskTime},#{entity.taskDeadline},#{entity.taskFinishTime},#{entity.taskStatus},#{entity.dwmc},#{entity.createId},#{entity.createBy},#{entity.createTime},#{entity.updateId},#{entity.updateBy},#{entity.updateTime},#{entity.userId},#{entity.deptId},#{entity.version},#{entity.reamark})
</foreach>
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into
asset_task(task_name,task_time,task_deadline,task_finish_time,task_status,dwmc,create_id,create_by,create_time,update_id,update_by,update_time,user_id,dept_id,version,reamark)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.taskName},#{entity.taskTime},#{entity.taskDeadline}#{entity.taskFinishTime}#{entity.taskStatus}#{entity.dwmc}#{entity.createId}#{entity.createBy}#{entity.createTime}#{entity.updateId}#{entity.updateBy}#{entity.updateTime}#{entity.userId}#{entity.deptId}#{entity.version}#{entity.reamark})
</foreach>
on duplicate key update
task_name = values(task_name)task_time = values(task_time)task_deadline =
values(task_deadline)task_finish_time = values(task_finish_time)task_status = values(task_status)dwmc =
values(dwmc)create_id = values(create_id)create_by = values(create_by)create_time =
values(create_time)update_id = values(update_id)update_by = values(update_by)update_time =
values(update_time)user_id = values(user_id)dept_id = values(dept_id)version = values(version)reamark =
values(reamark)
</insert>
<!--通过主键修改数据-->
<update id="update">
update asset_task
<set>
<if test="taskName != null and taskName != ''">
task_name = #{taskName},
</if>
<if test="taskTime != null">
task_time = #{taskTime},
</if>
<if test="taskDeadline != null and taskDeadline != ''">
task_deadline = #{taskDeadline},
</if>
<if test="taskFinishTime != null">
task_finish_time = #{taskFinishTime},
</if>
<if test="taskStatus != null and taskStatus != ''">
task_status = #{taskStatus},
</if>
<if test="dwmc != null">
dwmc = #{dwmc},
</if>
<if test="createId != null">
create_id = #{createId},
</if>
<if test="createBy != null and createBy != ''">
create_by = #{createBy},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateId != null">
update_id = #{updateId},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="deptId != null">
dept_id = #{deptId},
</if>
<if test="version != null and version != ''">
version = #{version},
</if>
<if test="reamark != null and reamark != ''">
reamark = #{reamark},
</if>
5 months ago
<if test="count != null ">
count = #{count},
</if>
<if test="totalCount != null ">
total_count = #{totalCount},
</if>
<if test="deadlineCount != null">
deadline_count = #{deadlineCount},
</if>
<if test="ygt != null">
ygt = #{ygt},
</if>
</set>
where id = #{id}
</update>
<update id="sh" parameterType="com.ruoyi.tc.entity.request.AssetCurrentShRequest">
update asset_current_cp
<set>
<if test="req.status != null ">
status = #{req.status},
</if>
update_time=now()
</set>
where id = #{req.assetId} and task_id = #{req.taskId}
</update>
<update id="updateByTaskId">
5 months ago
update asset_task
<set>
<if test="taskStatus != null ">
task_status=#{taskStatus},
</if>
<if test="finishTime != null ">
task_finish_time=#{finishTime}
</if>
</set>
where id =#{taskId}
</update>
5 months ago
<update id="appsh" parameterType="com.ruoyi.tc.entity.request.AssetCurrentShRequest">
update asset_app_cp
<set>
<if test="req.status != null ">
status = #{req.status},
</if>
update_time=now()
</set>
where asset_id = #{req.assetId} and task_id = #{req.taskId}
</update>
<update id="updateYgtByTaskId" parameterType="java.lang.Integer">
update asset_task set ygt=#{count} where id =#{taskId}
</update>
5 months ago
<update id="close" parameterType="java.lang.Integer">
update asset_task
set task_status=0
where id = #{taskId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from asset_task
where id = #{id}
</delete>
</mapper>