|
|
@ -1,23 +1,19 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
|
import com.epmet.dao.IcIndividualCategoryManageDao; |
|
|
|
import com.epmet.dto.IcIndividualCategoryManageDTO; |
|
|
|
import com.epmet.dto.form.EditIndividualCategoryFormDTO; |
|
|
|
import com.epmet.dto.result.IndividualCategoryListResultDTO; |
|
|
|
import com.epmet.entity.IcIndividualCategoryManageEntity; |
|
|
|
import com.epmet.service.IcIndividualCategoryManageService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.apache.commons.collections4.CollectionUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
/** |
|
|
|
* 个人分类管理 |
|
|
@ -28,18 +24,39 @@ import java.util.Map; |
|
|
|
@Service |
|
|
|
public class IcIndividualCategoryManageServiceImpl extends BaseServiceImpl<IcIndividualCategoryManageDao, IcIndividualCategoryManageEntity> implements IcIndividualCategoryManageService { |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 【人员分类管理】查询个人分类列表 |
|
|
|
* @param tokenDto |
|
|
|
* @author zxc |
|
|
|
* @date 2022/1/17 10:55 上午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(IcIndividualCategoryManageDTO dto) { |
|
|
|
IcIndividualCategoryManageEntity entity = ConvertUtils.sourceToTarget(dto, IcIndividualCategoryManageEntity.class); |
|
|
|
insert(entity); |
|
|
|
public List<IndividualCategoryListResultDTO> individualCategoryList(TokenDto tokenDto) { |
|
|
|
List<IndividualCategoryListResultDTO> result = baseDao.individualCategoryList(tokenDto.getUserId()); |
|
|
|
if (CollectionUtils.isNotEmpty(result)){ |
|
|
|
return result; |
|
|
|
} |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 【人员分类管理】个人分类修改(添加修改一个接口) |
|
|
|
* @param formDTOS |
|
|
|
* @param tokenDto |
|
|
|
* @author zxc |
|
|
|
* @date 2022/1/17 11:04 上午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void update(IcIndividualCategoryManageDTO dto) { |
|
|
|
IcIndividualCategoryManageEntity entity = ConvertUtils.sourceToTarget(dto, IcIndividualCategoryManageEntity.class); |
|
|
|
updateById(entity); |
|
|
|
public void editIndividualCategory(List<EditIndividualCategoryFormDTO> formDTOS, TokenDto tokenDto) { |
|
|
|
if (CollectionUtils.isNotEmpty(formDTOS)){ |
|
|
|
baseDao.deleteOldData(tokenDto.getUserId(),tokenDto.getCustomerId()); |
|
|
|
List<IcIndividualCategoryManageEntity> entities = ConvertUtils.sourceToTarget(formDTOS, IcIndividualCategoryManageEntity.class); |
|
|
|
entities.forEach(e -> { |
|
|
|
e.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
e.setUserId(tokenDto.getUserId()); |
|
|
|
}); |
|
|
|
insertBatch(entities); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |