package cn.besteam.modules.medical.controller;
|
|
import java.util.Arrays;
|
import javax.servlet.http.HttpServletRequest;
|
|
import cn.besteam.modules.medical.dto.MwMessageDTO;
|
import cn.besteam.modules.medical.vo.MwMessageVo;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import cn.besteam.common.api.vo.Result;
|
import cn.besteam.common.aspect.annotation.AutoLog;
|
import cn.besteam.modules.medical.entity.MwMessage;
|
import cn.besteam.modules.medical.service.IMwMessageService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import lombok.extern.slf4j.Slf4j;
|
|
/**
|
* @Title: Controller
|
* @Description: 通知消息
|
* @author: besteam
|
* @date: 2022-02-15
|
* @version: V1.0
|
*/
|
@RestController
|
@RequestMapping("/medical/mwMessage")
|
@Slf4j
|
@Api(description = "通知消息")
|
public class MwMessageController {
|
|
@Autowired
|
private IMwMessageService mwMessageService;
|
|
/**
|
* 分页列表查询
|
* @param mwMessageDto
|
* @param pageNo
|
* @param pageSize
|
* @param req
|
* @return
|
*/
|
@GetMapping(value = "/list")
|
@ApiOperation(value = "获取通知消息数据列表", notes = "获取所有通知消息数据列表", produces = "application/json")
|
public Result<IPage<MwMessageVo>> queryPageList(MwMessageDTO mwMessageDto, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
|
|
IPage<MwMessageVo> pageList = mwMessageService.queryPageList(pageNo,pageSize,mwMessageDto);
|
|
return Result.ok(pageList);
|
}
|
|
/**
|
* 设置已读状态
|
*
|
* @param
|
* @return
|
*/
|
@PostMapping(value = "/readReceipt")
|
@AutoLog(value = "设置已读状态")
|
@ApiOperation(value = "设置已读状态", notes = "设置已读状态", produces = "application/json")
|
public Result<Boolean> readReceipt(@RequestParam(name="ids",required=false) String ids) {
|
|
return Result.ok(mwMessageService.readReceipt(ids));
|
}
|
|
/**
|
* 通过id删除
|
* @param id
|
* @return
|
*/
|
@PostMapping(value = "/delete")
|
@AutoLog(value = "删除通知消息")
|
@ApiOperation(value = "删除通知消息", notes = "删除通知消息", produces = "application/json")
|
public Result<MwMessage> delete(@RequestParam(name="id",required=true) String id) {
|
|
Result<MwMessage> result = new Result<MwMessage>();
|
MwMessage mwMessage = mwMessageService.getById(id);
|
if(mwMessage==null) {
|
result.error500("未找到对应实体");
|
}else {
|
boolean ok = mwMessageService.removeById(id);
|
if(ok) {
|
result.success("删除成功!");
|
}
|
}
|
|
return result;
|
}
|
|
/**
|
* 批量删除
|
* @param ids
|
* @return
|
*/
|
@PostMapping(value = "/deleteBatch")
|
@AutoLog(value = "批量删除通知消息")
|
@ApiOperation(value = "批量删除通知消息", notes = "批量删除通知消息", produces = "application/json")
|
public Result<MwMessage> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
Result<MwMessage> result = new Result<MwMessage>();
|
if(ids==null || "".equals(ids.trim())) {
|
result.error500("参数不识别!");
|
}else {
|
this.mwMessageService.removeByIds(Arrays.asList(ids.split(",")));
|
result.success("删除成功!");
|
}
|
return result;
|
}
|
|
/**
|
* 通过id查询
|
* @param id
|
* @return
|
*/
|
@GetMapping(value = "/queryById")
|
@ApiOperation(value = "通过id查询通知消息", notes = "通过id查询通知消息", produces = "application/json")
|
public Result<MwMessage> queryById(@RequestParam(name="id",required=true) String id) {
|
|
Result<MwMessage> result = new Result<MwMessage>();
|
MwMessage mwMessage = mwMessageService.getById(id);
|
if(mwMessage==null) {
|
result.error500("未找到对应实体");
|
}else {
|
result.setResult(mwMessage);
|
result.setSuccess(true);
|
}
|
return result;
|
}
|
|
}
|