zss
2024-09-27 a14a26c04bc5863248b9a9d387610a143c3a4efd
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.yuanchu.mom.service.impl;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.mom.common.GetLook;
import com.yuanchu.mom.common.PrintChina;
import com.yuanchu.mom.pojo.Custom;
import com.yuanchu.mom.mapper.CustomMapper;
import com.yuanchu.mom.service.CustomService;
import com.yuanchu.mom.utils.QueryWrappers;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
* @author Administrator
* @description 针对表【power(用户id)】的数据库操作Service实现
* @createDate 2023-12-27 02:37:38
*/
@Service
@AllArgsConstructor
public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom>
    implements CustomService {
 
    private CustomMapper customMapper;
 
    private GetLook getLook;
 
    @Override
    public Map<String, Object> selectCustomPageList(IPage<Custom> page, Custom custom) {
        Map<String, Object> map = new HashMap<>();
        map.put("head", PrintChina.printChina(Custom.class));
        Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId("selectCustomPageList");
        if(map1.get("look")==1) custom.setCreateUser(map1.get("userId"));
        map.put("body", customMapper.selectCustomPageList(page, QueryWrappers.queryWrappers(custom)));
        return map;
    }
 
    @Override
    public int delCustomById(Long id) {
        return customMapper.deleteById(id);
    }
 
    @Override
    public int addCustom(Custom custom) {
        return customMapper.insert(custom);
    }
 
    @Override
    public int upCustom(Custom custom) {
        return customMapper.updateById(custom);
    }
 
    @Override
    public List<Custom> selectCustomEnum() {
        return customMapper.selectList(Wrappers.<Custom>lambdaQuery().select(Custom::getId,Custom::getCompany));
    }
 
    @Override
    public Custom getCustomId(String company) {
        return customMapper.selectOne(Wrappers.<Custom>lambdaQuery().eq(Custom::getCompany, company).last("limit 1"));
    }
}