package com.fs.crm.controller; 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.fs.common.annotation.Log; import com.fs.common.core.controller.BaseController; import com.fs.common.core.domain.AjaxResult; import com.fs.common.enums.BusinessType; import com.fs.crm.domain.CrmMsg; import com.fs.crm.service.ICrmMsgService; import com.fs.common.utils.poi.ExcelUtil; import com.fs.common.core.page.TableDataInfo; /** * 消息Controller * * @author fs * @date 2022-12-21 */ @RestController @RequestMapping("/crm/msg") public class CrmMsgController extends BaseController { @Autowired private ICrmMsgService crmMsgService; /** * 查询 消息列表 */ @PreAuthorize("@ss.hasPermi('crm:msg:list')") @GetMapping("/list") public TableDataInfo list(CrmMsg crmMsg) { startPage(); List list = crmMsgService.selectCrmMsgList(crmMsg); return getDataTable(list); } /** * 导出 消息列表 */ @PreAuthorize("@ss.hasPermi('crm:msg:export')") @Log(title = " 消息", businessType = BusinessType.EXPORT) @GetMapping("/export") public AjaxResult export(CrmMsg crmMsg) { List list = crmMsgService.selectCrmMsgList(crmMsg); ExcelUtil util = new ExcelUtil(CrmMsg.class); return util.exportExcel(list, "msg"); } /** * 获取 消息详细信息 */ @PreAuthorize("@ss.hasPermi('crm:msg:query')") @GetMapping(value = "/{msgId}") public AjaxResult getInfo(@PathVariable("msgId") Long msgId) { return AjaxResult.success(crmMsgService.selectCrmMsgById(msgId)); } /** * 新增 消息 */ @PreAuthorize("@ss.hasPermi('crm:msg:add')") @Log(title = " 消息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody CrmMsg crmMsg) { return toAjax(crmMsgService.insertCrmMsg(crmMsg)); } /** * 修改 消息 */ @PreAuthorize("@ss.hasPermi('crm:msg:edit')") @Log(title = " 消息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody CrmMsg crmMsg) { return toAjax(crmMsgService.updateCrmMsg(crmMsg)); } /** * 删除 消息 */ @PreAuthorize("@ss.hasPermi('crm:msg:remove')") @Log(title = " 消息", businessType = BusinessType.DELETE) @DeleteMapping("/{msgIds}") public AjaxResult remove(@PathVariable Long[] msgIds) { return toAjax(crmMsgService.deleteCrmMsgByIds(msgIds)); } }