xuhy
2025-11-06 603acbf0bd5c9ad0290c4d126a3f32faa218d7b0
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.ruoyi.system.service.impl;
 
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.TMerchantMapper;
import com.ruoyi.system.model.TMerchant;
import com.ruoyi.system.model.TMerchant;
import com.ruoyi.system.query.TMerchantQuery;
import com.ruoyi.system.service.TMerchantService;
import com.ruoyi.system.vo.TPartyBuildingVO;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * <p>
 * 商户信息 服务实现类
 * </p>
 *
 * @author xiaochen
 * @since 2025-11-06
 */
@Service
public class TMerchantServiceImpl extends ServiceImpl<TMerchantMapper, TMerchant> implements TMerchantService {
 
    @Override
    public boolean isExit(TMerchant dto) {
        if(StringUtils.isNotEmpty(dto.getId())){
            // 修改
            return this.count(Wrappers.lambdaQuery(TMerchant.class).ne(TMerchant::getId, dto.getId()).eq(TMerchant::getMerchantName, dto.getMerchantName())) > 0;
        }else {
            // 新增
            return this.count(Wrappers.lambdaQuery(TMerchant.class).eq(TMerchant::getMerchantName, dto.getMerchantName())) > 0;
        }
    }
 
    @Override
    public PageInfo<TMerchant> pageList(TMerchantQuery query) {
        PageInfo<TMerchant> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<TMerchant> list = this.baseMapper.pageList(query,pageInfo);
        pageInfo.setRecords(list);
        return pageInfo;
    }
}