607 lines
18 KiB
XML
607 lines
18 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.highriskwork.HotWorkApplicationMapper">
|
||
|
||
<!--表名 -->
|
||
<sql id="tableName">
|
||
BUS_HOTWORKAPPLICATION
|
||
</sql>
|
||
|
||
<!--数据字典表名 -->
|
||
<sql id="dicTableName">
|
||
SYS_DICTIONARIES
|
||
</sql>
|
||
|
||
<!-- 字段 -->
|
||
<sql id="Field">
|
||
f.APPLY_USER_ID,
|
||
f.JOB_NUMBER,
|
||
f.APPLICATION_DATE,
|
||
f.JOB_TYPE_INDEX,
|
||
f.HOT_WORK_POSITION,
|
||
f.HOT_WORK_LEVEL_INDEX,
|
||
f.HOT_WORK_METHOD_ID,
|
||
f.JOB_CONTENT,
|
||
f.HOT_WORK_TIME_START,
|
||
f.HOT_WORK_TIME_END,
|
||
f.CREATOR,
|
||
f.CREATTIME,
|
||
f.OPERATOR,
|
||
f.OPERATTIME,
|
||
f.STATE,
|
||
f.ISDELETE,
|
||
f.WORK_LONGITUDE,
|
||
f.WORK_LATITUDE,
|
||
f.CORPINFO_ID,
|
||
f.IS_SAFETY_DIRECTOR,
|
||
f.IS_GAS_TESTING,
|
||
f.SPARE,
|
||
f.HOTWORKAPPLICATION_ID
|
||
</sql>
|
||
|
||
<!-- 字段用于新增 -->
|
||
<sql id="Field2">
|
||
APPLY_USER_ID,
|
||
JOB_NUMBER,
|
||
APPLICATION_DATE,
|
||
JOB_TYPE_INDEX,
|
||
HOT_WORK_POSITION,
|
||
HOT_WORK_LEVEL_INDEX,
|
||
HOT_WORK_METHOD_ID,
|
||
JOB_CONTENT,
|
||
HOT_WORK_TIME_START,
|
||
HOT_WORK_TIME_END,
|
||
CREATOR,
|
||
CREATTIME,
|
||
OPERATOR,
|
||
OPERATTIME,
|
||
STATE,
|
||
ISDELETE,
|
||
WORK_LONGITUDE,
|
||
WORK_LATITUDE,
|
||
CORPINFO_ID,
|
||
IS_SAFETY_DIRECTOR,
|
||
IS_GAS_TESTING,
|
||
SPARE,
|
||
HOTWORKAPPLICATION_ID
|
||
</sql>
|
||
|
||
<!-- 字段值 -->
|
||
<sql id="FieldValue">
|
||
#{APPLY_USER_ID},
|
||
#{JOB_NUMBER},
|
||
#{APPLICATION_DATE},
|
||
#{JOB_TYPE_INDEX},
|
||
#{HOT_WORK_POSITION},
|
||
#{HOT_WORK_LEVEL_INDEX},
|
||
#{HOT_WORK_METHOD_ID},
|
||
#{JOB_CONTENT},
|
||
#{HOT_WORK_TIME_START},
|
||
#{HOT_WORK_TIME_END},
|
||
#{CREATOR},
|
||
#{CREATTIME},
|
||
#{OPERATOR},
|
||
#{OPERATTIME},
|
||
#{STATE},
|
||
#{ISDELETE},
|
||
#{WORK_LONGITUDE},
|
||
#{WORK_LATITUDE},
|
||
#{CORPINFO_ID},
|
||
#{IS_SAFETY_DIRECTOR},
|
||
#{IS_GAS_TESTING},
|
||
#{SPARE},
|
||
#{HOTWORKAPPLICATION_ID}
|
||
</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'
|
||
where
|
||
HOTWORKAPPLICATION_ID = #{HOTWORKAPPLICATION_ID}
|
||
</delete>
|
||
|
||
<!-- 修改 -->
|
||
<update id="edit" parameterType="pd">
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
APPLY_USER_ID = #{APPLY_USER_ID},
|
||
JOB_NUMBER = #{JOB_NUMBER},
|
||
APPLICATION_DATE = #{APPLICATION_DATE},
|
||
JOB_TYPE_INDEX = #{JOB_TYPE_INDEX},
|
||
HOT_WORK_POSITION = #{HOT_WORK_POSITION},
|
||
HOT_WORK_LEVEL_INDEX = #{HOT_WORK_LEVEL_INDEX},
|
||
HOT_WORK_METHOD_ID = #{HOT_WORK_METHOD_ID},
|
||
JOB_CONTENT = #{JOB_CONTENT},
|
||
HOT_WORK_TIME_START = #{HOT_WORK_TIME_START},
|
||
HOT_WORK_TIME_END = #{HOT_WORK_TIME_END},
|
||
CREATOR = #{CREATOR},
|
||
CREATTIME = #{CREATTIME},
|
||
OPERATOR = #{OPERATOR},
|
||
OPERATTIME = #{OPERATTIME},
|
||
<if test="STATE != null and STATE != ''">
|
||
STATE = #{STATE},
|
||
</if>
|
||
HOTWORKAPPLICATION_ID = HOTWORKAPPLICATION_ID
|
||
where
|
||
HOTWORKAPPLICATION_ID = #{HOTWORKAPPLICATION_ID}
|
||
</update>
|
||
|
||
<!-- 修改 -->
|
||
<update id="editState" parameterType="pd">
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
STATE = #{STATE}
|
||
where
|
||
HOTWORKAPPLICATION_ID = #{HOTWORKAPPLICATION_ID}
|
||
</update>
|
||
<!-- 通过ID获取数据 -->
|
||
<select id="findById" parameterType="pd" resultType="pd">
|
||
select
|
||
<include refid="Field"></include>,
|
||
u.NAME CREATORNAME,
|
||
d.NAME DEPARTMENTNAME,
|
||
group_concat(p.NAME) HOT_WORK_METHOD_NAME
|
||
from
|
||
<include refid="tableName"></include> f
|
||
left join sys_user u on f.CREATOR = u.USER_ID
|
||
left join oa_department d on d.DEPARTMENT_ID = u.DEPARTMENT_ID
|
||
LEFT JOIN sys_dictionaries p ON FIND_IN_SET(p.DICTIONARIES_ID,f.HOT_WORK_METHOD_ID)
|
||
where
|
||
f.HOTWORKAPPLICATION_ID = #{HOTWORKAPPLICATION_ID}
|
||
</select>
|
||
|
||
<!-- 列表 -->
|
||
<select id="datalistPage" parameterType="page" resultType="pd">
|
||
select
|
||
f.APPLY_USER_ID,
|
||
f.JOB_NUMBER,
|
||
f.APPLICATION_DATE,
|
||
f.JOB_TYPE_INDEX,
|
||
f.HOT_WORK_POSITION,
|
||
f.HOT_WORK_LEVEL_INDEX,
|
||
f.HOT_WORK_METHOD_ID,
|
||
f.JOB_CONTENT,
|
||
f.HOT_WORK_TIME_START,
|
||
f.HOT_WORK_TIME_END,
|
||
f.CREATOR,
|
||
DATE_FORMAT(f.CREATTIME, '%Y-%m-%d %H:%i:%s') as CREATTIME,
|
||
f.OPERATOR,
|
||
f.OPERATTIME,
|
||
f.STATE,
|
||
f.ISDELETE,
|
||
f.WORK_LONGITUDE,
|
||
f.WORK_LATITUDE,
|
||
f.CORPINFO_ID,
|
||
f.IS_SAFETY_DIRECTOR,
|
||
f.IS_GAS_TESTING,
|
||
f.SPARE,
|
||
f.HOTWORKAPPLICATION_ID,
|
||
u.NAME CREATORNAME,
|
||
d.NAME DEPARTMENTNAME,
|
||
ua.NAME OPERATORNAME
|
||
from
|
||
<include refid="tableName"></include> f
|
||
LEFT JOIN bus_hotworkapplicationuser fu ON f.HOTWORKAPPLICATION_ID = fu.FOREIGN_KEY and f.STATE = fu.STATE
|
||
left join sys_user u on f.CREATOR = u.USER_ID
|
||
left join oa_department d on d.DEPARTMENT_ID = u.DEPARTMENT_ID
|
||
left join vi_user_all ua on ua.USER_ID = f.OPERATOR
|
||
left join sys_user uu on uu.USER_ID = #{pd.loginUserId} and uu.DEPARTMENT_ID = fu.USER_ID
|
||
where
|
||
<if test="pd.STATE != null and pd.STATE != ''">
|
||
<if test='pd.STATE == "10"'>
|
||
(
|
||
</if>
|
||
</if> f.ISDELETE = '0'
|
||
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''">
|
||
and
|
||
( f.JOB_NUMBER LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
or f.HOT_WORK_POSITION LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||
)
|
||
</if>
|
||
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''">
|
||
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||
</if>
|
||
<if test="pd.CREATOR != null and pd.CREATOR != ''">
|
||
and (f.CREATOR = #{pd.CREATOR})
|
||
</if>
|
||
<if test="pd.HOT_WORK_LEVEL_INDEX != null and pd.HOT_WORK_LEVEL_INDEX != ''">
|
||
and (HOT_WORK_LEVEL_INDEX = #{pd.HOT_WORK_LEVEL_INDEX})
|
||
</if>
|
||
<if test="pd.roleLevel != null and pd.roleLevel != ''"><!-- 权限显示 -->
|
||
<choose>
|
||
<when test='pd.roleLevel == "0"'>
|
||
</when>
|
||
<when test='pd.roleLevel == "1"'>
|
||
and f.HOTWORKAPPLICATION_ID in (select hu.FOREIGN_KEY from bus_hotworkapplicationuser hu LEFT JOIN vi_user_all bhuuser ON bhuuser.USER_ID = hu.USER_ID where bhuuser.DEPARTMENT_ID in (${pd.supDeparIds}) or u.DEPARTMENT_ID in (${pd.supDeparIds}) )
|
||
</when>
|
||
<when test='pd.roleLevel == "2"'>
|
||
and f.HOTWORKAPPLICATION_ID in (select hu.FOREIGN_KEY from bus_hotworkapplicationuser hu where hu.USER_ID = #{pd.loginUserId}
|
||
|
||
<if test="pd.STATE != null and pd.STATE != ''">
|
||
<choose>
|
||
<!-- State为99时,查询的是特级动火归档,此处查询的是,由我审批的数据 -->
|
||
<when test='pd.STATE == "99"'>
|
||
and (hu.STATE in ('30','31','32','33','34'))
|
||
</when>
|
||
<when test='pd.STATE == "98"'>
|
||
|
||
</when>
|
||
<otherwise>
|
||
and (hu.STATE = #{pd.STATE})
|
||
</otherwise>
|
||
</choose>
|
||
|
||
</if>
|
||
)
|
||
</when>
|
||
</choose>
|
||
</if>
|
||
<if test="pd.myApprove != null and pd.myApprove != ''"><!-- 应该由我审批的数据 -->
|
||
and f.HOTWORKAPPLICATION_ID in (select hu.FOREIGN_KEY from bus_hotworkapplicationuser hu where hu.USER_ID = #{pd.myApprove}
|
||
|
||
<if test="pd.STATE != null and pd.STATE != ''">
|
||
<choose>
|
||
<!-- State为99时,查询的是特级动火归档,此处查询的是,由我审批的数据 -->
|
||
<when test='pd.STATE == "99"'>
|
||
and (hu.STATE in ('30','31','32','33','34'))
|
||
</when>
|
||
<when test='pd.STATE == "98"'>
|
||
|
||
</when>
|
||
<otherwise>
|
||
and (hu.STATE = #{pd.STATE})
|
||
</otherwise>
|
||
</choose>
|
||
|
||
</if>
|
||
)
|
||
</if>
|
||
<if test="pd.keyJobNumber != null and pd.keyJobNumber != ''">
|
||
and (f.JOB_NUMBER LIKE CONCAT(CONCAT('%', #{pd.keyJobNumber}),'%'))
|
||
</if>
|
||
<if test="pd.applicantName != null and pd.applicantName != ''">
|
||
and (u.NAME LIKE CONCAT(CONCAT('%', #{pd.applicantName}),'%'))
|
||
</if>
|
||
<if test="pd.keyState != null and pd.keyState != ''">
|
||
<!-- <if test='pd.keyState == "1"'>-->
|
||
<!-- and f.STATE = '11'-->
|
||
<!-- </if>-->
|
||
<!-- <if test='pd.keyState == "2"'>-->
|
||
<!-- and f.STATE = '12'-->
|
||
<!-- </if>-->
|
||
<!-- <if test='pd.keyState == "3"'>-->
|
||
<!-- and f.STATE = '2'-->
|
||
<!-- </if>-->
|
||
<!-- <if test='pd.keyState == "4"'>-->
|
||
<!-- and f.STATE = '-2'-->
|
||
<!-- </if>-->
|
||
and f.STATE = #{pd.keyState}
|
||
</if>
|
||
<if test="pd.keyApplyUserName != null and pd.keyApplyUserName != ''"><!-- 申请人 -->
|
||
and f.HOTWORKAPPLICATION_ID in (select FOREIGN_KEY from bus_hotworkapplicationuser houtUser LEFT JOIN vi_user_all u on u.user_id = houtUser.USER_ID where u.USERNAME = CONCAT(CONCAT('%', #{pd.keyApplyUserName}),'%') and STATE = '11')
|
||
</if>
|
||
<if test="pd.keyApproveUserName != null and pd.keyApproveUserName != ''"><!-- 申请人 -->
|
||
and f.HOTWORKAPPLICATION_ID in (select FOREIGN_KEY from bus_hotworkapplicationuser houtUser LEFT JOIN vi_user_all u on u.user_id = houtUser.USER_ID where u.USERNAME = CONCAT(CONCAT('%', #{pd.keyApproveUserName}),'%') and STATE = '12')
|
||
</if>
|
||
<if test="pd.STATE != null and pd.STATE != ''">
|
||
<choose>
|
||
<when test='pd.STATE == "0"'>
|
||
and f.CREATOR = #{pd.CREATOR} and f.state !='-4'
|
||
</when>
|
||
<when test='pd.STATE == "24"'>
|
||
and f.STATE in ('1','2','3','4','5','6'
|
||
,'7','8','9')
|
||
</when>
|
||
<when test='pd.STATE == "11"'>
|
||
and (f.STATE in ('11','-3'))
|
||
</when>
|
||
<!-- State为99时,查询的是特级动火归档,动火表查询已经完成特级动火流程的数据(即回归普通动火流程的数据) -->
|
||
<when test='pd.STATE == "99"'>
|
||
and (
|
||
(
|
||
f.STATE >= 1
|
||
and f.STATE <= 11
|
||
)
|
||
or f.STATE = '-3'
|
||
)
|
||
</when>
|
||
<when test='pd.STATE == "98"'>
|
||
<!-- and (f.STATE >= 1) -->
|
||
</when>
|
||
<when test='pd.STATE == "10"'>
|
||
and (f.STATE != '11')
|
||
) or (uu.USER_ID is not null and f.ISDELETE = '0')
|
||
</when>
|
||
<otherwise>
|
||
and (f.STATE = #{pd.STATE})
|
||
</otherwise>
|
||
</choose>
|
||
</if>
|
||
group by f.HOTWORKAPPLICATION_ID
|
||
ORDER BY f.CREATTIME desc
|
||
<!-- ORDER BY f.OPERATTIME desc -->
|
||
</select>
|
||
|
||
<!-- 列表 -->
|
||
<select id="hotworkdatalistPage" parameterType="page" resultType="pd">
|
||
select
|
||
fu.OPERATTIME as pxsj, <!-- 前台的排序时间查的是hotuser表里的OPERATTIME,起别名叫排序时间 -->
|
||
<include refid="Field"></include>,
|
||
u.NAME CREATORNAME,
|
||
d.NAME DEPARTMENTNAME,
|
||
ua.NAME OPERATORNAME
|
||
from
|
||
<include refid="tableName"></include> f
|
||
left join bus_hotworkapplicationuser fu on f.HOTWORKAPPLICATION_ID = fu.FOREIGN_KEY and fu.state='1' <!-- 前台的排序时间查的是hotuser表里的OPERATTIME,起别名叫排序时间 -->
|
||
left join sys_user u on f.CREATOR = u.USER_ID
|
||
left join oa_department d on d.DEPARTMENT_ID = u.DEPARTMENT_ID
|
||
left join vi_user_all ua on ua.USER_ID = f.OPERATOR
|
||
LEFT JOIN bus_hotworkapplicationuser bhu ON bhu.FOREIGN_KEY = f.HOTWORKAPPLICATION_ID
|
||
LEFT JOIN vi_user_all bhuuser ON bhuuser.USER_ID = bhu.USER_ID
|
||
left join bus_hotworkapplicationuser hot on f.HOTWORKAPPLICATION_ID = hot.FOREIGN_KEY and hot.ISDELETE ='0' and hot.state='4'
|
||
left join sys_user hu on hot.USER_ID = hu.USER_ID
|
||
left join oa_department hd on hd.DEPARTMENT_ID = hu.DEPARTMENT_ID
|
||
where f.ISDELETE = '0'
|
||
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''">
|
||
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||
</if>
|
||
<if test="pd.roleLevel != null and pd.roleLevel != ''"><!-- 权限显示 -->
|
||
<choose>
|
||
<when test='pd.roleLevel == "0"'>
|
||
</when>
|
||
<when test='pd.roleLevel == "1"'>
|
||
and (bhuuser.DEPARTMENT_ID in (${pd.supDeparIds}) or ua.DEPARTMENT_ID in (${pd.supDeparIds}))
|
||
</when>
|
||
<when test='pd.roleLevel == "2"'>
|
||
AND (f.CREATOR = #{pd.loginUserId} or bhu.USER_ID = #{pd.loginUserId})
|
||
</when>
|
||
</choose>
|
||
</if>
|
||
<!-- AND bhu.TYPE = '2' -->
|
||
AND f.state != '-4'
|
||
<if test="pd.keyJobNumber != null and pd.keyJobNumber != ''">
|
||
and (f.JOB_NUMBER LIKE CONCAT(CONCAT('%', #{pd.keyJobNumber}),'%'))
|
||
</if>
|
||
<if test="pd.JOB_CONTENT != null and pd.JOB_CONTENT != ''">
|
||
and f.JOB_CONTENT LIKE CONCAT(CONCAT('%', #{pd.JOB_CONTENT}),'%')
|
||
</if>
|
||
<if test="pd.HOT_WORK_POSITION != null and pd.HOT_WORK_POSITION != ''">
|
||
and f.HOT_WORK_POSITION LIKE CONCAT(CONCAT('%', #{pd.HOT_WORK_POSITION}),'%')
|
||
</if>
|
||
<if test="pd.HOT_WORK_LEVEL_INDEX != null and pd.HOT_WORK_LEVEL_INDEX != ''">
|
||
and f.HOT_WORK_LEVEL_INDEX = #{pd.HOT_WORK_LEVEL_INDEX}
|
||
</if>
|
||
<if test="pd.UNIT_LEADER_DEPARTMENT_ID != null and pd.UNIT_LEADER_DEPARTMENT_ID != ''">
|
||
and hd.DEPARTMENT_ID = #{pd.UNIT_LEADER_DEPARTMENT_ID}
|
||
</if>
|
||
<if test="pd.keyState != null and pd.keyState != ''">
|
||
and f.STATE = #{pd.keyState}
|
||
</if>
|
||
<if test="pd.STARTTIME != null and pd.STARTTIME != ''"><!-- 关键词检索 -->
|
||
and f.CREATTIME >= #{pd.STARTTIME}
|
||
</if>
|
||
<if test="pd.ENDTIME != null and pd.ENDTIME != ''">
|
||
and f.CREATTIME <= #{pd.ENDTIME}
|
||
</if>
|
||
GROUP BY HOTWORKAPPLICATION_ID
|
||
ORDER BY
|
||
fu.OPERATTIME DESC <!-- 前台的排序时间查的是hotuser表里的OPERATTIME,起别名叫排序时间 -->
|
||
</select>
|
||
|
||
<!-- 列表(全部) -->
|
||
<select id="listAll" parameterType="pd" resultType="pd">
|
||
select
|
||
<include refid="Field"></include>
|
||
from
|
||
<include refid="tableName"></include> f
|
||
where 1=1
|
||
<if test="INSTATES != null and INSTATES.size() > 0">
|
||
and STATE in
|
||
<foreach item="item" index="index" collection="INSTATES" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</if>
|
||
</select>
|
||
|
||
<!-- 批量删除 -->
|
||
<delete id="deleteAll" parameterType="String">
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
ISDELETE = '1'
|
||
where
|
||
HOTWORKAPPLICATION_ID in
|
||
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</delete>
|
||
<!-- bus_hotwork_measures-->
|
||
|
||
<!-- 列表(全部) -->
|
||
<select id="listAllMeasures" parameterType="pd" resultType="pd">
|
||
SELECT
|
||
f.BUS_HOTWORK_MEASURES_ID,
|
||
f.PROTECTIVE_MEASURES,
|
||
f.QUESTION1,
|
||
f.QUESTION2,
|
||
f.QUESTION3,
|
||
f.QUESTION4,
|
||
f.ISDELETE,
|
||
f.ORDERBY,
|
||
hwtm.ANSWER1,
|
||
hwtm.ANSWER2,
|
||
hwtm.ANSWER3,
|
||
hwtm.ANSWER4
|
||
|
||
FROM
|
||
BUS_HOTWORK_MEASURES f
|
||
LEFT JOIN BUS_HOTWORKTOMEASURES hwtm on f.BUS_HOTWORK_MEASURES_ID = hwtm.BUS_HOTWORK_MEASURES_ID and hwtm.HOTWORKAPPLICATION_ID = #{HOTWORKAPPLICATION_ID}
|
||
WHERE f.ISDELETE = '0'
|
||
oRDER BY f.ORDERBY
|
||
</select>
|
||
|
||
<!-- 修改 -->
|
||
<update id="editByState" parameterType="pd">
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
<if test="ISDELETEOLD != null and ISDELETEOLD != ''">
|
||
ISDELETE = #{ISDELETEOLD},
|
||
</if>
|
||
STATE = #{STATE},
|
||
OPERATOR = #{OPERATOR},
|
||
OPERATTIME = #{OPERATTIME}
|
||
|
||
where
|
||
HOTWORKAPPLICATION_ID = #{HOTWORKAPPLICATION_ID}
|
||
</update>
|
||
|
||
<!-- 修改 -->
|
||
<update id="editPosition" parameterType="pd">
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
WORK_LONGITUDE = #{WORK_LONGITUDE},
|
||
WORK_LATITUDE = #{WORK_LATITUDE}
|
||
where
|
||
HOTWORKAPPLICATION_ID = #{HOTWORKAPPLICATION_ID}
|
||
</update>
|
||
|
||
<select id="getCountByMyApproval" parameterType="pd" resultType="pd">
|
||
select f.STATE ,fu.USER_ID,count(distinct HOTWORKAPPLICATION_ID) as count
|
||
from bus_hotworkapplication f
|
||
left join bus_hotworkapplicationuser fu on fu.FOREIGN_KEY = f.HOTWORKAPPLICATION_ID
|
||
and f.STATE = fu.state
|
||
where fu.user_id = #{USER_ID} AND fu.ISDELETE = '0' and f.STATE != 11 and f.STATE != -3
|
||
GROUP BY f.STATE
|
||
</select>
|
||
<select id="getCountByMyGasAnaly" parameterType="pd" resultType="pd">
|
||
SELECT
|
||
f.STATE,
|
||
fu.USER_ID,
|
||
count(*) AS count
|
||
FROM
|
||
bus_hotworkapplication f
|
||
LEFT JOIN bus_hotworkapplicationuser fu ON fu.FOREIGN_KEY = f.HOTWORKAPPLICATION_ID
|
||
WHERE
|
||
fu.user_id = #{USER_ID}
|
||
AND fu.STATE = '24'
|
||
and f.STATE in ('1','2','3','4','5','6'
|
||
,'7','8','9')
|
||
</select>
|
||
|
||
<!-- 列表(全部) -->
|
||
<select id="getCountByDate" parameterType="pd" resultType="integer">
|
||
select
|
||
count(*) as count
|
||
from
|
||
<include refid="tableName"></include> f
|
||
where 1=1
|
||
and CREATOR >= #{startData}
|
||
and CREATOR <= #{endDate}
|
||
</select>
|
||
<!-- 列表(全部) -->
|
||
<update id="updateState4ids" parameterType="pd" >
|
||
update
|
||
<include refid="tableName"></include>
|
||
set
|
||
STATE = #{STATE},
|
||
OPERATTIME = #{OPERATTIME}
|
||
where
|
||
HOTWORKAPPLICATION_ID in
|
||
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
|
||
#{item}
|
||
</foreach>
|
||
</update>
|
||
<insert id="saveJobNumber" parameterType="pd">
|
||
insert into
|
||
bus_hotworkapplicationnumber
|
||
(
|
||
JOB_NUMBER
|
||
) values (
|
||
#{JOB_NUMBER}
|
||
)
|
||
</insert>
|
||
<select id="getJobNumber" parameterType="pd" resultType="integer">
|
||
SELECT
|
||
count(*) count
|
||
FROM
|
||
bus_hotworkapplicationnumber f
|
||
WHERE
|
||
f.JOB_NUMBER LIKE CONCAT(CONCAT('%', #{JOB_NUMBER}),'%')
|
||
</select>
|
||
|
||
<delete id="cleanUpJobNumber" parameterType="pd">
|
||
DELETE from bus_hotworkapplicationnumber where JOB_NUMBER LIKE CONCAT(CONCAT('%', #{JOB_NUMBER_LIKE}),'%')
|
||
</delete>
|
||
|
||
<!-- 列表 -->
|
||
<select id="filedatalistPage" parameterType="page" resultType="pd">
|
||
select
|
||
<include refid="Field"></include>,
|
||
u.NAME CREATORNAME,
|
||
d.NAME DEPARTMENTNAME,
|
||
ua.NAME OPERATORNAME
|
||
from
|
||
<include refid="tableName"></include> f
|
||
left join sys_user u on f.CREATOR = u.USER_ID
|
||
left join oa_department d on d.DEPARTMENT_ID = u.DEPARTMENT_ID
|
||
left join vi_user_all ua on ua.USER_ID = f.OPERATOR
|
||
left join bus_hotworkapplicationuser bhu on bhu.FOREIGN_KEY = f.HOTWORKAPPLICATION_ID
|
||
LEFT JOIN vi_user_all bhuuser ON bhuuser.USER_ID = bhu.USER_ID
|
||
where f.ISDELETE = '0'
|
||
<if test="pd.roleLevel != null and pd.roleLevel != ''"><!-- 权限显示 -->
|
||
<choose>
|
||
<when test='pd.roleLevel == "0"'>
|
||
</when>
|
||
<when test='pd.roleLevel == "1"'>
|
||
and (bhuuser.DEPARTMENT_ID in (${pd.supDeparIds}) or ua.DEPARTMENT_ID in (${pd.supDeparIds}))
|
||
</when>
|
||
<when test='pd.roleLevel == "2"'>
|
||
AND (f.CREATOR = #{pd.loginUserId} or bhu.USER_ID = #{pd.loginUserId})
|
||
</when>
|
||
</choose>
|
||
</if>
|
||
<if test="pd.STATE != null and pd.STATE != ''">
|
||
<choose>
|
||
<when test='pd.STATE == "11"'>
|
||
and (f.STATE in ('11','-3'))
|
||
</when>
|
||
</choose>
|
||
|
||
</if>
|
||
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''">
|
||
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||
</if>
|
||
<if test="pd.loginUserId != null and pd.loginUserId != ''">
|
||
AND (f.CREATOR = #{pd.loginUserId} or bhu.USER_ID = #{pd.loginUserId})
|
||
</if>
|
||
GROUP BY HOTWORKAPPLICATION_ID
|
||
ORDER BY f.OPERATTIME desc
|
||
</select>
|
||
|
||
<select id="getCountByMyApprovalForDelayedHotWork" parameterType="pd" resultType="pd">
|
||
select f.STATE,u.USER_ID,count(distinct HOTWORKAPPLICATION_ID) as count
|
||
from bus_hotworkapplication f
|
||
left join bus_hotworkapplicationuser fu on fu.FOREIGN_KEY = f.HOTWORKAPPLICATION_ID and f.STATE = fu.state
|
||
left join sys_user u on u.DEPARTMENT_ID = fu.USER_ID
|
||
where u.USER_ID = #{USER_ID} AND fu.ISDELETE = '0' and f.STATE = 10
|
||
</select>
|
||
</mapper>
|