zcloud_gbs_edu/web-infrastructure/src/main/resources/mapper/TrainingUserMapper.xml

209 lines
6.6 KiB
XML
Raw Normal View History

2026-01-22 08:25:32 +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.zcloud.edu.persistence.mapper.TrainingUserMapper">
<update id="updateTime">
update training_user
<set>
start_time = #{params.startTime},
end_time = #{params.endTime}
</set>
<where>
phone = #{params.phone}
and ( end_time is null or end_time &lt; #{params.endTime})
</where>
</update>
2026-03-17 17:40:52 +08:00
<select id="listAllByPhones" resultType="com.zcloud.edu.persistence.dataobject.TrainingUserDO">
select
phone,
start_time,
end_time,
case when start_time &lt; now() and end_time > now() then 1 else 0 end stateFlag
from
training_user
<where>
delete_enum = 'false'
<if test="params.phones != null">
and phone in
<foreach item="phone" collection="params.phones" open="(" separator="," close=")">
#{phone}
</foreach>
</if>
</where>
</select>
<select id="listEduUserPage" resultType="com.zcloud.edu.persistence.dataobject.TrainingUserDO">
select
u.id,
u.user_id,
u.username,
u.name,
u.corpinfo_id,
u.password,
u.main_corp_flag,
u.user_type,
u.department_id,
u.post_id,
u.post_name,
u.role_id,
u.email,
u.personnel_type,
u.personnel_type_name,
u.nation,
u.nation_name,
u.user_id_card,
u.user_avatar_url,
u.current_address,
u.location_address,
u.rank_level,
u.rank_level_name,
u.sort,
u.department_leader_flag,
u.deputy_leader_flag,
u.cultural_level,
u.cultural_level_name,
u.marital_status,
u.marital_status_name,
u.political_affiliation,
u.political_affiliation_name,
u.employment_flag,
u.flow_flag,
u.rz_flag,
u.version,
u.create_id,
u.create_name,
u.create_time,
u.update_id,
u.update_name,
u.update_time,
u.remarks,
u.delete_enum,
u.tenant_id,
u.org_id,
u.env,
u.open_id,
tu.phone,
case when tu.start_time &lt; now() and tu.end_time > now() then 1 else 0 end stateFlag
from
user u
left join training_user tu on tu.phone = u.username and tu.delete_enum = 'FALSE'
<where>
and u.delete_enum = 'FALSE'
<if test="params.noMain != null">
and u.id != u.corpinfo_id
</if>
<if test="params.name != null and params.name != ''">
and u.name LIKE CONCAT('%', #{params.name}, '%')
</if>
<if test="params.corpinfoId != null">
and u.corpinfo_id = #{params.corpinfoId}
</if>
<if test="params.flowFlag != null">
and u.flow_flag = #{params.flowFlag}
</if>
<if test="params.eqEmploymentFlag != null">
and u.employment_flag = #{params.eqEmploymentFlag}
</if>
<if test="params.departmentList != null and params.departmentList.size() > 0">
and u.department_id in
<foreach item="item" index="index" collection="params.departmentList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
group by u.id
order by u.create_time desc
</select>
2026-03-17 17:40:52 +08:00
<select id="listEduUser" resultType="com.zcloud.edu.persistence.dataobject.TrainingUserDO">
select
u.id,
u.user_id,
u.username,
u.name,
u.corpinfo_id,
u.password,
u.main_corp_flag,
u.user_type,
u.department_id,
u.post_id,
u.post_name,
u.role_id,
u.email,
u.personnel_type,
u.personnel_type_name,
u.nation,
u.nation_name,
u.user_id_card,
u.user_avatar_url,
u.current_address,
u.location_address,
u.rank_level,
u.rank_level_name,
u.sort,
u.department_leader_flag,
u.deputy_leader_flag,
u.cultural_level,
u.cultural_level_name,
u.marital_status,
u.marital_status_name,
u.political_affiliation,
u.political_affiliation_name,
u.employment_flag,
u.flow_flag,
u.rz_flag,
u.version,
u.create_id,
u.create_name,
u.create_time,
u.update_id,
u.update_name,
u.update_time,
u.remarks,
u.delete_enum,
u.tenant_id,
u.org_id,
u.env,
u.open_id,
tu.phone,
case when tu.start_time &lt; now() and tu.end_time > now() then 1 else 0 end stateFlag
from
user u
left join training_user tu on tu.phone = u.username and tu.delete_enum = 'FALSE'
<where>
and u.delete_enum = 'FALSE'
<if test="params.noMain != null">
and u.id != u.corpinfo_id
</if>
<if test="params.name != null and params.name != ''">
AND u.name LIKE CONCAT('%', #{params.name}, '%')
</if>
<if test="params.corpinfoId != null">
and u.corpinfo_id = #{params.corpinfoId}
</if>
<if test="params.flowFlag != null">
and u.flow_flag = #{params.flowFlag}
</if>
<if test="params.eqEmploymentFlag != null">
and u.employment_flag = #{params.eqEmploymentFlag}
</if>
<if test="params.departmentList != null and params.departmentList.size() > 0">
and u.department_id in
<foreach item="item" index="index" collection="params.departmentList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
2026-03-17 17:40:52 +08:00
</where>
group by u.id
order by u.create_time desc
2026-03-17 17:40:52 +08:00
</select>
2026-01-22 08:25:32 +08:00
</mapper>