guoyuji
2024-01-23 a8513206048eed68f2908a4d01ee9c2d9bd331e2
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
package com.example.erp.service.sd;
 
import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.erp.entity.sd.Product;
import com.example.erp.mapper.sd.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
@Service
@DS("sd")
public class ProductService {
    @Autowired
    ProductMapper productMapper;
    public Map<String,Object> defaultDateProduct(Integer pageNum, Integer pageSize, List<String> glassType, Product product) {
        Integer offset = (pageNum-1)*pageSize;
        String glassTypeId = null;
        if(glassType.size()>1){
            glassTypeId = glassType.get(1);
        }
        Map<String,Object> map = new HashMap<>();
        map.put("data",productMapper.defaultProduct(offset,pageSize,glassTypeId,product));
        map.put("total",productMapper.getPageTotal(offset,pageSize,glassTypeId,product));
        return map;
    }
}