From b00ac813e5be3fedb10ca49e7e57a757295e19fe Mon Sep 17 00:00:00 2001
From: fuchengshen <men883234@gmail.com>
Date: 星期二, 28 六月 2022 11:11:54 +0800
Subject: [PATCH] 更新设备分组接口
---
src/app/modules/base/service/sys/user.ts | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/app/modules/base/service/sys/user.ts b/src/app/modules/base/service/sys/user.ts
index 5798a9a..0173d12 100644
--- a/src/app/modules/base/service/sys/user.ts
+++ b/src/app/modules/base/service/sys/user.ts
@@ -34,6 +34,7 @@
* @param query
*/
async page(query) {
+ console.log(query, "page 鎵撳嵃 query")
const { keyWord, status, departmentIds = [] } = query;
const permsDepartmentArr = await this.baseSysPermsService.departmentIds(
this.ctx.admin.userId
@@ -50,21 +51,21 @@
LEFT JOIN t_sys_department d on a.departmentId = d.id
WHERE 1 = 1
${this.setSql(
- !_.isEmpty(departmentIds),
- 'and a.departmentId in (?)',
- [departmentIds]
- )}
+ !_.isEmpty(departmentIds),
+ 'and a.departmentId in (?)',
+ [departmentIds]
+ )}
${this.setSql(status, 'and a.status = ?', [status])}
${this.setSql(keyWord, 'and (a.name LIKE ? or a.username LIKE ?)', [
- `%${keyWord}%`,
- `%${keyWord}%`,
- ])}
+ `%${keyWord}%`,
+ `%${keyWord}%`,
+ ])}
${this.setSql(true, 'and a.username != ?', ['admin'])}
${this.setSql(
- this.ctx.admin.username !== 'admin',
- 'and a.departmentId in (?)',
- [!_.isEmpty(permsDepartmentArr) ? permsDepartmentArr : [null]]
- )}
+ this.ctx.admin.username !== 'admin',
+ 'and a.departmentId in (?)',
+ [!_.isEmpty(permsDepartmentArr) ? permsDepartmentArr : [null]]
+ )}
GROUP BY a.id
`;
return this.sqlRenderPage(sql, query);
@@ -117,9 +118,11 @@
* @param param
*/
async add(param) {
+ console.log(param, "param")
const exists = await this.baseSysUserEntity.findOne({
username: param.username,
});
+ console.log(exists, "exists")
if (!_.isEmpty(exists)) {
throw new CoolCommException('鐢ㄦ埛鍚嶅凡缁忓瓨鍦▇');
}
--
Gitblit v1.9.1