清理过期人脸

This commit is contained in:
2025-02-26 13:43:54 +08:00
parent 99f5adf841
commit 0aadd1d064
4 changed files with 52 additions and 7 deletions

View File

@ -30,11 +30,11 @@
update face set finished_journey = 1 where id = #{id}
</update>
<delete id="deleteById">
delete from face where id = #{id}
update face set is_delete = 1 where id = #{id}
</delete>
<delete id="deleteByIds">
<if test="list!= null and list.size() > 0">
delete from face where id in (
update face set is_delete = 1 where id in (
<foreach collection="list" item="id" separator=",">
#{id}
</foreach>
@ -45,9 +45,13 @@
select id, scenic_id, member_id, face_url,score, match_sample_ids, first_match_rate, match_result
from face
<where>
is_delete = 0
<if test="memberId!= null and memberId!= ''">
and member_id = #{memberId}
</if>
<if test="scenicId!= null">
and scenic_id = #{scenicId}
</if>
<if test="matchSampleIds!= null and matchSampleIds!= ''">
and match_sample_ids like concat('%', #{matchSampleIds}, '%')
</if>
@ -63,6 +67,12 @@
<if test="endTime!=null">
and create_at &lt;= #{endTime}
</if>
<if test="updateStartTime!=null">
and update_at >= #{updateStartTime}
</if>
<if test="updateEndTime!=null">
and update_at &lt;= #{updateEndTime}
</if>
</where>
</select>
<select id="getById" resultType="com.ycwl.basic.model.pc.face.resp.FaceRespVO">
@ -73,19 +83,19 @@
<select id="getLatestByMemberId" resultType="com.ycwl.basic.model.pc.face.resp.FaceRespVO">
select id, scenic_id, member_id, face_url,score, match_sample_ids, first_match_rate, match_result, create_at, update_at
from face
where member_id = #{userId} and scenic_id = #{scenicId}
where member_id = #{userId} and scenic_id = #{scenicId} and is_delete = 0
order by update_at desc
limit 1
</select>
<select id="listByScenicIdAndNotFinished" resultType="com.ycwl.basic.model.pc.face.resp.FaceRespVO">
select id, scenic_id, member_id, face_url,score, match_sample_ids, first_match_rate, match_result, create_at, update_at
from face
where scenic_id = #{scenicId} and finished_journey != 1
where scenic_id = #{scenicId} and finished_journey != 1 and is_delete = 0
</select>
<select id="findLastFaceByUserId" resultType="com.ycwl.basic.model.pc.face.resp.FaceRespVO">
select id, scenic_id, member_id, face_url,score, match_sample_ids, first_match_rate, match_result, create_at, update_at
from face
where member_id = #{userId}
where member_id = #{userId} and is_delete = 0
order by update_at desc
limit 1
</select>
@ -97,13 +107,13 @@
<select id="listByScenicAndUserId" resultType="com.ycwl.basic.model.pc.face.resp.FaceRespVO">
select id, face_url, create_at, update_at
from face
where member_id = #{userId} and scenic_id = #{scenicId}
where member_id = #{userId} and scenic_id = #{scenicId} and is_delete = 0
order by update_at desc
</select>
<select id="findLastFaceByScenicAndUserId" resultType="com.ycwl.basic.model.pc.face.resp.FaceRespVO">
select id, scenic_id, member_id, face_url,score, match_sample_ids, first_match_rate, match_result, create_at, update_at
from face
where member_id = #{userId} and scenic_id = #{scenicId}
where member_id = #{userId} and scenic_id = #{scenicId} and is_delete = 0
order by update_at desc
limit 1
</select>