From b55c9f4ddf68de8bade1f4bf627609fb36828ba5 Mon Sep 17 00:00:00 2001
From: yz <yz_0812@outlook.com>
Date: 星期日, 31 一月 2021 14:41:41 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/lybDevelop' into lybDevelop
---
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpPhysicalExamServiceImpl.java | 116 ++++++++++++++++++++++++++++++++++++---------------------
1 files changed, 73 insertions(+), 43 deletions(-)
diff --git a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpPhysicalExamServiceImpl.java b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpPhysicalExamServiceImpl.java
index c50e256..6907163 100644
--- a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/impl/EmpPhysicalExamServiceImpl.java
+++ b/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
-* @since JDK1.8
-*/
+ * name:EmpPhysicalexam
+ * package:cc.mrbird.febs.server.hr.controller
+ * description:员工体检信息服务接口实现
+ *
+ * @author luoyibo
+ * @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 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) {
-LambdaQueryWrapper<EmpPhysicalExam> queryWrapper = new LambdaQueryWrapper<>();
-// TODO 设置查询条件
-Page<EmpPhysicalExam> page = new Page<>(request.getPageNum(), request.getPageSize());
-return this.page(page, queryWrapper);
-}
+ @Override
+ public IPage<EmpPhysicalExam> findEmpPhysicalExams(QueryRequest request, EmpPhysicalExam empPhysicalexam) {
+ LambdaQueryWrapper<EmpPhysicalExam> queryWrapper = new LambdaQueryWrapper<>();
+ 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) {
-LambdaQueryWrapper<EmpPhysicalExam> queryWrapper = new LambdaQueryWrapper<>();
-// TODO 设置查询条件
-return this.baseMapper.selectList(queryWrapper);
-}
+ @Override
+ public List<EmpPhysicalExam> findEmpPhysicalExams(EmpPhysicalExam empPhysicalexam) {
+ LambdaQueryWrapper<EmpPhysicalExam> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(EmpPhysicalExam::getDelFlag, 0);
+ return this.baseMapper.selectList(queryWrapper);
+ }
-@Override
-@Transactional(rollbackFor = Exception.class)
-public void createEmpPhysicalexam(EmpPhysicalExam empPhysicalexam) {
-this.save(empPhysicalexam);
-}
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ 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) {
-this.saveOrUpdate(empPhysicalexam);
-}
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ 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<>();
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ 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);
+ }
+}
\ No newline at end of file
--
Gitblit v1.8.0