zss
7 天以前 11502c7f9f26edda0733c43a17b5b773ee8447e4
src/main/java/com/ruoyi/project/system/controller/SysDictTypeController.java
@@ -3,6 +3,7 @@
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
@@ -17,14 +18,14 @@
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.system.domain.SysDictType;
import com.ruoyi.project.system.service.ISysDictTypeService;
/**
 * 数据字典信息
 *
 *
 * @author ruoyi
 */
@RestController
@@ -58,9 +59,9 @@
     */
    @PreAuthorize("@ss.hasPermi('system:dict:query')")
    @GetMapping(value = "/{dictId}")
    public R<?> getInfo(@PathVariable Long dictId)
    public AjaxResult getInfo(@PathVariable Long dictId)
    {
        return R.ok(dictTypeService.selectDictTypeById(dictId));
        return success(dictTypeService.selectDictTypeById(dictId));
    }
    /**
@@ -69,15 +70,14 @@
    @PreAuthorize("@ss.hasPermi('system:dict:add')")
    @Log(title = "字典类型", businessType = BusinessType.INSERT)
    @PostMapping
    public R<?> add(@Validated @RequestBody SysDictType dict)
    public AjaxResult add(@Validated @RequestBody SysDictType dict)
    {
        if (!dictTypeService.checkDictTypeUnique(dict))
        {
            return R.fail("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
            return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
        }
        dict.setCreateBy(getUsername());
        dictTypeService.insertDictType(dict);
        return R.ok();
        return toAjax(dictTypeService.insertDictType(dict));
    }
    /**
@@ -86,15 +86,14 @@
    @PreAuthorize("@ss.hasPermi('system:dict:edit')")
    @Log(title = "字典类型", businessType = BusinessType.UPDATE)
    @PutMapping
    public R<?> edit(@Validated @RequestBody SysDictType dict)
    public AjaxResult edit(@Validated @RequestBody SysDictType dict)
    {
        if (!dictTypeService.checkDictTypeUnique(dict))
        {
            return R.fail("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
            return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
        }
        dict.setUpdateBy(getUsername());
        dictTypeService.updateDictType(dict);
        return R.ok();
        return toAjax(dictTypeService.updateDictType(dict));
    }
    /**
@@ -103,10 +102,10 @@
    @PreAuthorize("@ss.hasPermi('system:dict:remove')")
    @Log(title = "字典类型", businessType = BusinessType.DELETE)
    @DeleteMapping("/{dictIds}")
    public R<?> remove(@PathVariable Long[] dictIds)
    public AjaxResult remove(@PathVariable Long[] dictIds)
    {
        dictTypeService.deleteDictTypeByIds(dictIds);
        return R.ok();
        return success();
    }
    /**
@@ -115,19 +114,19 @@
    @PreAuthorize("@ss.hasPermi('system:dict:remove')")
    @Log(title = "字典类型", businessType = BusinessType.CLEAN)
    @DeleteMapping("/refreshCache")
    public R<?> refreshCache()
    public AjaxResult refreshCache()
    {
        dictTypeService.resetDictCache();
        return R.ok();
        return success();
    }
    /**
     * 获取字典选择框列表
     */
    @GetMapping("/optionselect")
    public R<?> optionselect()
    public AjaxResult optionselect()
    {
        List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
        return R.ok(dictTypes);
        return success(dictTypes);
    }
}
}