luoyb
2021-01-31 eb9efc5d8315a75393a86e1f237107cbd1faf30d
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpPhysicalExamServiceImpl.java
@@ -1,5 +1,6 @@
package cc.mrbird.febs.server.hr.service.impl;
import cc.mrbird.febs.common.core.constant.ModuleCode;
import cc.mrbird.febs.server.hr.entity.EmpPhysicalExam;
import cc.mrbird.febs.server.hr.mapper.EmpPhysicalExamMapper;
import cc.mrbird.febs.server.hr.service.IEmpPhysicalExamService;
@@ -12,59 +13,88 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cc.mrbird.febs.common.core.entity.QueryRequest;
import cc.mrbird.febs.common.core.utils.FebsUtil;
import cc.mrbird.febs.common.core.utils.SequenceUtil;
import java.util.List;
import java.util.*;
/**
*
* name:EmpPhysicalexam
* package:cc.mrbird.febs.server.hr.controller
* description:员工体检信息服务接口实现
*
* @author luoyibo
* @date 2021-01-24 20:35:19
 * @date 2021-01-31 09:11:00
* @since JDK1.8
*/
@Service
@RequiredArgsConstructor
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class EmpPhysicalExamServiceImpl extends ServiceImpl
<EmpPhysicalExamMapper, EmpPhysicalExam> implements IEmpPhysicalExamService {
class EmpPhysicalExamServiceImpl extends ServiceImpl<EmpPhysicalExamMapper, EmpPhysicalExam> implements IEmpPhysicalExamService {
private final EmpPhysicalExamMapper empPhysicalexamMapper;
    private final String operatorId = Optional.ofNullable(FebsUtil.getCurrentUser())
            .map(u -> u.getUserId().toString())
            .orElse("1");
@Override
public IPage<EmpPhysicalExam> findEmpPhysicalexams(QueryRequest request, EmpPhysicalExam empPhysicalexam) {
    public IPage<EmpPhysicalExam> findEmpPhysicalExams(QueryRequest request, EmpPhysicalExam empPhysicalexam) {
LambdaQueryWrapper<EmpPhysicalExam> queryWrapper = new LambdaQueryWrapper<>();
// TODO 设置查询条件
        queryWrapper.eq(EmpPhysicalExam::getDelFlag, 0);
Page<EmpPhysicalExam> page = new Page<>(request.getPageNum(), request.getPageSize());
return this.page(page, queryWrapper);
}
@Override
public List<EmpPhysicalExam> findEmpPhysicalexams(EmpPhysicalExam empPhysicalexam) {
    public List<EmpPhysicalExam> findEmpPhysicalExams(EmpPhysicalExam empPhysicalexam) {
LambdaQueryWrapper<EmpPhysicalExam> queryWrapper = new LambdaQueryWrapper<>();
// TODO 设置查询条件
        queryWrapper.eq(EmpPhysicalExam::getDelFlag, 0);
return this.baseMapper.selectList(queryWrapper);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void createEmpPhysicalexam(EmpPhysicalExam empPhysicalexam) {
    public void createEmpPhysicalExam(EmpPhysicalExam empPhysicalexam) {
        empPhysicalexam.setPhysicalExamId(SequenceUtil.generateId(0L, ModuleCode.HR_EMPLOYEE));
        empPhysicalexam.setCreator(operatorId);
        empPhysicalexam.setModifier(operatorId);
this.save(empPhysicalexam);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateEmpPhysicalexam(EmpPhysicalExam empPhysicalexam) {
    public void updateEmpPhysicalExam(EmpPhysicalExam empPhysicalexam) {
        EmpPhysicalExam dbData = this.getById(empPhysicalexam.getPhysicalExamId());
        empPhysicalexam.setCreateTime(dbData.getCreateTime());
        empPhysicalexam.setCreator(dbData.getCreator());
        empPhysicalexam.setDelFlag(dbData.getDelFlag());
        empPhysicalexam.setModifyTime(new Date());
        empPhysicalexam.setModifier(operatorId);
this.saveOrUpdate(empPhysicalexam);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteEmpPhysicalexam(EmpPhysicalExam empPhysicalexam) {
LambdaQueryWrapper<EmpPhysicalExam> wapper = new LambdaQueryWrapper<>();
    public void deleteEmpPhysicalExam(EmpPhysicalExam empPhysicalexam) {
        LambdaQueryWrapper<EmpPhysicalExam> wrapper = new LambdaQueryWrapper<>();
// TODO 设置删除条件
this.remove(wapper);
        this.remove(wrapper);
    }
    /**
     * 根据Id批量逻辑删除记录
     * <p>
     * date 2021-01-28 10:48
     *
     * @param ids 待删除Id
     * @return void
     * @author: luoyibo
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void logicDelEmpPhysicalExam(String ids) {
        String[] str = ids.split(",");
        List<String> list = new ArrayList<>(Arrays.asList(str));
        empPhysicalexamMapper.logicDeleteByIds(list, operatorId);
}
}