feat(消息管理): list接口支持按员工电话查询esContent

- queryPageList新增employeePhone参数
- 11位纯数字还原为3~4~4全角波浪线格式后like查询esContent
- 非11位用原值兜底like

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-16 16:25:31 +08:00
co-authored by Claude
parent 145cf89a89
commit f604d18b32
@@ -41,13 +41,36 @@ public class SysMessageController extends JeecgController<SysMessage, ISysMessag
*/
@GetMapping(value = "/list")
public Result<?> queryPageList(SysMessage sysMessage, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(name = "employeePhone", required = false) String employeePhone,
HttpServletRequest req) {
QueryWrapper<SysMessage> queryWrapper = QueryGenerator.initQueryWrapper(sysMessage, req.getParameterMap());
// 员工电话: esContent中手机号以"3位~4位~4位"(全角波浪线)格式存储,
// 前端传入纯数字手机号,此处还原为存储格式后对 esContent 做模糊查询
if (employeePhone != null && !employeePhone.trim().isEmpty()) {
queryWrapper.like("esContent", buildEmployeePhoneLikeValue(employeePhone));
}
Page<SysMessage> page = new Page<SysMessage>(pageNo, pageSize);
IPage<SysMessage> pageList = sysMessageService.page(page, queryWrapper);
return Result.ok(pageList);
}
/**
* 将前端传入的员工电话还原为 esContent 中存储的"3位~4位~4位"(全角波浪线)格式。
* 11位纯数字 -> 还原为 ddddddd~dddd;其余情况用原始输入兜底(兼容用户直接粘贴带~的原文)。
* 等效SQL: ES_CONTENT LIKE '%18599205354%'
*
* @param employeePhone 前端传入的员工电话
* @return 用于模糊查询 esContent 的值
*/
private String buildEmployeePhoneLikeValue(String employeePhone) {
String digits = employeePhone.replaceAll("[^0-9]", "");
if (digits.length() == 11) {
return digits.substring(0, 3) + "" + digits.substring(3, 7) + "" + digits.substring(7, 11);
}
return employeePhone.trim();
}
/**
* 添加
*