liuxm
2024-04-26 21587d964a6a43c4dff50a405b42509ce47504e7
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.dy.pmsBase.privilege;
 
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pmsGlobal.daoBa.BaPrivilegeMapper;
import com.dy.pmsGlobal.pojoBa.BaPrivilege;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
 
@Slf4j
@Service
public class PriSv {
 
    private BaPrivilegeMapper dao;
    @Autowired
    public void setDao(BaPrivilegeMapper dao) {
        this.dao = dao;
    }
 
    /**
     * 获取角色列表
     */
    public QueryResultVo<List<BaPrivilege>> selectSome(QueryVo queryVo) {
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
        //查询符合条件的记录总数
        Long itemTotal = dao.selectSomeCount(params);
        QueryResultVo<List<BaPrivilege>> rsVo = new QueryResultVo<>(queryVo.pageSize, queryVo.pageCurr) ;
        //计算分页等信息
        rsVo.calculateAndSet(itemTotal, params);
        //查询符合条件的记录
        rsVo.obj = dao.selectSome(params) ;
        return rsVo ;
    }
 
    public Map<String, List<BaPrivilege>> selectByType(){
        List<BaPrivilege> priList = dao.selectAll();
        Map<String, List<BaPrivilege>> map = priList.stream()
                .collect(Collectors.groupingBy(BaPrivilege::getTypeName));
        return map;
    }
}