yangys
2024-04-12 71d0c753036cc1ef06fa52f1874a5c806c9c5eda
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
package com.qianwen.core.coderule.handler;
 
import java.util.List;
import com.qianwen.core.coderule.constant.CodeRuleConstant;
import com.qianwen.core.coderule.dto.DropDownDTO;
import com.qianwen.core.tool.utils.CollectionUtil;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
 
 
public class MasterlinkDictHandler implements DictHandler {
    private final JdbcTemplate jdbcTemplate;
 
    public MasterlinkDictHandler(final JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }
 
    @Override
    public DropDownDTO getDictInfo(String dictCode, String dictKey) {
        DropDownDTO result = null;
        List<DropDownDTO> refObjects = this.jdbcTemplate.query(CodeRuleConstant.DICT_BY_CODE_KEY, new Object[]{dictCode, dictKey}, new BeanPropertyRowMapper(DropDownDTO.class));
        if (CollectionUtil.isNotEmpty(refObjects)) {
            result = refObjects.iterator().next();
        }
        return result;
    }
}