systemxml改造

This commit is contained in:
wanghao
2026-03-04 14:59:45 +08:00
parent 61045e4389
commit b751f40bb4
9 changed files with 53 additions and 48 deletions
@@ -116,22 +116,22 @@
<select id="selectWrapper" resultType="org.jeecg.modules.system.entity.DetailVO">
SELECT * FROM `remote_weight_manufacturer_one` one LEFT JOIN sys_user user ON one.card_number = user.id_card
SELECT * FROM remote_weight_manufacturer_one one LEFT JOIN sys_user su ON one.card_number = su.id_card
<where>
<if test="dto.code != null and dto.code != ''">
AND one.device_code = #{dto.code}
</if>
<if test="dto.orgCode != null and dto.orgCode != ''">
AND user.org_code like CONCAT(#{dto.orgCode},'%')
AND su.org_code like CONCAT(#{dto.orgCode},'%')
</if>
<if test="dto.realName != null and dto.realName != ''">
AND user.realname like CONCAT('%', #{dto.realName}, '%')
AND su.realname like CONCAT('%', #{dto.realName}, '%')
</if>
<if test="dto.workNo != null and dto.workNo != ''">
AND user.work_no like CONCAT('%', #{dto.workNo}, '%')
AND su.work_no like CONCAT('%', #{dto.workNo}, '%')
</if>
<if test="dto.sex != null and dto.sex != ''">
AND user.sex = #{dto.sex}
AND su.sex = #{dto.sex}
</if>
<if test="dto.startDate != null and dto.startDate != '' and dto.endDate != null and dto.endDate != ''">
AND exam_time between #{dto.startDate} and #{dto.endDate}
@@ -44,7 +44,7 @@
<where>
and a.del_flag = '0'
<if test="healthUserDoctorEx.id != null and healthUserDoctorEx.id != ''">
and FIND_IN_SET(a.id,#{#{healthUserDoctorEx.id}})
and INSTR(',' || #{healthUserDoctorEx.id} || ',', ',' || a.id || ',') > 0
</if>
<if test="healthUserDoctorEx.hospitalId != null and healthUserDoctorEx.hospitalId != ''">
and a.hospital_id = #{healthUserDoctorEx.hospitalId}
@@ -2,10 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.system.mapper.HealthUserEmployeeExMapper">
<sql id="UserEmployeeCols">
a
.
id
,
a.id,
emp_id,
emp_no,
emp_sysno,
@@ -66,7 +63,7 @@
medical_work_type_other,
username,
realname,
`password`,
password,
salt,
avatar,
birthday,
@@ -87,7 +84,7 @@
client_id,
login_tenant_id,
bpm_status,
`status`,
status,
b.del_flag,
create_by,
create_time,
@@ -315,9 +312,11 @@
<choose>
<when test="filter.idList != null and !filter.idList.isEmpty()">
order by
FIELD(b.id, <foreach collection="filter.idList" item="id" separator="," open="" close="">
#{id}
</foreach>) ASC, b.create_time DESC
CASE b.id
<foreach collection="filter.idList" item="id" index="idx" separator=" ">
WHEN #{id} THEN #{idx}
</foreach>
ELSE 99999 END ASC, b.create_time DESC
</when>
<otherwise>
order by b.create_time DESC
@@ -616,7 +615,7 @@
t2.org_code,
t2.sex,
t2.id_card,
IF(t2.user_group IS NULL OR t2.user_group = '', 'e', t2.user_group) AS userGroup,
CASE WHEN t2.user_group IS NULL OR t2.user_group = '' THEN 'e' ELSE t2.user_group END AS userGroup,
t2.user_group,
t2.user_group_update_time,
t2.avatar,
@@ -1101,15 +1100,21 @@
<update id="updateAge">
UPDATE health_user_employee_ex he
JOIN sys_user su
ON he.id = su.id
SET he.current_age = FLOOR(DATEDIFF(CURDATE(), STR_TO_DATE(SUBSTRING (REPLACE(su.id_card, ' ', ''), 7, 8), '%Y%m%d')) / 365)
WHERE
LENGTH (REPLACE(su.id_card
, ' '
, '')) = 18
and su.person_type = '1'
and su.del_flag = 0;
SET he.current_age = (
SELECT FLOOR((CURRENT_DATE - TO_DATE(SUBSTRING(REPLACE(su.id_card, ' ', ''), 7, 8), 'YYYYMMDD')) / 365)
FROM sys_user su
WHERE he.id = su.id
AND LENGTH(REPLACE(su.id_card, ' ', '')) = 18
AND su.person_type = '1'
AND su.del_flag = 0
)
WHERE EXISTS (
SELECT 1 FROM sys_user su
WHERE he.id = su.id
AND LENGTH(REPLACE(su.id_card, ' ', '')) = 18
AND su.person_type = '1'
AND su.del_flag = 0
)
</update>
</mapper>
@@ -46,7 +46,7 @@
<where>
and a.del_flag = '0'
<if test="healthUserOperatorEx.userId != null and healthUserOperatorEx.userId != ''">
and FIND_IN_SET(a.user_id,#{healthUserOperatorEx.userId})
and INSTR(',' || #{healthUserOperatorEx.userId} || ',', ',' || a.user_id || ',') > 0
</if>
<if test="healthUserOperatorEx.userType != null and healthUserOperatorEx.userType != ''">
and a.user_type = #{healthUserOperatorEx.userType}
@@ -9,7 +9,7 @@
t2.work_no,
t2.org_code as userOrgCode
FROM
`scale_personal` t1
scale_personal t1
LEFT JOIN sys_user t2 on t1.bind_user_id = t2.id
<where>
<if test="managedCodes != null and managedCodes.size() > 0">
@@ -74,7 +74,7 @@
AND t2.org_code like CONCAT(#{filter.userOrgCode}, '%')
</if>
</where>
ORDER BY IF(t1.bind_user_id IS NOT NULL AND t1.bind_user_id != '', 0, 1)
ORDER BY CASE WHEN t1.bind_user_id IS NOT NULL AND t1.bind_user_id != '' THEN 0 ELSE 1 END
</select>
<select id="getUserInfoBySnCode" resultType="org.jeecg.modules.system.bean.response.ScalePersonalUserInfo">
@@ -107,7 +107,7 @@
and status = 1
and depart_ids is not null
and depart_ids != ''
and FIND_IN_SET(#{departId}, depart_ids) > 0
and INSTR(',' || depart_ids || ',', ',' || #{departId} || ',') > 0
<if test="name != null and name != '' ">
and realname like CONCAT('%',#{name},'%')
</if>
@@ -136,10 +136,10 @@
where sd.del_flag = '0' and sd.status = '1'
</select>
<select id="queryDepartIdsByCodes" resultType="java.lang.String" parameterType="java.lang.String">
select GROUP_CONCAT(id) from sys_depart where FIND_IN_SET(org_code,#{orgCodes})>0
select LISTAGG(id, ',') WITHIN GROUP (ORDER BY id) from sys_depart where INSTR(',' || #{orgCodes} || ',', ',' || org_code || ',') > 0
</select>
<select id="queryCodesByDepartIds" resultType="java.lang.String" parameterType="java.lang.String">
select GROUP_CONCAT(org_code) from sys_depart where FIND_IN_SET(id,#{departIds})>0
select LISTAGG(org_code, ',') WITHIN GROUP (ORDER BY org_code) from sys_depart where INSTR(',' || #{departIds} || ',', ',' || id || ',') > 0
</select>
<insert id="insertGps">
insert into sys_depart_gps (id, depart_id, lng, lat)
@@ -165,7 +165,7 @@
b.lng,
b.lat
from sys_depart a left join sys_depart_gps b on a.id = b.depart_id
where FIND_IN_SET(a.id,#{departId})
where INSTR(',' || #{departId} || ',', ',' || a.id || ',') > 0
</select>
@@ -12,6 +12,6 @@
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, app_package, redeem_code, `status`, use_time
id, app_package, redeem_code, status, use_time
</sql>
</mapper>
@@ -55,7 +55,7 @@
t3.realname AS applyUserName,
t5.realname AS opUserName,
t4.current_age AS age
FROM `sys_user_depart_change_apply` t1
FROM sys_user_depart_change_apply t1
LEFT JOIN sys_user t2 ON t1.user_id = t2.id
LEFT JOIN sys_user t3 ON t1.apply_user_id = t3.id
LEFT JOIN health_user_employee_ex t4 ON t1.user_id = t4.id
@@ -137,7 +137,7 @@
user_id,
create_time
FROM
`sys_user_depart_change_apply`
sys_user_depart_change_apply
</sql>
<sql id="statWhereSql">
and create_time between #{beginOfYear} and #{endOfYear}
@@ -275,7 +275,7 @@
<select id="selectGroupIdByName" resultType="String">
select
GROUP_CONCAT(id)
LISTAGG(id, ',') WITHIN GROUP (ORDER BY id)
from sys_user
where realname LIKE concat(concat('%',#{realName}),'%')
</select>
@@ -400,11 +400,11 @@
select id as "userId",
org_code as "orgCode"
from sys_user
where FIND_IN_SET(id,#{userIds})
where INSTR(',' || #{userIds} || ',', ',' || id || ',') > 0
</select>
<select id="getUserNumByOrgCodeList" resultType="java.util.HashMap">
SELECT org_code as orgCode, count(org_code) as num
FROM `sys_user`
FROM sys_user
WHERE org_code LIKE
<foreach collection="orgCodeList" item="orgCode" separator=" OR " open="(" close=")">
CONCAT('', #{orgCode}, '%')
@@ -582,24 +582,24 @@
</select>
<select id="checkExistUser" resultType="org.jeecg.bean.response.CheckExistUserRes">
SELECT 'account' ,1 as count
SELECT 'account' as account, 1 as count
<if test="userName != null and userName != ''">
UNION ALL
select 'userName', count(1) as count FROM sys_user WHERE username = #{userName} and del_flag = 0
select 'userName' as account, CAST(count(1) AS INT) as count FROM sys_user WHERE username = #{userName} and del_flag = 0
<if test="existUserId != null and existUserId != ''">
and id != #{existUserId}
</if>
</if>
<if test="mobile != null and mobile != ''">
UNION ALL
select 'mobile', count(1) as count FROM sys_user WHERE phone = #{mobile} and del_flag = 0
select 'mobile' as account, CAST(count(1) AS INT) as count FROM sys_user WHERE phone = #{mobile} and del_flag = 0
<if test="existUserId != null and existUserId != ''">
and id != #{existUserId}
</if>
</if>
<if test="idCard != null and idCard != ''">
UNION ALL
select 'idCard', count(1) as count FROM sys_user WHERE id_card = #{idCard} and del_flag = 0
select 'idCard' as account, CAST(count(1) AS INT) as count FROM sys_user WHERE id_card = #{idCard} and del_flag = 0
<if test="existUserId != null and existUserId != ''">
and id != #{existUserId}
</if>
@@ -1016,7 +1016,7 @@
LEFT JOIN health_user_employee_ex e on u.id = e.id
WHERE 1=1
<if test="ex.sex != null and ex.sex != ''">
AND FIND_IN_SET(u.sex, #{ex.sex})
AND INSTR(',' || #{ex.sex} || ',', ',' || u.sex || ',') > 0
</if>
<if test="ex.dataAgeAnalysis != null and ex.dataAgeAnalysis != ''">
AND (
@@ -1029,19 +1029,19 @@
)
</if>
<if test="ex.empNation != null and ex.empNation != ''">
AND FIND_IN_SET(e.emp_nation, #{ex.empNation})
AND INSTR(',' || #{ex.empNation} || ',', ',' || e.emp_nation || ',') > 0
</if>
<if test="ex.empPolitical != null and ex.empPolitical != ''">
AND FIND_IN_SET(e.emp_political, #{ex.empPolitical})
AND INSTR(',' || #{ex.empPolitical} || ',', ',' || e.emp_political || ',') > 0
</if>
<if test="ex.jobLevel != null and ex.jobLevel != ''">
AND FIND_IN_SET(e.job_level, #{ex.jobLevel})
AND INSTR(',' || #{ex.jobLevel} || ',', ',' || e.job_level || ',') > 0
</if>
<if test="ex.empMarriage != null and ex.empMarriage != ''">
AND FIND_IN_SET(e.emp_marriage, #{ex.empMarriage})
AND INSTR(',' || #{ex.empMarriage} || ',', ',' || e.emp_marriage || ',') > 0
</if>
<if test="ex.userGroup != null and ex.userGroup != ''">
AND FIND_IN_SET(u.user_group, #{ex.userGroup})
AND INSTR(',' || #{ex.userGroup} || ',', ',' || u.user_group || ',') > 0
</if>
<if test="ex.orgCodeList != null and ex.orgCodeList.size() > 0">
AND (