forked from integrated_whb/integrated_whb
1169 lines
35 KiB
XML
1169 lines
35 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="com.zcloud.mapper.datasource.hiddenDangerCheckStandard.CustomMapper">
|
|
|
|
<!--表名 -->
|
|
<sql id="tableName">
|
|
BUS_HIDDENDANGERCHECKSTANDARD_CUSTOM
|
|
</sql>
|
|
|
|
<!--数据字典表名 -->
|
|
<sql id="dicTableName">
|
|
SYS_DICTIONARIES
|
|
</sql>
|
|
|
|
<!-- 字段 -->
|
|
<sql id="Field">
|
|
f.CUSTOM_ID,
|
|
f.NAME,
|
|
f.PERIOD,
|
|
f.TYPE,
|
|
f.CORPINFO_ID,
|
|
f.CREATOR,
|
|
f.CREATTIME,
|
|
f.OPERATOR,
|
|
f.OPERATTIME,
|
|
f.ISDELETE,
|
|
f.DEPARTMENT_ID,
|
|
f.POST_ID,
|
|
f.USER_ID,
|
|
f.START_DATE,
|
|
f.END_DATE,
|
|
f.SCREENTYPE,
|
|
f.BAO_BAO_DEPARTMENT_ID,
|
|
f.BAO_BAO_USER_ID,
|
|
f.BAO_BAO_TYPE,
|
|
f.TASK_TYPE
|
|
</sql>
|
|
|
|
<!-- 字段用于新增 -->
|
|
<sql id="Field2">
|
|
CUSTOM_ID,
|
|
NAME,
|
|
PERIOD,
|
|
TYPE,
|
|
CORPINFO_ID,
|
|
CREATOR,
|
|
CREATTIME,
|
|
OPERATOR,
|
|
OPERATTIME,
|
|
ISDELETE,
|
|
DEPARTMENT_ID,
|
|
POST_ID,
|
|
USER_ID,
|
|
START_DATE,
|
|
END_DATE,
|
|
SCREENTYPE,
|
|
BAO_BAO_DEPARTMENT_ID,
|
|
BAO_BAO_USER_ID,
|
|
BAO_BAO_TYPE,
|
|
TASK_TYPE
|
|
</sql>
|
|
|
|
<!-- 字段值 -->
|
|
<sql id="FieldValue">
|
|
#{CUSTOM_ID},
|
|
#{NAME},
|
|
#{PERIOD},
|
|
#{TYPE},
|
|
#{CORPINFO_ID},
|
|
#{CREATOR},
|
|
#{CREATTIME},
|
|
#{OPERATOR},
|
|
#{OPERATTIME},
|
|
#{ISDELETE},
|
|
#{DEPARTMENT_ID},
|
|
#{POST_ID},
|
|
#{USER_ID},
|
|
#{START_DATE},
|
|
#{END_DATE},
|
|
#{SCREENTYPE},
|
|
#{BAO_BAO_DEPARTMENT_ID},
|
|
#{BAO_BAO_USER_ID},
|
|
#{BAO_BAO_TYPE},
|
|
#{TASK_TYPE}
|
|
</sql>
|
|
|
|
<!-- 新增 -->
|
|
<insert id="save" parameterType="pd">
|
|
insert into
|
|
<include refid="tableName"></include>
|
|
(
|
|
<include refid="Field2"></include>
|
|
) values (
|
|
<include refid="FieldValue"></include>
|
|
)
|
|
</insert>
|
|
|
|
<!-- 列表(全部) -->
|
|
<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,
|
|
u.NAME USER_NAME,
|
|
bb.NAME as TASK_TYPE_NAME,
|
|
s.NAME as SCREENTYPENAME,
|
|
(select count(1) from bus_hiddendangercheckstandard_custom_item ch where
|
|
ch.CUSTOM_ID = f.CUSTOM_ID and ch.ISDELETE = '0') as count ,
|
|
(SELECT count(1) FROM bus_hiddendangercheckstandard_checkrecord ch WHERE ch.CUSTOM_ID =
|
|
f.CUSTOM_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 sys_dictionaries bb on f.TASK_TYPE = bb.DICTIONARIES_ID
|
|
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}
|
|
and f.ISDELETE != '2'
|
|
and f.ISDELETE !='-1'
|
|
<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.PERIOD != null and pd.PERIOD != ''"><!-- 关键词检索 -->
|
|
and f.PERIOD = #{pd.PERIOD}
|
|
</if>
|
|
<if test="pd.USERNAME != null and pd.USERNAME != ''"><!-- 关键词检索 -->
|
|
and u.NAME LIKE CONCAT(CONCAT('%', #{pd.USERNAME}),'%')
|
|
</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.SCREENTYPE != null and pd.SCREENTYPE != ''"><!-- 关键词检索 -->
|
|
and f.SCREENTYPE = #{pd.SCREENTYPE}
|
|
</if>
|
|
order by f.ISDELETE,f.OPERATTIME desc
|
|
</select>
|
|
|
|
<!-- 列表 -->
|
|
<select id="stopdatalistPage" parameterType="page" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
,
|
|
p.NAME PERIODNAME,
|
|
t.NAME TYPENAME,
|
|
d.NAME as DEPARTMENT_NAME,
|
|
getFullName(d.DEPARTMENT_ID) as DEPARTMENT_NAME_ALL,
|
|
sp.NAME
|
|
AS POST_NAME,
|
|
u.NAME USER_NAME,
|
|
bb.NAME as TASK_TYPE_NAME,
|
|
s.NAME AS SCREENTYPENAME,
|
|
(select count(1) from bus_hiddendangercheckstandard_custom_item ch where
|
|
ch.CUSTOM_ID=f.CUSTOM_ID and ch.ISDELETE = '0') as count ,
|
|
(SELECT count(1) FROM bus_hiddendangercheckstandard_checkrecord ch WHERE ch.CUSTOM_ID =
|
|
f.CUSTOM_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 sys_dictionaries bb on f.TASK_TYPE = bb.DICTIONARIES_ID
|
|
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}
|
|
and f.ISDELETE = '2'
|
|
|
|
<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>
|
|
<choose>
|
|
<when test='pd.ISMAIN != null and pd.ISMAIN != "" and pd.ISMAIN == "1"'>
|
|
<if test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</if>
|
|
</when>
|
|
<otherwise>
|
|
<choose>
|
|
<when test='pd.ISSUPERVISE != null and pd.ISSUPERVISE != "" and pd.ISSUPERVISE == "1"'>
|
|
<choose>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<otherwise>
|
|
and
|
|
(f.DEPARTMENT_ID in (
|
|
select
|
|
SUB_DEPARTMENT_ID
|
|
from
|
|
oa_supervision_department osd
|
|
where
|
|
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
and osd.ISDELETE = '0'
|
|
and osd.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
)or f.USER_ID = #{pd.USER_ID})
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'>
|
|
<choose>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<otherwise>
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
<when test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
|
|
and f.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
|
</when>
|
|
<otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</otherwise>
|
|
</choose>
|
|
<if test="pd.USERNAME != null and pd.USERNAME != ''"><!-- 关键词检索 -->
|
|
and u.NAME LIKE CONCAT(CONCAT('%', #{pd.USERNAME}),'%')
|
|
</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,f.DEPARTMENT_ID desc
|
|
</select>
|
|
|
|
<!-- 列表(全部) -->
|
|
<select id="datalistPage" 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,
|
|
u.NAME USER_NAME,
|
|
bb.NAME as TASK_TYPE_NAME,
|
|
s.NAME as SCREENTYPENAME,
|
|
(select count(1) from bus_hiddendangercheckstandard_custom_item ch where
|
|
ch.CUSTOM_ID = f.CUSTOM_ID and ch.ISDELETE = '0') as count ,
|
|
(SELECT count(1) FROM bus_hiddendangercheckstandard_checkrecord ch WHERE ch.CUSTOM_ID =
|
|
f.CUSTOM_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 sys_dictionaries bb on f.TASK_TYPE = bb.DICTIONARIES_ID
|
|
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}
|
|
and f.ISDELETE != '2'
|
|
and f.ISDELETE !='-1'
|
|
<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.PERIOD != null and pd.PERIOD != ''"><!-- 关键词检索 -->
|
|
and f.PERIOD = #{pd.PERIOD}
|
|
</if>
|
|
<if test="pd.USERNAME != null and pd.USERNAME != ''"><!-- 关键词检索 -->
|
|
and u.NAME LIKE CONCAT(CONCAT('%', #{pd.USERNAME}),'%')
|
|
</if>
|
|
<if test="pd.TYPE != null and pd.TYPE != ''"><!-- 关键词检索 -->
|
|
and f.TYPE = #{pd.TYPE}
|
|
</if>
|
|
<choose>
|
|
<when test='pd.ISMAIN != null and pd.ISMAIN != "" and pd.ISMAIN == "1"'>
|
|
<if test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</if>
|
|
</when>
|
|
<otherwise>
|
|
<choose>
|
|
<when test='pd.ISSUPERVISE != null and pd.ISSUPERVISE != "" and pd.ISSUPERVISE == "1"'>
|
|
<choose>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<otherwise>
|
|
and
|
|
(f.DEPARTMENT_ID in (
|
|
select
|
|
SUB_DEPARTMENT_ID
|
|
from
|
|
oa_supervision_department osd
|
|
where
|
|
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
and osd.ISDELETE = '0'
|
|
and osd.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
)or f.USER_ID = #{pd.USER_ID})
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'>
|
|
<choose>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<otherwise>
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
<when test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
|
|
and f.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
|
</when>
|
|
<otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</otherwise>
|
|
</choose>
|
|
<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>
|
|
|
|
<!-- 禁用 -->
|
|
<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
|
|
CUSTOM_ID = #{CUSTOM_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
|
|
CUSTOM_ID = #{CUSTOM_ID}
|
|
</delete>
|
|
|
|
<!-- 删除 -->
|
|
<delete id="deleted" 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
|
|
CUSTOM_ID = #{CUSTOM_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
|
|
CUSTOM_ID = #{CUSTOM_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,
|
|
tt.NAME as TASK_TYPE_NAME,
|
|
sp.NAME
|
|
AS POST_NAME,
|
|
s.NAME AS SCREENTYPENAME,
|
|
u.NAME AS USER_NAME,
|
|
bb.NAME as BAO_BAO_USER_NAME,
|
|
bbd.NAME as BAO_BAO_DEPARTMENT_NAME
|
|
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 sys_dictionaries tt on f.TASK_TYPE = tt.DICTIONARIES_ID
|
|
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 bb on bb.USER_ID = f.BAO_BAO_USER_ID
|
|
left join OA_DEPARTMENT bbd on bbd.DEPARTMENT_ID=f.DEPARTMENT_ID
|
|
where
|
|
f.CUSTOM_ID = #{CUSTOM_ID}
|
|
</select>
|
|
|
|
|
|
<!-- 部门清单列表 -->
|
|
<select id="recordlistPage" parameterType="page" resultType="pd">
|
|
select * from
|
|
(
|
|
select
|
|
<include refid="Field"></include>
|
|
,
|
|
u.WORKSTATUS,
|
|
a.STARTTIME,
|
|
a.ENDTIME ,
|
|
p.NAME PERIODNAME,
|
|
t.NAME TYPENAME,
|
|
m.NAME SCREENTYPENAME,
|
|
d.NAME as DEPARTMENT_NAME,
|
|
getFullName(d.DEPARTMENT_ID) as DEPARTMENT_NAME_ALL,
|
|
sp.NAME
|
|
AS POST_NAME,
|
|
u.NAME as USER_NAME,
|
|
(
|
|
select count(1) from BUS_HIDDENDANGERCHECKSTANDARD_CHECKRECORD ch
|
|
where ch.CUSTOM_ID=f.CUSTOM_ID AND ch.type = '1'
|
|
and ch.FINISHED='1' and ch.ISDELETE =0
|
|
) as count ,
|
|
(
|
|
select
|
|
count(1)
|
|
from BUS_HIDDENDANGERCHECKSTANDARD_CHECKRECORD ch
|
|
left join bus_hiddendangercheckstandard_hidden h on h.CHECKRECORD_ID = ch.CHECKRECORD_ID
|
|
where ch.CUSTOM_ID=f.CUSTOM_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
|
|
(select sd.DAY_START from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
WHEN f.PERIOD = 'checkPeriod0002' THEN
|
|
(select sd.WEEK_START from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
WHEN f.PERIOD = 'checkPeriod0003' THEN
|
|
(select sd.XUN_START from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
WHEN f.PERIOD = 'checkPeriod0004' THEN
|
|
(select sd.MONTH_START from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
WHEN f.PERIOD = 'checkPeriod0005' THEN
|
|
(select sd.QUARTER_START from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
WHEN f.PERIOD = 'checkPeriod0006' THEN
|
|
(select sd.YEAR_START from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
WHEN f.PERIOD = 'checkPeriod0007' THEN
|
|
(select sd.HALFYEAR_START from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
END
|
|
) DATESTART,
|
|
bb.NAME AS TASK_TYPE_NAME,
|
|
(
|
|
CASE
|
|
WHEN f.TYPE = 'listType0005' THEN
|
|
CONCAT( f.END_DATE, " 23:59:59" )
|
|
WHEN f.PERIOD = 'checkPeriod0001' THEN
|
|
(select sd.DAY_END from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
WHEN f.PERIOD = 'checkPeriod0002' THEN
|
|
(select sd.WEEK_END from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
WHEN f.PERIOD = 'checkPeriod0003' THEN
|
|
(select sd.XUN_END from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
WHEN f.PERIOD = 'checkPeriod0004' THEN
|
|
(select sd.MONTH_END from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
WHEN f.PERIOD = 'checkPeriod0005' THEN
|
|
(select sd.QUARTER_END from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
WHEN f.PERIOD = 'checkPeriod0006' THEN
|
|
(select sd.YEAR_END from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
WHEN f.PERIOD = 'checkPeriod0007' THEN
|
|
(select sd.HALFYEAR_END from v_sysdate sd where DATE_FORMAT( sd.`date`,'%Y-%m-%d' ) = DATE_FORMAT(now(),'%Y-%m-%d') )
|
|
END
|
|
) DATEEND,
|
|
getCheckedNum(f.CUSTOM_ID) checkCount,
|
|
(select count(1) from bus_checkrecord cc where cc.CUSTOM_ID = f.CUSTOM_ID and cc.FINISHED ='1' and type ='2') overTimeCount
|
|
from
|
|
<include refid="tableName"></include> f
|
|
LEFT JOIN BUS_OFFDUTY a on f.USER_ID = a.USER_ID and a.isdelete = '0' and a.STARTTIME <= date_format(now(),'%Y-%m-%d') and a.ENDTIME >= date_format(now(),'%Y-%m-%d')
|
|
left join sys_dictionaries p on f.PERIOD = p.BIANMA
|
|
left join sys_dictionaries t on f.TYPE = t.BIANMA
|
|
left join sys_dictionaries m on f.SCREENTYPE = m.BIANMA
|
|
left join OA_DEPARTMENT d on d.DEPARTMENT_ID = f.DEPARTMENT_ID
|
|
LEFT JOIN sys_dictionaries bb ON f.TASK_TYPE = bb.DICTIONARIES_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} and f.ISDELETE != '-99'
|
|
<if test="pd.RISKCHECKLISTTYPE != null and pd.RISKCHECKLISTTYPE != ''"><!-- 状态 -->
|
|
and f.SCREENTYPE = #{pd.RISKCHECKLISTTYPE}
|
|
</if>
|
|
<if test="pd.statusIds != null and pd.statusIds != ''">
|
|
and
|
|
(
|
|
f.CUSTOM_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>
|
|
<choose>
|
|
<when test='pd.ISMAIN != null and pd.ISMAIN != "" and pd.ISMAIN == "1"'>
|
|
<if test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</if>
|
|
</when>
|
|
<otherwise>
|
|
<choose>
|
|
<when test='pd.ISSUPERVISE != null and pd.ISSUPERVISE != "" and pd.ISSUPERVISE == "1"'>
|
|
<choose>
|
|
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'>
|
|
<choose>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<when test="pd.DEPT_ID != null and pd.DEPT_ID != ''"><!-- 关键词检索 -->
|
|
and f.DEPARTMENT_ID = #{pd.DEPT_ID}
|
|
</when>
|
|
<otherwise>
|
|
and
|
|
((f.DEPARTMENT_ID in (
|
|
select
|
|
SUB_DEPARTMENT_ID
|
|
from
|
|
oa_supervision_department osd
|
|
where
|
|
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
and osd.ISDELETE = '0'
|
|
and osd.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
)) or (
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
))
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<when test="pd.DEPT_ID != null and pd.DEPT_ID != ''">
|
|
and
|
|
f.DEPARTMENT_ID = #{pd.DEPT_ID}
|
|
</when>
|
|
<otherwise>
|
|
|
|
and
|
|
(f.DEPARTMENT_ID in (
|
|
select
|
|
SUB_DEPARTMENT_ID
|
|
from
|
|
oa_supervision_department osd
|
|
where
|
|
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
and osd.ISDELETE = '0'
|
|
and osd.CORPINFO_ID = #{pd.CORPINFO_ID})
|
|
or f.USER_ID = #{pd.USER_ID})
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
|
|
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'>
|
|
<choose>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<when test="pd.DEPT_ID != null and pd.DEPT_ID != ''">
|
|
and
|
|
f.DEPARTMENT_ID = #{pd.DEPT_ID}
|
|
</when>
|
|
<otherwise>
|
|
and
|
|
f.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
<when test="pd.DEPT_ID != null and pd.DEPT_ID != ''">
|
|
and
|
|
f.DEPARTMENT_ID = #{pd.DEPT_ID}
|
|
</when>
|
|
<when test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
|
|
and f.USER_ID = #{pd.USER_ID}
|
|
and f.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
|
</when>
|
|
<otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</otherwise>
|
|
</choose>
|
|
<if test="pd.USERNAME != null and pd.USERNAME != ''"><!-- 关键词检索 -->
|
|
and u.NAME LIKE CONCAT(CONCAT('%', #{pd.USERNAME}),'%')
|
|
</if>
|
|
|
|
<if test="pd.ISDELETE != null and pd.ISDELETE != ''"><!-- 状态 -->
|
|
and f.ISDELETE = #{pd.ISDELETE}
|
|
</if>
|
|
|
|
<if test="pd.STATUS != null and pd.STATUS != ''"><!-- 关键词检索 -->
|
|
<choose>
|
|
<when test='pd.STATUS=="1"'>
|
|
AND getCheckedNum(f.CUSTOM_ID) > 0
|
|
</when>
|
|
<when test='pd.STATUS=="0"'>
|
|
AND getCheckedNum(f.CUSTOM_ID) = 0
|
|
</when>
|
|
<otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</if>
|
|
<if test="pd.OVERTIME != null and pd.OVERTIME != ''"><!-- 关键词检索 -->
|
|
<choose>
|
|
<when test='pd.OVERTIME=="1"'>
|
|
AND (select count(1) from bus_checkrecord cc where cc.CUSTOM_ID = f.CUSTOM_ID and cc.FINISHED ='1' and type ='2') > 0
|
|
</when>
|
|
<when test='pd.OVERTIME=="0"'>
|
|
AND (select count(1) from bus_checkrecord cc where cc.CUSTOM_ID = f.CUSTOM_ID and cc.FINISHED ='1' and type ='2') = 0
|
|
</when>
|
|
<otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</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.WORKSTATUS == "0"'>
|
|
and (
|
|
(a.STARTTIME is null or a.ENDTIME is null)
|
|
or (to_days(a.STARTTIME) < to_days(NOW()) and to_days(a.ENDTIME) > to_days(NOW()))
|
|
AND u.WORKSTATUS != '2'
|
|
)
|
|
</if>
|
|
<if test='pd.WORKSTATUS == "1"'>
|
|
and !(
|
|
(a.STARTTIME is null or a.ENDTIME is null)
|
|
or (to_days(a.STARTTIME) < to_days(NOW()) and to_days(a.ENDTIME) > to_days(NOW()))
|
|
or u.WORKSTATUS = '2'
|
|
)
|
|
</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.CUSTOM_ID in
|
|
(
|
|
SELECT CUSTOM_ID
|
|
FROM BUS_HIDDENDANGERCHECKSTANDARD_CHECKRECORD
|
|
WHERE FINISHED = '1'
|
|
AND ISDELETE = 0
|
|
and DATE_FORMAT(CHECK_TIME,'%Y-%m-%d %H:%i:%s') >= #{pd.STARTTIME}
|
|
and DATE_FORMAT(CHECK_TIME,'%Y-%m-%d %H:%i:%s') <= #{pd.ENDTIME}
|
|
)
|
|
</when>
|
|
<when test="pd.STARTTIME != null and pd.STARTTIME != ''">
|
|
and f.CUSTOM_ID in
|
|
(
|
|
SELECT CUSTOM_ID
|
|
FROM BUS_HIDDENDANGERCHECKSTANDARD_CHECKRECORD
|
|
WHERE FINISHED = '1'
|
|
AND ISDELETE = 0
|
|
and DATE_FORMAT(CHECK_TIME,'%Y-%m-%d %H:%i:%s') >= #{pd.STARTTIME}
|
|
)
|
|
</when>
|
|
<when test="pd.ENDTIME != null and pd.ENDTIME != ''">
|
|
and f.CUSTOM_ID in
|
|
(
|
|
SELECT CUSTOM_ID
|
|
FROM BUS_HIDDENDANGERCHECKSTANDARD_CHECKRECORD
|
|
WHERE FINISHED = '1'
|
|
AND ISDELETE = 0
|
|
and DATE_FORMAT(CHECK_TIME,'%Y-%m-%d %H:%i:%s') <= #{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>
|
|
group by f.CUSTOM_ID
|
|
order by field(f.ISDELETE,'0','1','2','-1') ,f.OPERATTIME desc
|
|
</select>
|
|
|
|
<!-- 列表(全部) -->
|
|
<select id="getMyCheckList" parameterType="pd" resultType="pd">
|
|
select
|
|
f.CUSTOM_ID,
|
|
f.CORPINFO_ID,
|
|
f.NAME,
|
|
t.NAME TYPENAME,
|
|
p.NAME PERIODNAME,
|
|
f.USER_ID,
|
|
u.NAME USER_NAME,
|
|
f.START_DATE,
|
|
f.END_DATE,
|
|
f.BAO_BAO_TYPE,
|
|
COUNT(bhci.CUSTOM_ITEM_ID) count,
|
|
getStandardCheckedNum(f.CUSTOM_ID) checkCount
|
|
from
|
|
<include refid="tableName"></include> f
|
|
left join sys_dictionaries t on f.TYPE = t.BIANMA
|
|
left join sys_dictionaries p on f.PERIOD = p.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 bus_hiddendangercheckstandard_custom_item bhci on bhci.CUSTOM_ID = f.CUSTOM_ID and bhci.ISDELETE = '0'
|
|
where f.ISDELETE = 0
|
|
and f.CORPINFO_ID = #{CORPINFO_ID}
|
|
<if test="KEYWORDS != null and KEYWORDS != ''"><!-- 关键词检索 -->
|
|
and bhci.CHECK_CONTENT LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
|
|
</if>
|
|
GROUP BY f.CUSTOM_ID
|
|
ORDER BY f.OPERATTIME DESC
|
|
</select>
|
|
|
|
<!-- 清单检查分页 -->
|
|
<select id="checklistPage" parameterType="page" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
,
|
|
p.NAME PERIODNAME,
|
|
t.NAME TYPENAME,
|
|
d.NAME as DEPARTMENT_NAME,
|
|
getFullName(d.DEPARTMENT_ID) as DEPARTMENT_NAME_ALL,
|
|
sp.NAME
|
|
AS POST_NAME,
|
|
u.NAME USER_NAME,
|
|
(select count(1) from bus_hiddendangercheckstandard_custom_item
|
|
ch where ch.CUSTOM_ID = f.CUSTOM_ID and ch.ISDELETE =0) as count,
|
|
getStandardCheckedNum(f.CUSTOM_ID) 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
|
|
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="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''">
|
|
and
|
|
f.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
</if>
|
|
<if test="pd.USERNAME != null and pd.USERNAME != ''">
|
|
and u.NAME LIKE CONCAT(CONCAT('%', #{pd.USERNAME}),'%')
|
|
</if>
|
|
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''">
|
|
and f.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
|
</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 getStandardCheckedNum(f.CUSTOM_ID) > 0
|
|
</when>
|
|
<when test='pd.STATUS=="0"'>
|
|
AND getStandardCheckedNum(f.CUSTOM_ID) = 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.OPERATTIME desc
|
|
</select>
|
|
|
|
<!-- 查询公司清单总数 -->
|
|
<select id="getListCount" parameterType="pd" resultType="int" >
|
|
SELECT
|
|
count( 1 )
|
|
FROM
|
|
bus_hiddendangercheckstandard_custom
|
|
WHERE
|
|
CORPINFO_ID = #{CORPINFO_ID}
|
|
and ISDELETE = '0'
|
|
</select>
|
|
|
|
<!-- 查询公司检查过清单的总数 -->
|
|
<select id="getWorkedListCount" parameterType="pd" resultType="int" >
|
|
SELECT
|
|
count( 1 )
|
|
FROM
|
|
(
|
|
SELECT
|
|
count( s.CUSTOM_ID )
|
|
FROM
|
|
bus_hiddendangercheckstandard_custom s
|
|
LEFT JOIN bus_hiddendangercheckstandard_checkrecord f ON f.CUSTOM_ID = s.CUSTOM_ID
|
|
WHERE
|
|
s.CORPINFO_ID = #{CORPINFO_ID}
|
|
AND f.FINISHED = '1'
|
|
AND f.isdelete = '0'
|
|
AND s.isdelete = '0'
|
|
AND f.TYPE = '1'
|
|
AND f.CHECKRECORD_ID IS NOT NULL
|
|
GROUP BY
|
|
s.CUSTOM_ID
|
|
) q
|
|
|
|
</select>
|
|
|
|
<!--查询人员清单 -->
|
|
<select id="getListByCorplistPage" parameterType="page" resultType="pd">
|
|
SELECT
|
|
f.CUSTOM_ID,
|
|
f.NAME,
|
|
f.CREATTIME,
|
|
p.NAME AS PERIOD_NAME,
|
|
t.NAME AS TYPE_NAME,
|
|
u.NAME USER_NAME,
|
|
getFullName(d.DEPARTMENT_ID) DEPARTMENT_NAME,
|
|
po.NAME POST_NAME
|
|
FROM
|
|
bus_listmanager f
|
|
left join sys_dictionaries p on p.BIANMA = f.PERIOD
|
|
left join sys_dictionaries t on t.BIANMA = f.TYPE
|
|
left join sys_user u on u.USER_ID = f.USER_ID
|
|
left join oa_department d on u.DEPARTMENT_ID = d.DEPARTMENT_ID
|
|
left join sys_post po on u.POST_ID = po.POST_ID
|
|
WHERE
|
|
f.ISDELETE = '0'
|
|
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
<if test="pd.USERNAME != null and pd.USERNAME != ''">
|
|
and u.NAME LIKE CONCAT(CONCAT('%', #{pd.USERNAME}),'%')
|
|
</if>
|
|
<choose>
|
|
<when test='pd.ISMAIN != null and pd.ISMAIN != "" and pd.ISMAIN == "1"'>
|
|
<if test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
d.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</if>
|
|
</when>
|
|
<otherwise>
|
|
<choose>
|
|
<when test='pd.ISSUPERVISE != null and pd.ISSUPERVISE != "" and pd.ISSUPERVISE == "1"'>
|
|
<choose>
|
|
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'>
|
|
<choose>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
d.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<otherwise>
|
|
and
|
|
((d.DEPARTMENT_ID in (
|
|
select
|
|
SUB_DEPARTMENT_ID
|
|
from
|
|
oa_supervision_department osd
|
|
where
|
|
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
and osd.ISDELETE = '0'
|
|
and osd.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
)) or (
|
|
d.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
))
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
or f.USER_ID = #{pd.USER_ID}
|
|
and
|
|
d.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<otherwise>
|
|
|
|
and
|
|
d.DEPARTMENT_ID in (
|
|
select
|
|
SUB_DEPARTMENT_ID
|
|
from
|
|
oa_supervision_department osd
|
|
where
|
|
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
and osd.ISDELETE = '0'
|
|
and osd.CORPINFO_ID = #{pd.CORPINFO_ID})
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'>
|
|
<choose>
|
|
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
|
and
|
|
d.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</when>
|
|
<otherwise>
|
|
and
|
|
d.DEPARTMENT_ID in
|
|
<foreach item="item" index="index"
|
|
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
|
|
'${item}'
|
|
</foreach>
|
|
</otherwise>
|
|
</choose>
|
|
</when>
|
|
<when test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
|
|
and d.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
|
and f.USER_ID = #{pd.USER_ID}
|
|
</when>
|
|
<otherwise>
|
|
</otherwise>
|
|
</choose>
|
|
</otherwise>
|
|
</choose>
|
|
|
|
ORDER BY d.DEP_ORDER,po.POST_ID,f.USER_ID,f.PERIOD
|
|
</select>
|
|
|
|
<!-- 修改 -->
|
|
<update id="edit" parameterType="pd">
|
|
update
|
|
<include refid="tableName"></include>
|
|
set
|
|
NAME = #{NAME},
|
|
PERIOD = #{PERIOD},
|
|
TYPE = #{TYPE},
|
|
<if test="BAO_BAO_DEPARTMENT_ID != null or BAO_BAO_DEPARTMENT_ID != ''">
|
|
BAO_BAO_DEPARTMENT_ID = #{BAO_BAO_DEPARTMENT_ID},
|
|
</if>
|
|
<if test="ISDELETE != null or ISDELETE != ''">
|
|
ISDELETE = #{ISDELETE},
|
|
</if>
|
|
<if test="BAO_BAO_USER_ID != null or BAO_BAO_USER_ID != ''">
|
|
BAO_BAO_USER_ID = #{BAO_BAO_USER_ID},
|
|
</if>
|
|
<if test="BAO_BAO_TYPE != null or BAO_BAO_TYPE != ''">
|
|
BAO_BAO_TYPE = #{BAO_BAO_TYPE},
|
|
</if>
|
|
<if test="TASK_TYPE != null or TASK_TYPE != ''">
|
|
TASK_TYPE = #{TASK_TYPE},
|
|
</if>
|
|
<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>
|
|
CUSTOM_ID = CUSTOM_ID
|
|
where
|
|
CUSTOM_ID = #{CUSTOM_ID}
|
|
</update>
|
|
|
|
</mapper>
|