| New file |
| | |
| | | package cn.gistack.sm.sms.controller; |
| | | |
| | | import cn.gistack.sm.sms.entity.SmsTemplate; |
| | | import cn.gistack.sm.sms.service.ISmsTemplateService; |
| | | import cn.gistack.sm.sms.vo.SmsTemplateVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * 短信发送模板控制层 |
| | | * @author zhongrj |
| | | * @date 2023-05-23 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags="短信发送模板") |
| | | @RestController |
| | | @RequestMapping("/smsTemplate/smsTemplate") |
| | | @AllArgsConstructor |
| | | public class SmsTemplateController extends BladeController { |
| | | |
| | | private ISmsTemplateService smsTemplateService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="短信发送模板-分页列表查询", notes="短信发送模板-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public R queryPageList(SmsTemplate smsTemplate, Query query) { |
| | | IPage<SmsTemplate> pageList = smsTemplateService.page(Condition.getPage(query), Condition.getQueryWrapper(smsTemplate)); |
| | | return R.data(pageList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 自定义列表查询 |
| | | * @param query |
| | | * @param smsTemplate |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="短信发送模板-自定义列表查询", notes="短信发送模板-自定义列表查询") |
| | | @GetMapping(value = "/page") |
| | | public R selectSmsTemplatePage(SmsTemplateVO smsTemplate, Query query) { |
| | | return R.data(smsTemplateService.selectSmsTemplatePage(Condition.getPage(query),smsTemplate)); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | */ |
| | | @ApiOperation(value="短信发送模板-添加", notes="短信发送模板-添加") |
| | | @PostMapping(value = "/add") |
| | | public R add(@RequestBody SmsTemplate smsTemplate) { |
| | | return R.data(smsTemplateService.save(smsTemplate)); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="短信发送模板-编辑", notes="短信发送模板-编辑") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
| | | public R edit(@RequestBody SmsTemplate smsTemplate) { |
| | | return R.data(smsTemplateService.updateById(smsTemplate)); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="短信发送模板-通过id删除", notes="短信发送模板-通过id删除") |
| | | @PostMapping(value = "/delete") |
| | | public R delete(@RequestParam(name="id",required=true) String id) { |
| | | return R.data(smsTemplateService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="短信发送模板-批量删除", notes="短信发送模板-批量删除") |
| | | @PostMapping(value = "/deleteBatch") |
| | | public R deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
| | | return R.data(smsTemplateService.removeByIds(Arrays.asList(ids.split(",")))); |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value="短信发送模板-通过id查询", notes="短信发送模板-通过id查询") |
| | | @GetMapping(value = "/queryById") |
| | | public R queryById(@RequestParam(name="id",required=true) String id) { |
| | | SmsTemplate SmsTemplate = smsTemplateService.getById(id); |
| | | return R.data(SmsTemplate); |
| | | } |
| | | |
| | | } |