wang-hao-jie
2021-12-27 fb53a9997de491c3d0a30ed333a6bd3b24877b82
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
package cn.exrick.xboot.your.serviceimpl;
 
import cn.exrick.xboot.your.mapper.CustomerMapper;
import cn.exrick.xboot.your.entity.Customer;
import cn.exrick.xboot.your.service.ICustomerService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * 商户表接口实现
 * @author zhangzeli
 */
@Slf4j
@Service
@Transactional
public class ICustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements ICustomerService {
 
    @Autowired
    private CustomerMapper customerMapper;
 
    @Override
    public int countOpenId() {
        QueryWrapper<Customer> wrapper = new QueryWrapper<>();
        wrapper.isNotNull("open_id");
        int i = customerMapper.selectCount(wrapper);
        int i2 = customerMapper.count();
        if(i2==0){
            return 0;
        }else{
            return (i*100)/i2;
        }
    }
}