skyouc
2025-03-26 a935fc71d8e52f2ba10e42cfdb9e75ef9cb32bd7
rsf-server/src/main/java/com/vincent/rsf/server/system/controller/DictTypeController.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vincent.rsf.framework.common.Cools;
import com.vincent.rsf.framework.common.R;
import com.vincent.rsf.framework.exception.CoolException;
import com.vincent.rsf.server.common.utils.ExcelUtil;
import com.vincent.rsf.server.common.annotation.OperationLog;
import com.vincent.rsf.server.common.domain.BaseParam;
@@ -56,9 +57,19 @@
    @PostMapping("/dictType/save")
    public R save(@RequestBody DictType dictType) {
        dictType.setCreateBy(getLoginUserId());
        dictType.setCreateTime(new Date());
        dictType.setUpdateBy(getLoginUserId());
        dictType.setUpdateTime(new Date());
        if (Objects.isNull(dictType.getName())) {
            throw new CoolException("字典名称不能为空!!");
        }
        if (Objects.isNull(dictType.getCode())) {
            throw new CoolException("字典编码不能为空!!");
        }
        if (!dictTypeService.list(new LambdaQueryWrapper<DictType>().eq(DictType::getCode, dictType.getCode())).isEmpty()) {
            throw new CoolException("编码不能重复!!");
        }
        if (!dictTypeService.list(new LambdaQueryWrapper<DictType>().eq(DictType::getName, dictType.getName())).isEmpty()) {
            throw new CoolException("名称不能重复!!");
        }
        if (!dictTypeService.save(dictType)) {
            return R.error("Save Fail");
        }
@@ -69,8 +80,10 @@
    @OperationLog("Update 数据字典")
    @PostMapping("/dictType/update")
    public R update(@RequestBody DictType dictType) {
        if (Objects.isNull(dictType)) {
            throw new CoolException("参数不能为空!!");
        }
        dictType.setUpdateBy(getLoginUserId());
        dictType.setUpdateTime(new Date());
        if (!dictTypeService.updateById(dictType)) {
            return R.error("Update Fail");
        }