cool-team-official / cool-admin-midway

🔥 cool-admin(midway版)一个很酷的后台权限管理框架,Ai编码、流程编排、模块化、插件化、CRUD极速开发,永久开源免费,基于midway.js 3.x、typescript、typeorm、mysql、jwt、vue3、vite、element-ui等构建
https://cool-js.com
MIT License
2.65k stars 588 forks source link

重写crud,调用super.page(param); keyWordLikeFields: ['out_trade_no'],模糊查询就没效果了 #134

Closed caolonggang closed 1 year ago

caolonggang commented 1 year ago

需求是把用户的手机号隐藏中间四位,所以重写crud, 重写方法如下: async page(param: any) { const data = await super.page(param); data.list.forEach(item => { if (item.mobile) { item.mobile = item.mobile.replace(/(\d{3})(\d{4})(\d{4})/, '$1****$3'); } }); return data; }

这时候配置的模糊查询就没效果了 @CoolController({ api: ['add', 'delete', 'update', 'info', 'list', 'page'], entity: OrderEntity, service: OrderService, pageQueryOp: { addOrderBy: { create_time: 'desc', }, keyWordLikeFields: ['out_trade_no'], } })

cool-team-official commented 1 year ago

最后执行的sql 打印出来看下

cool-team-official commented 1 year ago

未能复现您说的情况