package com.ruoyi.hezhi.controller; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.hezhi.domain.TbSmsCode; import com.ruoyi.hezhi.service.ITbSmsCodeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 短信验证码Controller * * @author ruoyi * @date 2024-11-06 */ @RestController @RequestMapping("/hezhi/smsCode") public class TbSmsCodeController extends BaseController { @Autowired private ITbSmsCodeService tbSmsCodeService; /** * 查询短信验证码列表 */ @PreAuthorize("@ss.hasPermi('hezhi:smsCode:list')") @GetMapping("/list") public TableDataInfo list(TbSmsCode tbSmsCode) { startPage(); List list = tbSmsCodeService.selectTbSmsCodeList(tbSmsCode); return getDataTable(list); } /** * 导出短信验证码列表 */ @PreAuthorize("@ss.hasPermi('hezhi:smsCode:export')") @Log(title = "短信验证码", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, TbSmsCode tbSmsCode) { List list = tbSmsCodeService.selectTbSmsCodeList(tbSmsCode); ExcelUtil util = new ExcelUtil(TbSmsCode.class); util.exportExcel(response, list, "短信验证码数据"); } /** * 获取短信验证码详细信息 */ @PreAuthorize("@ss.hasPermi('hezhi:smsCode:query')") @GetMapping(value = "/{smsCodeId}") public AjaxResult getInfo(@PathVariable("smsCodeId") Long smsCodeId) { return success(tbSmsCodeService.selectTbSmsCodeBySmsCodeId(smsCodeId)); } /** * 新增短信验证码 */ @PreAuthorize("@ss.hasPermi('hezhi:smsCode:add')") @Log(title = "短信验证码", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TbSmsCode tbSmsCode) { return toAjax(tbSmsCodeService.insertTbSmsCode(tbSmsCode)); } /** * 修改短信验证码 */ @PreAuthorize("@ss.hasPermi('hezhi:smsCode:edit')") @Log(title = "短信验证码", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TbSmsCode tbSmsCode) { return toAjax(tbSmsCodeService.updateTbSmsCode(tbSmsCode)); } /** * 删除短信验证码 */ @PreAuthorize("@ss.hasPermi('hezhi:smsCode:remove')") @Log(title = "短信验证码", businessType = BusinessType.DELETE) @DeleteMapping("/{smsCodeIds}") public AjaxResult remove(@PathVariable Long[] smsCodeIds) { return toAjax(tbSmsCodeService.deleteTbSmsCodeBySmsCodeIds(smsCodeIds)); } }