提交代码

master
胡锐 1 month 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) { if (body == null || body.getBigDecimal("exchangeRate") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); 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); SecDictionary dictionary = secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0);
dictionary.setCodeValue(body.getBigDecimal("exchangeRate").toString()); dictionary.setCodeValue(body.getBigDecimal("exchangeRate").toString());
secDictionaryService.editData(dictionary); secDictionaryService.update(where, dictionary);
// 刷新缓存 // 刷新缓存
secDictionaryService.refreshCache(); secDictionaryService.refreshCache();

@ -1,7 +1,28 @@
package com.hfkj.dao; package com.hfkj.dao;
import com.hfkj.entity.SecDictionary;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
/** /**
* mapper扩展类 * mapper扩展类
*/ */
public interface SecDictionaryMapperExt { 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 { public interface SecDictionaryService {
/** /**
* 编辑数据 * 增加
* @param data * @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"; private final String CACHE_KEY = "SEC_DICTIONARY";
@Override @Override
public void editData(SecDictionary data) { public void insert(SecDictionary data) {
SecDictionary dictionary = getDictionary(data.getCodeType(), data.getCodeValue()); secDictionaryMapper.insert(data);
if (dictionary == null) { }
secDictionaryMapper.insert(data);
} else { @Override
secDictionaryMapper.updateByPrimaryKey(data); public void update(SecDictionary where,SecDictionary data) {
} secDictionaryMapper.update(where.getCodeType(), where.getCodeValue(), data);
} }
@Override @Override

Loading…
Cancel
Save