futian.liu
2023-11-13 31692354e8191b583250c213152bfd0068ffe0fc
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
package com.consum.base.service;
 
import com.consum.model.po.SDictData;
import com.walker.jdbc.service.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
 
import java.util.HashMap;
import java.util.List;
 
@Service
public class SDictDataServiceImpl extends BaseServiceImpl {
 
    /**
     * @Description  根据报废原因code查询数据字典
     * @Author 卢庆阳
     * @Date 2023/11/2
     */
    public List<SDictData> selectByScrappedCodeList(List<String> scrappedCodeList) {
        if (CollectionUtils.isEmpty(scrappedCodeList)) {
            log.error("参数错误");
            return null;
        }
        StringBuilder sql = new StringBuilder("SELECT * FROM s_dict_data WHERE 1 = 1 ");
        HashMap<String, Object> paramts = new HashMap<>();
 
        sql.append(" and dict_code in ( ");
        for (int i = 0; i < scrappedCodeList.size(); i++) {
            sql.append(scrappedCodeList.get(i));
            if (i < scrappedCodeList.size() - 1) {
                sql.append(",");
            }
        }
        sql.append(" ) ");
 
        return this.select(sql.toString(), paramts, new SDictData());
    }
}