This commit is contained in:
xiaofajia 2024-12-16 16:11:37 +08:00
parent 87eb50c282
commit 3b5c87b032
3 changed files with 45 additions and 23 deletions

View File

@ -314,5 +314,4 @@ public class AppNewsController extends BaseController {
IPage<InspectionNews> news = inspectionNewsService.msgList(page,partnerId);
return success(news);
}
}

View File

@ -5,16 +5,12 @@ import javax.servlet.http.HttpServletResponse;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.util.ExcelUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.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 org.springframework.web.bind.annotation.*;
import cn.iocoder.yudao.module.core.controller.BaseController;
import cn.iocoder.yudao.module.inspection.entity.WarnMessage;
import cn.iocoder.yudao.module.inspection.service.IWarnMessageService;
@ -27,8 +23,7 @@ import cn.iocoder.yudao.module.inspection.service.IWarnMessageService;
*/
@RestController
@RequestMapping("/admin-api/warnMsg/warnMsg")
public class WarnMessageController extends BaseController
{
public class WarnMessageController extends BaseController {
@Autowired
private IWarnMessageService warnMessageService;
@ -42,11 +37,12 @@ public class WarnMessageController extends BaseController
}
@GetMapping("/pageList")
public CommonResult pageList(WarnMessage warnMessage,Integer pageNo,Integer pageSize) throws Exception {
Page page =new Page(pageNo,pageSize);
IPage<WarnMessage> list = warnMessageService.pageList(page,warnMessage);
public CommonResult pageList(WarnMessage warnMessage, Integer pageNo, Integer pageSize) throws Exception {
Page page = new Page(pageNo, pageSize);
IPage<WarnMessage> list = warnMessageService.pageList(page, warnMessage);
return success(list);
}
@PostMapping("/export")
public void export(HttpServletResponse response, WarnMessage warnMessage) throws Exception {
List<WarnMessage> list = warnMessageService.selectWarnMessageList(warnMessage);
@ -58,29 +54,56 @@ public class WarnMessageController extends BaseController
* 获取warnMsg详细信息
*/
@GetMapping(value = "/{id}")
public CommonResult getInfo(@PathVariable("id") Long id)
{
public CommonResult getInfo(@PathVariable("id") Long id) {
WarnMessage warnMessage = new WarnMessage();
warnMessage.setId(id);
warnMessage.setIsRead("1");
warnMessageService.updateById(warnMessage);
return success(warnMessageService.selectWarnMessageById(id));
}
@PostMapping("/add")
public CommonResult add(@RequestBody WarnMessage warnMessage)
{
public CommonResult add(@RequestBody WarnMessage warnMessage) {
return toAjax(warnMessageService.insertWarnMessage(warnMessage));
}
@PostMapping("/edit")
public CommonResult edit(@RequestBody WarnMessage warnMessage)
{
public CommonResult edit(@RequestBody WarnMessage warnMessage) {
return toAjax(warnMessageService.updateWarnMessage(warnMessage));
}
@DeleteMapping("/{ids}")
public CommonResult remove(@PathVariable Long[] ids)
{
@DeleteMapping("/{ids}")
public CommonResult remove(@PathVariable Long[] ids) {
return toAjax(warnMessageService.deleteWarnMessageByIds(ids));
}
/**
* 获取未读的提醒数量
*
* @author 小李
* @date 14:33 2024/12/16
**/
@GetMapping("/getCount")
public CommonResult<?> getCount() {
long count = warnMessageService.count(new LambdaQueryWrapper<WarnMessage>().eq(WarnMessage::getIsRead, "0"));
return success(count);
}
/**
* 已读全部
*
* @author 小李
* @date 15:57 2024/12/16
**/
@GetMapping("/readAll")
public CommonResult<?> readAll() {
warnMessageService.update(new LambdaUpdateWrapper<WarnMessage>()
.set(WarnMessage::getIsRead, "1")
.eq(WarnMessage::getIsRead, "0")
);
return CommonResult.ok();
}
}

View File

@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWarnMessageList" resultType="cn.iocoder.yudao.module.inspection.entity.WarnMessage">
select * from warn_message
<where>
and warn_time <![CDATA[<=]]> NOW()
and warn_time <![CDATA[<=]]> NOW() and deleted = '0'
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="partnerId != null "> and partner_id = #{partnerId}</if>
<if test="isRead != null and isRead != ''"> and is_read = #{isRead}</if>