Files
FrameTour-BE/src/main/resources/mapper/pc/FaceSampleMapper.xml
2024-12-05 18:00:44 +08:00

79 lines
3.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="com.ycwl.basic.mapper.pc.FaceSampleMapper">
<insert id="add">
insert into face_sample(id, device_id, face_url, match_sample_ids, first_match_rate, match_result,`status`)
values (#{id}, #{deviceId}, #{faceUrl}, #{matchSampleIds}, #{firstMatchRate}, #{matchResult},#{status})
</insert>
<update id="update">
update face_sample
<set>
<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>
</set>
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 id, scenic_id, device_id, face_url, match_sample_ids, first_match_rate, match_result,`status`
from face_sample
<where>
<if test="scenicId!= null and scenicId!= ''">
and device_id = #{deviceId}
</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="startMatchRate!= null ">
and first_match_rate &gt;= #{startMatchRate}
</if>
<if test="endMatchRate!= null ">
and first_match_rate &lt;= #{endMatchRate}
</if>
<if test="startTime!=null">
and create_at >= #{startTime}
</if>
<if test="endTime!=null">
and create_at &lt;= #{endTime}
</if>
<if test="status!= null ">
and `status` = #{status}
</if>
</where>
</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`
from face_sample
where id = #{id}
</select>
</mapper>