This commit is contained in:
zhangheng 2024-03-07 13:30:57 +08:00
parent 7df8307c3c
commit 29b6ad4d66

View File

@ -1,6 +1,5 @@
package com.xinelu.manage.service.agencycategory.impl;
import com.xinelu.common.constant.Constants;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.StringUtils;
@ -16,6 +15,7 @@ import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@ -29,8 +29,6 @@ import java.util.stream.Collectors;
public class AgencyCategoryServiceImpl implements IAgencyCategoryService {
@Resource
private AgencyCategoryMapper agencyCategoryMapper;
@Resource
private GenerateSystemCodeUtil generateSystemCodeUtil;
/**
* 查询机构类别
@ -62,12 +60,11 @@ public class AgencyCategoryServiceImpl implements IAgencyCategoryService {
*/
@Override
public int insertAgencyCategory(AgencyCategory agencyCategory) {
if (agencyCategory.getCategoryLevel().equals(1)) {
if (Objects.isNull(agencyCategory.getCategoryLevel()) || agencyCategory.getCategoryLevel().equals(1)) {
agencyCategory.setParentCategoryId(null);
}
agencyCategory.setCreateTime(DateUtils.getNowDate());
agencyCategory.setCreateBy(SecurityUtils.getUsername());
agencyCategory.setCategoryCode(Constants.CATEGORY_CODE + generateSystemCodeUtil.generateSystemCode(Constants.CATEGORY_CODE));
return agencyCategoryMapper.insertAgencyCategory(agencyCategory);
}