This commit is contained in:
2024-12-30 20:47:34 +08:00
parent 2031b77f12
commit cfd48861d5
17 changed files with 134 additions and 61 deletions

View File

@@ -6,14 +6,14 @@
values (#{id}, #{scenicId}, #{deviceId}, #{url}, #{videoUrl}, #{type}, #{faceSampleId}, #{posJson})
</insert>
<insert id="addRelation">
replace member_source(member_id, source_id, is_buy, type, order_id)
values (#{memberId}, #{sourceId}, #{isBuy}, #{type}, #{orderId})
replace member_source(scenic_id, face_id, member_id, source_id, is_buy, type, order_id)
values (#{scenicId}, #{faceId}, #{memberId}, #{sourceId}, #{isBuy}, #{type}, #{orderId})
</insert>
<insert id="addRelations">
replace member_source(member_id, source_id, is_buy, type, order_id)
replace member_source(scenic_id, face_id, member_id, source_id, is_buy, type, order_id)
values
<foreach collection="list" item="item" separator=",">
(#{item.memberId}, #{item.sourceId}, #{item.isBuy}, #{item.type}, #{orderId})
(#{item.scenicId}, #{item.faceId}, #{item.memberId}, #{item.sourceId}, #{item.isBuy}, #{item.type}, #{item.orderId})
</foreach>
</insert>
<update id="update">
@@ -54,14 +54,13 @@
and is_buy = #{isBuy}
</if>
<if test="type!=null">and so.type = #{type} </if>
<if test="faceId!=null">and FIND_IN_SET(so.face_sample_id, (select face.match_sample_ids from face where id = #{faceId})) </if>
<if test="startTime!= null">and so.create_time &gt;= #{startTime} </if>
<if test="endTime!= null">and so.create_time &lt;= #{endTime} </if>
</where>
order by so.create_time desc
</select>
<select id="userGetById" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
select so.id, scenic_id, device_id, ms.member_id, url, so.create_time, so.update_time,sc.`name` as scenicName
select so.id, ms.scenic_id, device_id, ms.member_id, url, so.create_time, so.update_time,sc.`name` as scenicName
from member_source ms
left join source so on ms.source_id = so.id
left join scenic sc on sc.id = so.scenic_id
@@ -74,7 +73,7 @@
where so.id = #{id}
</select>
<select id="listGroupByType" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
select so.id, scenic_id,sc.name scenicName, sc.longitude ,sc.latitude,so.type,so.is_buy
select so.id, ms.scenic_id,sc.name scenicName, sc.longitude ,sc.latitude,so.type,so.is_buy
from member_source ms
left join source so on ms.source_id = so.id
left join scenic sc on sc.id = so.scenic_id
@@ -121,7 +120,7 @@
<if test="scenicId!= null">and ms.scenic_id = #{scenicId} </if>
<if test="isBuy!=null">and ms.is_buy = #{isBuy}</if>
<if test="type!=null">and ms.type = #{type} </if>
<if test="faceId!=null">and FIND_IN_SET(so.face_sample_id, (select face.match_sample_ids from face where id = #{faceId})) </if>
<if test="faceId!=null">and ms.face_id = #{faceId} </if>
order by so.create_time desc
</select>
<select id="queryByRelation" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
@@ -135,4 +134,15 @@
<if test="scenicId!= null">and ms.scenic_id = #{scenicId} </if>
<if test="isBuy!=null">and ms.is_buy = #{isBuy}</if>
</select>
<select id="querySameVideo" resultType="com.ycwl.basic.model.pc.source.entity.SourceEntity">
select *
from source
where device_id = #{deviceId} and face_sample_id = #{faceSampleId} and type = 1
limit 1
</select>
<select id="hasRelationTo" resultType="java.lang.Integer">
select count(1)
from member_source
where member_id = #{memberId} and source_id = #{sourceId} and type = #{type}
</select>
</mapper>