diff --git a/ruoyi-system/src/main/resources/mapper/system/ShopUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/ShopUserMapper.xml index 3b56e6b..6a9c88b 100644 --- a/ruoyi-system/src/main/resources/mapper/system/ShopUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/ShopUserMapper.xml @@ -81,8 +81,12 @@ and user_id = #{userId} and username like concat('%', #{username}, '%') and password = #{password} - and phone = #{phone} - and nickname like concat('%', #{nickname}, '%') + + or phone like concat('%', #{phone}, '%') + + + or nickname like concat('%', #{nickname}, '%') + and sex = #{sex} and birthday = #{birthday} and addr = #{addr} diff --git a/ruoyi-ui/src/views/user/manage/index.vue b/ruoyi-ui/src/views/user/manage/index.vue index a468f8a..b1ee0a4 100644 --- a/ruoyi-ui/src/views/user/manage/index.vue +++ b/ruoyi-ui/src/views/user/manage/index.vue @@ -105,6 +105,8 @@ export default { queryParams: { pageNum: 1, pageSize: 10, + phone: null, + nickname: null, searchKey: null } }; @@ -139,11 +141,22 @@ export default { /** 搜索按钮操作 */ handleQuery() { this.queryParams.pageNum = 1; + // 如果有搜索关键字,同时设置手机号和昵称参数 + if (this.queryParams.searchKey) { + this.queryParams.phone = this.queryParams.searchKey; + this.queryParams.nickname = this.queryParams.searchKey; + } else { + this.queryParams.phone = null; + this.queryParams.nickname = null; + } this.getList(); }, /** 重置按钮操作 */ resetQuery() { this.resetForm("queryForm"); + this.queryParams.phone = null; + this.queryParams.nickname = null; + this.queryParams.searchKey = null; this.handleQuery(); }, /** 状态修改 */