ConfigParamDao.java
1008 Bytes
package com.viontech.keliu.dao;
import com.viontech.keliu.entity.SConfigParam;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* Created with IntelliJ IDEA.
*
* @author: zhuhai
* Date: 2023-12-23
* Time: 14:29
*/
@Repository
public class ConfigParamDao {
@Resource
private JdbcTemplate jdbcTemplate;
public String getConfigParamByMallIdAndConfigKey(Long mallId, String configKey) {
String sql = "select mall_id, config_key, config_value from s_config_params where (mall_id = ? or mall_id is null) and config_key = ? order by mall_id asc limit 1;";
SConfigParam configParam = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(SConfigParam.class), mallId, configKey);
return configParam == null ? null : configParam.getConfigValue();
}
}