提交代码

master
胡锐 3 weeks ago
parent de4d867fda
commit afcc1d49d4
  1. 4
      bweb/src/main/java/com/hfkj/controller/SysSettingController.java
  2. 21
      service/src/main/java/com/hfkj/dao/SecDictionaryMapperExt.java
  3. 10
      service/src/main/java/com/hfkj/service/sec/SecDictionaryService.java
  4. 14
      service/src/main/java/com/hfkj/service/sec/impl/SecDictionaryServiceImpl.java

@ -51,10 +51,12 @@ public class SysSettingController {
if (body == null || body.getBigDecimal("exchangeRate") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
SecDictionary where = new SecDictionary();
where.setCodeType("GOLD_COIN_EXCHANGE_RATE");
// 查询数据
SecDictionary dictionary = secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0);
dictionary.setCodeValue(body.getBigDecimal("exchangeRate").toString());
secDictionaryService.editData(dictionary);
secDictionaryService.update(where, dictionary);
// 刷新缓存
secDictionaryService.refreshCache();

@ -1,7 +1,28 @@
package com.hfkj.dao;
import com.hfkj.entity.SecDictionary;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
/**
* mapper扩展类
*/
public interface SecDictionaryMapperExt {
@Update({
"<script>" +
"update sec_dictionary",
"set code_value = #{data.codeValue,jdbcType=VARCHAR}," +
"code_name = #{data.codeName,jdbcType=VARCHAR},",
"code_desc = #{data.codeDesc,jdbcType=VARCHAR},",
"sort_id = #{data.sortId,jdbcType=INTEGER},",
"`status` = #{data.status,jdbcType=INTEGER},",
"ext_1 = #{data.ext1,jdbcType=VARCHAR},",
"ext_2 = #{data.ext2,jdbcType=VARCHAR},",
"ext_3 = #{data.ext3,jdbcType=VARCHAR}",
"where code_type = #{codeType,jdbcType=VARCHAR}",
" <if test='codeValue != null'> and code_value = #{codeValue,jdbcType=VARCHAR} </if>",
"</script>"
})
void update(@Param("codeType") String codeType, @Param("codeValue") String codeValue, @Param("data") SecDictionary data);
}

@ -12,10 +12,16 @@ import java.util.List;
public interface SecDictionaryService {
/**
* 编辑数据
* 增加
* @param data
*/
void editData(SecDictionary data);
void insert(SecDictionary data);
/**
* 修改
* @param data
*/
void update(SecDictionary where,SecDictionary data);
/**
* 获取数据字典

@ -27,13 +27,13 @@ public class SecDictionaryServiceImpl implements SecDictionaryService {
private final String CACHE_KEY = "SEC_DICTIONARY";
@Override
public void editData(SecDictionary data) {
SecDictionary dictionary = getDictionary(data.getCodeType(), data.getCodeValue());
if (dictionary == null) {
secDictionaryMapper.insert(data);
} else {
secDictionaryMapper.updateByPrimaryKey(data);
}
public void insert(SecDictionary data) {
secDictionaryMapper.insert(data);
}
@Override
public void update(SecDictionary where,SecDictionary data) {
secDictionaryMapper.update(where.getCodeType(), where.getCodeValue(), data);
}
@Override

Loading…
Cancel
Save