Files
FrameTour-BE/src/main/resources/mapper/FaceSampleMapper.xml
Jerry Yan dbe0447987 refactor(pc): 移除日志记录并优化数据查询
- 移除了多个控制器和服务类中的冗余日志记录
- 在查询数据时,不再通过 SQL左连接直接获取景点和设备名称,而是使用 Repository 单独查询
- 更新了 FaceSampleMapper、
2025-09-04 15:57:18 +08:00

107 lines
4.0 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="com.ycwl.basic.mapper.FaceSampleMapper">
<insert id="add">
insert into face_sample(id, scenic_id, device_id, face_url, match_sample_ids, first_match_rate, match_result,`status`, create_at)
values (#{id}, #{scenicId}, #{deviceId}, #{faceUrl}, #{matchSampleIds}, #{firstMatchRate}, #{matchResult},#{status},#{createAt})
</insert>
<update id="update">
update face_sample
<set>
<if test="scenicId!= null ">
scenic_id = #{scenicId},
</if>
<if test="deviceId!= null ">
device_id = #{deviceId},
</if>
<if test="faceUrl!= null and faceUrl!= ''">
face_url = #{faceUrl},
</if>
<if test="matchSampleIds!= null and matchSampleIds!= ''">
match_sample_ids = #{matchSampleIds},
</if>
<if test="firstMatchRate!= null ">
first_match_rate = #{firstMatchRate},
</if>
<if test="matchResult!= null and matchResult!= ''">
match_result = #{matchResult},
</if>
<if test="status!= null ">
`status` = #{status},
</if>
<if test="score!= null ">
`score` = #{score},
</if>
update_at = now(),
</set>
where id = #{id}
</update>
<update id="updateScore">
update face_sample
set score = #{score}
where id = #{id}
</update>
<delete id="deleteById">
delete from face_sample where id = #{id}
</delete>
<delete id="deleteByIds">
<if test="list!= null and list.size() > 0">
delete from face_sample where id in (
<foreach collection="list" item="id" separator=",">
#{id}
</foreach>
)
</if>
</delete>
<select id="list" resultType="com.ycwl.basic.model.pc.faceSample.resp.FaceSampleRespVO">
select f.id, f.scenic_id, device_id, face_url, f.score, match_sample_ids, first_match_rate, match_result, f.`status`, f.create_at
from face_sample f
<where>
<if test="scenicId!= null and scenicId!= ''">
and f.scenic_id = #{scenicId}
</if>
<if test="deviceId!= null and deviceId!= ''">
and device_id = #{deviceId}
</if>
<if test="matchSampleIds!= null and matchSampleIds!= ''">
and match_sample_ids like concat('%', #{matchSampleIds}, '%')
</if>
<if test="startTime!=null">
and f.create_at >= #{startTime}
</if>
<if test="endTime!=null">
and f.create_at &lt;= #{endTime}
</if>
<if test="status!= null ">
and f.`status` = #{status}
</if>
</where>
ORDER BY f.create_at desc
</select>
<select id="getById" resultType="com.ycwl.basic.model.pc.faceSample.resp.FaceSampleRespVO">
select id, scenic_id, device_id, face_url, match_sample_ids, first_match_rate, match_result,`status`, create_at
from face_sample
where id = #{id}
</select>
<select id="listByIds" resultType="com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity">
select *
from face_sample
where id in (
<foreach collection="list" item="id" separator=",">
#{id}
</foreach>
)
order by create_at desc
</select>
<select id="getEntity" resultType="com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity">
select *
from face_sample
where id = #{id}
</select>
<select id="listEntityBeforeDate" resultType="com.ycwl.basic.model.pc.faceSample.entity.FaceSampleEntity">
select *
from face_sample
where scenic_id = #{scenicId} and create_at &lt;= #{endDate}
</select>
</mapper>