| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TSysMessageTemplate; |
| | | import com.ruoyi.system.query.TSysMessageTemplateQuery; |
| | | import com.ruoyi.system.service.TSysMessageTemplateService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2025-08-20 |
| | | */ |
| | | @Api(tags = "短信模板管理") |
| | | @RestController |
| | | @RequestMapping("/t-sys-message-template") |
| | | public class TSysMessageTemplateController { |
| | | |
| | | private final TSysMessageTemplateService sysMessageTemplateService; |
| | | @Autowired |
| | | public TSysMessageTemplateController(TSysMessageTemplateService sysMessageTemplateService) { |
| | | this.sysMessageTemplateService = sysMessageTemplateService; |
| | | } |
| | | |
| | | /** |
| | | * 获取短信模板管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取短信模板管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TSysMessageTemplate>> pageList(@RequestBody TSysMessageTemplateQuery query) { |
| | | return R.ok(sysMessageTemplateService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 获取短信模板管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取短信模板管理列表") |
| | | @PostMapping(value = "/list") |
| | | public R<List<TSysMessageTemplate>> list() { |
| | | return R.ok(sysMessageTemplateService.list(Wrappers.lambdaQuery(TSysMessageTemplate.class).orderByDesc(TSysMessageTemplate::getCreateTime))); |
| | | } |
| | | |
| | | /** |
| | | * 添加短信模板管理管理 |
| | | */ |
| | | @Log(title = "短信模板管理信息-新增短信模板管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加短信模板管理") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TSysMessageTemplate dto) { |
| | | if (sysMessageTemplateService.isExit(dto)) { |
| | | return R.fail("短信模板管理名称已存在"); |
| | | } |
| | | return R.ok(sysMessageTemplateService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改短信模板管理 |
| | | */ |
| | | @Log(title = "短信模板管理信息-修改短信模板管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改短信模板管理") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TSysMessageTemplate dto) { |
| | | if (sysMessageTemplateService.isExit(dto)) { |
| | | return R.fail("短信模板管理名称已存在"); |
| | | } |
| | | return R.ok(sysMessageTemplateService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看短信模板管理详情 |
| | | */ |
| | | @ApiOperation(value = "查看短信模板管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysMessageTemplate> getDetailById(@RequestParam String id) { |
| | | return R.ok(sysMessageTemplateService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除短信模板管理 |
| | | */ |
| | | @Log(title = "短信模板管理信息-删除短信模板管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除短信模板管理") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(sysMessageTemplateService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除短信模板管理 |
| | | */ |
| | | @Log(title = "短信模板管理信息-删除短信模板管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除短信模板管理") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(sysMessageTemplateService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |