zhitong.yu
7 天以前 7fc9c42987a13c1d8d2159591a5803e70518827f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.hxzk.gps.service.impl.Loragateway;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hxzk.gps.controller.Loragateway.dto.TableSearchResult.TableSearchResult;
import com.hxzk.gps.entity.Anchor.TbAchor;
import com.hxzk.gps.entity.Loragateway.TbLoragateway;
import com.hxzk.gps.mapper.Loragateway.TbLoragatewayMapper;
import com.hxzk.gps.result.ListDataResult;
import com.hxzk.gps.result.ResultTable;
import com.hxzk.gps.result.table;
import com.hxzk.gps.service.Loragateway.TbLoragatewayService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxzk.gps.util.GetUser.UserInfoUtil;
import com.hxzk.gps.util.MessageUtils.MessageUtils;
import org.springframework.stereotype.Service;
 
import java.util.Optional;
 
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author YuZhiTong
 * @since 2025-05-22
 */
@Service
public class TbLoragatewayServiceImpl extends ServiceImpl<TbLoragatewayMapper, TbLoragateway> implements TbLoragatewayService {
 
    @Override
    public ResultTable FindLoragatewayInfo(TableSearchResult TableSearchResult) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("company", UserInfoUtil.getUserCompany());
        Optional.ofNullable(TableSearchResult.getLoragateway().getLoragwid()).ifPresent(loragwid -> queryWrapper.like("loragwid", loragwid));
        PageHelper.startPage(TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize());
        PageInfo<TbLoragateway> info = new PageInfo<>(baseMapper.selectList(queryWrapper));
        table<TbLoragateway> achortable = new table<>(info.getList(),TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize(),info.getTotal());
        return ListDataResult.resultTableSuccess(achortable, MessageUtils.getMessage("Success"));
    }
}