select a.id,
a.auto_code,
a.user_id,
a.process_id,
a.process_status,
a.face_img,
a.quality_score,
a.quality_status,
a.quality_checked_at,
a.quality_error_code,
a.quality_device_id,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.tenant_id,
a.process_time,
a.del_flag = '0'
and a.user_id = #{pa.userId}
and a.user_id in
#{v}
and a.process_status = #{pa.processStatus}
and a.quality_status = 'detected' and a.quality_score >= 0.60
and a.quality_status = 'detected' and a.quality_score < 0.60
and a.quality_status = 'failed'
and a.quality_status is null
and a.process_id is not null
u.name as username,
u.avatar as userAvatar,
u.phone as userMobile,
u.dept_id as userDeptId,
u.dept_id as deptId,
d.name as deptName
from sys_user_face a
inner join sys_user u on u.user_id = a.user_id and u.del_flag = '0'
inner join sys_dept d on d.dept_id = u.dept_id and d.del_flag = '0'
and u.name LIKE CONCAT('%', #{pa.username}, '%')
and u.phone LIKE CONCAT('%', #{pa.phone}, '%')
order by a.create_time desc , a.id desc
select count(0) from sys_user_face
select a.user_id, group_concat(a.face_img) as faceImgs
from sys_user_face a
del_flag = '0'
and user_id in
#{v}
GROUP BY a.user_id
u.name as username,
u.phone as userMobile,
u.avatar as userAvatar,
d.dept_id as deptId,
d.name as deptName
from sys_user_face a
inner join sys_user u on u.user_id = a.user_id and u.del_flag = '0'
inner join sys_dept d on d.dept_id = u.dept_id and d.del_flag = '0'
and a.user_id = #{pa.userId}
and a.user_id in
#{v}
and a.process_status = #{pa.processStatus}
and a.process_id is not null
and d.dept_id IN
and d.dept_id NOT IN
and d.dept_id IN
#{v}
order by a.create_time desc, a.id desc
select count(0)
from (
select cast(a.auto_code as unsigned) as numeric_auto_code
from sys_user_face a
inner join sys_user u on u.user_id = a.user_id and u.del_flag = '0'
inner join sys_dept d on d.dept_id = u.dept_id and d.del_flag = '0'
where a.del_flag = '0'
and a.process_status = #{processStatus}
and a.auto_code regexp '^[0-9]+$'
and d.dept_id in
#{deptId}
group by cast(a.auto_code as unsigned)
having count(0) > 1
) duplicate_codes
select coalesce(max(a.id), 0)
from sys_user_face a
inner join sys_user u on u.user_id = a.user_id and u.del_flag = '0'
where a.del_flag = '0'
and a.process_status = #{processStatus}
and u.dept_id in
#{deptId}
and a.user_id = #{userId}
select a.id,
a.auto_code as sampleId,
a.user_id as userId,
u.name as username,
d.dept_id as deptId,
d.name as deptName,
a.face_img as faceImg,
coalesce(a.update_time, a.create_time) as sourceUpdatedAt
from sys_user_face a
inner join sys_user u on u.user_id = a.user_id and u.del_flag = '0'
inner join sys_dept d on d.dept_id = u.dept_id and d.del_flag = '0'
where a.del_flag = '0'
and a.process_status = #{processStatus}
and a.id > #{afterId}
and a.id <= #{snapshotMaxId}
and d.dept_id in
#{deptId}
and a.user_id = #{userId}
order by a.id asc
limit #{fetchSize}
select user_id as userId,
sum(case when process_status = #{availableStatus} then 1 else 0 end) as availableCount,
sum(case when process_status = #{pendingStatus} then 1 else 0 end) as pendingCount
from sys_user_face
where del_flag = '0'
and user_id in
#{userId}
and process_status in (#{availableStatus}, #{pendingStatus})
group by user_id