jl-jjsp-service/securityControl-modules/securityControl-proteam/target/classes/mapper/StudyTaskMapper.xml

264 lines
12 KiB
XML
Raw Permalink Normal View History

2025-09-24 11:10:04 +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.sercurityControl.proteam.study.mapper.StudyTaskMapper">
<insert id="addStudyTask" useGeneratedKeys="true" keyProperty="id">
INSERT INTO study_task(study_task_name,study_object,publish_user,publish_time,create_time,create_user,publish_status) VALUES
(
#{studyTaskName},#{studyObject},#{publishUser},#{publishTime},#{createTime},#{createUser},#{publishStatus}
)
</insert>
<insert id="addStudyPeople" useGeneratedKeys="true" keyProperty="id">
INSERT INTO study_people(study_object,user_name,nick_name,study_id) VALUES
(
#{studyObject},#{userName},#{nickName},#{studyId}
)
</insert>
<insert id="addStudyFile" useGeneratedKeys="true" keyProperty="id">
INSERT INTO study_file(task_id,file_name,file_url,file_previous_name,file_size,file_url_new) VALUES
(
#{taskId},#{fileName},#{fileUrl},#{filePreviousName},#{fileSize},#{fileUrlNew}
)
</insert>
<insert id="addStudyDetails">
INSERT INTO study_details(study_id,study_people_id,file_name) VALUES
(
#{studyId},#{studyPeopleId},#{fileName}
)
</insert>
<update id="updateStudyTask">
update study_task
<set>
<if test="studyTaskName!=null and studyTaskName !=''">
,study_task_name = #{studyTaskName}
</if>
<if test="studyObject!=null and studyObject !=''">
,study_object = #{studyObject}
</if>
<if test="publishStatus!=null and publishStatus !=''">
,publish_status = #{publishStatus}
</if>
<if test="publishUser!=null and publishUser !=''">
,publish_user = #{publishUser}
</if>
<if test="publishTime!=null and publishTime !=''">
,publish_time = #{publishTime}
</if>
</set>
WHERE id=#{id}
</update>
<update id="updateStudyDetails">
update study_details set study_status='1' where id=#{id}
</update>
<update id="updateStudyPeople">
update study_people set study_status=#{studyStatus} where id=#{studyPeopleId}
</update>
<delete id="delStudyTask">
delete from study_task where id = #{id}
</delete>
<delete id="delStudyPeople">
delete from study_people where study_id = #{studyId}
</delete>
<delete id="delStudyFile">
delete from study_file where task_id = #{taskId}
</delete>
<delete id="delStudyDetails">
delete from study_details where study_id = #{studyId} and study_people_id = #{id}
</delete>
<delete id="delStudyFileByFileName">
delete from study_file where file_url = #{fileUrl}
</delete>
<select id="getStudyTaskList" resultType="com.sercurityControl.proteam.study.domain.StudyTaskVo">
select
st.id as id,
st.study_task_name as studyTaskName,
st.study_object as studyObject,
st.publish_user as publishUser,
st.publish_time as publishTime,
st.create_time as createTime,
st.create_user as createUser,
st.publish_status as publishStatus
from study_task st
<where>
<if test="studyTaskName !=null and studyTaskName !=''">
st.study_task_name like concat('%', #{studyTaskName}, '%')
</if>
<if test="publishStatus !=null and publishStatus !=''">
and st.publish_status =#{publishStatus}
</if>
</where>
</select>
<select id="getStudyPeopleList" resultType="com.sercurityControl.proteam.study.domain.StudyTaskRes">
select
ANY_VALUE(sp.id) as studyPeopleId,
ANY_VALUE(sp.study_object) as studyObject,
ANY_VALUE(sp.user_name) as userName,
ANY_VALUE(sp.nick_name) as nickName,
ANY_VALUE(sp.study_status) as studyStatus,
ANY_VALUE(st.study_task_name) as studyTaskName,
ANY_VALUE(st.publish_user) as publishUser,
ANY_VALUE(st.publish_time) as publishTime,
ANY_VALUE(st.id) as studyId
from study_people sp
left join study_task st on sp.study_id = st.id and st.id = #{id}
where sp.study_id = #{id}
<if test="studyStatus != null and studyStatus !=''">
and sp.study_status =#{studyStatus}
</if>
<if test="studyTaskName !=null and studyTaskName !=''">
and st.study_task_name like concat('%', #{studyTaskName}, '%')
</if>
GROUP BY sp.id
</select>
<select id="getStudyDetailsList" resultType="com.sercurityControl.proteam.study.domain.StudyDetailsRes">
select
ANY_VALUE(sd.id) as id,
ANY_VALUE(sf.file_previous_name) as fileName,
ANY_VALUE(sd.study_status) as studyStatus,
ANY_VALUE(sf.file_url) as fileUrl,
ANY_VALUE(sf.file_url_new) as fileUrlNew,
ANY_VALUE(st.study_task_name) as studyTaskName
from study_details sd
left join study_file sf on sd.file_name = sf.file_name
left join study_task st on sd.study_id = st.id
where sd.study_id = #{studyId} and sd.study_people_id = #{studyPeopleId}
group by sd.id
</select>
<select id="getStudyTaskListByUser" resultType="com.sercurityControl.proteam.study.domain.StudyTaskRes">
select
ANY_VALUE(sp.id) as studyPeopleId,
ANY_VALUE(sp.study_status) as studyStatus,
ANY_VALUE(st.study_task_name) as studyTaskName,
ANY_VALUE(st.publish_user) as publishUser,
ANY_VALUE(st.publish_time) as publishTime,
ANY_VALUE(st.id) as studyId
from study_people sp
left join study_task st on sp.study_id = st.id
where sp.user_name = #{userName} and sp.study_object = #{studyObject}
<if test="studyTaskName !=null and studyTaskName !=''">
and st.study_task_name like concat('%', #{studyTaskName}, '%')
</if>
<if test="studyStatus !=null and studyStatus !=''">
and sp.study_status =#{studyStatus}
</if>
group by sp.id
</select>
<select id="getUnfinished" resultType="java.lang.Integer">
select count(*) from study_details where study_id =#{studyId} and study_people_id=#{studyPeopleId} and study_status='0'
</select>
<select id="getFinished" resultType="java.lang.Integer">
select count(*) from study_details where study_id =#{studyId} and study_people_id=#{studyPeopleId} and study_status='1'
</select>
<select id="getStudyTaskById" resultType="com.sercurityControl.proteam.study.domain.StudyTaskVo">
select
st.id as id,
st.study_task_name as studyTaskName,
st.study_object as studyObject,
st.publish_user as publishUser,
st.publish_time as publishTime,
st.create_time as createTime,
st.create_user as createUser,
st.publish_status as publishStatus
from study_task st
where st.id = #{id}
</select>
<select id="getStudyPeopleListByTaskId"
resultType="com.sercurityControl.proteam.study.domain.StudyPeopleVo">
select
sp.id as id,
sp.study_object as studyObject,
sp.user_name as userName,
sp.nick_name as nickName,
sp.study_status as studyStatus
from study_people sp
where sp.study_id = #{id}
</select>
<select id="getStudyFileListByTaskId" resultType="com.sercurityControl.proteam.study.domain.StudyFileVo">
select
sf.id as id,
sf.task_id as taskId,
sf.file_name as fileName,
sf.file_url as fileUrl,
sf.file_previous_name as filePreviousName,
sf.file_url_new as fileUrlNew,
sf.file_size as fileSize
from study_file sf
where sf.task_id = #{id}
</select>
<select id="getStudyUserList" resultType="com.securityControl.system.api.domain.decision.SysUserVo">
select
su.id as userId,
su.user_name as userName,
su.login_name as loginName,
su.role_name as roleName
from sys_user su
left join sys_role sr on sr.id = su.role_id
where sr.role_code = 'ds-001' and sr.status ='0' and su.status='0'
</select>
<select id="countFileNumByTaskId" resultType="java.lang.Integer">
select count(*) from study_file where task_id = #{id}
</select>
<select id="getFileParameter" resultType="java.lang.String">
select remarks from sys_dist where code = #{parameter} and is_flag='0'
</select>
<select id="getStudyPeopleDetailList"
resultType="com.sercurityControl.proteam.study.domain.StudyDetailsRes">
select
ANY_VALUE(sf.file_previous_name) as fileName,
ANY_VALUE(sd.study_status) as studyStatus,
ANY_VALUE(sf.file_url) as fileUrl,
ANY_VALUE(sf.file_url_new) as fileUrlNew,
ANY_VALUE(st.study_task_name) as studyTaskName,
ANY_VALUE(sp.user_name) as userName,
ANY_VALUE(sp.nick_name) as nickName,
ANY_VALUE(sp.study_object) as studyObject
from study_details sd
left join study_file sf on sd.file_name = sf.file_name
left join study_task st on sd.study_id = st.id
left join study_people sp on sd.study_people_id = sp.id
where sd.study_id = #{studyId} and sd.study_people_id = #{studyPeopleId}
GROUP BY sd.id
</select>
<select id="getStudyUserListNew" resultType="com.securityControl.system.api.domain.decision.SysUserVo">
select
ANY_VALUE(su.id) as userId,
ANY_VALUE(coalesce(tub.scheduling_name, su.user_name)) as userName,
ANY_VALUE(su.login_name) as loginName,
ANY_VALUE(su.role_name) as roleName
from sys_user su
left join sys_role sr on sr.id = su.role_id
left join tb_user_banding tub on sr.id = tub.login_user_id
where sr.role_code = 'dcry-001' and sr.status ='0' and su.status='0'
and tub.banding_date BETWEEN #{startTime} AND #{endTime}
group by su.id
</select>
<select id="getDutyPersonVoList" resultType="com.sercurityControl.proteam.dutyTask.domain.DutyPersonVo">
select
id as id,
post as post,
user_name as userName,
create_time as createTime
from tb_duty_person
where post = '值班员' and is_flag='0'
</select>
<select id="getUserBandingByUserId"
resultType="com.sercurityControl.proteam.dutyTask.domain.UserBandingVo">
select
scheduling_id as schedulingId,
scheduling_name as schedulingName
from tb_user_banding where login_user_id = #{id}
and banding_date BETWEEN #{startTime} AND #{endTime}
</select>
<select id="getStudyUserById" resultType="com.securityControl.system.api.domain.decision.SysUserVo">
select
su.id as userId,
su.user_name as userName,
su.login_name as loginName,
sr.role_code as roleName
from sys_user su
left join sys_role sr on sr.id = su.role_id
where sr.status ='0' and su.status='0'
and su.id = #{userId}
</select>
</mapper>