You've already forked FrameTour-BE
关联关系修改
This commit is contained in:
@ -88,18 +88,9 @@
|
||||
where d.scenic_id = #{scenicId}
|
||||
</select>
|
||||
<select id="deviceCountByScenicId" resultType="com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO">
|
||||
select ifnull(a.totalDeviceCount,0) as totalDeviceCount,ifnull(b.shotDeviceCount,0) as shotDeviceCount
|
||||
from (
|
||||
select count(1) totalDeviceCount,scenic_id
|
||||
from device
|
||||
where scenic_id = #{scenicId} and status = 1
|
||||
)a
|
||||
left join (
|
||||
select count(1) shotDeviceCount,scenic_id
|
||||
from source
|
||||
where scenic_id = #{scenicId} and member_id=#{userId}
|
||||
group by device_id
|
||||
)b on a.scenic_id = b.scenic_id
|
||||
select count(1) totalDeviceCount
|
||||
from device
|
||||
where scenic_id = #{scenicId} and status = 1
|
||||
</select>
|
||||
<select id="getConfigByDeviceId" resultType="com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity">
|
||||
select *
|
||||
|
@ -209,10 +209,6 @@
|
||||
from `order` o
|
||||
left join member m on m.id = o.member_id
|
||||
left join scenic s on o.scenic_id = s.id
|
||||
left join order_item oi on o.id = oi.order_id
|
||||
left join template t on o.goods_type='3' and oi.goods_id = t.id
|
||||
left join source sr on o.goods_type='2' and oi.goods_id = sr.id
|
||||
left join video vd on o.goods_type='1' and oi.goods_id = vd.id
|
||||
where o.id = #{id}
|
||||
</select>
|
||||
<select id="getOrderCount" resultType="java.lang.Integer">
|
||||
@ -395,4 +391,7 @@
|
||||
</where>
|
||||
order by o.create_at desc
|
||||
</select>
|
||||
<select id="listOrderItemByOrderId" resultType="com.ycwl.basic.model.pc.order.entity.OrderItemEntity">
|
||||
select * from order_item where order_id = #{orderId}
|
||||
</select>
|
||||
</mapper>
|
@ -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)
|
||||
values (#{memberId}, #{sourceId}, #{isBuy}, #{type})
|
||||
replace member_source(member_id, source_id, is_buy, type, order_id)
|
||||
values (#{memberId}, #{sourceId}, #{isBuy}, #{type}, #{orderId})
|
||||
</insert>
|
||||
<insert id="addRelations">
|
||||
replace member_source(member_id, source_id, is_buy, type)
|
||||
replace member_source(member_id, source_id, is_buy, type, order_id)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.memberId}, #{item.sourceId}, #{item.isBuy}, #{item.type})
|
||||
(#{item.memberId}, #{item.sourceId}, #{item.isBuy}, #{item.type}, #{orderId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="update">
|
||||
@ -30,12 +30,20 @@
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateRelation">
|
||||
update member_source
|
||||
<set>
|
||||
<if test="isBuy!=null">is_buy = #{isBuy}, </if>
|
||||
<if test="orderId!=null">order_id = #{orderId}, </if>
|
||||
</set>
|
||||
where member_id = #{memberId} and source_id = #{sourceId} and type = #{type}
|
||||
</update>
|
||||
<delete id="deleteById">
|
||||
delete from source where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="list" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
||||
select so.id, scenic_id, device_id, member_id, url, so.create_time, so.update_time,sc.`name` as scenicName, so.video_url, so.`type`, so.face_sample_id
|
||||
select so.id, scenic_id, device_id, url, so.create_time, so.update_time,sc.`name` as scenicName, so.video_url, so.`type`, so.face_sample_id
|
||||
from source so
|
||||
left join scenic sc on sc.id = so.scenic_id
|
||||
<where>
|
||||
@ -104,17 +112,27 @@
|
||||
limit 1
|
||||
</select>
|
||||
<select id="listUser" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
||||
select so.id, scenic_id, device_id, url, so.create_time, so.update_time,sc.`name` as scenicName
|
||||
select so.id, ms.scenic_id, device_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
|
||||
where
|
||||
ms.member_id = #{memberId}
|
||||
<if test="scenicId!= null">and so.scenic_id = #{scenicId} </if>
|
||||
<if test="deviceId!= null">and so.device_id = #{deviceId} </if>
|
||||
<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>
|
||||
order by so.create_time desc
|
||||
</select>
|
||||
<select id="queryByRelation" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
||||
select so.id, ms.scenic_id, ms.type, so.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
|
||||
where
|
||||
ms.member_id = #{memberId}
|
||||
<if test="type!=null">and ms.type = #{type} </if>
|
||||
<if test="scenicId!= null">and ms.scenic_id = #{scenicId} </if>
|
||||
<if test="isBuy!=null">and ms.is_buy = #{isBuy}</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -5,6 +5,17 @@
|
||||
insert into video(id, scenic_id, member_id, template_id, task_id, worker_id, video_url)
|
||||
values (#{id}, #{scenicId}, #{memberId}, #{templateId}, #{taskId}, #{workerId}, #{videoUrl})
|
||||
</insert>
|
||||
<insert id="addRelation">
|
||||
replace member_video(member_id, task_id, video_id, is_buy, order_id)
|
||||
values (#{memberId}, #{taskId}, #{videoId}, #{isBuy}, #{orderId})
|
||||
</insert>
|
||||
<insert id="addRelations">
|
||||
replace member_video(member_id, task_id, video_id, is_buy, order_id)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.memberId}, #{item.taskId}, #{item.videoId}, #{item.isBuy}, #{orderId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="update">
|
||||
update video
|
||||
<set>
|
||||
@ -18,6 +29,14 @@
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateRelation">
|
||||
update member_video
|
||||
<set>
|
||||
<if test="isBuy!= null">is_buy = #{isBuy}, </if>
|
||||
<if test="orderId!= null">order_id = #{orderId}, </if>
|
||||
</set>
|
||||
where member_id = #{memberId} and video_id = #{videoId}
|
||||
</update>
|
||||
<delete id="deleteById">
|
||||
delete from video where id = #{id}
|
||||
</delete>
|
||||
@ -60,4 +79,27 @@
|
||||
<select id="findByTaskId" resultType="com.ycwl.basic.model.pc.video.entity.VideoEntity">
|
||||
select * from video where task_id = #{taskId} limit 1
|
||||
</select>
|
||||
<select id="queryByRelation" resultType="com.ycwl.basic.model.pc.video.resp.VideoRespVO">
|
||||
select v.id, mv.scenic_id, v.template_id, mv.task_id, worker_id, video_url, v.create_time, v.update_time,
|
||||
s.name scenicName, t.name templateName, t.price templatePrice,t.cover_url templateCoverUrl,mv.is_buy
|
||||
from member_video mv
|
||||
left join video v on mv.video_id = v.id
|
||||
left join scenic s on s.id = v.scenic_id
|
||||
left join template t on v.template_id = t.id
|
||||
<where>
|
||||
<if test="scenicId!= null">and mv.scenic_id = #{scenicId} </if>
|
||||
<if test="memberId!= null">and mv.member_id = #{memberId} </if>
|
||||
<if test="templateId!= null">and template_id = #{templateId} </if>
|
||||
<if test="taskId!=null">and mv.task_id = #{taskId} </if>
|
||||
<if test="isBuy!=null">and mv.is_buy = #{isBuy}</if>
|
||||
<if test="startTime!= null">and v.create_time >= #{startTime} </if>
|
||||
<if test="endTime!= null">and v.create_time <= #{endTime} </if>
|
||||
<if test="faceId!= null">
|
||||
and mv.task_id in (
|
||||
select id from task where face_id = #{faceId}
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
order by v.create_time desc
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user