|
@@ -26,6 +26,7 @@ import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
@@ -35,6 +36,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 产品类别的Service层
|
|
* 产品类别的Service层
|
|
|
|
+ *
|
|
* @Author xiexiang
|
|
* @Author xiexiang
|
|
* @Date 2023/10/24
|
|
* @Date 2023/10/24
|
|
*/
|
|
*/
|
|
@@ -70,16 +72,17 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询产品类别
|
|
* 查询产品类别
|
|
|
|
+ *
|
|
* @param queryRequest
|
|
* @param queryRequest
|
|
* @return
|
|
* @return
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Object queryMessage(QueryRequest queryRequest) throws Exception {
|
|
public Object queryMessage(QueryRequest queryRequest) throws Exception {
|
|
- List<String> sqls = formatQueryService.reSqls(queryRequest,"productCategory");
|
|
|
|
|
|
+ List<String> sqls = formatQueryService.reSqls(queryRequest, "productCategory");
|
|
sqls = this.loadSearchSql(sqls);
|
|
sqls = this.loadSearchSql(sqls);
|
|
//根据sql查询产品类别信息
|
|
//根据sql查询产品类别信息
|
|
- List<ProductCategoryVO> productCategoryVOS = productCategoryMapper.getProductCategory(sqls.get(0),sqls.get(1),sqls.get(2));
|
|
|
|
|
|
+ List<ProductCategoryVO> productCategoryVOS = productCategoryMapper.getProductCategory(sqls.get(0), sqls.get(1), sqls.get(2));
|
|
//查询总数
|
|
//查询总数
|
|
Long total = productCategoryMapper.getProductCategoryCount(sqls.get(0));
|
|
Long total = productCategoryMapper.getProductCategoryCount(sqls.get(0));
|
|
//装载产品类别信息
|
|
//装载产品类别信息
|
|
@@ -95,6 +98,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
|
|
|
/**
|
|
/**
|
|
* 新增产品类别
|
|
* 新增产品类别
|
|
|
|
+ *
|
|
* @param object
|
|
* @param object
|
|
* @param files
|
|
* @param files
|
|
* @return
|
|
* @return
|
|
@@ -103,17 +107,17 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
public Object addMessage(Object object, List<MultipartFile> files) {
|
|
public Object addMessage(Object object, List<MultipartFile> files) {
|
|
//获取登陆人信息 用于设置创建人
|
|
//获取登陆人信息 用于设置创建人
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
- personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
|
|
|
+ personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
|
|
|
//object to productCategoryDTO
|
|
//object to productCategoryDTO
|
|
- ProductCategoryDTO productCategoryDTO = (ProductCategoryDTO)object;
|
|
|
|
|
|
+ ProductCategoryDTO productCategoryDTO = (ProductCategoryDTO) object;
|
|
//检测名称是否不规范
|
|
//检测名称是否不规范
|
|
productCategoryDTO.setName(productCategoryDTO.getName().trim());
|
|
productCategoryDTO.setName(productCategoryDTO.getName().trim());
|
|
//根据名称查询数据库中是否存在
|
|
//根据名称查询数据库中是否存在
|
|
String name = productCategoryDTO.getName();
|
|
String name = productCategoryDTO.getName();
|
|
LambdaQueryWrapper<ProductCategory> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<ProductCategory> queryWrapper = new LambdaQueryWrapper<>();
|
|
queryWrapper.eq(ProductCategory::getName, name)
|
|
queryWrapper.eq(ProductCategory::getName, name)
|
|
- .eq(ProductCategory::getTenant,personnelVO.getTenantId());
|
|
|
|
|
|
+ .eq(ProductCategory::getTenant, personnelVO.getTenantId());
|
|
List<ProductCategory> productCategories = this.list(queryWrapper);
|
|
List<ProductCategory> productCategories = this.list(queryWrapper);
|
|
if (productCategories != null && productCategories.size() != 0) {
|
|
if (productCategories != null && productCategories.size() != 0) {
|
|
throw new XiaoShiException("名称重复");
|
|
throw new XiaoShiException("名称重复");
|
|
@@ -135,20 +139,22 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
assoProductCategoryPeople.add(assoProductCategoryAdmin);
|
|
assoProductCategoryPeople.add(assoProductCategoryAdmin);
|
|
//设置的管理员
|
|
//设置的管理员
|
|
List<String> adminIds = productCategoryDTO.getAdminIds();
|
|
List<String> adminIds = productCategoryDTO.getAdminIds();
|
|
- for (String adminId : adminIds) {
|
|
|
|
- AssoProductCategoryPerson admin = new AssoProductCategoryPerson();
|
|
|
|
- admin.setProductCategoryId(productCategory.getId());
|
|
|
|
- admin.setPersonId(adminId);
|
|
|
|
- admin.setRole(0);
|
|
|
|
- admin.setCreateId(personnelVO.getId());
|
|
|
|
- assoProductCategoryPeople.add(admin);
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(adminIds)) {
|
|
|
|
+ for (String adminId : adminIds) {
|
|
|
|
+ AssoProductCategoryPerson admin = new AssoProductCategoryPerson();
|
|
|
|
+ admin.setProductCategoryId(productCategory.getId());
|
|
|
|
+ admin.setPersonId(adminId);
|
|
|
|
+ admin.setRole(0);
|
|
|
|
+ admin.setCreateId(personnelVO.getId());
|
|
|
|
+ assoProductCategoryPeople.add(admin);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//判断可见类型:
|
|
//判断可见类型:
|
|
Integer showType = productCategoryDTO.getShowType();
|
|
Integer showType = productCategoryDTO.getShowType();
|
|
- if(showType != 0 && showType != 1){
|
|
|
|
|
|
+ if (showType != 0 && showType != 1) {
|
|
List<String> showPersonIds = productCategoryDTO.getShowPersonIds();
|
|
List<String> showPersonIds = productCategoryDTO.getShowPersonIds();
|
|
//0所有人可见,1本人可见
|
|
//0所有人可见,1本人可见
|
|
- if(showPersonIds.size() != 0){
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(showPersonIds)) {
|
|
for (String showPersonId : showPersonIds) {
|
|
for (String showPersonId : showPersonIds) {
|
|
AssoProductCategoryPerson assoProductCategoryPerson = new AssoProductCategoryPerson();
|
|
AssoProductCategoryPerson assoProductCategoryPerson = new AssoProductCategoryPerson();
|
|
assoProductCategoryPerson.setProductCategoryId(productCategory.getId());
|
|
assoProductCategoryPerson.setProductCategoryId(productCategory.getId());
|
|
@@ -166,7 +172,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(assoProductCategoryPeople != null && assoProductCategoryPeople.size() != 0){
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(assoProductCategoryPeople)) {
|
|
assoProductCategoryPersonService.saveBatch(assoProductCategoryPeople);
|
|
assoProductCategoryPersonService.saveBatch(assoProductCategoryPeople);
|
|
}
|
|
}
|
|
//判断文件是否为空
|
|
//判断文件是否为空
|
|
@@ -182,7 +188,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
assoProductCategoryFile.setCreateId(personnelVO.getId());
|
|
assoProductCategoryFile.setCreateId(personnelVO.getId());
|
|
assoProductCategoryFiles.add(assoProductCategoryFile);
|
|
assoProductCategoryFiles.add(assoProductCategoryFile);
|
|
}
|
|
}
|
|
- if (assoProductCategoryFiles != null && assoProductCategoryFiles.size() != 0) {
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(assoProductCategoryFiles)) {
|
|
assoProductCategoryFileService.saveBatch(assoProductCategoryFiles);
|
|
assoProductCategoryFileService.saveBatch(assoProductCategoryFiles);
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -195,6 +201,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
|
|
|
/**
|
|
/**
|
|
* 删除产品类别
|
|
* 删除产品类别
|
|
|
|
+ *
|
|
* @param ids
|
|
* @param ids
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@@ -229,6 +236,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
|
|
|
/**
|
|
/**
|
|
* 更新产品类别
|
|
* 更新产品类别
|
|
|
|
+ *
|
|
* @param object
|
|
* @param object
|
|
* @param files
|
|
* @param files
|
|
* @return
|
|
* @return
|
|
@@ -236,14 +244,14 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
@Override
|
|
@Override
|
|
public Object updateMessage(Object object, List<MultipartFile> files) {
|
|
public Object updateMessage(Object object, List<MultipartFile> files) {
|
|
//object to productCategory
|
|
//object to productCategory
|
|
- UpdateProductCategoryDTO updateProductCategoryDTO = (UpdateProductCategoryDTO)object;
|
|
|
|
- if(updateProductCategoryDTO == null || updateProductCategoryDTO.getId() == null){
|
|
|
|
|
|
+ UpdateProductCategoryDTO updateProductCategoryDTO = (UpdateProductCategoryDTO) object;
|
|
|
|
+ if (updateProductCategoryDTO == null || updateProductCategoryDTO.getId() == null) {
|
|
throw new XiaoShiException("参数错误");
|
|
throw new XiaoShiException("参数错误");
|
|
}
|
|
}
|
|
//获取登陆人信息 用于设置创建人
|
|
//获取登陆人信息 用于设置创建人
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
|
|
|
|
- personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
|
|
|
+ personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
|
|
|
ProductCategory productCategory = this.getById(updateProductCategoryDTO.getId());
|
|
ProductCategory productCategory = this.getById(updateProductCategoryDTO.getId());
|
|
//检测名称是否不规范
|
|
//检测名称是否不规范
|
|
@@ -253,7 +261,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
LambdaQueryWrapper<ProductCategory> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<ProductCategory> queryWrapper = new LambdaQueryWrapper<>();
|
|
queryWrapper.eq(ProductCategory::getName, name);
|
|
queryWrapper.eq(ProductCategory::getName, name);
|
|
List<ProductCategory> productCategories = this.list(queryWrapper);
|
|
List<ProductCategory> productCategories = this.list(queryWrapper);
|
|
- if(!updateProductCategoryDTO.getName().equals(productCategory.getName()) && productCategories.size() != 0){
|
|
|
|
|
|
+ if (!updateProductCategoryDTO.getName().equals(productCategory.getName()) && productCategories.size() != 0) {
|
|
throw new XiaoShiException("名称重复");
|
|
throw new XiaoShiException("名称重复");
|
|
}
|
|
}
|
|
BeanUtils.copyProperties(updateProductCategoryDTO, productCategory);
|
|
BeanUtils.copyProperties(updateProductCategoryDTO, productCategory);
|
|
@@ -285,10 +293,10 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
}
|
|
}
|
|
//判断可见类型:
|
|
//判断可见类型:
|
|
Integer showType = updateProductCategoryDTO.getShowType();
|
|
Integer showType = updateProductCategoryDTO.getShowType();
|
|
- if(showType != 0 && showType != 1){
|
|
|
|
|
|
+ if (showType != 0 && showType != 1) {
|
|
List<String> showPersonIds = updateProductCategoryDTO.getShowPersonIds();
|
|
List<String> showPersonIds = updateProductCategoryDTO.getShowPersonIds();
|
|
//0所有人可见,1本人可见
|
|
//0所有人可见,1本人可见
|
|
- if(showPersonIds != null && showPersonIds.size() != 0){
|
|
|
|
|
|
+ if (showPersonIds != null && showPersonIds.size() != 0) {
|
|
for (String showPersonId : showPersonIds) {
|
|
for (String showPersonId : showPersonIds) {
|
|
AssoProductCategoryPerson assoProductCategoryPerson = new AssoProductCategoryPerson();
|
|
AssoProductCategoryPerson assoProductCategoryPerson = new AssoProductCategoryPerson();
|
|
assoProductCategoryPerson.setProductCategoryId(productCategory.getId());
|
|
assoProductCategoryPerson.setProductCategoryId(productCategory.getId());
|
|
@@ -306,7 +314,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(assoProductCategoryPeople != null && assoProductCategoryPeople.size() != 0){
|
|
|
|
|
|
+ if (assoProductCategoryPeople != null && assoProductCategoryPeople.size() != 0) {
|
|
assoProductCategoryPersonService.saveBatch(assoProductCategoryPeople);
|
|
assoProductCategoryPersonService.saveBatch(assoProductCategoryPeople);
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
@@ -319,20 +327,20 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
List<String> fileGuIds = assoFiles.stream().map(AssoProductCategoryFile::getFileGuid).collect(Collectors.toList());
|
|
List<String> fileGuIds = assoFiles.stream().map(AssoProductCategoryFile::getFileGuid).collect(Collectors.toList());
|
|
//获取更新后的附件ids
|
|
//获取更新后的附件ids
|
|
List<String> updateFileGuIds = new ArrayList<>();
|
|
List<String> updateFileGuIds = new ArrayList<>();
|
|
- if(updateProductCategoryDTO.getGuids() != null && updateProductCategoryDTO.getGuids().size() != 0){
|
|
|
|
|
|
+ if (updateProductCategoryDTO.getGuids() != null && updateProductCategoryDTO.getGuids().size() != 0) {
|
|
updateFileGuIds = updateProductCategoryDTO.getGuids();
|
|
updateFileGuIds = updateProductCategoryDTO.getGuids();
|
|
fileGuIds.retainAll(updateFileGuIds);
|
|
fileGuIds.retainAll(updateFileGuIds);
|
|
}
|
|
}
|
|
//做差获得被删除的文件id
|
|
//做差获得被删除的文件id
|
|
- if(fileGuIds.size() != 0){
|
|
|
|
|
|
+ if (fileGuIds.size() != 0) {
|
|
//根据文件id删除产品类别与文件关联表记录
|
|
//根据文件id删除产品类别与文件关联表记录
|
|
LambdaQueryWrapper<AssoProductCategoryFile> deleteWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<AssoProductCategoryFile> deleteWrapper = new LambdaQueryWrapper<>();
|
|
deleteWrapper.in(AssoProductCategoryFile::getFileGuid, fileGuIds);
|
|
deleteWrapper.in(AssoProductCategoryFile::getFileGuid, fileGuIds);
|
|
assoProductCategoryFileService.remove(deleteWrapper);
|
|
assoProductCategoryFileService.remove(deleteWrapper);
|
|
//远程删除服务器上的文件
|
|
//远程删除服务器上的文件
|
|
- try{
|
|
|
|
|
|
+ try {
|
|
fileManagerService.deleteFileFromFMS(fileGuIds);
|
|
fileManagerService.deleteFileFromFMS(fileGuIds);
|
|
- } catch (Exception e){
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -359,7 +367,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public GroupVO getGroup(GroupRequest groupRequest,String name) throws Exception {
|
|
|
|
|
|
+ public GroupVO getGroup(GroupRequest groupRequest, String name) throws Exception {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -375,6 +383,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
|
|
|
/**
|
|
/**
|
|
* 装载产品类别
|
|
* 装载产品类别
|
|
|
|
+ *
|
|
* @param productCategoryVOS
|
|
* @param productCategoryVOS
|
|
* @throws IOException
|
|
* @throws IOException
|
|
*/
|
|
*/
|
|
@@ -383,7 +392,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
List<Integer> ids = new ArrayList<>();
|
|
List<Integer> ids = new ArrayList<>();
|
|
productCategoryVOS.forEach(
|
|
productCategoryVOS.forEach(
|
|
item -> {
|
|
item -> {
|
|
- if(item.getCreateId() != null){
|
|
|
|
|
|
+ if (item.getCreateId() != null) {
|
|
createIds.add(item.getCreateId());
|
|
createIds.add(item.getCreateId());
|
|
}
|
|
}
|
|
if (item.getId() != null) {
|
|
if (item.getId() != null) {
|
|
@@ -414,7 +423,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
//查询文件
|
|
//查询文件
|
|
if (guids.size() != 0) {
|
|
if (guids.size() != 0) {
|
|
String res = fileManagerService.getSystemFileFromFMS(guids);
|
|
String res = fileManagerService.getSystemFileFromFMS(guids);
|
|
- if(res!=null&&!res.trim().equals("")) {
|
|
|
|
|
|
+ if (res != null && !res.trim().equals("")) {
|
|
systemFiles = JSONObject.parseArray(res, SystemFile.class);
|
|
systemFiles = JSONObject.parseArray(res, SystemFile.class);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -423,14 +432,14 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
for (ProductCategoryVO productCategoryVO : productCategoryVOS) {
|
|
for (ProductCategoryVO productCategoryVO : productCategoryVOS) {
|
|
//装载人员信息
|
|
//装载人员信息
|
|
Personnel personnel = personnels.stream().filter(item -> item.getId().toString().equals(productCategoryVO.getCreateId())).findFirst().orElse(null);
|
|
Personnel personnel = personnels.stream().filter(item -> item.getId().toString().equals(productCategoryVO.getCreateId())).findFirst().orElse(null);
|
|
- if(personnel != null){
|
|
|
|
|
|
+ if (personnel != null) {
|
|
productCategoryVO.setCreateName(personnel.getPersonnelName());
|
|
productCategoryVO.setCreateName(personnel.getPersonnelName());
|
|
} else {
|
|
} else {
|
|
throw new XiaoShiException("未获取到当前登陆人信息");
|
|
throw new XiaoShiException("未获取到当前登陆人信息");
|
|
}
|
|
}
|
|
//装载文件信息
|
|
//装载文件信息
|
|
List<AssoProductCategoryFile> assoProductCategoryFilesTemp = assoProductCategoryFiles.stream().filter(item -> item.getProductCategoryId().equals(productCategoryVO.getId())).collect(Collectors.toList());
|
|
List<AssoProductCategoryFile> assoProductCategoryFilesTemp = assoProductCategoryFiles.stream().filter(item -> item.getProductCategoryId().equals(productCategoryVO.getId())).collect(Collectors.toList());
|
|
- if(assoProductCategoryFilesTemp.size() != 0){
|
|
|
|
|
|
+ if (assoProductCategoryFilesTemp.size() != 0) {
|
|
List<String> guidTemp = assoProductCategoryFilesTemp.stream().map(AssoProductCategoryFile::getFileGuid).collect(Collectors.toList());
|
|
List<String> guidTemp = assoProductCategoryFilesTemp.stream().map(AssoProductCategoryFile::getFileGuid).collect(Collectors.toList());
|
|
if (guidTemp.size() != 0) {
|
|
if (guidTemp.size() != 0) {
|
|
List<SystemFile> systemFileTemp = systemFiles.stream().filter(item -> guidTemp.contains(item.getGuid())).collect(Collectors.toList());
|
|
List<SystemFile> systemFileTemp = systemFiles.stream().filter(item -> guidTemp.contains(item.getGuid())).collect(Collectors.toList());
|
|
@@ -441,7 +450,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
}
|
|
}
|
|
//根据showType到产品类别与可见人员关联表中查询可见人员
|
|
//根据showType到产品类别与可见人员关联表中查询可见人员
|
|
Integer showType = productCategoryVO.getShowType();
|
|
Integer showType = productCategoryVO.getShowType();
|
|
- if(showType.equals(2) || showType.equals(3)){
|
|
|
|
|
|
+ if (showType.equals(2) || showType.equals(3)) {
|
|
LambdaQueryWrapper<AssoProductCategoryPerson> queryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<AssoProductCategoryPerson> queryWrapper = new LambdaQueryWrapper<>();
|
|
queryWrapper.eq(AssoProductCategoryPerson::getProductCategoryId, productCategoryVO.getId());
|
|
queryWrapper.eq(AssoProductCategoryPerson::getProductCategoryId, productCategoryVO.getId());
|
|
//如果showType为2,则查询的角色类型为1
|
|
//如果showType为2,则查询的角色类型为1
|
|
@@ -501,28 +510,26 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
}
|
|
}
|
|
|
|
|
|
//装载查询语句
|
|
//装载查询语句
|
|
- private List<String> loadSearchSql(List<String> sqls){
|
|
|
|
- PersonnelVO personnelVO =cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
|
- String id =personnelVO.getId();
|
|
|
|
- Integer tenantId= personnelVO.getTenantId();
|
|
|
|
|
|
+ private List<String> loadSearchSql(List<String> sqls) {
|
|
|
|
+ PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
|
+ String id = personnelVO.getId();
|
|
|
|
+ Integer tenantId = personnelVO.getTenantId();
|
|
Integer roleType = personnelVO.getRoleType();
|
|
Integer roleType = personnelVO.getRoleType();
|
|
String rootSql = "";
|
|
String rootSql = "";
|
|
if (roleType == null || roleType.equals(0)) {
|
|
if (roleType == null || roleType.equals(0)) {
|
|
- rootSql ="category.create_id="+id+" or(category.show_type =0 and category.tenant ="+tenantId+") or ( category.id in (select product_category_id from asso_product_category_person where" +
|
|
|
|
- " person_id="+id+" and role=0)) or (category.show_type=2 and category.id in (select product_category_id from asso_product_category_person where" +
|
|
|
|
- " person_id="+id+" and role=1)) or(category.show_type =3 and category.id not in(select product_category_id from asso_product_category_person where" +
|
|
|
|
- " person_id="+id+" and role=2) and category.tenant="+tenantId+")";
|
|
|
|
|
|
+ rootSql = "category.create_id=" + id + " or(category.show_type =0 and category.tenant =" + tenantId + ") or ( category.id in (select product_category_id from asso_product_category_person where" +
|
|
|
|
+ " person_id=" + id + " and role=0)) or (category.show_type=2 and category.id in (select product_category_id from asso_product_category_person where" +
|
|
|
|
+ " person_id=" + id + " and role=1)) or(category.show_type =3 and category.id not in(select product_category_id from asso_product_category_person where" +
|
|
|
|
+ " person_id=" + id + " and role=2) and category.tenant=" + tenantId + ")";
|
|
|
|
|
|
- }
|
|
|
|
- else if(roleType.equals(2))
|
|
|
|
- {
|
|
|
|
- rootSql="category.tenant="+tenantId;
|
|
|
|
|
|
+ } else if (roleType.equals(2)) {
|
|
|
|
+ rootSql = "category.tenant=" + tenantId;
|
|
}
|
|
}
|
|
|
|
|
|
if (sqls.get(0) != null && !sqls.get(0).equals("") && !rootSql.equals("")) {
|
|
if (sqls.get(0) != null && !sqls.get(0).equals("") && !rootSql.equals("")) {
|
|
- sqls.set(0, "("+rootSql+")" + " and" + "(" + sqls.get(0) + ")");
|
|
|
|
|
|
+ sqls.set(0, "(" + rootSql + ")" + " and" + "(" + sqls.get(0) + ")");
|
|
} else if ((sqls.get(0) == null || sqls.get(0).equals("")) && !rootSql.equals("")) {
|
|
} else if ((sqls.get(0) == null || sqls.get(0).equals("")) && !rootSql.equals("")) {
|
|
- sqls.set(0, "("+rootSql+")");
|
|
|
|
|
|
+ sqls.set(0, "(" + rootSql + ")");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|