一、工资套账管理
1、修改实体类2、controller层,由于单表,而mybatis-plus写完controller层即可。 二、员工账套管理
修改员工类1.员工账套功能 EmployeeMapper2.EmployeeService3.controller
一、工资套账管理 1、修改实体类添加返回日期格式
pojo/ Salary.java
package com.xxxx.server.controller;
import com.xxxx.server.pojo.RespBean;
import com.xxxx.server.pojo.Salary;
import com.xxxx.server.service.ISalaryService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
@RestController
@RequestMapping("/salary/sob")
public class SalaryController工资 {
@Autowired
private ISalaryService iSalaryService;
@ApiOperation(value = "获取所有工资账套")
@GetMapping("/")
public List getAllSalary(){
return iSalaryService.list();
}
@ApiOperation(value = "添加工资账套")
@PostMapping( "/")
public RespBean addSalary(@RequestBody Salary salary){
salary.setCreateDate(LocalDateTime.now());
if (iSalaryService.save(salary)){
return RespBean.success("添加成功");
}
return RespBean.error("添加失败");
}
@ApiOperation(value = "删除工资账套")
@DeleteMapping("/{id}")
public RespBean deleteSalary(@PathVariable Integer id) {
if (iSalaryService.removeById(id)){
return RespBean.success("删除成功!");
}
return RespBean.error("删除失败!");
}
@ApiOperation(value = "更改工资账套")
@PutMapping(value = "/")
public RespBean updateSalary(@RequestBody Salary salary){
if (iSalaryService.updateById(salary)){
return RespBean.success("更改成功");
}
return RespBean.error("更新失败");
}
}
二、员工账套管理
员工账套:是不同的员工,运用了不同的工资账套
例如说:市场部基本工资是8千,人事部是3千。所以说不同的一个公司有不同的账套名称。那么某一个员工属于某个账套,从而员工的工资,是根据账套来进行计算的。
虽然是说员工账套,但是查询的是员工表,员工表是需要关联外键id(salaryId),其中有对应的工资情况。
需要的接口:
- 查询所有员工账套,分页显示。那么需要查询员工信息,关联员工账套。查询所有的工资账套, 因为得需要修改工资账套功能更新员工账套。
给员工类添加工资属性
Employee.java
EmployeeMapper
2.EmployeeService
IEmployeeService.java
RespPageBean getEmployeeWithSalary(Integer currentPage, Integer size);
@Override
public RespPageBean getEmployeeWithSalary(Integer currentPage, Integer size) {
//开启分页
Page page = new Page<>(currentPage, size);
IPage employeePage = employeeMapper.getEmployeeWithSalary(page);
RespPageBean respPageBean = new RespPageBean(employeePage.getTotal(),
employeePage.getRecords());
return respPageBean;
}
3.controller
@RestController
@RequestMapping("/salary/sobcfg")
public class SalarySobCfgController {
@Autowired
private ISalaryService salaryService;
@Autowired
private IEmployeeService employeeService;
@ApiOperation(value = "获取所有员工账套")
@GetMapping("/")
public RespPageBean getEmployeeWithSalary(@RequestParam(defaultValue = "1")
Integer currentPage,
@RequestParam(defaultValue = "10")
Integer size) {
return employeeService.getEmployeeWithSalary(currentPage, size);
}
@ApiOperation(value = "获取所有工资账套")
@GetMapping("/salaries")
public List getAllSalaries() {
return salaryService.list();
}
@ApiOperation(value = "更新员工账套")
@PutMapping("/")
public RespBean updateEmployeeSalary(Integer eid, Integer sid) {
if (employeeService.update(new UpdateWrapper().set("salaryId",
sid).eq("id", eid))) {
return RespBean.success("更新成功!");
}
return RespBean.error("更新失败!");
}
}



