前言
本系列博客基于B站的云e办管理系统,前端和后端我都自己敲了一遍,这里做一个学习记录。云e办的原始视频链接如下:https://www.bilibili.com/video/BV1Ai4y1P7Tk?p=1
分页查询所有人员资料
配置类,就是返回分页插件组件
新建分页返回对象的实体类
新建全局日期转换工具类
处理人员实体类,对日期字段加上日期转换注解
添加几个字段
Controller
Service
服务实现
Mapper接口,Ipage来接收,只有在查询的时候,分页插件自动加入分页查询,类似于AOP操作。
mapper.xml文件,人员信息表只有民族、部门这些属性的id,所以得通过id来对应这些属性的表来查询人员的详细信息。只查询人员信息表只能得到这些属性的id值。
员工添加功能实现
首先在Controller里面添加获取所有政治面貌,职称,职位,民族,部门。获取最大workID。添加employee。
package com.xxxx.server.pojo;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
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.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.redis.core.ValueOperations;
import java.io.Serializable;
import java.time.LocalDate;
/**
* <p>
*
* </p>
*
* @author zhoubin
* @since 2022-04-09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("t_employee")
@ApiModel(value="Employee对象", description="")
public class Employee implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "人员编号")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "登账人姓名")
@Excel(name = "登账人姓名")
private String name;
@ApiModelProperty(value = "性别")
@Excel(name = "性别")
private String gender;
@ApiModelProperty(value = "出生日期")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai")
@Excel(name = "出生日期",width = 20,format = "yyyy-MM-dd")
private LocalDate birthday;
@ApiModelProperty(value = "身份证号")
@Excel(name = "身份证号",width = 30)
private String idCard;
@ApiModelProperty(value = "婚姻状况")
@Excel(name = "婚姻状况")
private String wedlock;
@ApiModelProperty(value = "民族")
private Integer nationId;
@ApiModelProperty(value = "籍贯")
@Excel(name = "籍贯")
private String nativePlace;
@ApiModelProperty(value = "政治面貌")
private Integer politicId;
@ApiModelProperty(value = "邮箱")
@Excel(name = "邮箱",width = 30)
private String email;
@ApiModelProperty(value = "电话号码")
@Excel(name = "电话号码",width = 15)
private String phone;
@ApiModelProperty(value = "联系地址")
@Excel(name = "联系地址",width = 40)
private String address;
@ApiModelProperty(value = "资产所在仓库")
private Integer departmentId;
@ApiModelProperty(value = "职称ID")
private Integer jobLevelId;
@ApiModelProperty(value = "职位ID")
private Integer posId;
@ApiModelProperty(value = "入库形式")
@Excel(name = "入库形式")
private String engageForm;
// private String tiptopDegree;
//
// private String specialty;
//
// private String school;
@ApiModelProperty(value = "入库日期")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai")
private LocalDate beginDate;
@ApiModelProperty(value = "仓库状态")
@Excel(name = "仓库状态")
private String workState;
@ApiModelProperty(value = "资产编号")
@Excel(name = "资产编号")
private String workID;
@ApiModelProperty(value = "合同期限")
@Excel(name = "合同期限",suffix = "年")
private Double contractTerm;
@ApiModelProperty(value = "正式入库日期")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai")
@Excel(name = "正式入库日期",width = 20,format = "yyyy-MM-dd")
private LocalDate conversionTime;
@ApiModelProperty(value = "离库日期")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai")
// @Excel(name = "离库日期",width = 20,format = "yyyy-MM-dd")
private LocalDate notWorkDate;
@ApiModelProperty(value = "合同起始日期")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai")
@Excel(name = "合同起始日期",width = 20,format = "yyyy-MM-dd")
private LocalDate beginContract;
@ApiModelProperty(value = "合同终止日期")
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "Asia/Shanghai")
@Excel(name = "合同终止日期",width = 20,format = "yyyy-MM-dd")
private LocalDate endContract;
@ApiModelProperty(value = "存放时间")
// @Excel(name = "存放时间")
private Integer workAge;
private Integer salaryId;
@ApiModelProperty(value = "仓库")
@TableField(exist = false)
@ExcelEntity(name = "仓库")
private Department department;
@ApiModelProperty(value = "职位")
@TableField(exist = false)
@ExcelEntity(name = "职位")
private Position position;
@ApiModelProperty(value = "职称")
@TableField(exist = false)
@ExcelEntity(name = "职称")
private Joblevel joblevel;
@ApiModelProperty(value = "民族")
@TableField(exist = false)
@ExcelEntity(name = "民族")
private Nation nation;
@ApiModelProperty(value = "政治面貌")
@TableField(exist = false)
@ExcelEntity(name = "政治面貌")
private PoliticsStatus politicsStatus;
@ApiModelProperty(value = "资产账套")
@TableField(exist = false)
private Salary salary;
}