Commit fa1dea31 authored by mx's avatar mx

通道

parent 509ac65a
package org.rcisoft.sys.doordeviceinfo.dao;
import org.apache.ibatis.annotations.Mapper;
import org.rcisoft.core.mapper.CyBaseMapper;
import org.rcisoft.sys.doordeviceinfo.entity.DoorDeviceInfo;
import org.apache.ibatis.annotations.ResultMap;
......@@ -12,9 +13,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
* Created with cy on 2022年12月23日 下午2:04:50.
*/
* Created with cy on 2022年12月23日 下午2:04:50.
*/
@Mapper
public interface DoorDeviceInfoRepository extends CyBaseMapper<DoorDeviceInfo> {
......@@ -22,8 +23,9 @@ public interface DoorDeviceInfoRepository extends CyBaseMapper<DoorDeviceInfo> {
/**
* 分页查询 doorDeviceInfo
*
*/
IPage<DoorDeviceInfo> queryDoorDeviceInfosPaged(CyPageInfo cyPageInfo,@Param("entity") DoorDeviceInfo doorDeviceInfo);
IPage<DoorDeviceInfo> queryDoorDeviceInfosPaged(CyPageInfo cyPageInfo, @Param("entity") DoorDeviceInfo doorDeviceInfo);
DoorDeviceInfo queryDoorDeviceInfosById(Integer business_id);
}
......@@ -2,17 +2,56 @@ package org.rcisoft.sys.doordeviceinfo.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.rcisoft.core.entity.CyIdIncreEntity;
import org.rcisoft.core.entity.CyIdNotDataEntity;
import org.springframework.data.annotation.Transient;
/**
* Created with cy on 2022年12月23日 下午2:04:50.
*/
* Created with cy on 2022年12月23日 下午2:04:50.
*/
@Data
@TableName("door_device_info")
public class DoorDeviceInfo extends CyIdIncreEntity<DoorDeviceInfo> {
//id
private Integer id;
//设备所在地址中文
private String deviceAddressLabel;
//排序
@Transient
private String px;
//标记异常(0 异常 1非异常)
private String abnormal;
@Transient
/**
* @desc 设备上报数据类型
* open:开门
* close:关门
* warn:警告
* up:设备上线
* down:设备下线
* @column data_type
* @default
*/
private String dataType;
/**
* 开始时间
*/
@Transient
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private String beginTime;
//结束时间
@Transient
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private String endTime;
/**
* @desc 设备imei码
......
......@@ -22,92 +22,103 @@ import org.springframework.transaction.annotation.Transactional;
import org.rcisoft.core.model.CyPageInfo;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by cy on 2022年12月23日 下午2:04:50.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class DoorDeviceInfoServiceImpl extends ServiceImpl<DoorDeviceInfoRepository,DoorDeviceInfo> implements DoorDeviceInfoService {
public class DoorDeviceInfoServiceImpl extends ServiceImpl<DoorDeviceInfoRepository, DoorDeviceInfo> implements DoorDeviceInfoService {
@Autowired
DoorDeviceInfoRepository doorDeviceInfoRepository;
/**
* 保存 门磁设备记录表
*
* @param doorDeviceInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel persist(DoorDeviceInfo doorDeviceInfo){
public CyPersistModel persist(DoorDeviceInfo doorDeviceInfo) {
//增加操作
int line = baseMapper.insert(doorDeviceInfo);
log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+
doorDeviceInfo.getBusinessId()+"的门磁设备记录表信息");
log.debug(CyUserUtil.getAuthenUsername() + "新增了ID为" +
doorDeviceInfo.getBusinessId() + "的门磁设备记录表信息");
return new CyPersistModel(line);
}
/**
* 删除 门磁设备记录表
*
* @param doorDeviceInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel remove(DoorDeviceInfo doorDeviceInfo){
public CyPersistModel remove(DoorDeviceInfo doorDeviceInfo) {
int line = baseMapper.realDelete(doorDeviceInfo);
log.debug(CyUserUtil.getAuthenUsername()+"删除了ID为"+
doorDeviceInfo.getBusinessId()+"的门磁设备记录表信息");
log.debug(CyUserUtil.getAuthenUsername() + "删除了ID为" +
doorDeviceInfo.getBusinessId() + "的门磁设备记录表信息");
return new CyPersistModel(line);
}
/**
* 修改 门磁设备记录表
*
* @param doorDeviceInfo
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(DoorDeviceInfo doorDeviceInfo){
public CyPersistModel merge(DoorDeviceInfo doorDeviceInfo) {
int line = baseMapper.updateById(doorDeviceInfo);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ doorDeviceInfo.getBusinessId()+"的门磁设备记录表信息");
log.debug(CyUserUtil.getAuthenUsername() + "修改了ID为" + doorDeviceInfo.getBusinessId() + "的门磁设备记录表信息");
return new CyPersistModel(line);
}
/**
* 根据id查询 门磁设备记录表
*
* @param id
* @return
*/
@Override
public DoorDeviceInfo findById(int id){
return baseMapper.selectById(id);
public DoorDeviceInfo findById(int id) {
return doorDeviceInfoRepository.queryDoorDeviceInfosById(id);
}
/**
* 分页查询 门磁设备记录表
*
* @param doorDeviceInfo
* @return
*/
@Override
public IPage<DoorDeviceInfo> findAllByPagination(CyPageInfo<DoorDeviceInfo> paginationUtility,
DoorDeviceInfo doorDeviceInfo){
return baseMapper.queryDoorDeviceInfosPaged(paginationUtility,doorDeviceInfo);
DoorDeviceInfo doorDeviceInfo) {
return baseMapper.queryDoorDeviceInfosPaged(paginationUtility, doorDeviceInfo);
}
/**
* 查询list 门磁设备记录表
*
* @param doorDeviceInfo
* @return
*/
@Override
public List<DoorDeviceInfo> findAll(DoorDeviceInfo doorDeviceInfo){
public List<DoorDeviceInfo> findAll(DoorDeviceInfo doorDeviceInfo) {
return baseMapper.queryDoorDeviceInfos(doorDeviceInfo);
}
/**
* 导出门磁设备记录表
*
* @return
*/
@Override
......@@ -124,12 +135,12 @@ public class DoorDeviceInfoServiceImpl extends ServiceImpl<DoorDeviceInfoReposit
@Override
public DoorDeviceInfo getDeviceInfoByIMEICode(String deviceImei) {
QueryWrapper<DoorDeviceInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("device_imei",deviceImei);
queryWrapper.eq("del_flag","0");
queryWrapper.eq("device_imei", deviceImei);
queryWrapper.eq("del_flag", "0");
List<DoorDeviceInfo> doorDeviceInfos = baseMapper.selectList(queryWrapper);
if(doorDeviceInfos!=null && !doorDeviceInfos.isEmpty()){
if (doorDeviceInfos != null && !doorDeviceInfos.isEmpty()) {
return doorDeviceInfos.get(0);
}else{
} else {
return null;
}
}
......
......@@ -15,12 +15,48 @@
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryDoorDeviceInfos" resultMap="BaseResultMap">
select * from door_device_info
where 1=1
select *
from door_device_info
where 1 = 1
</select>
<select id="queryDoorDeviceInfosPaged" resultMap="BaseResultMap">
select * from door_device_info
where 1=1
SELECT drd.business_id AS id,ddi.*,drd.*
FROM door_device_info ddi
LEFT JOIN door_report_data drd ON ddi.business_id = drd.device_id
LEFT JOIN sys_dict_data sdd ON ddi.device_address = sdd.dict_value
WHERE ddi.del_flag = 0
<if test="entity.flag !=null and entity.flag != '' ">
and ddi.flag = #{entity.flag}
</if>
<if test="entity.beginTime != null and entity.beginTime !='' "><!-- 开始时间检索 -->
and date_format(ddi.create_date,'%Y-%m-%d') &gt;= date_format(#{entity.beginTime},'%Y-%m-%d')
</if>
<if test="entity.endTime != null and entity.endTime !='' "><!-- 结束时间检索 -->
and date_format(ddi.create_date,'%Y-%m-%d') &lt;= date_format(#{entity.endTime},'%Y-%m-%d')
</if>
<if test="entity.deviceAddress !=null and entity.deviceAddress != '' ">
and ddi.device_address = #{entity.deviceAddress}
</if>
<if test="entity.dataType !=null and entity.dataType != '' ">
and ddi.data_type = #{entity.dataType}
</if>
<if test="entity.abnormal !=null and entity.abnormal != '' ">
and ddi.abnormal = #{entity.abnormal}
</if>
<if test="entity.px == '1'.toString() "><!-- 排序-->
order BY ddi.create_date desc
</if>
<if test="entity.px == '2'.toString() "><!-- 排序-->
ORDER BY sdd.dict_sort desc
</if>
</select>
<select id="queryDoorDeviceInfosById" resultMap="BaseResultMap">
SELECT drd.business_id AS id, ddi.*, drd.*
FROM door_device_info ddi
LEFT JOIN door_report_data drd ON ddi.business_id = drd.device_id
WHERE ddi.del_flag = 0
AND drd.business_id = #{id}
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment