|  |  |  | 
|---|
|  |  |  | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); | 
|---|
|  |  |  | if(brandMapper.selectCount(new QueryWrapper<Brand>() | 
|---|
|  |  |  | .eq("ISDELETED",Constants.ZERO) | 
|---|
|  |  |  | .eq(user.getType().equals(Constants.UserType.SYSTEM.getKey()),"name",brand.getName()) | 
|---|
|  |  |  | .and(user.getType().equals(Constants.UserType.SYSTEM.getKey()), wapper->wapper.lambda().eq(Brand::getType,Constants.ONE).eq(Brand::getName,brand.getName())) | 
|---|
|  |  |  | //               .eq(user.getType().equals(Constants.UserType.SYSTEM.getKey()),"name",brand.getName()) | 
|---|
|  |  |  | .and(user.getType().equals(Constants.UserType.COMPANY.getKey()), | 
|---|
|  |  |  | i->i.apply(" name = '"+brand.getName()+"' and type = 1 ") | 
|---|
|  |  |  | .or().apply( "  name = '"+brand.getName()+"' and COMPANY_ID = '"+user.getCompanyId()+"' and type = 0 ") | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Brand brand1 = brandMapper.selectOne(new QueryWrapper<Brand>() | 
|---|
|  |  |  | .eq("ISDELETED", Constants.ZERO) | 
|---|
|  |  |  | .eq(user.getType().equals(Constants.UserType.SYSTEM.getKey()), "name", brand.getName()) | 
|---|
|  |  |  | .and(user.getType().equals(Constants.UserType.SYSTEM.getKey()), wapper->wapper.lambda().eq(Brand::getType,Constants.ONE).eq(Brand::getName,brand.getName())) | 
|---|
|  |  |  | //              .eq(user.getType().equals(Constants.UserType.SYSTEM.getKey()), "name", brand.getName()) | 
|---|
|  |  |  | .and(user.getType().equals(Constants.UserType.COMPANY.getKey()), | 
|---|
|  |  |  | i -> i.apply(" name = '" + brand.getName() + "' and type = 1 ") | 
|---|
|  |  |  | .or().apply("  name = '" + brand.getName() + "' and COMPANY_ID = '" + user.getCompanyId() + "' and type = 0 ") | 
|---|
|  |  |  | 
|---|
|  |  |  | QueryWrapper<Brand> wrapper = new QueryWrapper<>(brand); | 
|---|
|  |  |  | wrapper.lambda().eq(Brand::getIsdeleted,Constants.ZERO); | 
|---|
|  |  |  | //        wrapper.lambda().eq(Brand::getStatus,Constants.ZERO); | 
|---|
|  |  |  | wrapper.lambda().orderByAsc(Brand::getType); | 
|---|
|  |  |  | wrapper.lambda().orderByAsc(Brand::getSortnum); | 
|---|
|  |  |  | // 类型 0企业 1平台 | 
|---|
|  |  |  | if (Constants.equalsInteger(user.getType(), Constants.UserType.SYSTEM.getKey())) { | 
|---|
|  |  |  | wrapper.lambda().eq(Brand::getType,Constants.ONE); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | wrapper.lambda().exists(!Objects.isNull(brand.getCategoryId())," select 1 from goods g where g.brand_id = brand.id and g.category_id = "+brand.getCategoryId()+" and  g.COMPANY_ID = "+user.getCompanyId()+" " + | 
|---|
|  |  |  | " and g.STATUS = 0 and g.ISDELETED = 0  "); | 
|---|
|  |  |  | wrapper.lambda().and(i->i.eq(Brand::getCompanyId,user.getCompanyId()) | 
|---|
|  |  |  | .or().eq(Brand::getType,Constants.ONE) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | 
|---|
|  |  |  | .or().eq(Brand::getType,Constants.ONE) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | queryWrapper.lambda().orderByAsc(Brand::getType); | 
|---|
|  |  |  | queryWrapper.lambda().orderByAsc(Brand::getSortnum); | 
|---|
|  |  |  | IPage<Brand> brandIPage = brandMapper.selectPage(page, queryWrapper); | 
|---|
|  |  |  | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() | 
|---|