You've already forked FrameTour-BE
refactor: 删除 DeviceMapper 接口及其对应的 XML 文件
- 删除了 DeviceMapper.java 文件,包括所有与设备管理相关的接口方法 - 删除了 DeviceMapper.xml 文件,包括所有与设备管理相关的 SQL 语句 - 此次重构移除了设备管理功能模块的持久层代码
This commit is contained in:
@@ -1,52 +0,0 @@
|
||||
package com.ycwl.basic.mapper;
|
||||
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceConfigEntity;
|
||||
import com.ycwl.basic.model.pc.device.entity.DeviceEntity;
|
||||
import com.ycwl.basic.model.pc.device.req.DeviceAddOrUpdateReq;
|
||||
import com.ycwl.basic.model.pc.device.req.DeviceReqQuery;
|
||||
import com.ycwl.basic.model.pc.device.resp.DeviceRespVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/11/29 14:48
|
||||
* device(设备管理)
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeviceMapper {
|
||||
List<DeviceRespVO> list(DeviceReqQuery deviceReqQuery);
|
||||
List<DeviceEntity> listAll();
|
||||
DeviceRespVO getById(Long id);
|
||||
int add(DeviceAddOrUpdateReq deviceReqQuery);
|
||||
int deleteById(Long id);
|
||||
int update(DeviceAddOrUpdateReq deviceReqQuery);
|
||||
int updateStatus(Long id);
|
||||
|
||||
DeviceEntity getByDeviceId(Long deviceId);
|
||||
List<DeviceRespVO> listByScenicIdWithWVP(Long scenicId);
|
||||
|
||||
ScenicDeviceCountVO deviceCountByScenicId(@Param("scenicId") Long scenicId);
|
||||
|
||||
DeviceConfigEntity getConfigByDeviceId(Long deviceId);
|
||||
int addConfig(DeviceConfigEntity deviceConfigEntity);
|
||||
int updateConfig(DeviceConfigEntity deviceConfigEntity);
|
||||
|
||||
DeviceEntity getByDeviceNo(String deviceNo);
|
||||
|
||||
int updateEntity(DeviceEntity device);
|
||||
|
||||
int addEntity(DeviceEntity device);
|
||||
|
||||
int updateOnlineStatus(Long id, String ipAddr, int online, Date keepaliveAt);
|
||||
|
||||
DeviceEntity getByDeviceNo2(String deviceNo);
|
||||
|
||||
List<Long> listAllByScenicId(Long scenicId);
|
||||
|
||||
int updateSort(Long id, Integer sort);
|
||||
}
|
@@ -1,153 +0,0 @@
|
||||
<?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.DeviceMapper">
|
||||
<insert id="add">
|
||||
insert into device(id, scenic_id, name, no, latitude, longitude) values (#{id}, #{scenicId}, #{name}, #{no}, #{latitude}, #{longitude})
|
||||
</insert>
|
||||
<insert id="addConfig">
|
||||
insert into device_config(id, device_id, create_time)
|
||||
values (#{id}, #{deviceId}, now())
|
||||
</insert>
|
||||
<insert id="addEntity">
|
||||
insert into device(id, name, no, status, online, ip_addr, keepalive_at, create_at, update_at)
|
||||
values (#{id}, #{name}, #{no}, 0, #{online}, #{ipAddr}, #{keepaliveAt}, now(), now())
|
||||
</insert>
|
||||
<update id="update">
|
||||
update device set scenic_id = #{scenicId}, name = #{name}, no = #{no}, longitude = #{longitude}, latitude = #{latitude}, update_at = now() where id = #{id}
|
||||
</update>
|
||||
<update id="updateStatus">
|
||||
update device
|
||||
set status = (CASE
|
||||
status
|
||||
WHEN 1 THEN
|
||||
0
|
||||
WHEN 0 THEN
|
||||
1
|
||||
ELSE null
|
||||
END)
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateConfig">
|
||||
update device_config
|
||||
set viid_type = #{viidType},
|
||||
store_type = #{storeType},
|
||||
store_config_json = #{storeConfigJson},
|
||||
store_expire_day = #{storeExpireDay},
|
||||
online_check = #{onlineCheck},
|
||||
online_max_interval = #{onlineMaxInterval},
|
||||
cut_pre = #{cutPre},
|
||||
cut_post = #{cutPost},
|
||||
enable_pre_book = #{enablePreBook},
|
||||
image_free = #{imageFree},
|
||||
video_free = #{videoFree},
|
||||
pair_device = #{pairDevice},
|
||||
video_crop = #{videoCrop}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateEntity">
|
||||
update device
|
||||
set name = #{name},
|
||||
no = #{no},
|
||||
online = #{online},
|
||||
ip_addr = #{ipAddr},
|
||||
keepalive_at = #{keepaliveAt},
|
||||
update_at = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateOnlineStatus">
|
||||
update device
|
||||
set online = #{online},
|
||||
<if test="ipAddr != null">ip_addr = #{ipAddr},</if>
|
||||
keepalive_at = #{keepaliveAt},
|
||||
update_at = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateSort">
|
||||
update device
|
||||
set sort = #{sort}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<delete id="deleteById">
|
||||
delete from device where id = #{id}
|
||||
</delete>
|
||||
<select id="list" resultType="com.ycwl.basic.model.pc.device.resp.DeviceRespVO">
|
||||
select d.id, scenic_id, d.name, no, d.longitude, d.latitude, d.status, create_at, d.update_at, s.name scenic_name, d.keepalive_at, d.online, p.wvp_device_no as device_no, p.wvp_channel_no channel_no,
|
||||
(select s.url from source s where s.device_id=d.id order by id desc limit 1) coverUrl
|
||||
from device d
|
||||
left join scenic s on d.scenic_id = s.id
|
||||
left join device_preview_config p on d.id = p.device_id and p.status = 1
|
||||
<where>
|
||||
<if test="name!= null and name!= ''">
|
||||
and d.`name` like concat('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="no!= null and no!= ''">
|
||||
and `no` like concat('%', #{no}, '%')
|
||||
</if>
|
||||
<if test="status!= null">
|
||||
and d.`status` = #{status}
|
||||
</if>
|
||||
<if test="scenicId!= null and scenicId!= ''">
|
||||
and scenic_id = #{scenicId}
|
||||
</if>
|
||||
<if test="startTime!=null">
|
||||
and d.create_at >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime!=null">
|
||||
and d.create_at <= #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
order by d.scenic_id desc, sort asc
|
||||
</select>
|
||||
<select id="getById" resultType="com.ycwl.basic.model.pc.device.resp.DeviceRespVO">
|
||||
select d.id, scenic_id, d.name, no, d.longitude, d.latitude, d.status, create_at, d.update_at, s.name scenic_name
|
||||
from device d
|
||||
left join scenic s on d.scenic_id = s.id
|
||||
where d.id = #{id}
|
||||
</select>
|
||||
<select id="listByScenicIdWithWVP" resultType="com.ycwl.basic.model.pc.device.resp.DeviceRespVO">
|
||||
select d.id, d.name, no, d.status, create_at, d.update_at, p.wvp_device_no as device_no, p.wvp_channel_no channel_no
|
||||
from device d
|
||||
left join device_preview_config p on d.id = p.device_id and p.status = 1
|
||||
where d.scenic_id = #{scenicId}
|
||||
order by d.sort
|
||||
</select>
|
||||
<select id="deviceCountByScenicId" resultType="com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO">
|
||||
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 *
|
||||
from device_config
|
||||
where device_id = #{deviceId}
|
||||
limit 1
|
||||
</select>
|
||||
<select id="getByDeviceId" resultType="com.ycwl.basic.model.pc.device.entity.DeviceEntity">
|
||||
select *
|
||||
from device
|
||||
where id = #{deviceId}
|
||||
</select>
|
||||
<select id="getByDeviceNo" resultType="com.ycwl.basic.model.pc.device.entity.DeviceEntity">
|
||||
select *
|
||||
from device
|
||||
where no = #{deviceNo}
|
||||
</select>
|
||||
<select id="listAll" resultType="com.ycwl.basic.model.pc.device.entity.DeviceEntity">
|
||||
select *
|
||||
from device
|
||||
where status = 1
|
||||
order by sort
|
||||
</select>
|
||||
<select id="getByDeviceNo2" resultType="com.ycwl.basic.model.pc.device.entity.DeviceEntity">
|
||||
select *
|
||||
from device
|
||||
where no_2 = #{deviceNo}
|
||||
limit 1
|
||||
</select>
|
||||
<select id="listAllByScenicId" resultType="java.lang.Long">
|
||||
select id
|
||||
from device
|
||||
where scenic_id = #{scenicId}
|
||||
order by sort
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user