lanan-system/dl-module-inspection/src/main/resources/mapper/inspection/InspectionStaffMapper.xml
2025-02-06 09:11:14 +08:00

122 lines
4.1 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="cn.iocoder.yudao.module.inspection.mapper.InspectionStaffMapper">
<select id="getList" resultType="cn.iocoder.yudao.module.inspection.vo.InspectionStaffSaveVo">
SELECT distinct
su.id,
su.nickname,
su.username,
su.user_type,
su.remark,
su.dept_id,
su.mobile,
su.password,
su.avatar,
su.sex,
su.status,
iss.id_card,
iss.address,
iss.educational,
iss.school,
iss.short_number,
iss.join_date,
iss.probation_period,
iss.social_security_buy_date,
iss.emergency_contact_name,
iss.emergency_contact_phone,
iss.driver_license_type
FROM system_users su
left join system_user_role sur on su.id = sur.user_id
left join system_role sr on sur.role_id = sr.id
left join inspection_staff iss on iss.user_id = su.id
<where>
sr.service_package_id = 'jiance' and sr.code != 'jcyh' and su.deleted = 0
<if test="query.nickname != null and query.nickname != ''">
and su.nickname like concat('%', #{query.nickname}, '%')
</if>
<if test="query.mobile != null and query.mobile != ''">
and su.mobile like concat('%', #{query.mobile}, '%')
</if>
<if test="query.status != null and query.status != ''">
and su.status = #{query.status}
</if>
</where>
</select>
<select id="get" resultType="cn.iocoder.yudao.module.inspection.vo.InspectionStaffSaveVo">
SELECT distinct
su.id as id,
su.nickname,
su.username,
su.user_type,
su.remark,
su.dept_id,
su.mobile,
su.password,
su.avatar,
su.sex,
su.status,
iss.id_card,
iss.address,
iss.educational,
iss.school,
iss.short_number,
iss.join_date,
iss.probation_period,
iss.social_security_buy_date,
iss.emergency_contact_name,
iss.emergency_contact_phone,
iss.driver_license_type,
iss.folder_id
FROM system_users su
left join system_user_role sur on su.id = sur.user_id
left join system_role sr on sur.role_id = sr.id
left join inspection_staff iss on iss.user_id = su.id
<where>
sr.service_package_id = 'jiance' and sr.code != 'jcyh'
and su.id = #{id}
</where>
</select>
<select id="getAll" resultType="cn.iocoder.yudao.module.inspection.vo.InspectionStaffExportVo"
parameterType="cn.iocoder.yudao.module.inspection.query.InspectionStaffQuery">
SELECT distinct
su.id,
su.nickname,
su.username,
su.mobile,
su.avatar,
su.sex,
case sex when 0 then '男' when 1 then '女' end as sexStr,
su.status,
case su.status when 0 then '正常' when 1 then '停用' end as statusStr,
iss.id_card,
iss.address,
iss.educational,
iss.school,
iss.short_number,
iss.join_date,
iss.probation_period,
iss.social_security_buy_date,
iss.emergency_contact_name,
iss.emergency_contact_phone,
iss.driver_license_type
FROM system_users su
left join system_user_role sur on su.id = sur.user_id
left join system_role sr on sur.role_id = sr.id
left join inspection_staff iss on iss.user_id = su.id
<where>
sr.service_package_id = 'jiance' and sr.code != 'jcyh'
<if test="nickname != null and nickname != ''">
and su.nickname like concat('%', #{nickname}, '%')
</if>
<if test="mobile != null and mobile != ''">
and su.mobile like concat('%', #{mobile}, '%')
</if>
<if test="status != null and status != ''">
and su.status = #{status}
</if>
</where>
</select>
</mapper>