<?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.thhy.secure.modules.biz.train.mapper.TSecureTrainMapper">
|
<resultMap id="BaseResultMap" type="com.thhy.secure.modules.biz.train.entity.TSecureTrain">
|
<!--
|
WARNING - @mbg.generated
|
This element is automatically generated by MyBatis Generator, do not modify.
|
This element was generated on Fri May 26 12:59:50 CST 2023.
|
-->
|
<id column="secure_id" jdbcType="VARCHAR" property="secureId" />
|
<result column="secure_name" jdbcType="VARCHAR" property="secureName" />
|
<result column="secure_type" jdbcType="VARCHAR" property="secureType" />
|
<result column="secure_time" jdbcType="TIMESTAMP" property="secureTime" />
|
<result column="company_id" jdbcType="VARCHAR" property="companyId" />
|
<result column="is_use" jdbcType="INTEGER" property="isUse" />
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
|
</resultMap>
|
|
|
<insert id="secureTrainInsert" >
|
insert into t_secure_train
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="secureId != null">
|
secure_id,
|
</if>
|
<if test="secureName != null">
|
secure_name,
|
</if>
|
<if test="secureType != null">
|
secure_type,
|
</if>
|
<if test="secureTime != null">
|
secure_time,
|
</if>
|
<if test="companyId != null">
|
company_id,
|
</if>
|
<if test="isUse != null">
|
is_use,
|
</if>
|
<if test="createTime != null">
|
create_time,
|
</if>
|
<if test="createUser != null">
|
create_user,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="secureId != null">
|
#{secureId,jdbcType=VARCHAR},
|
</if>
|
<if test="secureName != null">
|
#{secureName,jdbcType=VARCHAR},
|
</if>
|
<if test="secureType != null">
|
#{secureType,jdbcType=VARCHAR},
|
</if>
|
<if test="secureTime != null">
|
#{secureTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="companyId != null">
|
#{companyId,jdbcType=VARCHAR},
|
</if>
|
<if test="isUse != null">
|
#{isUse,jdbcType=INTEGER},
|
</if>
|
<if test="createTime != null">
|
#{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createUser != null">
|
#{createUser,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
|
<insert id="secureTrainPathInsert">
|
insert into t_secure_path
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="securePathId != null">
|
secure_path_id,
|
</if>
|
<if test="secureId != null">
|
secure_id,
|
</if>
|
<if test="securePathVideo != null">
|
secure_path_video,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="securePathId != null">
|
#{securePathId,jdbcType=VARCHAR},
|
</if>
|
<if test="secureId != null">
|
#{secureId,jdbcType=VARCHAR},
|
</if>
|
<if test="securePathVideo != null">
|
#{securePathVideo,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
<select id="secureTrainList" resultType="com.thhy.secure.modules.biz.train.entity.TSecureTrain">
|
SELECT
|
tst.secure_id as secureId,
|
tst.secure_name as secureName,
|
sd.dict_name as dictName,
|
tst.secure_time as secureTime
|
FROM
|
t_secure_train tst
|
LEFT JOIN sys_dict sd ON tst.secure_type = sd.dict_id
|
where tst.is_use=1
|
<if test="companyId!=null and companyId!='' ">
|
and tst.company_id=#{companyId}
|
</if>
|
<if test="secureName!=null and secureName!='' ">
|
and tst.secure_name like concat('%',#{secureName},'%')
|
</if>
|
<if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
|
and tst.secure_time between #{strTime} and #{endTime}
|
</if>
|
order by tst.create_time desc
|
</select>
|
|
<select id="totalsSum" resultType="java.lang.String">
|
SELECT
|
count( ppu.user_id ) AS suma
|
FROM
|
t_secure_group tsg
|
LEFT JOIN sys_plat_position_user ppu ON tsg.group_id = ppu.position_id
|
LEFT JOIN sys_position sp ON ppu.position_id = sp.pos_id
|
where 1=1
|
<if test="secureId!=null and secureId!='' ">
|
and tsg.secure_id=#{secureId}
|
</if>
|
<if test="companyId!=null and companyId!='' ">
|
and sp.company_id=#{companyId}
|
</if>
|
GROUP BY
|
tsg.secure_id
|
</select>
|
<select id="completesSum" parameterType="java.lang.String" resultType="java.lang.String">
|
SELECT
|
COUNT( tsr.user_id ) as completes
|
FROM
|
t_secure_record tsr
|
where tsr.secure_id=#{secureId}
|
GROUP BY
|
tsr.secure_id
|
</select>
|
|
<select id="secureTrainInfo" parameterType="java.lang.String" resultType="com.thhy.secure.modules.biz.train.entity.dto.SecureTrainDto">
|
SELECT
|
tst.secure_id as secureId,
|
tst.secure_name as secureName,
|
sd.dict_name as dictName,
|
tst.secure_type as secureType,
|
tst.secure_time as secureTime
|
FROM
|
t_secure_train tst
|
LEFT JOIN sys_dict sd ON tst.secure_type = sd.dict_id
|
where tst.is_use=1
|
<if test="secureId!=null and secureId!='' ">
|
and tst.secure_id=#{secureId}
|
</if>
|
</select>
|
|
<select id="securePath" parameterType="java.lang.String" resultType="com.thhy.secure.modules.biz.train.entity.dto.SecurePathDto">
|
select secure_path_video as securePathVideo from t_secure_path
|
where secure_id=#{secureId}
|
</select>
|
<select id="secureGroup" parameterType="java.lang.String" resultType="com.thhy.secure.modules.biz.train.entity.dto.SecureGroupDto">
|
select tsg.group_id as groupId,
|
sp.pos_name as groupName
|
from t_secure_group tsg
|
left join sys_position sp
|
on tsg.group_id=sp.pos_id
|
where tsg.secure_id=#{secureId}
|
</select>
|
|
<select id="secureTrainPull" resultType="com.thhy.secure.modules.biz.train.entity.dto.SecureTrainDto">
|
select
|
secure_id as secureId,
|
secure_name as secureName
|
from
|
t_secure_train
|
where is_use=1
|
<if test="companyId!=null and companyId!='' ">
|
and company_id=#{companyId}
|
</if>
|
<if test="secureType!=null and secureType!='' ">
|
and secure_type=#{secureType}
|
</if>
|
</select>
|
<update id="secureTrainDel" >
|
update t_secure_train set is_use=2
|
where secure_id=#{secureId}
|
</update>
|
|
<select id="secureTrainRecord" parameterType="java.lang.String" resultType="com.thhy.secure.modules.biz.train.entity.dto.SecureGroupUserDto">
|
SELECT
|
tsr.user_id as userId,
|
spu.real_name as realName,
|
spu.phone as phone,
|
sp.pos_name as posName,
|
tsr.create_time as createTime,
|
group_concat(sg.group_name) as groupName
|
FROM
|
t_secure_record tsr
|
LEFT JOIN sys_users su ON tsr.user_id = su.user_id
|
LEFT JOIN sys_plat_user spu ON su.plat_id = spu.user_id
|
LEFT JOIN sys_plat_position_user pu ON su.plat_id = pu.user_id
|
LEFT JOIN sys_position sp ON pu.position_id = sp.pos_id
|
LEFT JOIN sys_group_user sgu ON spu.user_id = sgu.user_id
|
LEFT JOIN sys_group sg ON sgu.group_id = sg.group_id
|
where 1=1
|
<if test="secureId!=null and secureId!='' ">
|
and tsr.secure_id=#{secureId}
|
</if>
|
<if test="groupId!=null and groupId!='' ">
|
and sg.group_id=#{groupId}
|
</if>
|
<if test="realName!=null and realName!='' ">
|
and spu.real_name like concat('%',#{realName},'%')
|
</if>
|
GROUP BY
|
tsr.user_id,
|
sp.pos_id,tsr.create_time
|
</select>
|
<update id="secureTrainUpdate" >
|
update t_secure_train
|
<set>
|
<if test="secureName != null">
|
secure_name = #{secureName,jdbcType=VARCHAR},
|
</if>
|
<if test="secureType != null">
|
secure_type = #{secureType,jdbcType=VARCHAR},
|
</if>
|
<if test="secureTime != null">
|
secure_time = #{secureTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="companyId != null">
|
company_id = #{companyId,jdbcType=VARCHAR},
|
</if>
|
<if test="isUse != null">
|
is_use = #{isUse,jdbcType=INTEGER},
|
</if>
|
<if test="createTime != null">
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="createUser != null">
|
create_user = #{createUser,jdbcType=VARCHAR},
|
</if>
|
</set>
|
where secure_id = #{secureId,jdbcType=VARCHAR}
|
</update>
|
<delete id="secureTrainGroupDel" parameterType="java.lang.String">
|
delete from t_secure_group where secure_id=#{secureId}
|
</delete>
|
<delete id="secureTrainPathDel" parameterType="java.lang.String">
|
delete from t_secure_path where secure_id=#{secureId}
|
</delete>
|
<insert id="secureTrainGroupInsert">
|
insert into t_secure_group
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="secureGroupId != null">
|
secure_group_id,
|
</if>
|
<if test="secureId != null">
|
secure_id,
|
</if>
|
<if test="groupId != null">
|
group_id,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="secureGroupId != null">
|
#{secureGroupId,jdbcType=VARCHAR},
|
</if>
|
<if test="secureId != null">
|
#{secureId,jdbcType=VARCHAR},
|
</if>
|
<if test="groupId != null">
|
#{groupId,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
<select id="secureTrainUserInfo" parameterType="java.lang.String" resultType="com.thhy.secure.modules.biz.train.entity.OpenUserInfo">
|
select
|
spu.job_num as jobNum,
|
spu.real_name as realName,
|
spu.sex as sex,
|
spu.photo,
|
sp.pos_name as posName,
|
sd.depart_name as departName,
|
spu.user_id as userId,
|
100 as an
|
from sys_plat_user spu left join
|
sys_plat_position_user sppu on spu.user_id=sppu.user_id
|
left join sys_position sp on sp.pos_id=sppu.position_id
|
left join sys_depart_user sdu on spu.user_id=sdu.user_id
|
left join sys_depart sd on sdu.depart_id=sd.depart_id
|
where 1=1
|
<if test="openId!=null and openId!='' ">
|
and spu.open_id=#{openId}
|
</if>
|
<if test="userId!=null and userId!='' ">
|
and spu.user_id=#{userId}
|
</if>
|
</select>
|
<select id="platId" parameterType="java.lang.String" resultType="java.lang.String">
|
select plat_id from sys_users where user_id=#{userId}
|
</select>
|
|
<select id="secureTrainUser" resultType="com.thhy.secure.modules.biz.train.entity.dto.SecureTrainUserDto">
|
SELECT
|
tst.secure_id AS secureId,
|
tst.secure_name AS secureName,
|
tst.secure_type AS secureType,
|
tst.secure_time AS secureTime,
|
sd.dict_name AS dictName
|
FROM
|
t_secure_train tst
|
LEFT JOIN t_secure_group tsg ON tst.secure_id = tsg.secure_id
|
LEFT JOIN sys_position sp ON tsg.group_id = sp.pos_id
|
LEFT JOIN sys_plat_position_user ppu ON sp.pos_id = ppu.position_id
|
LEFT JOIN sys_dict sd ON tst.secure_type = sd.dict_id
|
WHERE
|
tst.is_use = 1
|
<if test="companyId!=null and companyId!='' ">
|
AND tst.company_id = #{companyId}
|
</if>
|
<if test="platId!=null and platId!='' ">
|
AND ppu.user_id =#{platId}
|
</if>
|
GROUP BY tst.secure_id
|
</select>
|
|
<select id="secureRecord" parameterType="java.lang.String" resultType="java.lang.String">
|
select secure_id from t_secure_record where user_id=#{userId} group by secure_id
|
</select>
|
<insert id="secureTrainRecordInsert" >
|
insert into t_secure_record
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="recordId != null">
|
record_id,
|
</if>
|
<if test="secureId != null">
|
secure_id,
|
</if>
|
<if test="userId != null">
|
user_id,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="recordId != null">
|
#{recordId,jdbcType=VARCHAR},
|
</if>
|
<if test="secureId != null">
|
#{secureId,jdbcType=VARCHAR},
|
</if>
|
<if test="userId != null">
|
#{userId,jdbcType=VARCHAR},
|
</if>
|
</trim>
|
</insert>
|
|
</mapper>
|