All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.nxyfan.framework.sys.controller.SysConfigController Maven / Gradle / Ivy

There is a newer version: 1.5.6
Show newest version
package com.nxyfan.framework.sys.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.nxyfan.framework.common.annotation.CommonLog;
import com.nxyfan.framework.common.pojo.CommonResult;
import com.nxyfan.framework.common.pojo.CommonValidList;
import com.nxyfan.framework.core.entity.SysConfig;
import com.nxyfan.framework.core.param.*;
import com.nxyfan.framework.core.service.SysConfigService;
import javax.annotation.Resource;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * 配置控制器
 *
 * @author xuyuxiang
 * @date 2022/4/22 10:56
 **/
@Api(tags = "配置控制器")
@ApiSupport(author = "Nxyfan Caoyang", order = 6)
@RestController
@Validated
public class SysConfigController {

    @Resource
    private SysConfigService devConfigService;

    /**
     * 获取配置分页
     *
     * @author xuyuxiang
     * @date 2022/4/24 20:00
     */
    @ApiOperationSupport(order = 1)
    @ApiOperation("获取配置分页")
    @GetMapping("/sys/config/page")
    public CommonResult> page(SysConfigPageParam devConfigPageParam) {
        return CommonResult.data(devConfigService.page(devConfigPageParam));
    }

    /**
     * 获取系统基础配置
     *
     * @author xuyuxiang
     * @date 2022/4/24 20:00
     */
    @ApiOperationSupport(order = 2)
    @ApiOperation("获取系统基础配置")
    @GetMapping("/sys/config/sysBaseList")
    public CommonResult> sysBaseList(String channel) {
        return CommonResult.data(devConfigService.getSysBaseList(channel));
    }

    /**
     * 获取配置列表
     *
     * @author xuyuxiang
     * @date 2022/4/24 20:00
     */
    @ApiOperationSupport(order = 2)
    @ApiOperation("获取配置列表")
    @GetMapping("/sys/config/list")
    public CommonResult> list(SysConfigListParam devConfigListParam) {
        return CommonResult.data(devConfigService.list(devConfigListParam));
    }

    /**
     * 添加配置
     *
     * @author xuyuxiang
     * @date 2022/4/24 20:47
     */
    @ApiOperationSupport(order = 3)
    @ApiOperation("添加配置")
    @CommonLog("添加配置")
    @PostMapping("/sys/config/add")
    public CommonResult add(@RequestBody @Valid SysConfigAddParam devConfigAddParam) {
        devConfigService.add(devConfigAddParam);
        return CommonResult.ok();
    }

    /**
     * 编辑配置
     *
     * @author xuyuxiang
     * @date 2022/4/24 20:47
     */
    @ApiOperationSupport(order = 4)
    @ApiOperation("编辑配置")
    @CommonLog("编辑配置")
    @PostMapping("/sys/config/edit")
    public CommonResult edit(@RequestBody @Valid SysConfigEditParam devConfigEditParam) {
        devConfigService.edit(devConfigEditParam);
        return CommonResult.ok();
    }

    /**
     * 删除配置
     *
     * @author xuyuxiang
     * @date 2022/4/24 20:00
     */
    @ApiOperationSupport(order = 5)
    @ApiOperation("删除配置")
    @CommonLog("删除配置")
    @PostMapping("/sys/config/delete")
    public CommonResult delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空")
                                           CommonValidList devConfigIdParamList) {
        devConfigService.delete(devConfigIdParamList);
        return CommonResult.ok();
    }

    /**
     * 获取配置详情
     *
     * @author xuyuxiang
     * @date 2022/4/24 20:00
     */
    @ApiOperationSupport(order = 6)
    @ApiOperation("获取配置详情")
    @GetMapping("/sys/config/detail")
    public CommonResult detail(@Valid SysConfigFlowParam devConfigIdParam) {
        return CommonResult.data(devConfigService.detail(devConfigIdParam));
    }

    /**
     * 配置批量更新
     *
     * @author xuyuxiang
     * @date 2022/4/24 20:00
     */
    @ApiOperationSupport(order = 7)
    @ApiOperation("配置批量更新")
    @CommonLog("配置批量更新")
    @PostMapping("/sys/config/editBatch")
    public CommonResult editBatch(@RequestBody @Valid @NotEmpty(message = "集合不能为空")
                                                      CommonValidList devConfigBatchParamList) {
        devConfigService.editBatch(devConfigBatchParamList);
        return CommonResult.ok();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy