Newer
Older
newfiber-termite / newfiber-system / newfiber-system-sms / src / main / java / com / newfiber / system / controller / SmsConfigController.java
package com.newfiber.system.controller;

import com.newfiber.common.core.web.controller.BaseController;
import com.newfiber.common.core.web.domain.Result;
import com.newfiber.common.core.web.page.PageResult;
import com.newfiber.common.log.annotation.Log;
import com.newfiber.common.log.enums.BusinessType;
import com.newfiber.common.security.annotation.RequiresPermissions;
import com.newfiber.system.domain.SmsConfig;
import com.newfiber.system.domain.request.smsConfig.SmsConfigQueryRequest;
import com.newfiber.system.domain.request.smsConfig.SmsConfigSaveRequest;
import com.newfiber.system.domain.request.smsConfig.SmsConfigUpdateRequest;
import com.newfiber.system.service.ISmsConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 短信配置Controller
 * 
 * @author X.K
 * @date 2023-02-27
 */
@RestController
@RequestMapping("/smsConfig")
@Api(value = "短信配置", tags = "短信配置")
public class SmsConfigController extends BaseController {

    @Resource
    private ISmsConfigService smsConfigService;

    /**
     * 新增短信配置
     */
    @PostMapping("add")
    @RequiresPermissions("systemSms:smsConfig:add")
    @ApiOperation(value = "新增短信配置", position = 10)
    @Log(title = "短信配置", businessType = BusinessType.INSERT)
    public Result<Long> add(@RequestBody SmsConfigSaveRequest request) {
        return success(smsConfigService.insert(request));
    }

    /**
     * 修改短信配置
     */
    @PutMapping("edit")
    @RequiresPermissions("systemSms:smsConfig:edit")
    @ApiOperation(value = "修改短信配置", position = 20)
    @Log(title = "短信配置", businessType = BusinessType.UPDATE)
    public Result<Object> edit(@RequestBody SmsConfigUpdateRequest request) {
        return success(smsConfigService.update(request));
    }

    /**
     * 删除短信配置
     */
    @DeleteMapping("/{ids}")
    @RequiresPermissions("systemSms:smsConfig:remove")
    @ApiOperation(value = "删除短信配置", notes = "传入ids(,隔开)", position = 30)
    @Log(title = "短信配置", businessType = BusinessType.DELETE)
    public Result<Object> remove(@PathVariable String ids) {
        return success(smsConfigService.delete(ids));
    }

    /**
     * 详细查询短信配置
     */
    @GetMapping(value = "/{id}")
    @RequiresPermissions("systemSms:smsConfig:detail")
    @ApiOperation(value = "详细查询短信配置", position = 40)
    public Result<SmsConfig> detail(@PathVariable("id") Long id) {
        return success(smsConfigService.selectDetail(id));
    }

    /**
     * 分页查询短信配置
     */
    @GetMapping("/page")
    @RequiresPermissions("systemSms:smsConfig:page")
    @ApiOperation(value = "分页查询短信配置", position = 50)
    public PageResult<List<SmsConfig>> page(SmsConfigQueryRequest request) {
        startPage();
        List<SmsConfig> list = smsConfigService.selectPage(request);
        return pageResult(list);
    }

    /**
     * 列表查询短信配置
     */
    @GetMapping("/list")
    @RequiresPermissions("systemSms:smsConfig:list")
    @ApiOperation(value = "列表查询短信配置", position = 60)
    public Result<List<SmsConfig>> list(SmsConfigQueryRequest request) {
        List<SmsConfig> list = smsConfigService.selectList(request);
        return success(list);
    }

}