2023-11-07 09:32:12 +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.zcloud.mapper.datasource.bus.ListManagerMapper">
|
|
|
|
|
|
|
|
|
|
<!--表名 -->
|
|
|
|
|
<sql id="tableName">
|
|
|
|
|
BUS_LISTMANAGER
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<!--数据字典表名 -->
|
|
|
|
|
<sql id="dicTableName">
|
|
|
|
|
SYS_DICTIONARIES
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<!-- 字段 -->
|
|
|
|
|
<sql id="Field">
|
|
|
|
|
f.NAME,
|
|
|
|
|
f.PERIOD,
|
|
|
|
|
f.TYPE,
|
|
|
|
|
f.CORPINFO_ID,
|
|
|
|
|
f.CREATOR,
|
|
|
|
|
f.CREATTIME,
|
|
|
|
|
f.OPERATOR,
|
|
|
|
|
f.OPERATTIME,
|
|
|
|
|
f.ISDELETE,
|
|
|
|
|
f.LISTMANAGER_ID,
|
|
|
|
|
f.DEPARTMENT_ID,
|
|
|
|
|
f.POST_ID,
|
|
|
|
|
f.USER_ID,
|
|
|
|
|
f.ACOUNT,
|
|
|
|
|
f.BCOUNT,
|
|
|
|
|
f.CCOUNT,
|
|
|
|
|
f.DCOUNT,
|
|
|
|
|
f.START_DATE,
|
|
|
|
|
f.END_DATE,
|
|
|
|
|
f.SCREENTYPE
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<!-- 字段用于新增 -->
|
|
|
|
|
<sql id="Field2">
|
|
|
|
|
NAME,
|
|
|
|
|
PERIOD,
|
|
|
|
|
TYPE,
|
|
|
|
|
CORPINFO_ID,
|
|
|
|
|
CREATOR,
|
|
|
|
|
CREATTIME,
|
|
|
|
|
OPERATOR,
|
|
|
|
|
OPERATTIME,
|
|
|
|
|
ISDELETE,
|
|
|
|
|
LISTMANAGER_ID,
|
|
|
|
|
DEPARTMENT_ID,
|
|
|
|
|
POST_ID,
|
|
|
|
|
USER_ID,
|
|
|
|
|
ACOUNT,
|
|
|
|
|
BCOUNT,
|
|
|
|
|
CCOUNT,
|
|
|
|
|
DCOUNT,
|
|
|
|
|
START_DATE,
|
|
|
|
|
END_DATE,
|
|
|
|
|
SCREENTYPE
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<!-- 字段值 -->
|
|
|
|
|
<sql id="FieldValue">
|
|
|
|
|
#{NAME},
|
|
|
|
|
#{PERIOD},
|
|
|
|
|
#{TYPE},
|
|
|
|
|
#{CORPINFO_ID},
|
|
|
|
|
#{CREATOR},
|
|
|
|
|
#{CREATTIME},
|
|
|
|
|
#{OPERATOR},
|
|
|
|
|
#{OPERATTIME},
|
|
|
|
|
#{ISDELETE},
|
|
|
|
|
#{LISTMANAGER_ID},
|
|
|
|
|
#{DEPARTMENT_ID},
|
|
|
|
|
#{POST_ID},
|
|
|
|
|
#{USER_ID},
|
|
|
|
|
#{ACOUNT},
|
|
|
|
|
#{BCOUNT},
|
|
|
|
|
#{CCOUNT},
|
|
|
|
|
#{DCOUNT},
|
|
|
|
|
#{START_DATE},
|
|
|
|
|
#{END_DATE},
|
|
|
|
|
#{SCREENTYPE}
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<!-- 新增 -->
|
|
|
|
|
<insert id="save" parameterType="pd">
|
|
|
|
|
insert into
|
|
|
|
|
<include refid="tableName"></include>
|
|
|
|
|
(
|
|
|
|
|
<include refid="Field2"></include>
|
|
|
|
|
) values (
|
|
|
|
|
<include refid="FieldValue"></include>
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<!-- 禁用 -->
|
|
|
|
|
<delete id="delete" parameterType="pd">
|
|
|
|
|
update
|
|
|
|
|
<include refid="tableName"></include>
|
|
|
|
|
set
|
|
|
|
|
ISDELETE = '1'
|
|
|
|
|
<if test="OPERATTIME != null or OPERATTIME != ''">
|
|
|
|
|
,OPERATTIME =#{OPERATTIME}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="OPERATOR != null or OPERATOR != ''">
|
|
|
|
|
,OPERATOR =#{OPERATOR}
|
|
|
|
|
</if>
|
|
|
|
|
where
|
|
|
|
|
LISTMANAGER_ID = #{LISTMANAGER_ID}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<!-- 删除 -->
|
|
|
|
|
<delete id="remove" parameterType="pd">
|
|
|
|
|
update
|
|
|
|
|
<include refid="tableName"></include>
|
|
|
|
|
set
|
|
|
|
|
ISDELETE = '2'
|
|
|
|
|
<if test="OPERATTIME != null or OPERATTIME != ''">
|
|
|
|
|
,OPERATTIME =#{OPERATTIME}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="OPERATOR != null or OPERATOR != ''">
|
|
|
|
|
,OPERATOR =#{OPERATOR}
|
|
|
|
|
</if>
|
|
|
|
|
where
|
|
|
|
|
LISTMANAGER_ID = #{LISTMANAGER_ID}
|
|
|
|
|
</delete>
|
|
|
|
|
<!-- 启用 -->
|
|
|
|
|
<update id="enable" parameterType="pd">
|
|
|
|
|
update
|
|
|
|
|
<include refid="tableName"></include>
|
|
|
|
|
set
|
|
|
|
|
ISDELETE = '0'
|
|
|
|
|
<if test="OPERATTIME != null or OPERATTIME != ''">
|
|
|
|
|
,OPERATTIME =#{OPERATTIME}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="OPERATOR != null or OPERATOR != ''">
|
|
|
|
|
,OPERATOR =#{OPERATOR}
|
|
|
|
|
</if>
|
|
|
|
|
where
|
|
|
|
|
LISTMANAGER_ID = #{LISTMANAGER_ID}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<!-- 修改 -->
|
|
|
|
|
<update id="edit" parameterType="pd">
|
|
|
|
|
update
|
|
|
|
|
<include refid="tableName"></include>
|
|
|
|
|
set
|
|
|
|
|
NAME = #{NAME},
|
|
|
|
|
PERIOD = #{PERIOD},
|
|
|
|
|
TYPE = #{TYPE},
|
|
|
|
|
ACOUNT = #{ACOUNT},
|
|
|
|
|
BCOUNT = #{BCOUNT},
|
|
|
|
|
CCOUNT = #{CCOUNT},
|
|
|
|
|
DCOUNT = #{DCOUNT},
|
|
|
|
|
<if test="DEPARTMENT_ID != null or DEPARTMENT_ID != ''">
|
|
|
|
|
DEPARTMENT_ID= #{DEPARTMENT_ID},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="POST_ID != null or POST_ID != ''">
|
|
|
|
|
POST_ID =#{POST_ID},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="SCREENTYPE != null or SCREENTYPE != ''">
|
|
|
|
|
SCREENTYPE =#{SCREENTYPE},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="START_DATE != null or START_DATE != ''">
|
|
|
|
|
START_DATE =#{START_DATE},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="END_DATE != null or END_DATE != ''">
|
|
|
|
|
END_DATE =#{END_DATE},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="OVERTIMENUM != null or OVERTIMENUM != ''">
|
|
|
|
|
OVERTIMENUM =#{OVERTIMENUM},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="USER_ID != null or USER_ID!= ''">
|
|
|
|
|
USER_ID =#{USER_ID},
|
|
|
|
|
</if>
|
|
|
|
|
LISTMANAGER_ID = LISTMANAGER_ID
|
|
|
|
|
where
|
|
|
|
|
LISTMANAGER_ID = #{LISTMANAGER_ID}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<!-- 通过ID获取数据 -->
|
|
|
|
|
<select id="findById" parameterType="pd" resultType="pd">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Field"></include>
|
|
|
|
|
,
|
|
|
|
|
p.NAME PERIODNAME,
|
|
|
|
|
t.NAME TYPENAME,
|
|
|
|
|
d.NAME as DEPARTMENT_NAME,
|
|
|
|
|
sp.NAME
|
|
|
|
|
AS POST_NAME,
|
|
|
|
|
s.NAME AS SCREENTYPENAME,
|
2024-09-19 10:02:54 +08:00
|
|
|
|
getUnameByUid(f.USER_ID) AS USER_NAME
|
2023-11-07 09:32:12 +08:00
|
|
|
|
from
|
|
|
|
|
<include refid="tableName"></include>
|
|
|
|
|
f
|
|
|
|
|
left join sys_dictionaries p on f.PERIOD = p.BIANMA
|
|
|
|
|
left join sys_dictionaries t on f.TYPE = t.BIANMA
|
|
|
|
|
left join sys_dictionaries s on f.SCREENTYPE = s.BIANMA
|
|
|
|
|
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=f.DEPARTMENT_ID
|
|
|
|
|
left join
|
|
|
|
|
SYS_POST sp on sp.POST_ID=f.POST_ID
|
|
|
|
|
LEFT JOIN SYS_USER u on u.USER_ID =
|
|
|
|
|
f.USER_ID
|
|
|
|
|
where
|
|
|
|
|
f.LISTMANAGER_ID = #{LISTMANAGER_ID}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<select id="datalistPage" parameterType="page" resultType="pd">
|
|
|
|
|
select
|
|
|
|
|
v.USER_ID V_USER_ID,
|
|
|
|
|
v.USERNAME,
|
|
|
|
|
<include refid="Field"></include>
|
|
|
|
|
,
|
|
|
|
|
p.NAME PERIODNAME,
|
|
|
|
|
t.NAME TYPENAME,
|
|
|
|
|
d.NAME as DEPARTMENT_NAME,
|
|
|
|
|
sp.NAME
|
|
|
|
|
AS POST_NAME,
|
2024-09-19 10:02:54 +08:00
|
|
|
|
getUnameByUid(f.USER_ID) USER_NAME,
|
2023-11-07 09:32:12 +08:00
|
|
|
|
s.NAME AS SCREENTYPENAME,
|
|
|
|
|
(select count(1) from BUS_LIST_CHECKITEM ch where
|
|
|
|
|
ch.LISTMANAGER_ID=f.LISTMANAGER_ID and ch.ISDELETE = '0') as count ,
|
|
|
|
|
(SELECT count(1) FROM BUS_CHECKRECORD ch WHERE ch.LISTMANAGER_ID =
|
|
|
|
|
f.LISTMANAGER_ID AND ch.FINISHED = '1' AND ch.ISDELETE = 0 ) as
|
|
|
|
|
cdcount
|
|
|
|
|
from
|
|
|
|
|
<include refid="tableName"></include> f
|
|
|
|
|
left join sys_dictionaries p on f.PERIOD = p.BIANMA
|
|
|
|
|
left join sys_dictionaries t on f.TYPE = t.BIANMA
|
|
|
|
|
left join sys_dictionaries s on f.SCREENTYPE = s.BIANMA
|
|
|
|
|
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=f.DEPARTMENT_ID
|
|
|
|
|
left join SYS_POST sp on sp.POST_ID=f.POST_ID
|
|
|
|
|
left join sys_user u on u.USER_ID = f.USER_ID
|
|
|
|
|
LEFT JOIN sys_user v ON v.USERNAME = f.CREATOR
|
|
|
|
|
where f.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
|
|
|
and f.ISDELETE != '2'
|
|
|
|
|
<if test="pd.roleLevel != null and pd.roleLevel != ''"><!-- 权限显示 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='pd.roleLevel == "0"'>
|
|
|
|
|
</when>
|
|
|
|
|
<when test='pd.roleLevel == "1"'>
|
|
|
|
|
and f.DEPARTMENT_ID in (${pd.supDeparIds})
|
|
|
|
|
</when>
|
|
|
|
|
<when test='pd.roleLevel == "2"'>
|
|
|
|
|
<!-- f.CREATOR = #{pd.loginUserId} -->
|
|
|
|
|
and ( v.user_id = #{pd.loginUserId} or f.USER_ID = #{pd.loginUserId} )
|
|
|
|
|
<!-- rolelevel是2的情况下,CREATOR存的是手机号,前台传的当前登录人是id,所以我用CREATOR的id去跟登录人的id对比 -->
|
|
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.HIDFORBIDDEN == null or pd.HIDFORBIDDEN == ''"><!-- 是否隐藏禁用清单,当HIDFORBIDDEN为空时,隐藏已禁用清单 -->
|
|
|
|
|
and f.ISDELETE = '0'
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
|
|
|
|
|
and
|
|
|
|
|
(
|
|
|
|
|
f.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.POST_ID != null and pd.POST_ID != ''"><!-- 关键词检索 -->
|
|
|
|
|
and
|
|
|
|
|
(
|
|
|
|
|
f.POST_ID = #{pd.POST_ID}
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''"><!-- 关键词检索 -->
|
|
|
|
|
and f.DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.USERNAME != null and pd.USERNAME != ''"><!-- 关键词检索 -->
|
2024-09-19 10:02:54 +08:00
|
|
|
|
and getUnameByUid(f.USER_ID) LIKE CONCAT(CONCAT('%', #{pd.USERNAME}),'%')
|
2023-11-07 09:32:12 +08:00
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.TYPE != null and pd.TYPE != ''"><!-- 关键词检索 -->
|
|
|
|
|
and f.TYPE = #{pd.TYPE}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.LISTINGLEVEL != null and pd.LISTINGLEVEL != ''"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='pd.LISTINGLEVEL == "1"'>
|
|
|
|
|
and d.LEVEL = ''
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
and d.LEVEL = #{pd.LISTINGLEVEL}
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if
|
|
|
|
|
test="pd.RISKCHECKLISTTYPE != null and pd.RISKCHECKLISTTYPE != ''"><!-- 关键词检索 -->
|
|
|
|
|
and f.SCREENTYPE = #{pd.RISKCHECKLISTTYPE}
|
|
|
|
|
</if>
|
|
|
|
|
order by f.ISDELETE,f.OPERATTIME desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 部门清单列表 -->
|
|
|
|
|
<select id="recordlistPage" parameterType="page" resultType="pd">
|
|
|
|
|
select * from
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
|
select
|
|
|
|
|
<include refid="Field"></include>
|
|
|
|
|
,
|
|
|
|
|
p.NAME PERIODNAME,
|
|
|
|
|
t.NAME TYPENAME,
|
|
|
|
|
d.NAME as DEPARTMENT_NAME,
|
|
|
|
|
sp.NAME
|
|
|
|
|
AS POST_NAME,
|
|
|
|
|
u.NAME as USER_NAME,
|
|
|
|
|
(
|
|
|
|
|
select count(1) from BUS_CHECKRECORD ch
|
|
|
|
|
where ch.LISTMANAGER_ID=f.LISTMANAGER_ID
|
|
|
|
|
and ch.FINISHED='1' and ch.ISDELETE =0
|
|
|
|
|
) as count ,
|
|
|
|
|
(
|
|
|
|
|
select
|
|
|
|
|
count(1)
|
|
|
|
|
from BUS_CHECKRECORD ch
|
|
|
|
|
left join bus_hidden h on h.CHECKRECORD_ID = ch.CHECKRECORD_ID
|
|
|
|
|
where ch.LISTMANAGER_ID=f.LISTMANAGER_ID
|
|
|
|
|
and ch.FINISHED='1'
|
|
|
|
|
and ch.ISDELETE =0
|
|
|
|
|
and h.ISDELETE =0
|
|
|
|
|
and h.HIDDEN_ID is not null
|
|
|
|
|
) as hiddenCount,
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
|
CASE
|
|
|
|
|
WHEN f.TYPE ='listType0005' THEN CONCAT(f.START_DATE," 00:00:00")
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0001' THEN sd.DAY_START
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0002' THEN sd.WEEK_START
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0003' THEN sd.XUN_START
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0004' THEN sd.MONTH_START
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0005' THEN sd.QUARTER_START
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0006' THEN sd.YEAR_START
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0007' THEN sd.HALFYEAR_START
|
|
|
|
|
end
|
|
|
|
|
) DATESTART,
|
|
|
|
|
(
|
|
|
|
|
CASE
|
|
|
|
|
WHEN f.TYPE ='listType0005' THEN CONCAT(f.END_DATE," 23:59:59")
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0001' THEN sd.DAY_END
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0002' THEN sd.WEEK_END
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0003' THEN sd.XUN_END
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0004' THEN sd.MONTH_END
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0005' THEN sd.QUARTER_END
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0006' THEN sd.YEAR_END
|
|
|
|
|
WHEN f.PERIOD ='checkPeriod0007' THEN sd.HALFYEAR_END
|
|
|
|
|
end
|
|
|
|
|
) DATEEND,
|
|
|
|
|
ve.numCount checkCount,
|
|
|
|
|
f.OVERTIMENUM overTimeCount
|
|
|
|
|
from
|
|
|
|
|
<include refid="tableName"></include>
|
|
|
|
|
f
|
|
|
|
|
left join sys_dictionaries p on f.PERIOD = p.BIANMA
|
|
|
|
|
left join sys_dictionaries t on f.TYPE = t.BIANMA
|
|
|
|
|
left join OA_DEPARTMENT d on d.DEPARTMENT_ID = f.DEPARTMENT_ID
|
|
|
|
|
left join
|
|
|
|
|
SYS_POST sp on sp.POST_ID=f.POST_ID
|
|
|
|
|
left join SYS_USER u on u.USER_ID =
|
|
|
|
|
f.USER_ID
|
|
|
|
|
left join bus_sysdate sd on TO_DAYS(sd.date) = TO_DAYS(NOW())
|
|
|
|
|
left join view_examine ve on ve.LISTMANAGER_ID = f.LISTMANAGER_ID
|
|
|
|
|
where f.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
|
|
|
<if test="pd.statusIds != null and pd.statusIds != ''">
|
|
|
|
|
and
|
|
|
|
|
(
|
|
|
|
|
f.LISTMANAGER_ID in
|
|
|
|
|
<foreach item="item" index="index" collection="pd.statusIds"
|
|
|
|
|
open="(" separator="," close=")">
|
|
|
|
|
'${item}'
|
|
|
|
|
</foreach>
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
|
|
|
|
|
and
|
|
|
|
|
(
|
|
|
|
|
f.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<!-- <if test="pd.DEPARTMENT_IDS != null and pd.DEPARTMENT_IDS != ''"><!– 关键词检索 –>-->
|
|
|
|
|
<!-- and-->
|
|
|
|
|
<!-- (-->
|
|
|
|
|
<!-- f.DEPARTMENT_ID in-->
|
|
|
|
|
<!-- <foreach item="item" index="index"-->
|
|
|
|
|
<!-- collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">-->
|
|
|
|
|
<!-- '${item}'-->
|
|
|
|
|
<!-- </foreach>-->
|
|
|
|
|
<!-- or f.USER_ID = #{pd.USER_ID}-->
|
|
|
|
|
<!-- )-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<if test="pd.USERNAME != null and pd.USERNAME != ''"><!-- 关键词检索 -->
|
|
|
|
|
and u.NAME LIKE CONCAT(CONCAT('%', #{pd.USERNAME}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''"><!-- 关键词检索 -->
|
|
|
|
|
and f.DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.PERIOD != null and pd.PERIOD != ''"><!-- 关键词检索 -->
|
|
|
|
|
and f.PERIOD = #{pd.PERIOD}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.STATUS != null and pd.STATUS != ''"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='pd.STATUS=="1"'>
|
|
|
|
|
AND ve.numCount > 0
|
|
|
|
|
</when>
|
|
|
|
|
<when test='pd.STATUS=="0"'>
|
|
|
|
|
AND ve.numCount = 0
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.OVERTIME != null and pd.OVERTIME != ''"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='pd.OVERTIME=="1"'>
|
|
|
|
|
AND f.OVERTIMENUM > 0
|
|
|
|
|
</when>
|
|
|
|
|
<when test='pd.OVERTIME=="0"'>
|
|
|
|
|
AND f.OVERTIMENUM = 0
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.TYPE != null and pd.TYPE != ''"><!-- 关键词检索 -->
|
|
|
|
|
and f.TYPE = #{pd.TYPE}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.LISTINGLEVEL != null and pd.LISTINGLEVEL != ''"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='pd.LISTINGLEVEL == "1"'>
|
|
|
|
|
and d.LEVEL = ''
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
and d.LEVEL = #{pd.LISTINGLEVEL}
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if
|
|
|
|
|
test="(pd.STARTTIME != null and pd.STARTTIME != '') or (pd.ENDTIME != null and pd.ENDTIME != '')"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when
|
|
|
|
|
test="pd.STARTTIME != null and pd.STARTTIME != '' and pd.ENDTIME != null and pd.ENDTIME != ''">
|
|
|
|
|
and f.LISTMANAGER_ID in
|
|
|
|
|
(
|
|
|
|
|
SELECT LISTMANAGER_ID
|
|
|
|
|
FROM BUS_CHECKRECORD
|
|
|
|
|
WHERE FINISHED = '1'
|
|
|
|
|
AND ISDELETE = 0
|
|
|
|
|
and CHECK_TIME >= #{pd.STARTTIME}
|
|
|
|
|
and CHECK_TIME <= #{pd.ENDTIME}
|
|
|
|
|
)
|
|
|
|
|
</when>
|
|
|
|
|
<when test="pd.STARTTIME != null and pd.STARTTIME != ''">
|
|
|
|
|
and f.LISTMANAGER_ID in
|
|
|
|
|
(
|
|
|
|
|
SELECT LISTMANAGER_ID
|
|
|
|
|
FROM BUS_CHECKRECORD
|
|
|
|
|
WHERE FINISHED = '1'
|
|
|
|
|
AND ISDELETE = 0
|
|
|
|
|
and CHECK_TIME >= #{pd.STARTTIME}
|
|
|
|
|
)
|
|
|
|
|
</when>
|
|
|
|
|
<when test="pd.ENDTIME != null and pd.ENDTIME != ''">
|
|
|
|
|
and f.LISTMANAGER_ID in
|
|
|
|
|
(
|
|
|
|
|
SELECT LISTMANAGER_ID
|
|
|
|
|
FROM BUS_CHECKRECORD
|
|
|
|
|
WHERE FINISHED = '1'
|
|
|
|
|
AND ISDELETE = 0
|
|
|
|
|
and CHECK_TIME <= #{pd.ENDTIME}
|
|
|
|
|
)
|
|
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
) f
|
|
|
|
|
where 1= 1
|
|
|
|
|
<if test="pd.HASHIDDEN != null and pd.HASHIDDEN != ''"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="pd.HASHIDDEN == 0">
|
|
|
|
|
and f.hiddenCount = 0
|
|
|
|
|
</when>
|
|
|
|
|
<when test="pd.HASHIDDEN == 1">
|
|
|
|
|
and f.hiddenCount > 0
|
|
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
order by f.ISDELETE,f.OPERATTIME desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 列表(全部) -->
|
|
|
|
|
<select id="listAll" parameterType="pd" resultType="pd">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Field"></include>
|
|
|
|
|
,
|
|
|
|
|
p.NAME PERIODNAME,
|
|
|
|
|
t.NAME TYPENAME,
|
|
|
|
|
d.NAME as DEPARTMENT_NAME,
|
|
|
|
|
sp.NAME
|
|
|
|
|
AS POST_NAME,
|
2024-09-19 10:02:54 +08:00
|
|
|
|
getUnameByUid(f.USER_ID) USER_NAME,
|
2023-11-07 09:32:12 +08:00
|
|
|
|
(select count(1) from BUS_LIST_CHECKITEM
|
|
|
|
|
ch where ch.LISTMANAGER_ID=f.LISTMANAGER_ID and ch.ISDELETE =0) as
|
|
|
|
|
count,
|
|
|
|
|
ve.numCount checkCount
|
|
|
|
|
from
|
|
|
|
|
<include refid="tableName"></include>
|
|
|
|
|
f
|
|
|
|
|
left join sys_dictionaries p on f.PERIOD = p.BIANMA
|
|
|
|
|
left join sys_dictionaries t on f.TYPE = t.BIANMA
|
|
|
|
|
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=f.DEPARTMENT_ID
|
|
|
|
|
left join
|
|
|
|
|
sys_user u on u.USER_ID = f.USER_ID
|
|
|
|
|
left join SYS_POST sp on
|
|
|
|
|
sp.POST_ID=f.POST_ID
|
|
|
|
|
left join view_examine ve on ve.LISTMANAGER_ID =
|
|
|
|
|
f.LISTMANAGER_ID
|
|
|
|
|
where f.ISDELETE = '0' and (f.TYPE != 'listType0005'
|
|
|
|
|
or (f.START_DATE <= DATE_FORMAT(NOW(),'%Y-%m-%d') and f.END_DATE
|
|
|
|
|
>= DATE_FORMAT(NOW(),'%Y-%m-%d') ))
|
|
|
|
|
<!-- <if test="POST_ID != null and POST_ID != ''">关键词检索 -->
|
|
|
|
|
<!-- and -->
|
|
|
|
|
<!-- ( -->
|
|
|
|
|
<!-- f.POST_ID = #{POST_ID} -->
|
|
|
|
|
<!-- ) -->
|
|
|
|
|
<!-- </if> -->
|
|
|
|
|
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
|
|
|
|
|
and
|
|
|
|
|
f.CORPINFO_ID = #{CORPINFO_ID}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="DEPARTMENT_IDS != null and DEPARTMENT_IDS != ''"><!-- 关键词检索 -->
|
|
|
|
|
and
|
|
|
|
|
(
|
|
|
|
|
f.DEPARTMENT_ID in
|
|
|
|
|
<foreach item="item" index="index"
|
|
|
|
|
collection="DEPARTMENT_IDS" open="(" separator="," close=")">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
or f.USER_ID = #{USER_ID}
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
|
|
|
|
|
and
|
|
|
|
|
f.DEPARTMENT_ID = #{DEPARTMENT_ID}
|
|
|
|
|
|
|
|
|
|
</if>
|
|
|
|
|
<if test="USER_ID != null and USER_ID != ''">
|
|
|
|
|
and f.USER_ID = #{USER_ID}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="DTID != null and DTID != ''"><!-- 部门查询条件 -->
|
|
|
|
|
and f.DEPARTMENT_ID = #{DTID}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="USERNAME != null and USERNAME != ''">
|
|
|
|
|
and u.NAME LIKE CONCAT(CONCAT('%', #{USERNAME}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="KEYWORDS != null and KEYWORDS != ''">
|
|
|
|
|
and f.NAME LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="STATUS != null and STATUS != ''"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='STATUS=="1"'>
|
|
|
|
|
AND ve.numCount > 0
|
|
|
|
|
</when>
|
|
|
|
|
<when test='STATUS=="0"'>
|
|
|
|
|
AND ve.numCount = 0
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="LISTINGLEVEL != null and LISTINGLEVEL != ''"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='LISTINGLEVEL == "1"'>
|
|
|
|
|
and d.LEVEL = ''
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
and d.LEVEL = #{LISTINGLEVEL}
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
order by f.USER_ID= #{orderUserId} desc ,f.DEPARTMENT_ID asc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 清单检查分页 -->
|
|
|
|
|
<select id="checklistPage" parameterType="page" resultType="pd">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Field"></include>
|
|
|
|
|
,
|
|
|
|
|
p.NAME PERIODNAME,
|
|
|
|
|
t.NAME TYPENAME,
|
|
|
|
|
d.NAME as DEPARTMENT_NAME,
|
|
|
|
|
sp.NAME
|
|
|
|
|
AS POST_NAME,
|
2024-09-19 10:02:54 +08:00
|
|
|
|
getUnameByUid(f.USER_ID) USER_NAME,
|
2023-11-07 09:32:12 +08:00
|
|
|
|
(select count(1) from BUS_LIST_CHECKITEM ch where ch.LISTMANAGER_ID=f.LISTMANAGER_ID and ch.ISDELETE =0) as count,
|
|
|
|
|
ve.numCount checkCount
|
|
|
|
|
from
|
|
|
|
|
<include refid="tableName"></include>
|
|
|
|
|
f
|
|
|
|
|
left join sys_dictionaries p on f.PERIOD = p.BIANMA
|
|
|
|
|
left join sys_dictionaries t on f.TYPE = t.BIANMA
|
|
|
|
|
left join OA_DEPARTMENT d on d.DEPARTMENT_ID = f.DEPARTMENT_ID
|
|
|
|
|
left join sys_user u on u.USER_ID = f.USER_ID
|
|
|
|
|
left join SYS_POST sp on sp.POST_ID=f.POST_ID
|
|
|
|
|
left join view_examine ve on ve.LISTMANAGER_ID = f.LISTMANAGER_ID
|
|
|
|
|
where f.ISDELETE = '0'
|
|
|
|
|
and (f.TYPE != 'listType0005' or (f.START_DATE <= DATE_FORMAT(NOW(),'%Y-%m-%d') and f.END_DATE >= DATE_FORMAT(NOW(),'%Y-%m-%d') ))
|
|
|
|
|
<!-- <if test="POST_ID != null and POST_ID != ''">关键词检索 -->
|
|
|
|
|
<!-- and -->
|
|
|
|
|
<!-- ( -->
|
|
|
|
|
<!-- f.POST_ID = #{POST_ID} -->
|
|
|
|
|
<!-- ) -->
|
|
|
|
|
<!-- </if> -->
|
|
|
|
|
<if test="pd.roleLevel != null and pd.roleLevel != ''"><!-- 权限显示 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='pd.roleLevel == "0"'>
|
|
|
|
|
</when>
|
|
|
|
|
<when test='pd.roleLevel == "1"'>
|
|
|
|
|
and f.DEPARTMENT_ID in (${pd.supDeparIds})
|
|
|
|
|
</when>
|
|
|
|
|
<when test='pd.roleLevel == "2"'>
|
|
|
|
|
and f.USER_ID = #{pd.loginUserId}
|
|
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''">
|
|
|
|
|
and
|
|
|
|
|
f.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
|
|
|
</if>
|
|
|
|
|
<!-- <if test="pd.DEPARTMENT_IDS != null and pd.DEPARTMENT_IDS != ''"><!– 关键词检索 –>-->
|
|
|
|
|
<!-- and-->
|
|
|
|
|
<!-- (-->
|
|
|
|
|
<!-- f.DEPARTMENT_ID in-->
|
|
|
|
|
<!-- <foreach item="item" index="index"-->
|
|
|
|
|
<!-- collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">-->
|
|
|
|
|
<!-- #{pd.DEPARTMENT_IDS[${index}]}-->
|
|
|
|
|
<!-- </foreach>-->
|
|
|
|
|
<!-- or f.USER_ID = #{pd.USER_ID}-->
|
|
|
|
|
<!-- )-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
|
|
|
|
|
and
|
|
|
|
|
f.DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
|
|
|
and f.USER_ID = #{pd.USER_ID}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.DTID != null and pd.DTID != ''"><!-- 部门查询条件 -->
|
|
|
|
|
and f.DEPARTMENT_ID = #{pd.DTID}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.USERNAME != null and pd.USERNAME != ''">
|
2024-09-19 10:02:54 +08:00
|
|
|
|
and getUnameByUid(f.USER_ID) LIKE CONCAT(CONCAT('%', #{pd.USERNAME}),'%')
|
2023-11-07 09:32:12 +08:00
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''">
|
|
|
|
|
and f.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.PERIODNAME != null and pd.PERIODNAME != ''">
|
|
|
|
|
and p.NAME LIKE CONCAT(CONCAT('%', #{pd.PERIODNAME}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.STATUS != null and pd.STATUS != ''"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='pd.STATUS=="1"'>
|
|
|
|
|
AND ve.numCount > 0
|
|
|
|
|
</when>
|
|
|
|
|
<when test='pd.STATUS=="0"'>
|
|
|
|
|
AND ve.numCount = 0
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.LISTINGLEVEL != null and pd.LISTINGLEVEL != ''"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='pd.LISTINGLEVEL == "1"'>
|
|
|
|
|
and d.LEVEL = ''
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
and d.LEVEL = #{pd.LISTINGLEVEL}
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
order by f.USER_ID= #{pd.orderUserId} desc ,f.DEPARTMENT_ID asc,f.CREATTIME desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 列表(全部) -->
|
|
|
|
|
<select id="listRecordAll" parameterType="pd" resultType="pd">
|
|
|
|
|
select * from (
|
|
|
|
|
select
|
|
|
|
|
f.TYPE,
|
|
|
|
|
f.START_DATE,
|
|
|
|
|
f.END_DATE,
|
|
|
|
|
f.CREATTIME,
|
|
|
|
|
f.LISTMANAGER_ID,
|
|
|
|
|
p.NAME PERIODNAME,
|
|
|
|
|
f.OPERATTIME,
|
|
|
|
|
(
|
|
|
|
|
select
|
|
|
|
|
count(1)
|
|
|
|
|
from BUS_CHECKRECORD ch
|
|
|
|
|
left join bus_hidden h on h.CHECKRECORD_ID = ch.CHECKRECORD_ID
|
|
|
|
|
where ch.LISTMANAGER_ID=f.LISTMANAGER_ID
|
|
|
|
|
and ch.FINISHED='1'
|
|
|
|
|
and ch.ISDELETE =0
|
|
|
|
|
and h.ISDELETE =0
|
|
|
|
|
and h.HIDDEN_ID is not null
|
|
|
|
|
) as hiddenCount
|
|
|
|
|
from
|
|
|
|
|
<include refid="tableName"></include>
|
|
|
|
|
f
|
|
|
|
|
left join sys_dictionaries p on f.PERIOD = p.BIANMA
|
|
|
|
|
left join sys_dictionaries t on f.TYPE = t.BIANMA
|
|
|
|
|
left join OA_DEPARTMENT d on d.DEPARTMENT_ID = f.DEPARTMENT_ID
|
|
|
|
|
left join
|
|
|
|
|
SYS_POST sp on sp.POST_ID=f.POST_ID
|
|
|
|
|
left join SYS_USER u on u.USER_ID =
|
|
|
|
|
f.USER_ID
|
|
|
|
|
where f.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
|
|
|
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
|
|
|
|
|
and
|
|
|
|
|
(
|
|
|
|
|
f.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<!-- <if test="pd.DEPARTMENT_IDS != null and pd.DEPARTMENT_IDS != ''"><!– 关键词检索 –>-->
|
|
|
|
|
<!-- and-->
|
|
|
|
|
<!-- (-->
|
|
|
|
|
<!-- f.DEPARTMENT_ID in-->
|
|
|
|
|
<!-- <foreach item="item" index="index"-->
|
|
|
|
|
<!-- collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">-->
|
|
|
|
|
<!-- '${item}'-->
|
|
|
|
|
<!-- </foreach>-->
|
|
|
|
|
<!-- or f.USER_ID = #{pd.USER_ID}-->
|
|
|
|
|
<!-- )-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<if test="pd.USERNAME != null and pd.USERNAME != ''"><!-- 关键词检索 -->
|
|
|
|
|
and u.NAME LIKE CONCAT(CONCAT('%', #{pd.USERNAME}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''"><!-- 关键词检索 -->
|
|
|
|
|
and f.DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.PERIOD != null and pd.PERIOD != ''"><!-- 关键词检索 -->
|
|
|
|
|
and f.PERIOD = #{pd.PERIOD}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.TYPE != null and pd.TYPE != ''"><!-- 关键词检索 -->
|
|
|
|
|
and f.TYPE = #{pd.TYPE}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.LISTINGLEVEL != null and pd.LISTINGLEVEL != ''"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='pd.LISTINGLEVEL == "1"'>
|
|
|
|
|
and d.LEVEL = ''
|
|
|
|
|
</when>
|
|
|
|
|
<otherwise>
|
|
|
|
|
and d.LEVEL = #{pd.LISTINGLEVEL}
|
|
|
|
|
</otherwise>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
<if
|
|
|
|
|
test="(pd.STARTTIME != null and pd.STARTTIME != '') or (pd.ENDTIME != null and pd.ENDTIME != '')"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when
|
|
|
|
|
test="pd.STARTTIME != null and pd.STARTTIME != '' and pd.ENDTIME != null and pd.ENDTIME != ''">
|
|
|
|
|
and f.LISTMANAGER_ID in
|
|
|
|
|
(
|
|
|
|
|
SELECT LISTMANAGER_ID
|
|
|
|
|
FROM BUS_CHECKRECORD
|
|
|
|
|
WHERE FINISHED = '1'
|
|
|
|
|
AND ISDELETE = 0
|
|
|
|
|
and CHECK_TIME >= #{pd.STARTTIME}
|
|
|
|
|
and CHECK_TIME <= #{pd.ENDTIME}
|
|
|
|
|
)
|
|
|
|
|
</when>
|
|
|
|
|
<when test="pd.STARTTIME != null and pd.STARTTIME != ''">
|
|
|
|
|
and f.LISTMANAGER_ID in
|
|
|
|
|
(
|
|
|
|
|
SELECT LISTMANAGER_ID
|
|
|
|
|
FROM BUS_CHECKRECORD
|
|
|
|
|
WHERE FINISHED = '1'
|
|
|
|
|
AND ISDELETE = 0
|
|
|
|
|
and CHECK_TIME >= #{pd.STARTTIME}
|
|
|
|
|
)
|
|
|
|
|
</when>
|
|
|
|
|
<when test="pd.ENDTIME != null and pd.ENDTIME != ''">
|
|
|
|
|
and f.LISTMANAGER_ID in
|
|
|
|
|
(
|
|
|
|
|
SELECT LISTMANAGER_ID
|
|
|
|
|
FROM BUS_CHECKRECORD
|
|
|
|
|
WHERE FINISHED = '1'
|
|
|
|
|
AND ISDELETE = 0
|
|
|
|
|
and CHECK_TIME <= #{pd.ENDTIME}
|
|
|
|
|
)
|
|
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
) f
|
|
|
|
|
where 1= 1
|
|
|
|
|
<if test="pd.HASHIDDEN != null and pd.HASHIDDEN != ''"><!-- 关键词检索 -->
|
|
|
|
|
<choose>
|
|
|
|
|
<when test="pd.HASHIDDEN == 0">
|
|
|
|
|
and f.hiddenCount = 0
|
|
|
|
|
</when>
|
|
|
|
|
<when test="pd.HASHIDDEN == 1">
|
|
|
|
|
and f.hiddenCount > 0
|
|
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
</if>
|
|
|
|
|
order by f.OPERATTIME desc
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 列表(不包含节假日) -->
|
|
|
|
|
<select id="listExaminedNum" parameterType="pd" resultType="pd">
|
|
|
|
|
SELECT
|
|
|
|
|
count(1) NOTEXAMINEDNUM,PERIOD,TYPE,CORPINFO_ID,USER_ID
|
|
|
|
|
FROM
|
|
|
|
|
BUS_LISTMANAGER
|
|
|
|
|
where
|
|
|
|
|
ISDELETE = 0
|
|
|
|
|
and TYPE != 'listType0005'
|
|
|
|
|
GROUP BY PERIOD,TYPE,CORPINFO_ID,USER_ID
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="listExaminedNumJjr" parameterType="pd"
|
|
|
|
|
resultType="pd">
|
|
|
|
|
SELECT
|
|
|
|
|
count(1)*2 NOTEXAMINEDNUM,TYPE,CORPINFO_ID,START_DATE,END_DATE,USER_ID
|
|
|
|
|
FROM
|
|
|
|
|
BUS_LISTMANAGER
|
|
|
|
|
where
|
|
|
|
|
ISDELETE = 0
|
|
|
|
|
and TYPE = 'listType0005'
|
|
|
|
|
and START_DATE is not null
|
|
|
|
|
and END_DATE is
|
|
|
|
|
not null
|
|
|
|
|
AND START_DATE != ''
|
|
|
|
|
AND END_DATE != ''
|
|
|
|
|
GROUP BY TYPE,CORPINFO_ID,START_DATE,END_DATE,USER_ID
|
|
|
|
|
</select>
|
|
|
|
|
<!--清单全部风险 -->
|
|
|
|
|
<select id="listAllRisk" parameterType="pd" resultType="pd">
|
|
|
|
|
select
|
|
|
|
|
id.PARTSNAME,
|
|
|
|
|
id.IDENTIFICATIONPARTS_ID,
|
|
|
|
|
un.RISKUNITNAME,
|
|
|
|
|
de.NAME DEPT_NAME,
|
|
|
|
|
count(r.RISKPOINT_ID) as RISK_COUNT
|
|
|
|
|
from
|
|
|
|
|
BUS_LIST_CHECKITEM f
|
|
|
|
|
left join BUS_RISKPOINT r on r.RISKPOINT_ID=f.RISKPOINT_ID
|
|
|
|
|
left join bus_identificationparts id on id.IDENTIFICATIONPARTS_ID =
|
|
|
|
|
r.IDENTIFICATION_ID
|
|
|
|
|
left join BUS_RISKUNIT un on id.RISK_UNIT_ID = un.RISKUNIT_ID
|
|
|
|
|
left join OA_DEPARTMENT de on de.DEPARTMENT_ID = un.DEPARTMENT_ID
|
|
|
|
|
where
|
|
|
|
|
f.LISTMANAGER_ID = #{LISTMANAGER_ID}
|
|
|
|
|
and
|
|
|
|
|
f.ISDELETE = '0'
|
|
|
|
|
group by id.IDENTIFICATIONPARTS_ID,id.PARTSNAME
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 批量删除 -->
|
|
|
|
|
<delete id="deleteAll" parameterType="String">
|
|
|
|
|
update
|
|
|
|
|
<include refid="tableName"></include>
|
|
|
|
|
set
|
|
|
|
|
ISDELETE = '1'
|
|
|
|
|
where
|
|
|
|
|
LISTMANAGER_ID in
|
|
|
|
|
<foreach item="item" index="index" collection="ArrayDATA_IDS"
|
|
|
|
|
open="(" separator="," close=")">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<!--查询部门清单 -->
|
|
|
|
|
<select id="listListByDep" parameterType="pd" resultType="pd">
|
|
|
|
|
SELECT
|
|
|
|
|
f.LISTMANAGER_ID
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager f
|
|
|
|
|
WHERE
|
|
|
|
|
f.ISDELETE = '0'
|
|
|
|
|
and f.DEPARTMENT_ID = #{DEPARTMENT_ID}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!--人员负责清单数 -->
|
|
|
|
|
<select id="countListByUser" parameterType="pd" resultType="pd">
|
|
|
|
|
SELECT
|
|
|
|
|
count(1) NUM,
|
|
|
|
|
f.USER_ID
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager f
|
|
|
|
|
LEFT JOIN SYS_USER u ON u.USER_ID = f.USER_ID
|
|
|
|
|
WHERE
|
|
|
|
|
f.ISDELETE = '0'
|
|
|
|
|
and f.CORPINFO_ID = #{CORPINFO_ID}
|
|
|
|
|
GROUP BY
|
|
|
|
|
f.USER_ID
|
|
|
|
|
</select>
|
|
|
|
|
<!-- 查询所有可发送短信的企业的清单 -->
|
|
|
|
|
<select id="listAllByCorpMsm" parameterType="pd" resultType="pd">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Field"></include>
|
|
|
|
|
,
|
|
|
|
|
u.NAME USER_NAME,
|
|
|
|
|
u.USERNAME PHONE,
|
|
|
|
|
c.SMS_COUNT,
|
|
|
|
|
ve.numCount checkCount
|
|
|
|
|
from
|
|
|
|
|
<include refid="tableName"></include>
|
|
|
|
|
f
|
|
|
|
|
left join sys_user u on u.USER_ID = f.USER_ID
|
|
|
|
|
left join bus_corp_info
|
|
|
|
|
c on c.CORPINFO_ID = f.CORPINFO_ID
|
|
|
|
|
left join view_examine ve on
|
|
|
|
|
ve.LISTMANAGER_ID = f.LISTMANAGER_ID
|
|
|
|
|
where f.ISDELETE = '0' and (f.TYPE
|
|
|
|
|
!= 'listType0005' or (f.START_DATE <= DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
|
|
|
and f.END_DATE >= DATE_FORMAT(NOW(),'%Y-%m-%d') ))
|
|
|
|
|
and u.USERNAME is
|
|
|
|
|
not null
|
|
|
|
|
and u.USERNAME != ''
|
|
|
|
|
and u.ISMAIN = '0' <!-- 非主账号 -->
|
|
|
|
|
and f.CORPINFO_ID in (select CORPINFO_ID from bus_corp_info where
|
|
|
|
|
ISRECEIVE='1' and ISDELETE = '0' )
|
|
|
|
|
<if test="USERNAME != null and USERNAME != ''">
|
|
|
|
|
and u.NAME LIKE CONCAT(CONCAT('%', #{USERNAME}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="KEYWORDS != null and KEYWORDS != ''">
|
|
|
|
|
and f.NAME LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
order by f.CORPINFO_ID
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--查询人员清单 -->
|
|
|
|
|
<select id="listListByUser" parameterType="pd" resultType="pd">
|
|
|
|
|
SELECT
|
|
|
|
|
f.LISTMANAGER_ID
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager f
|
|
|
|
|
WHERE
|
|
|
|
|
f.ISDELETE = '0'
|
|
|
|
|
and f.USER_ID = #{USER_ID}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!--查询所有清单清单 -->
|
|
|
|
|
<select id="getAllList" parameterType="pd" resultType="pd">
|
|
|
|
|
SELECT
|
|
|
|
|
f.*,
|
|
|
|
|
ve.numCount checkCount
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager f
|
|
|
|
|
left join view_examine ve on ve.LISTMANAGER_ID = f.LISTMANAGER_ID
|
|
|
|
|
WHERE
|
|
|
|
|
f.ISDELETE = '0'
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="goIndexCount" parameterType="pd" resultType="pd">
|
|
|
|
|
SELECT
|
|
|
|
|
lis.screenType,
|
|
|
|
|
count(*) as count,
|
|
|
|
|
DATE_FORMAT(CHECK_TIME, '%Y-%m') months
|
|
|
|
|
FROM
|
|
|
|
|
BUS_CHECKRECORD f
|
|
|
|
|
LEFT JOIN bus_LISTMANAGER lis ON lis.LISTMANAGER_ID = f.LISTMANAGER_ID
|
|
|
|
|
WHERE
|
|
|
|
|
f.CORPINFO_ID = #{CORPINFO_ID}
|
|
|
|
|
and f.CHECK_TIME is not null
|
|
|
|
|
AND f.CHECK_TIME >= CONCAT_WS(" ", date_format(DATE_ADD(date_sub(curdate(),interval 5 month),interval -day(date_sub(curdate(),interval 5 month))+1 DAY),'%Y-%m-%d'), '00:00:00')
|
|
|
|
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
lis.screenType,
|
|
|
|
|
DATE_FORMAT(CHECK_TIME, '%Y-%m')
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 查询公司清单总数 -->
|
|
|
|
|
<select id="getListCount" parameterType="pd" resultType="int" >
|
|
|
|
|
SELECT
|
|
|
|
|
count( 1 )
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager
|
|
|
|
|
WHERE
|
|
|
|
|
CORPINFO_ID = #{CORPINFO_ID}
|
|
|
|
|
and ISDELETE = '0'
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 查询公司检查过清单的总数 -->
|
|
|
|
|
<select id="getWorkedListCount" parameterType="pd" resultType="int" >
|
|
|
|
|
SELECT
|
|
|
|
|
count( 1 )
|
|
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
count( s.LISTMANAGER_ID )
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager s
|
|
|
|
|
LEFT JOIN bus_checkrecord f ON f.LISTMANAGER_ID = s.LISTMANAGER_ID
|
|
|
|
|
WHERE
|
|
|
|
|
s.CORPINFO_ID = #{CORPINFO_ID}
|
|
|
|
|
AND f.FINISHED = '1'
|
|
|
|
|
AND f.isdelete = '0'
|
|
|
|
|
AND s.isdelete = '0'
|
|
|
|
|
AND f.CHECKRECORD_ID IS NOT NULL
|
|
|
|
|
GROUP BY
|
|
|
|
|
s.LISTMANAGER_ID
|
|
|
|
|
) q
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 根据分类统计清单 -->
|
|
|
|
|
<select id="countListByType" parameterType="pd" resultType="pd" >
|
|
|
|
|
SELECT
|
|
|
|
|
COUNT( f.TYPE ) NUM,
|
|
|
|
|
d.NAME NAME
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager f
|
|
|
|
|
LEFT JOIN sys_dictionaries d ON f.TYPE = d.BIANMA
|
|
|
|
|
AND d.YNDEL = 'no'
|
|
|
|
|
WHERE
|
|
|
|
|
f.ISDELETE = '0'
|
|
|
|
|
AND f.CORPINFO_ID = #{CORPINFO_ID}
|
|
|
|
|
GROUP BY
|
|
|
|
|
f.TYPE
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 上期超期未检查的清单 -->
|
|
|
|
|
<select id="overTimeRecord" parameterType="pd" resultType="pd">
|
|
|
|
|
SELECT
|
|
|
|
|
f.NAME,f.LISTMANAGER_ID,f.CORPINFO_ID
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager f
|
|
|
|
|
LEFT JOIN bus_offduty o ON o.USER_ID = f.USER_ID
|
|
|
|
|
AND concat( o.STARTTIME, ' 00:00:00' ) <= #{STARTTIME} AND concat( o.ENDTIME, ' 23:59:59' ) >= #{ENDTIME}
|
|
|
|
|
left join bus_listdisabletime ld on ld.LISTMANAGER_ID = f.LISTMANAGER_ID and ld.ENDTIME is not null
|
|
|
|
|
and ld.STARTTIME <= #{STARTTIME} and ld.ENDTIME >= #{ENDTIME}
|
|
|
|
|
WHERE
|
|
|
|
|
f.LISTMANAGER_ID NOT IN (
|
|
|
|
|
SELECT
|
|
|
|
|
l.LISTMANAGER_ID
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager l
|
|
|
|
|
LEFT JOIN bus_checkrecord c ON c.LISTMANAGER_ID = l.LISTMANAGER_ID
|
|
|
|
|
WHERE
|
|
|
|
|
l.isdelete = '0'
|
|
|
|
|
AND l.PERIOD = #{PERIOD}
|
|
|
|
|
AND l.TYPE != 'listType0005'
|
|
|
|
|
AND (
|
|
|
|
|
|
|
|
|
|
c.CHECK_TIME BETWEEN #{STARTTIME} AND #{ENDTIME}
|
|
|
|
|
or
|
|
|
|
|
(
|
|
|
|
|
c.periodstart =#{STARTTIME} and c.periodend = #{ENDTIME}
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
AND f.isdelete = '0'
|
|
|
|
|
AND f.TYPE != 'listType0005'
|
|
|
|
|
AND f.PERIOD = #{PERIOD}
|
|
|
|
|
AND o.OFFDUTY_ID IS NULL
|
|
|
|
|
AND ld.LISTDISABLETIME_ID IS NULL
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 节假日超期未检查的清单 -->
|
|
|
|
|
<select id="overTimeRecordJjr" parameterType="pd" resultType="pd">
|
|
|
|
|
SELECT
|
|
|
|
|
f.NAME,
|
|
|
|
|
f.LISTMANAGER_ID,
|
|
|
|
|
f.CORPINFO_ID,
|
|
|
|
|
IFNULL( h.num, 0 ) COUNT,
|
|
|
|
|
f.START_DATE,
|
|
|
|
|
f.END_DATE
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager f
|
|
|
|
|
LEFT JOIN bus_offduty o ON o.USER_ID = f.USER_ID
|
|
|
|
|
AND concat( o.STARTTIME, ' 00:00:00' ) <= concat( f.START_DATE, ' 00:00:00' ) AND concat( o.ENDTIME, ' 23:59:59' ) >= concat( f.End_DATE, ' 23:59:59' )
|
|
|
|
|
LEFT JOIN bus_listdisabletime ld ON ld.LISTMANAGER_ID = f.LISTMANAGER_ID
|
|
|
|
|
AND ld.ENDTIME IS NOT NULL
|
|
|
|
|
AND ld.STARTTIME <= concat( f.START_DATE, ' 00:00:00' ) AND ld.ENDTIME >= concat( f.End_DATE, ' 23:59:59' )
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
SELECT
|
|
|
|
|
l.LISTMANAGER_ID,
|
|
|
|
|
count( 1 ) NUM
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager l
|
|
|
|
|
LEFT JOIN bus_checkrecord c ON c.LISTMANAGER_ID = l.LISTMANAGER_ID
|
|
|
|
|
WHERE
|
|
|
|
|
l.isdelete = '0'
|
|
|
|
|
AND l.TYPE = 'listType0005'
|
|
|
|
|
AND (
|
|
|
|
|
c.CHECK_TIME BETWEEN concat( l.START_DATE, ' 00:00:00' )
|
|
|
|
|
AND concat( l.END_DATE, ' 23:59:59' )
|
|
|
|
|
OR (
|
|
|
|
|
c.periodstart = concat( l.START_DATE, ' 00:00:00' )
|
|
|
|
|
AND c.periodend = concat( l.END_DATE, ' 23:59:59' ))
|
|
|
|
|
)
|
|
|
|
|
GROUP BY
|
|
|
|
|
l.LISTMANAGER_ID
|
|
|
|
|
) h ON h.LISTMANAGER_ID = f.LISTMANAGER_ID
|
|
|
|
|
WHERE
|
|
|
|
|
f.isdelete = '0'
|
|
|
|
|
AND f.TYPE = 'listType0005'
|
|
|
|
|
AND ( h.NUM < 2 OR h.NUM IS NULL )
|
|
|
|
|
AND o.OFFDUTY_ID IS NULL
|
|
|
|
|
AND f.START_DATE IS NOT NULL
|
|
|
|
|
AND f.END_DATE IS NOT NULL
|
|
|
|
|
AND ld.LISTDISABLETIME_ID IS NULL
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 首页隐患排查数据 清单数(总数、已排查清单数) -->
|
|
|
|
|
<select id="statisticsByCorp" parameterType="pd" resultType="pd" >
|
|
|
|
|
SELECT IFNULL(count(*), 0) COUNT
|
|
|
|
|
FROM BUS_LISTMANAGER f
|
|
|
|
|
WHERE f.ISDELETE != '2' AND f.CORPINFO_ID = #{CORPINFO_ID}
|
|
|
|
|
UNION ALL
|
|
|
|
|
SELECT IFNULL(COUNT(DISTINCT f.LISTMANAGER_ID), 0) COUNT
|
|
|
|
|
FROM BUS_LISTMANAGER f
|
|
|
|
|
LEFT JOIN BUS_CHECKRECORD u ON u.LISTMANAGER_ID = f.LISTMANAGER_ID
|
|
|
|
|
WHERE f.ISDELETE != '2' AND u.CORPINFO_ID = #{CORPINFO_ID}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 清单类型占比统计 -->
|
|
|
|
|
<select id="statisticsGroupType" parameterType="pd" resultType="pd" >
|
|
|
|
|
SELECT f.NAME, COUNT(l.LISTMANAGER_ID) COUNT
|
|
|
|
|
FROM sys_dictionaries f
|
|
|
|
|
LEFT JOIN bus_listmanager l ON l.`TYPE` = f.BIANMA AND l.ISDELETE != '2'
|
|
|
|
|
WHERE PARENT_ID = '4a3d0d99b0ea4e268c11dd0b18866917' AND l.CORPINFO_ID = #{CORPINFO_ID}
|
|
|
|
|
GROUP BY f.DICTIONARIES_ID
|
|
|
|
|
ORDER BY f.ORDER_BY
|
|
|
|
|
</select>
|
|
|
|
|
<!-- 上期超期未检查的清单(每日使用) -->
|
|
|
|
|
<select id="overTimeRecordDay" parameterType="pd" resultType="pd">
|
|
|
|
|
SELECT
|
|
|
|
|
f.NAME,f.LISTMANAGER_ID,f.CORPINFO_ID
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager f
|
|
|
|
|
LEFT JOIN bus_offduty o ON o.USER_ID = f.USER_ID
|
|
|
|
|
AND concat( o.STARTTIME, ' 00:00:00' ) <= #{STARTTIME} AND concat( o.ENDTIME, ' 23:59:59' ) >= #{ENDTIME}
|
|
|
|
|
left join bus_listdisabletime ld on ld.LISTMANAGER_ID = f.LISTMANAGER_ID and ld.ENDTIME is not null
|
|
|
|
|
and ld.STARTTIME <= #{STARTTIME} and ld.ENDTIME >= #{ENDTIME}
|
|
|
|
|
LEFT JOIN SYS_USER u on u.USER_ID = f.USER_ID
|
|
|
|
|
LEFT JOIN BUS_SHIFTWORKRULES swr ON u.SHIFTDUTYTWO = swr.SHIFTWORKRULES_ID
|
|
|
|
|
WHERE
|
|
|
|
|
f.LISTMANAGER_ID NOT IN (
|
|
|
|
|
SELECT
|
|
|
|
|
l.LISTMANAGER_ID
|
|
|
|
|
FROM
|
|
|
|
|
bus_listmanager l
|
|
|
|
|
LEFT JOIN bus_checkrecord c ON c.LISTMANAGER_ID = l.LISTMANAGER_ID
|
|
|
|
|
WHERE
|
|
|
|
|
l.isdelete = '0'
|
|
|
|
|
AND l.PERIOD = #{PERIOD}
|
|
|
|
|
AND l.TYPE != 'listType0005'
|
|
|
|
|
AND (
|
|
|
|
|
|
|
|
|
|
c.CHECK_TIME BETWEEN #{STARTTIME} AND #{ENDTIME}
|
|
|
|
|
or
|
|
|
|
|
(
|
|
|
|
|
c.periodstart =#{STARTTIME} and c.periodend = #{ENDTIME}
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
AND f.isdelete = '0'
|
|
|
|
|
AND f.TYPE != 'listType0005'
|
|
|
|
|
AND f.PERIOD = #{PERIOD}
|
|
|
|
|
AND o.OFFDUTY_ID IS NULL
|
|
|
|
|
AND ld.LISTDISABLETIME_ID IS NULL
|
|
|
|
|
AND (
|
|
|
|
|
(
|
|
|
|
|
swr.ISDELETE = '0'
|
|
|
|
|
AND (
|
|
|
|
|
swr.ISCUSTOM = '0'
|
|
|
|
|
OR ( u.WORKSTATUS = '1' AND u.DURATION > 1 )
|
|
|
|
|
OR ( u.WORKSTATUS = '2' AND u.DURATION = '1' )
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
OR u.SHIFTDUTYONE IS NULL
|
|
|
|
|
OR u.SHIFTDUTYONE = ''
|
|
|
|
|
)
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|