forked from dyf/fys-Multi-tenant
分页查询围栏进出记录列表
This commit is contained in:
@ -8,7 +8,9 @@ import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
@ -34,6 +36,11 @@ public class DeviceFenceAccessRecordBo extends BaseEntity {
|
||||
@NotNull(message = "围栏ID不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long fenceId;
|
||||
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
private String fenceName;
|
||||
|
||||
/**
|
||||
* 设备标识
|
||||
*/
|
||||
|
||||
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import com.fuyuanshen.equipment.domain.DeviceFenceAccessRecord;
|
||||
import com.fuyuanshen.equipment.domain.bo.DeviceFenceAccessRecordBo;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceFenceAccessRecordVo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -29,5 +30,14 @@ public interface DeviceFenceAccessRecordMapper extends BaseMapperPlus<DeviceFenc
|
||||
|
||||
List<DeviceFenceAccessRecordVo> selectVoPageWithFenceAndDeviceName(@Param(Constants.WRAPPER) Wrapper<DeviceFenceAccessRecord> wrapper);
|
||||
|
||||
/**
|
||||
* 分页查询围栏进出记录列表(纯XML形式)
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param bo 查询条件
|
||||
* @return 围栏进出记录分页列表
|
||||
*/
|
||||
Page<DeviceFenceAccessRecordVo> selectVoPageByXml(Page<DeviceFenceAccessRecord> page, @Param("bo") DeviceFenceAccessRecordBo bo);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -54,7 +54,8 @@ public class DeviceFenceAccessRecordServiceImpl implements IDeviceFenceAccessRec
|
||||
@Override
|
||||
public TableDataInfo<DeviceFenceAccessRecordVo> queryPageList(DeviceFenceAccessRecordBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<DeviceFenceAccessRecord> lqw = buildQueryWrapper(bo);
|
||||
Page<DeviceFenceAccessRecordVo> result = baseMapper.selectVoPageWithFenceAndDeviceName(pageQuery.build(), lqw);
|
||||
// Page<DeviceFenceAccessRecordVo> result = baseMapper.selectVoPageWithFenceAndDeviceName(pageQuery.build(), lqw);
|
||||
Page<DeviceFenceAccessRecordVo> result = baseMapper.selectVoPageByXml(pageQuery.build(), bo);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@ -85,6 +86,9 @@ public class DeviceFenceAccessRecordServiceImpl implements IDeviceFenceAccessRec
|
||||
lqw.eq(bo.getAccuracy() != null, DeviceFenceAccessRecord::getAccuracy, bo.getAccuracy());
|
||||
lqw.eq(bo.getEventTime() != null, DeviceFenceAccessRecord::getEventTime, bo.getEventTime());
|
||||
lqw.eq(bo.getCreateTime() != null, DeviceFenceAccessRecord::getCreateTime, bo.getCreateTime());
|
||||
if (StringUtils.isNotBlank(bo.getFenceName())) {
|
||||
params.put("fenceName", bo.getFenceName());
|
||||
}
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
||||
@ -23,6 +23,73 @@
|
||||
LEFT JOIN device_geo_fence f ON r.fence_id = f.id
|
||||
LEFT JOIN device d ON r.device_id = d.id
|
||||
${ew.customSqlSegment}
|
||||
<where>
|
||||
<if test="ew.params != null">
|
||||
<if test="ew.params.fenceName != null and ew.params.fenceName != ''">
|
||||
AND f.name LIKE CONCAT('%', #{ew.params.fenceName}, '%')
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY r.id ASC
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 分页查询围栏进出记录列表(纯XML形式) -->
|
||||
<select id="selectVoPageByXml" resultType="com.fuyuanshen.equipment.domain.vo.DeviceFenceAccessRecordVo">
|
||||
SELECT r.id,
|
||||
r.fence_id,
|
||||
f.name AS fence_name,
|
||||
r.device_id,
|
||||
d.device_name,
|
||||
r.user_id,
|
||||
r.event_type,
|
||||
r.latitude,
|
||||
r.longitude,
|
||||
r.accuracy,
|
||||
r.event_time,
|
||||
r.create_time
|
||||
FROM device_fence_access_record r
|
||||
LEFT JOIN device_geo_fence f ON r.fence_id = f.id
|
||||
LEFT JOIN device d ON r.device_id = d.id
|
||||
<where>
|
||||
<if test="bo.fenceId != null">
|
||||
AND r.fence_id = #{bo.fenceId}
|
||||
</if>
|
||||
<if test="bo.deviceId != null and bo.deviceId != ''">
|
||||
AND r.device_id = #{bo.deviceId}
|
||||
</if>
|
||||
<if test="bo.userId != null">
|
||||
AND r.user_id = #{bo.userId}
|
||||
</if>
|
||||
<if test="bo.eventType != null">
|
||||
AND r.event_type = #{bo.eventType}
|
||||
</if>
|
||||
<if test="bo.latitude != null">
|
||||
AND r.latitude = #{bo.latitude}
|
||||
</if>
|
||||
<if test="bo.longitude != null">
|
||||
AND r.longitude = #{bo.longitude}
|
||||
</if>
|
||||
<if test="bo.accuracy != null">
|
||||
AND r.accuracy = #{bo.accuracy}
|
||||
</if>
|
||||
<if test="bo.eventTime != null">
|
||||
AND r.event_time = #{bo.eventTime}
|
||||
</if>
|
||||
<if test="bo.createTime != null">
|
||||
AND r.create_time = #{bo.createTime}
|
||||
</if>
|
||||
<if test="bo.fenceName != null and bo.fenceName != ''">
|
||||
AND f.name LIKE CONCAT('%', #{bo.fenceName}, '%')
|
||||
</if>
|
||||
<!-- 添加时间范围筛选条件 -->
|
||||
<if test="bo.beginTime != null and bo.beginTime != ''">
|
||||
AND r.event_time >= #{bo.beginTime}
|
||||
</if>
|
||||
<if test="bo.endTime != null and bo.endTime != ''">
|
||||
AND r.event_time <![CDATA[ <= ]]> #{bo.endTime}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY r.id ASC
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user