栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

038-云E办

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

038-云E办

038-云E办_工资账套功能

一、工资套账管理

1、修改实体类2、controller层,由于单表,而mybatis-plus写完controller层即可。 二、员工账套管理

修改员工类1.员工账套功能 EmployeeMapper2.EmployeeService3.controller

一、工资套账管理 1、修改实体类

添加返回日期格式
pojo/ Salary.java

2、controller层,由于单表,而mybatis-plus写完controller层即可。
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

1.员工账套功能 EmployeeMapper

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("更新失败!");
 }
}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/760253.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号