364 lines
11 KiB
XML
364 lines
11 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.HotWorkApplicationUserMapper">
|
|
|
|
<!--表名 -->
|
|
<sql id="tableName">
|
|
BUS_HOTWORKAPPLICATIONUSER
|
|
</sql>
|
|
|
|
<!--数据字典表名 -->
|
|
<sql id="dicTableName">
|
|
SYS_DICTIONARIES
|
|
</sql>
|
|
|
|
<!-- 字段 -->
|
|
<sql id="Field">
|
|
f.USER_ID,
|
|
f.STATE,
|
|
f.FOREIGN_KEY,
|
|
f.TYPE,
|
|
f.OPINION,
|
|
f.AUTOGRAPH,
|
|
f.ISDELETE,
|
|
f.CREATOR,
|
|
f.CREATTIME,
|
|
f.OPERATOR,
|
|
f.OPERATTIME,
|
|
f.HOTWORKAPPLICATIONUSER_ID
|
|
</sql>
|
|
|
|
<!-- 字段用于新增 -->
|
|
<sql id="Field2">
|
|
USER_ID,
|
|
STATE,
|
|
FOREIGN_KEY,
|
|
TYPE,
|
|
OPINION,
|
|
AUTOGRAPH,
|
|
ISDELETE,
|
|
CREATOR,
|
|
CREATTIME,
|
|
OPERATOR,
|
|
OPERATTIME,
|
|
HOTWORKAPPLICATIONUSER_ID
|
|
</sql>
|
|
|
|
<!-- 字段值 -->
|
|
<sql id="FieldValue">
|
|
#{USER_ID},
|
|
#{STATE},
|
|
#{FOREIGN_KEY},
|
|
#{TYPE},
|
|
#{OPINION},
|
|
#{AUTOGRAPH},
|
|
#{ISDELETE},
|
|
#{CREATOR},
|
|
#{CREATTIME},
|
|
#{OPERATOR},
|
|
#{OPERATTIME},
|
|
#{HOTWORKAPPLICATIONUSER_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">
|
|
delete from
|
|
<include refid="tableName"></include>
|
|
where
|
|
FOREIGN_KEY = #{FOREIGN_KEY}
|
|
</delete>
|
|
|
|
<!-- 修改 -->
|
|
<update id="edit" parameterType="pd">
|
|
update
|
|
<include refid="tableName"></include>
|
|
set
|
|
TYPE = #{TYPE},
|
|
OPINION = #{OPINION},
|
|
AUTOGRAPH = #{AUTOGRAPH},
|
|
OPERATOR = #{OPERATOR},
|
|
OPERATTIME = #{OPERATTIME}
|
|
where
|
|
HOTWORKAPPLICATIONUSER_ID = #{HOTWORKAPPLICATIONUSER_ID}
|
|
</update>
|
|
|
|
<!-- 通过ID获取数据 -->
|
|
<select id="findById" parameterType="pd" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
|
|
from
|
|
<include refid="tableName"></include> f
|
|
where f.ISDELETE = '0' and
|
|
f.HOTWORKAPPLICATIONUSER_ID = #{HOTWORKAPPLICATIONUSER_ID}
|
|
</select>
|
|
<!-- 通过ID获取数据 -->
|
|
<update id="updateTypeByKeyID" parameterType="pd" >
|
|
update
|
|
<include refid="tableName"></include>
|
|
set
|
|
TYPE = '1'
|
|
where
|
|
FOREIGN_KEY = #{FOREIGN_KEY} and STATE = '8' and USER_ID = #{loginUserId}
|
|
</update>
|
|
<!-- 列表 -->
|
|
<select id="datalistPage" parameterType="page" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
from
|
|
<include refid="tableName"></include> f
|
|
where f.ISDELETE = '0' and
|
|
<if test="pd.FOREIGN_KEY != null and pd.FOREIGN_KEY != ''"><!-- 关键词检索 -->
|
|
and FOREIGN_KEY = #{FOREIGN_KEY}
|
|
</if>
|
|
<if test="pd.CREATOR != null and pd.CREATOR != ''"><!-- 关键词检索 -->
|
|
and CREATOR = #{pd.CREATOR}
|
|
</if>
|
|
<if test="pd.myApprove != null and pd.myApprove != ''"><!-- 应该由我审批的数据 -->
|
|
and HOTWORKAPPLICATION_ID in (select FOREIGN_KEY from bus_hotworkapplicationuser where USER_ID = #{pd.myApprove} and STATE = #{pd.STATE})
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 列表(全部) -->
|
|
<select id="listAll" parameterType="pd" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
,if(dept.NAME is null,dept1.NAME,dept.NAME) as deptName
|
|
,u.NAME as userName
|
|
,su.USERNAME as userName2
|
|
, u.USERNAME as userPhone
|
|
,if(dept.DEPARTMENT_ID is null,dept1.DEPARTMENT_ID,dept.DEPARTMENT_ID) as DEPARTMENT_ID
|
|
,su.USER_TYPE USER_TYPE
|
|
,reuser.NAME as REGULATORY_USER_NAME
|
|
,if(redept.NAME is null,redept1.NAME,redept.NAME) as REGULATORY_DEPT_NAME
|
|
from
|
|
<include refid="tableName"></include> f
|
|
left join SYS_USER u on u.USER_ID = f.USER_ID
|
|
left join bus_specialuser su on su.SPECIALUSER_ID = f.USER_ID
|
|
left join oa_department dept on dept.DEPARTMENT_ID = u.DEPARTMENT_ID
|
|
left join oa_department dept1 on dept1.DEPARTMENT_ID = f.USER_ID
|
|
left join `qa-gwj-regulatory`.SYS_USER reuser on reuser.USER_ID = f.USER_ID and reuser.USERNAME != 'admin'
|
|
left join `qa-gwj-regulatory`.SYS_DEPARTMENT redept on redept.DEPARTMENT_ID = reuser.DEPARTMENT_ID
|
|
left join `qa-gwj-regulatory`.SYS_DEPARTMENT redept1 on redept1.DEPARTMENT_ID = f.USER_ID
|
|
where f.ISDELETE = '0'
|
|
<if test="hotIds != null and hotIds.size>0"> <!-- 关键词检索 -->
|
|
and(f.FOREIGN_KEY in
|
|
<foreach item="item" index="index" collection="hotIds" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<if test="FOREIGN_KEY != null and FOREIGN_KEY != ''"><!-- 关键词检索 -->
|
|
and( f.FOREIGN_KEY = #{FOREIGN_KEY})
|
|
</if>
|
|
<if test="USER_ID != null and USER_ID != ''"><!-- 关键词检索 -->
|
|
and( f.USER_ID = #{USER_ID})
|
|
</if>
|
|
<if test="STATE != null and STATE != ''"><!-- 关键词检索 -->
|
|
and( f.STATE = #{STATE})
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 列表(打回) -->
|
|
<select id="listRepulse" parameterType="pd" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
,dept.NAME as deptName
|
|
,u.NAME as userName
|
|
,su.USERNAME as userName2
|
|
, u.USERNAME as userPhone
|
|
,dept.DEPARTMENT_ID DEPARTMENT_ID
|
|
,su.USER_TYPE USER_TYPE
|
|
,reuser.NAME as REGULATORY_USER_NAME
|
|
,redept.NAME as REGULATORY_DEPT_NAME
|
|
from
|
|
<include refid="tableName"></include> f
|
|
left join SYS_USER u on u.USER_ID = f.USER_ID
|
|
left join bus_specialuser su on su.SPECIALUSER_ID = f.USER_ID
|
|
left join oa_department dept on dept.DEPARTMENT_ID = u.DEPARTMENT_ID
|
|
left join `qa-gwj-regulatory`.SYS_USER reuser on reuser.USER_ID = f.USER_ID and reuser.USERNAME != 'admin'
|
|
left join `qa-gwj-regulatory`.SYS_DEPARTMENT redept on redept.DEPARTMENT_ID = reuser.DEPARTMENT_ID
|
|
where f.ISDELETE = '0'
|
|
<if test="hotIds != null and hotIds.size>0"><!-- 关键词检索 -->
|
|
and(f.FOREIGN_KEY in
|
|
<foreach item="item" index="index" collection="hotIds" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<if test="FOREIGN_KEY != null and FOREIGN_KEY != ''"><!-- 关键词检索 -->
|
|
and( f.FOREIGN_KEY = #{FOREIGN_KEY})
|
|
</if>
|
|
<if test="USER_ID != null and USER_ID != ''"><!-- 关键词检索 -->
|
|
and( f.USER_ID = #{USER_ID})
|
|
</if>
|
|
<if test="STATE != null and STATE != ''"><!-- 关键词检索 -->
|
|
and( f.STATE = #{STATE})
|
|
</if>
|
|
<if test="TYPE != null and TYPE != ''"><!-- 关键词检索 -->
|
|
and f.TYPE = #{TYPE}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 查询动火流程图 -->
|
|
<select id="showFlowChart" parameterType="pd" resultType="pd">
|
|
SELECT
|
|
f.STATE,
|
|
f.OPERATTIME,
|
|
s.NAME,
|
|
f.TYPE,
|
|
if(u.NAME is null,od.NAME,u.NAME) as USER_NAME,
|
|
su.USERNAME as SPECIAL_USER_NAME,
|
|
reuser.NAME as REGULATORY_USER_NAME
|
|
FROM
|
|
BUS_HOTWORKAPPLICATIONUSER f
|
|
left join bus_hotworkapplicationstate s on s.STATE = f.STATE
|
|
left join SYS_USER u on u.USER_ID = f.USER_ID
|
|
left join bus_specialuser su on su.SPECIALUSER_ID = f.USER_ID
|
|
left join `qa-gwj-regulatory`.SYS_USER reuser on reuser.USER_ID = f.USER_ID and reuser.USERNAME != 'admin'
|
|
left join oa_department od on od.DEPARTMENT_ID = f.USER_ID
|
|
left join `qa-gwj-regulatory`.SYS_DEPARTMENT rd on rd.DEPARTMENT_ID = f.USER_ID
|
|
WHERE
|
|
f.FOREIGN_KEY = #{FOREIGN_KEY}
|
|
AND f.ISDELETE = '0'
|
|
ORDER BY
|
|
CAST(f.STATE AS SIGNED)
|
|
</select>
|
|
|
|
<!-- 批量删除 -->
|
|
<delete id="deleteAll" parameterType="String">
|
|
update
|
|
<include refid="tableName"></include>
|
|
set
|
|
ISDELETE = '1'
|
|
where
|
|
USER_ID in
|
|
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</delete>
|
|
<!-- 批量删除 -->
|
|
<delete id="deleteByforward" parameterType="String">
|
|
delete from
|
|
<include refid="tableName"></include>
|
|
where STATE = #{STATE} and FOREIGN_KEY = #{FOREIGN_KEY}
|
|
</delete>
|
|
<!-- 批量删除 -->
|
|
<delete id="deleteForBack" parameterType="String">
|
|
update
|
|
<include refid="tableName"></include>
|
|
set ISDELETE = '1'
|
|
where STATE = #{STATE} and FOREIGN_KEY = #{FOREIGN_KEY}
|
|
</delete>
|
|
<!-- 修改 -->
|
|
<update id="editType" parameterType="pd">
|
|
update
|
|
<include refid="tableName"></include>
|
|
set
|
|
TYPE = #{TYPE}
|
|
where
|
|
</update>
|
|
<!-- 批量删除 -->
|
|
<delete id="deleteByForeignKey" parameterType="String">
|
|
update
|
|
<include refid="tableName"></include>
|
|
set
|
|
ISDELETE = '1',
|
|
OPERATOR = #{OPERATOR},
|
|
OPERATTIME = #{OPERATTIME}
|
|
where FOREIGN_KEY = #{FOREIGN_KEY}
|
|
</delete>
|
|
<!-- 修改 -->
|
|
<update id="editExplain" parameterType="pd">
|
|
update
|
|
<include refid="tableName"></include>
|
|
set
|
|
OPINION = #{OPINION},
|
|
OPERATOR = #{OPERATOR},
|
|
OPERATTIME = #{OPERATTIME}
|
|
where
|
|
STATE = #{STATE}
|
|
and FOREIGN_KEY = #{FOREIGN_KEY}
|
|
and USER_ID = #{USER_ID}
|
|
</update>
|
|
<!-- 删除-->
|
|
<delete id="deleteTem" parameterType="pd">
|
|
delete from
|
|
<include refid="tableName"></include>
|
|
where
|
|
HOTWORKAPPLICATIONUSER_ID = #{HOTWORKAPPLICATIONUSER_ID}
|
|
</delete>
|
|
|
|
|
|
<select id="getHotGasanalysis" parameterType="pd" resultType="pd">
|
|
select f.* ,u.USERNAME , u.name
|
|
from
|
|
bus_gasanalysis f
|
|
left join vi_user_all u on u.USER_ID = f.GAS_USER_ID
|
|
where f.ISDELETE = '0'
|
|
<if test="HOTWORKAPPLICATION_ID != null and HOTWORKAPPLICATION_ID != ''"><!-- 关键词检索 -->
|
|
and( f.HOTWORKAPPLICATION_ID = #{HOTWORKAPPLICATION_ID})
|
|
</if>
|
|
order by CREATTIME
|
|
</select>
|
|
<select id="getHotdelayed" parameterType="pd" resultType="pd">
|
|
select f.* ,u.USERNAME , u.name
|
|
from
|
|
bus_hotworkapplicationdelayed f
|
|
left join vi_user_all u on u.USER_ID = f.USER_ID
|
|
where f.ISDELETE = '0'
|
|
<if test="HOTWORKAPPLICATION_ID != null and HOTWORKAPPLICATION_ID != ''"><!-- 关键词检索 -->
|
|
and( f.HOTWORKAPPLICATION_ID = #{HOTWORKAPPLICATION_ID})
|
|
</if>
|
|
order by CREATTIME
|
|
</select>
|
|
|
|
<select id="listByDepartment" parameterType="pd" resultType="pd">
|
|
select
|
|
<include refid="Field"></include>
|
|
,dept.NAME as deptName
|
|
,u.NAME as userName
|
|
,su.USERNAME as userName2
|
|
, u.USERNAME as userPhone
|
|
,dept.DEPARTMENT_ID DEPARTMENT_ID
|
|
,su.USER_TYPE USER_TYPE
|
|
,reuser.NAME as REGULATORY_USER_NAME
|
|
,redept.NAME as REGULATORY_DEPT_NAME
|
|
from
|
|
<include refid="tableName"></include> f
|
|
left join SYS_USER u on u.DEPARTMENT_ID = f.USER_ID
|
|
left join bus_specialuser su on su.SPECIALUSER_ID = f.USER_ID
|
|
left join oa_department dept on dept.DEPARTMENT_ID = u.DEPARTMENT_ID
|
|
left join `qa-gwj-regulatory`.SYS_USER reuser on reuser.USER_ID = f.USER_ID and reuser.USERNAME != 'admin'
|
|
left join `qa-gwj-regulatory`.SYS_DEPARTMENT redept on redept.DEPARTMENT_ID = reuser.DEPARTMENT_ID
|
|
where f.ISDELETE = '0'
|
|
<if test="hotIds != null and hotIds.size>0"> <!-- 关键词检索 -->
|
|
and(f.FOREIGN_KEY in
|
|
<foreach item="item" index="index" collection="hotIds" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<if test="FOREIGN_KEY != null and FOREIGN_KEY != ''"><!-- 关键词检索 -->
|
|
and( f.FOREIGN_KEY = #{FOREIGN_KEY})
|
|
</if>
|
|
<if test="USER_ID != null and USER_ID != ''"><!-- 关键词检索 -->
|
|
and( f.USER_ID = (select DEPARTMENT_ID from SYS_USER where USER_ID = #{USER_ID}))
|
|
</if>
|
|
<if test="STATE != null and STATE != ''"><!-- 关键词检索 -->
|
|
and( f.STATE = #{STATE})
|
|
</if>
|
|
</select>
|
|
</mapper>
|