febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/EmpPhysicalExamController.java
@@ -16,44 +16,43 @@ import java.util.Map; /** * * 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 */ @Slf4j @Validated @RestController @RequestMapping("empPhysicalexam") @RequestMapping("empPhysicalExam") @RequiredArgsConstructor public class EmpPhysicalExamController { private final IEmpPhysicalExamService empPhysicalexamService; private final IEmpPhysicalExamService empPhysicalExamService; @GetMapping @PreAuthorize("hasAuthority('empPhysicalexam:list')") public FebsResponse getAllEmpPhysicalexams(EmpPhysicalExam empPhysicalexam) { return new FebsResponse().data(empPhysicalexamService.findEmpPhysicalexams(empPhysicalexam)); public FebsResponse getAllEmpPhysicalExams(EmpPhysicalExam empPhysicalexam) { return new FebsResponse().data(empPhysicalExamService.findEmpPhysicalExams(empPhysicalexam)); } @GetMapping("list") @PreAuthorize("hasAuthority('empPhysicalexam:list')") public FebsResponse empPhysicalexamList(QueryRequest request, EmpPhysicalExam empPhysicalexam) { Map<String, Object> dataTable = FebsUtil.getDataTable(this.empPhysicalexamService.findEmpPhysicalexams(request, empPhysicalexam)); public FebsResponse empPhysicalExamList(QueryRequest request, EmpPhysicalExam empPhysicalexam) { Map<String, Object> dataTable = FebsUtil.getDataTable(this.empPhysicalExamService.findEmpPhysicalExams(request, empPhysicalexam)); return new FebsResponse().data(dataTable); } @PostMapping @PreAuthorize("hasAuthority('empPhysicalexam:add')") public void addEmpPhysicalexam(@Valid EmpPhysicalExam empPhysicalexam) throws FebsException { public void addEmpPhysicalExam(@Valid EmpPhysicalExam empPhysicalexam) throws FebsException { try { this.empPhysicalexamService.createEmpPhysicalexam(empPhysicalexam); this.empPhysicalExamService.createEmpPhysicalExam(empPhysicalexam); } catch (Exception e) { String message = "新增EmpPhysicalexam失败"; String message = "新增员工体检信息失败"; log.error(message, e); throw new FebsException(message); } @@ -61,11 +60,23 @@ @DeleteMapping @PreAuthorize("hasAuthority('empPhysicalexam:delete')") public void deleteEmpPhysicalexam(EmpPhysicalExam empPhysicalexam) throws FebsException { public void deleteEmpPhysicalExam(EmpPhysicalExam empPhysicalexam) throws FebsException { try { this.empPhysicalexamService.deleteEmpPhysicalexam(empPhysicalexam); this.empPhysicalExamService.deleteEmpPhysicalExam(empPhysicalexam); } catch (Exception e) { String message = "删除EmpPhysicalexam失败"; String message = "删除员工体检信息失败"; log.error(message, e); throw new FebsException(message); } } @DeleteMapping("{ids}") @PreAuthorize("hasAuthority('empPhysicalexam:delete')") public void logicDeleteEmpPhysicalExam(@PathVariable("ids") String ids) throws FebsException { try { this.empPhysicalExamService.logicDelEmpPhysicalExam(ids); } catch (Exception e) { String message = "逻辑删除员工体检信息失败"; log.error(message, e); throw new FebsException(message); } @@ -73,11 +84,11 @@ @PutMapping @PreAuthorize("hasAuthority('empPhysicalexam:update')") public void updateEmpPhysicalexam(EmpPhysicalExam empPhysicalexam) throws FebsException { public void updateEmpPhysicalExam(EmpPhysicalExam empPhysicalexam) throws FebsException { try { this.empPhysicalexamService.updateEmpPhysicalexam(empPhysicalexam); this.empPhysicalExamService.updateEmpPhysicalExam(empPhysicalexam); } catch (Exception e) { String message = "修改EmpPhysicalexam失败"; String message = "修改员工体检信息失败"; log.error(message, e); throw new FebsException(message); } febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/entity/EmpPhysicalExam.java
@@ -1,120 +1,143 @@ package cc.mrbird.febs.server.hr.entity; import java.io.Serializable; import java.util.Date; import cc.mrbird.febs.common.core.annotation.FieldInfo; import cc.mrbird.febs.common.core.utils.DateDeSerializer; import cc.mrbird.febs.common.core.utils.DateSerializer; import cc.mrbird.febs.common.core.utils.DateTimeDeserializer; import cc.mrbird.febs.common.core.utils.DateTimeSerializer; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import lombok.Data; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.Version; import org.springframework.format.annotation.DateTimeFormat; /** * * name:EmpPhysicalexam * 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 */ @Data @TableName("t_emp_physicalexam") public class EmpPhysicalExam { public class EmpPhysicalExam implements Serializable{ /** * 体检Id */ @TableId(value = "physicalExamId", type = IdType.AUTO) private Long physicalExamId; @FieldInfo(name = "physicalExamId",type = "bigint",explain = "体检Id") @TableId(value = "physicalExamId") private Long physicalExamId=0L; /** * 员工Id */ @FieldInfo(name = "empId",type = "bigint",explain = "员工Id") @TableField("empId") private Long empId; private Long empId=0L; /** * 体检医院 */ @TableField("hosptial") private String hosptial; @FieldInfo(name = "empNumb",type = "varchar",explain = "员工编号") @TableField("empNumb") private String empNumb=""; /** * 体检日期 */ @FieldInfo(name = "empName",type = "varchar",explain = "员工姓名") @TableField("empName") private String empName=""; @FieldInfo(name = "certificateNumb",type = "varchar",explain = "证件号码") @TableField("certificateNumb") private String certificateNumb=""; @FieldInfo(name = "sex",type = "varchar",explain = "性别码") @TableField("sex") private String sex=""; @FieldInfo(name = "deptId",type = "bigint",explain = "部门Id") @TableField("deptId") private Long deptId=0L; @FieldInfo(name = "deptName",type = "varchar",explain = "部门名称") @TableField("deptName") private String deptName=""; @FieldInfo(name = "JobId",type = "bigint",explain = "岗位Id") @TableField("JobId") private Long jobId=0L; @FieldInfo(name = "jobName",type = "varchar",explain = "岗位名称") @TableField("jobName") private String jobName=""; @FieldInfo(name = "hospital",type = "varchar",explain = "体检医院") @TableField("hospital") private String hospital=""; @FieldInfo(name = "physicalExamDate",type = "date",explain = "体检日期") @TableField("physicalExamDate") @JsonSerialize(using = DateSerializer.class) @JsonDeserialize(using = DateDeSerializer.class) @DateTimeFormat(pattern="yyyy-MM-dd") private Date physicalExamDate; /** * 体检类型 */ @FieldInfo(name = "physicalExamType",type = "varchar",explain = "体检类型") @TableField("physicalExamType") private String physicalExamType; private String physicalExamType=""; /** * 血压 */ @FieldInfo(name = "bloodPressure",type = "varchar",explain = "血压") @TableField("bloodPressure") private String bloodPressure; private String bloodPressure=""; /** * 转氨酶 */ @FieldInfo(name = "transaminase",type = "varchar",explain = "转氨酶") @TableField("transaminase") private String transaminase; private String transaminase=""; /** * 心电图 */ @FieldInfo(name = "ecg",type = "varchar",explain = "心电图") @TableField("ecg") private String ecg; private String ecg=""; /** * 体检结论 */ @FieldInfo(name = "conclusion",type = "varchar",explain = "体检结论") @TableField("conclusion") private String conclusion; private String conclusion=""; /** * 复查记录 */ @FieldInfo(name = "reviewRecord",type = "varchar",explain = "复查记录") @TableField("reviewRecord") private String reviewRecord; private String reviewRecord=""; /** * 备注 */ @FieldInfo(name = "remark",type = "varchar",explain = "备注") @TableField("remark") private String remark; private String remark=""; /** * 记录创建人 */ @FieldInfo(name = "createTime",type = "datetime",explain = "记录创建时间") @TableField("createTime") @JsonSerialize(using = DateTimeSerializer.class) @JsonDeserialize(using = DateTimeDeserializer.class) @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date createTime; @FieldInfo(name = "creator",type = "varchar",explain = "记录创建人") @TableField("creator") private String creator; private String creator=""; /** * 记录最后更新时间 */ @FieldInfo(name = "modifyTime",type = "datetime",explain = "记录最后更新时间") @TableField("modifyTime") @JsonSerialize(using = DateTimeSerializer.class) @JsonDeserialize(using = DateTimeDeserializer.class) @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date modifyTime; /** * 记录最后更新人 */ @FieldInfo(name = "modifier",type = "varchar",explain = "记录最后更新人") @TableField("modifier") private String modifier; private String modifier=""; /** * 记录删除标志。0-未删除 1-已删除,默认0 */ @FieldInfo(name = "delFlag",type = "bit",explain = "记录删除标志。0-未删除 1-已删除,默认0") @TableField("delFlag") private Integer delFlag; private Integer delFlag=0; /** * 记录版本号,用来进行乐观锁控制 */ @FieldInfo(name = "version",type = "int",explain = "记录版本号,用来进行乐观锁控制") @TableField("version") private Integer version; @Version private Integer version=0; } febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/mapper/EmpPhysicalExamMapper.java
@@ -2,17 +2,40 @@ import cc.mrbird.febs.server.hr.entity.EmpPhysicalExam; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Update; import java.util.List; /** * * name:EmpPhysicalexam * package:cc.mrbird.febs.server.hr.controller * description:员工体检信息实体Mapper * * @author luoyibo * @date 2021-01-24 20:35:19 * @date 2021-01-31 09:11:00 * @since JDK1.8 */ public interface EmpPhysicalExamMapper extends BaseMapper<EmpPhysicalExam> { /** * 根据Id批量逻辑删除记录 * <p> * date luoyibo * * @param list 待删除Id * @param operatorId 操作员Id * @return void * @author: 2021-01-31 09:11:00 */ @Update("<script> " + " UPDATE t_emp_physicalexam SET delFlag = 1,\n" + " modifyTime = NOW(),\n" + " modifier = #{operatorId}, \n" + " version = version+1 \n" + " WHERE physicalExamId IN \n" + " <foreach item=\"delId\" collection=\"list\" open=\"(\" close=\")\" separator=\",\">\n" + " #{delId} \n" + " </foreach>\n" + "</script>") void logicDeleteByIds(@Param("list") List<String> list, @Param("operatorId") String operatorId); } febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/IEmpPhysicalExamService.java
@@ -9,13 +9,12 @@ import java.util.List; /** * * 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 */ public interface IEmpPhysicalExamService extends IService<EmpPhysicalExam> { @@ -23,37 +22,48 @@ * 查询(分页) * * @param request QueryRequest * @param empPhysicalexam empPhysicalexam * @return IPage<EmpPhysicalexam> * @param empPhysicalExam empPhysicalExam * @return IPage<EmpPhysicalExam> */ IPage<EmpPhysicalExam> findEmpPhysicalexams(QueryRequest request, EmpPhysicalExam empPhysicalexam); IPage<EmpPhysicalExam> findEmpPhysicalExams(QueryRequest request, EmpPhysicalExam empPhysicalExam); /** * 查询(所有) * * @param empPhysicalexam empPhysicalexam * @return List<EmpPhysicalexam> * @param empPhysicalExam empPhysicalExam * @return List<EmpPhysicalExam> */ List<EmpPhysicalExam> findEmpPhysicalexams(EmpPhysicalExam empPhysicalexam); List<EmpPhysicalExam> findEmpPhysicalExams(EmpPhysicalExam empPhysicalExam); /** * 新增 * * @param empPhysicalexam empPhysicalexam * @param empPhysicalExam empPhysicalExam */ void createEmpPhysicalexam(EmpPhysicalExam empPhysicalexam); void createEmpPhysicalExam(EmpPhysicalExam empPhysicalExam); /** * 修改 * * @param empPhysicalexam empPhysicalexam * @param empPhysicalExam empPhysicalExam */ void updateEmpPhysicalexam(EmpPhysicalExam empPhysicalexam); void updateEmpPhysicalExam(EmpPhysicalExam empPhysicalExam); /** * 删除 * * @param empPhysicalexam empPhysicalexam * @param empPhysicalExam empPhysicalExam */ void deleteEmpPhysicalexam(EmpPhysicalExam empPhysicalexam); void deleteEmpPhysicalExam(EmpPhysicalExam empPhysicalExam); /** * 根据Id批量逻辑删除记录 * <p> * date 2021-01-28 10:48 * * @param ids 待删除Id * @return void * @author: luoyibo */ void logicDelEmpPhysicalExam(String ids); } febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/service/IEmpRemarkinfoService.java
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); } }