package com.ruoyi.web.controller.system; import java.util.List; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.domain.TextMessage; import com.ruoyi.system.service.ITextMessageService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 短信设置Controller * * @author ruoyi * @date 2021-07-20 */ @RestController @RequestMapping("/system/sendMessage") public class TextMessageController extends BaseController { @Autowired private ITextMessageService textMessageService; /** * 查询短信设置列表 */ @PreAuthorize("@ss.hasPermi('system:sendMessage:list')") @GetMapping("/list") public TableDataInfo list(TextMessage textMessage) { startPage(); List list = textMessageService.selectTextMessageList(textMessage); return getDataTable(list); } /** * 导出短信设置列表 */ @PreAuthorize("@ss.hasPermi('system:sendMessage:export')") @Log(title = "短信设置", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(TextMessage textMessage) { List list = textMessageService.selectTextMessageList(textMessage); ExcelUtil util = new ExcelUtil(TextMessage.class); return util.exportExcel(list, "sendMessage"); } /** * 获取短信设置详细信息 */ @PreAuthorize("@ss.hasPermi('system:sendMessage:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(textMessageService.selectTextMessageById(id)); } /** * 新增短信设置 */ @PreAuthorize("@ss.hasPermi('system:sendMessage:add')") @Log(title = "短信设置", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TextMessage textMessage) { return toAjax(textMessageService.insertTextMessage(textMessage)); } /** * 修改短信设置 */ @PreAuthorize("@ss.hasPermi('system:sendMessage:edit')") @Log(title = "短信设置", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TextMessage textMessage) { return toAjax(textMessageService.updateTextMessage(textMessage)); } /** * 删除短信设置 */ @PreAuthorize("@ss.hasPermi('system:sendMessage:remove')") @Log(title = "短信设置", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(textMessageService.deleteTextMessageByIds(ids)); } }