添加mq推送消息

This commit is contained in:
yangjun 2026-03-09 11:20:53 +08:00
parent 347d5d4053
commit 93a9f3c18b
1 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nu.modules.nubaseinfo.entity.NuBaseInfo;
import com.nu.modules.nubaseinfo.service.INuBaseInfoService;
import com.nu.utils.RabbitMQUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -39,6 +40,8 @@ public class NuBaseInfoController extends JeecgController<NuBaseInfo, INuBaseInf
@Autowired
private INuBaseInfoService nuBaseInfoService;
@Autowired
private RabbitMQUtil rabbitMQUtil;
/**
* 分页列表查询
*
@ -118,7 +121,6 @@ public class NuBaseInfoController extends JeecgController<NuBaseInfo, INuBaseInf
queryWrapper.eq("area_flag","1");
Page<NuBaseInfo> page = new Page<NuBaseInfo>(pageNo, pageSize);
IPage<NuBaseInfo> pageList = nuBaseInfoService.page(page, queryWrapper);
//TODO 把长者信息加进来
return Result.OK(pageList);
}
@ -136,6 +138,8 @@ public class NuBaseInfoController extends JeecgController<NuBaseInfo, INuBaseInf
public Result<String> add(@RequestBody NuBaseInfo nuBaseInfo) {
service.setNuId(nuBaseInfo);
nuBaseInfoService.save(nuBaseInfo);
rabbitMQUtil.sendToExchange("hldy.hldy", "hldy.async.addBase", nuBaseInfo);
return Result.OK("添加成功!");
}
@ -151,6 +155,7 @@ public class NuBaseInfoController extends JeecgController<NuBaseInfo, INuBaseInf
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody NuBaseInfo nuBaseInfo) {
nuBaseInfoService.updateById(nuBaseInfo);
rabbitMQUtil.sendToExchange("hldy.hldy", "hldy.async.updateBase", nuBaseInfo);
return Result.OK("操作成功!");
}