Browse Source

feat:“增加子账号搜索功能“

soobin 1 year ago
parent
commit
e6b46c7957

+ 5 - 0
src/main/java/com/szwl/controller/IndexController.java

@@ -1709,6 +1709,11 @@ public class IndexController {
         query.eq(TEquipment::getClientId, clientId);
         TEquipment equipment = equipmentService.getOne(query);
         LambdaQueryWrapper<TProduct> queryProduct = Wrappers.lambdaQuery();
+        if (equipment == null) {
+            jsonObject.put("code", 1);
+            jsonObject.put("errmsg", "找不到设备");
+            return jsonObject.toJSONString();
+        }
         queryProduct.eq(TProduct::getEquipmentId, equipment.getId());
         List<TProduct> products = productService.list(queryProduct);
         TEquipmentDesc equipmentDesc = equipmentDescService.getById(equipment.getId());

+ 16 - 13
src/main/java/com/szwl/controller/TAdminController.java

@@ -41,7 +41,7 @@ import java.util.stream.Collectors;
 
 /**
  * <p>
- *  前端控制器
+ * 前端控制器
  * </p>
  *
  * @author wuhs
@@ -347,7 +347,6 @@ public class TAdminController {
 
     @ApiOperation(value = "获取所有子账号信息")
     @GetMapping("/getChildDrenAdminList")
-//    public ResponseModel<?> getChildDrenAdminList(String adminId, String userName, String name, String isUse) {
     public ResponseModel<?> getChildDrenAdminList(String adminId, String userName, String name) {
         List<AddLoginUserParam> returnList = new ArrayList<>();
         LambdaQueryWrapper<TAdmin> query = Wrappers.lambdaQuery();
@@ -478,7 +477,7 @@ public class TAdminController {
         LambdaQueryWrapper<TAdmin> query = Wrappers.lambdaQuery();
         query.eq(TAdmin::getUsername, registerParam.getUsername());
         List<TAdmin> list = tAdminService.list(query);
-        if (list.size() > 0) {
+        if (!list.isEmpty()) {
             return R.fail(ResponseCodesEnum.A0201, "用户登录名已存在");
         }
         LambdaQueryWrapper<TAdmin> query1 = Wrappers.lambdaQuery();
@@ -493,7 +492,7 @@ public class TAdminController {
             query1.eq(TAdmin::getEmail, registerParam.getPhoneOrEmail());
         }
         List<TAdmin> list1 = tAdminService.list(query1);
-        if (list1.size() > 0) {
+        if (!list1.isEmpty()) {
             return R.fail(ResponseCodesEnum.A0203, "用户手机/邮箱已存在");
         }
 
@@ -515,7 +514,7 @@ public class TAdminController {
         query2.eq(TMessageCode::getStatus, "0");
         List<TMessageCode> messageCodeList = tMessageCodeService.list(query2);
         TAdmin admin = new TAdmin();
-        if (messageCodeList.size() > 0) {
+        if (!messageCodeList.isEmpty()) {
             TMessageCode tMessageCode = messageCodeList.get(messageCodeList.size() - 1);
             if (!tMessageCode.getCode().equals(registerParam.getCode())) {
                 return R.fail(ResponseCodesEnum.A0002, "验证码错误");
@@ -619,17 +618,17 @@ public class TAdminController {
 
         // 判断是为申泽用户还是七云用户
         String companyType = tAdmin.getCompanyType();
-        String SZ = "Sunzee";
-        String SC = "Sevencloud";
+        String sZ = "Sunzee";
+        String sC = "Sevencloud";
         // 如果不为管理员
         if (tAdmin.getType() >= 1) {
-            if (SZ.equals(hostName)) {
+            if (sZ.equals(hostName)) {
                 // 如果companyType不为空,且不等于“0”
                 if (StringUtils.isNotEmpty(companyType) && !companyType.equals("0")) {
                     return R.fail(ResponseCodesEnum.L0002);
                 }
             }
-            if (SC.equals(hostName)) {
+            if (sC.equals(hostName)) {
                 // 如果companyType为空,或者不等于“1”
                 if (StringUtils.isEmpty(companyType) || !(companyType.equals("1"))) {
                     return R.fail(ResponseCodesEnum.L0002);
@@ -694,7 +693,7 @@ public class TAdminController {
         LambdaQueryWrapper<TAdmin> query = Wrappers.lambdaQuery();
         query.eq(TAdmin::getUsername, username);
         List<TAdmin> list = tAdminService.list(query);
-        if (list.size() > 0) {
+        if (!list.isEmpty()) {
             TAdmin admin = list.get(0);
             admin.setPassword(password);
             boolean b = tAdminService.saveOrUpdate(admin);
@@ -722,8 +721,8 @@ public class TAdminController {
 
     @ApiOperation(value = "获取账号列表 分页")
     @GetMapping("/pageAdmin")
-    public ResponseModel<IPage<?>> pageAdmin(String id, String name, String userName, String ifForeign,
-                                             long current, long size) {
+    public ResponseModel<IPage<?>> pageAdmin(String id, String name, String userName,
+                                             String ifForeign, String type, long current, long size) {
         if (StringUtils.isEmpty(id)) {
             return R.fail(ResponseCodesEnum.A0001, "null参数");
         }
@@ -755,7 +754,11 @@ public class TAdminController {
                 query.eq(TAdmin::getRelationAdminId, id);
             }
         }
-        query.eq(TAdmin::getType, "2");
+        if (StringUtils.isNotEmpty(type)) {
+            query.eq(TAdmin::getType, type);
+        } else {
+            query.eq(TAdmin::getType, "2");
+        }
         query.orderByDesc(TAdmin::getCreateDate);
         Page<TAdmin> page = new Page<>(current, size, true);
         IPage<TAdmin> iPage = tAdminService.page(page, query);