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
43
44
45
46
package com.hxzk.gps.service.impl.Anchor;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hxzk.gps.controller.Anchor.dto.TableSearchResult.TableSearchResult;
import com.hxzk.gps.entity.Anchor.TbAchor;
import com.hxzk.gps.mapper.Anchor.TbAchorMapper;
import com.hxzk.gps.result.ListDataResult;
import com.hxzk.gps.result.ResultTable;
import com.hxzk.gps.result.table;
import com.hxzk.gps.service.Anchor.TbAchorService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxzk.gps.service.Company.TbCompanyService;
import com.hxzk.gps.util.GetUser.UserInfoUtil;
import com.hxzk.gps.util.MessageUtils.MessageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
import java.util.Optional;
 
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author YuZhiTong
 * @since 2025-05-22
 */
@Service
public class TbAchorServiceImpl extends ServiceImpl<TbAchorMapper, TbAchor> implements TbAchorService {
    @Autowired
    TbCompanyService companyService;
    @Override
    public ResultTable FindAnchorInfo(TableSearchResult TableSearchResult) {
        List<Long> companyname = companyService.getChildCompanyNames(UserInfoUtil.getUserCompany());
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.in("company", companyname);
        PageHelper.startPage(TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize());
        Optional.ofNullable(TableSearchResult.getAchor().getAnchorid()).ifPresent(anchorid -> queryWrapper.like("anchorid", anchorid));
        PageInfo<TbAchor> info = new PageInfo<>(baseMapper.selectList(queryWrapper));
        table<TbAchor> achortable = new table<>(info.getList(),TableSearchResult.getTableList().getPageNum(),TableSearchResult.getTableList().getPageSize(),info.getTotal());
        return ListDataResult.resultTableSuccess(achortable, MessageUtils.getMessage("Success"));
    }
}