|
@@ -8,11 +8,12 @@ import api.common.pojo.vo.system.DictVO;
|
|
|
import api.common.util.JsonUtil;
|
|
|
import api.common.util.ObjectUtil;
|
|
|
import api.common.util.StringUtil;
|
|
|
-import com.css.simulation.resource.server.infra.feign.service.RedisService;
|
|
|
import com.css.simulation.resource.server.infra.db.mysql.mapper.DictMapper;
|
|
|
+import com.css.simulation.resource.server.infra.feign.service.RedisService;
|
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.*;
|
|
@@ -164,12 +165,28 @@ public class DictService {
|
|
|
return dictMap;
|
|
|
}
|
|
|
|
|
|
- public void deleteSystemDictByCodeAndType(DictPO dictPO) {
|
|
|
- dictMapper.deleteSystemDictByCodeAndType(dictPO);
|
|
|
- }
|
|
|
-
|
|
|
- public void createSystemDict(DictPO dictPO) {
|
|
|
+ @Transactional
|
|
|
+ public ResponseBodyVO<String> createDictByType(DictPO dictPO) {
|
|
|
dictPO.setId(StringUtil.getRandomUUID());
|
|
|
+ DictPO tempPo = dictMapper.getDictByDictType(dictPO);
|
|
|
+ int tempOrder = 1;
|
|
|
+ if (tempPo != null) {
|
|
|
+ tempOrder = tempPo.getDictOrder() + 1;
|
|
|
+ }
|
|
|
+ dictPO.setDictOrder(tempOrder);
|
|
|
+ dictPO.setIsDeleted("0");
|
|
|
dictMapper.createSystemDict(dictPO);
|
|
|
+ DictParam param = new DictParam();
|
|
|
+ param.setDictTypes(dictPO.getDictType());
|
|
|
+ refreshDicts(param);
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResponseBodyVO<String> deleteDictById(DictPO param) {
|
|
|
+ dictMapper.deleteDictById(param);
|
|
|
+ DictParam deleteParam = new DictParam();
|
|
|
+ deleteParam.setDictTypes(param.getDictType());
|
|
|
+ refreshDicts(deleteParam);
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
}
|
|
|
}
|