From 008d985cc68391844a12a0bfc77ecc852e8b8adb Mon Sep 17 00:00:00 2001 From: k94314517 <8417338+k94314517@user.noreply.gitee.com> Date: 星期一, 11 九月 2023 11:09:10 +0800 Subject: [PATCH] 基础字段 --- server/service/src/main/java/com/doumee/service/business/impl/BrandServiceImpl.java | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/BrandServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/BrandServiceImpl.java index c20037a..f5c19c8 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/BrandServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/BrandServiceImpl.java @@ -11,11 +11,13 @@ import com.doumee.dao.business.BrandMapper; import com.doumee.dao.business.model.Brand; import com.doumee.dao.business.model.Category; +import com.doumee.dao.business.model.Goods; import com.doumee.service.business.BrandService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -41,7 +43,14 @@ @Override public Integer create(Brand brand) { LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); - if(brandMapper.selectCount(new QueryWrapper<Brand>().eq("ISDELETED",Constants.ZERO).eq("name",brand.getName()))>0){ + if(brandMapper.selectCount(new QueryWrapper<Brand>() + .eq("ISDELETED",Constants.ZERO) + .eq(user.getType().equals(Constants.UserType.SYSTEM),"name",brand.getName()) + .and(user.getType().equals(Constants.UserType.COMPANY), + i->i.apply(" name = '"+brand.getName()+"' and type = 1 ") + .or().apply( " name = '"+brand.getName()+"' and COMPANY_ID = '"+user.getCompanyId()+"' and type = 0 ") + ) + )>0){ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"銆�"+brand.getName()+"銆戝凡瀛樺湪"); }; brand.setStatus(Constants.ZERO); -- Gitblit v1.9.3