whywhyo
2023-08-01 b5da9c2985bd3e131f9b174fdf9ad2bbf7b30c6f
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
package com.ruoyi.service.impl;
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.ZfCode;
import com.ruoyi.mapper.ZfCodeMapper;
import com.ruoyi.service.ZfCodeService;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
 
/**
 * @Author Jinquan_Ou
 * @Description
 * @Date 2023-07-16 23:32
 * @Version 1.0.0
 **/
@Service
public class ZfCodeServiceImpl extends ServiceImpl<ZfCodeMapper, ZfCode> implements ZfCodeService {
    @Override
    public List<ZfCode> likeGetByName(String name) {
        LambdaQueryWrapper<ZfCode> lqw = new LambdaQueryWrapper<>();
        lqw.like(ZfCode::getName,name);
        return list(lqw);
    }
 
    @Override
    public List<String> getNameByCode(List<Long> codeList) {
        if(codeList.size() == 0){
            return new ArrayList<>();
        }
        LambdaQueryWrapper<ZfCode> lqw = new LambdaQueryWrapper<>();
        lqw.in(codeList.size()!=0,ZfCode::getCode,codeList);
        List<ZfCode> zfCodeList = list(lqw);
        return zfCodeList.stream().map(ZfCode::getName).collect(Collectors.toList());
    }
}