员工信息系统 excel_员工信息录入系统

员工信息系统 excel_员工信息录入系统超级详细的Idea控制台管理系统项目,打印带颜色以及表情包的控制台代码,还等啥呢来看看吧

员工信息管理系统

在这里插入图片描述

系统模块简述

image-20210829220307343

部门信息管理模块

image-20210829220403755

  • 部门信息新增

    • 描述
      • 在控制台中引导使用者录入部门的信息,部门信息只有部门名称

        image-20210829220456019

      • 将用户输入的部门信息,添加至数据库中

        image-20210829220604533

    • 要求
      • 部门名称只允许保存中文

        image-20210829221735669

      • 部门名称不能与已保存的部门名称重复

        image-20210829222112239

  • 部门信息修改

    • 描述
      • 在控制台中引导使用者修改已经录入的部门信息

        image-20210829222226387

      • 将用户修改的部门信息,保存至数据库中

        image-20210829222309306

    • 要求
      • 部门名称只允许保存中文
      • 新修改的部门名称不能与已保存的部门名称重复
  • 部门信息删除

    • 描述
      • 在控制台中引导使用者删除已经录入的部门信息

        image-20210829222402811

    • 要求
      • 删除的信息使用逻辑删除的方式,不能够在数据库中直接删除该数据
      • 删除部门信息时,需要考虑已经关联该部门的员工信息
  • 部门信息查询

    image-20210829221642901

  • 描述

    • 在控制台中引导用户能够查询并展示已经录入好的部门信息
    • 以表格的形式展示查询出来的部门信息
  • 要求

    • 能够以表格的形式展示出来,属加分项

员工信息管理模块

image-20210829222533515

  • 员工信息增加

    • 描述
      • 在控制台引导使用者录入员工信息

        image-20210829222605086

      • 将使用者录入的员工信息保存至数据库中

        image-20210829222649459

    • 要求
      • 员工属于某个部门,在录入员工信息时,需要关联部门信息
      • 员工编码需要程序自动生成:
        • 生成规则:部门名称首字母 + 年月日(210804) + 序列号(当日的第几个,保留两位,从01开始)
        • 已经生成的编码不允许重复生成,即使该员工已经被删除,也不允许重复使用该员工编码
        • 生成示例:部门:研发部 员工编码:YFB21080401
  • 员工信息修改

    • 描述
      • 在控制台引导使用者修改已经录入的员工信息

        image-20210829222743559

    • 要求
      • 员工的ID、部门、编码是不允许修改的

      • 员工信息可以修改:员工名称、员工性别

        image-20210829222842035

  • 员工信息删除

    • 描述
      • 在控制台引导使用者删除已经录入的员工信息

        image-20210829222909941

    • 要求
      • 删除的信息使用逻辑删除的方式,不能够在数据库中直接删除该数据
      • 删除员工信息时,需要考虑已经关联该员工的薪资信息
  • 员工信息查询

    image-20210829223123296

  • 描述

    • 在控制台中引导用户能够查询并展示已经录入好的员工信息
    • 以表格的形式展示查询出来的员工信息,包括该员工所属的部门信息
  • 要求

    • 能够以表格的形式展示出来,属加分项

薪资信息管理模块

image-20210829223040189

  • 薪资信息增加
    • 描述
      • 在控制台引导使用者录入薪资信息

        image-20210829223215548

      • 将使用者录入的薪资信息保存在数据库中

        image-20210829223304241

    • 要求
      • 录入薪资时,只能录入当月的薪资,当月薪资只能录入一次,不能重复录入

        image-20210829223330565

  • 薪资信息修改
    • 描述
      • 在控制台引导使用者修改已经录入的薪资信息

        image-20210829223450176

      • 将修改的薪资信息保存在数据库中

        image-20210829223508240

    • 要求
      • 修改薪资时,只允许修改当月的薪资,历史的薪资不允许修改

      • 没有录入薪资的人员,不允许修改薪资信息

        image-20210829223553225

  • 薪资信息删除
    • 描述
      • 在控制台引导使用者删除已经录入的薪资信息

        image-20210829224825744

    • 要求
      • 只允许删除当月已经录入的薪资信息,历史的薪资信息不允许删除

        image-20210829224852189

      • 没有录入薪资信息的员工不允许删除薪资信息

        image-20210829224916412

  • 薪资信息查询
    • 描述
      • 提供两种查询信息的方式

        image-20210829223700861

  • 按照员工进行查询,展示出该员工系统中已经录入的全部薪资信息
      <img src="https://tva1.sinaimg.cn/large/008i3skNly1gty1jq7jmaj60wy0jmdj902.jpg" alt="image-20210829224502957" style="zoom:50%;" />
  • 按照日期进行查询,展示出该日期下所有员工的信息薪资信息,日期格式为yyyy-MM
      <img src="https://tva1.sinaimg.cn/large/008i3skNly1gty1lwc6v0j60wk0c8di002.jpg" alt="image-20210829224708308" style="zoom:50%;" />
    • 要求
      • 能够以表格的形式展示出来,属加分项

系统数据库设计

要求:按照系统数据设计表格,自建数据库

部门信息表(ims_department)

字段名称 字段类型 字段描述
dpt_id varchar(64) 主键ID
dpt_name varchar(255) 部门名称
is_deleted int 逻辑删除标识(0:未删除;1:已删除)
create_time datetime 创建时间
update_time datetime 更新时间

员工信息表(ims_employee)

字段名称 字段类型 字段描述
emp_id varchar(64) 主键ID
dpt_id varchar(64) 部门ID
emp_name varchar(255) 员工姓名
emp_code varchar(255) 员工编码(部门首字母小写+日期+序列号)
emp_sex varchar(64) 性别(MALE:男性;FEMALE:女性)
dpt_id varchar(64) 主键ID
dpt_name varchar(255) 部门名称
is_deleted int 逻辑删除标识(0:未删除;1:已删除)
create_time datetime 创建时间
update_time datetime 更新时间

员工薪资表(ims_salary)

字段名称 字段类型 字段描述
sa_id varchar(64) 主键ID
emp_id varchar(64) 员工ID
sa_date varchar(255) 工资日期(字符串类型:例:2021-03)
sa_base decimal(9, 2) 基础工资
sa_performance decimal(9, 2) 绩效工资
sa_insurance decimal(9, 2) 保险扣除
sa_actual decimal(9, 2) 实发工资(基础工资+绩效工资-保险扣除)
is_deleted int 逻辑删除标识(0:未删除;1:已删除)
create_time datetime 创建时间
update_time datetime 更新时间

好啦以上就是项目的全部需求,接下来话不多说直接上代码!

首先druid的配置文件,druid.properties

driverClassName=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/demo
characterEncoding=utf-8
username=root
password=101297
initialSize=5
maxActive=10
maxWait=3000
validationQuery=SELECT 1
testWhileIdle=true
disableDruidFilter=false
use-ping-method: false
  • Entity实体类

  • ImsDepartment
    package com.codingfuture.entity;
    
    import java.util.Date;
    
    /** * 部门实体类 * @author wxy */
    public class ImsDepartment { 
         
      private String dptId;
      private String dptName;
      private Date createTime;
      private Date updateTime;
        
        public ImsDepartment() { 
         
        }
    
        public ImsDepartment(String dptId, String dptName, Date createTime, Date updateTime) { 
         
            this.dptId = dptId;
            this.dptName = dptName;
            this.createTime = createTime;
            this.updateTime = updateTime;
        }
    
        public String getDptId() { 
         
            return dptId;
        }
    
        public void setDptId(String dptId) { 
         
            this.dptId = dptId;
        }
    
        public String getDptName() { 
         
            return dptName;
        }
    
        public void setDptName(String dptName) { 
         
            this.dptName = dptName;
        }
    
        public Date getCreateTime() { 
         
            return createTime;
        }
    
        public void setCreateTime(Date createTime) { 
         
            this.createTime = createTime;
        }
    
        public Date getUpdateTime() { 
         
            return updateTime;
        }
    
        public void setUpdateTime(Date updateTime) { 
         
            this.updateTime = updateTime;
        }
    
        @Override
        public String toString() { 
         
            return "ImsDepartment{" +
                    "dptId='" + dptId + '\'' +
                    ", dptName='" + dptName + '\'' +
                    ", createTime=" + createTime +
                    ", updateTime=" + updateTime +
                    '}';
        }
    }
    
    
  • ImsEmployee
package com.codingfuture.entity;

import java.util.Date;

/** * 员工实体类 * @author wxy */
public class ImsEmployee { 
   
    private String empId;
    private String dptId;
    private String empName;
    private String empCode;
    private String empSex;
    private String dptName;
    private Date createTime;
    private Date updateTime;

    public ImsEmployee() { 
   
    }

    public ImsEmployee(String empId, String dptId, String empName, String empCode, String empSex, String dptName, Date createTime, Date updateTime) { 
   
        this.empId = empId;
        this.dptId = dptId;
        this.empName = empName;
        this.empCode = empCode;
        this.empSex = empSex;
        this.dptName = dptName;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }

    public String getEmpId() { 
   
        return empId;
    }

    public void setEmpId(String empId) { 
   
        this.empId = empId;
    }

    public String getDptId() { 
   
        return dptId;
    }

    public void setDptId(String dptId) { 
   
        this.dptId = dptId;
    }

    public String getEmpName() { 
   
        return empName;
    }

    public void setEmpName(String empName) { 
   
        this.empName = empName;
    }

    public String getEmpCode() { 
   
        return empCode;
    }

    public void setEmpCode(String empCode) { 
   
        this.empCode = empCode;
    }

    public String getEmpSex() { 
   
        return empSex;
    }

    public void setEmpSex(String empSex) { 
   
        this.empSex = empSex;
    }

    public String getDptName() { 
   
        return dptName;
    }

    public void setDptName(String dptName) { 
   
        this.dptName = dptName;
    }

    public Date getCreateTime() { 
   
        return createTime;
    }

    public void setCreateTime(Date createTime) { 
   
        this.createTime = createTime;
    }

    public Date getUpdateTime() { 
   
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) { 
   
        this.updateTime = updateTime;
    }

    @Override
    public String toString() { 
   
        return "ImsEmployee{" +
                "empId='" + empId + '\'' +
                ", dptId='" + dptId + '\'' +
                ", empName='" + empName + '\'' +
                ", empCode='" + empCode + '\'' +
                ", empSex='" + empSex + '\'' +
                ", dptName='" + dptName + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }
}

  • ImsSalary
package com.codingfuture.entity;

import java.util.Date;

/** * 薪资实体类 * @author wxy */
public class ImsSalary { 
   
    private String saId;
    private String empId;
    private String saDate;
    private double saBase;
    private double saPerformance;
    private double saInsurance;
    private double saActual;
    private Date createTime;
    private Date updateTime;

    public ImsSalary() { 
   
    }

    public ImsSalary(String saId, String empId, String saDate, double saBase, double saPerformance, double saInsurance, double saActual, Date createTime, Date updateTime) { 
   
        this.saId = saId;
        this.empId = empId;
        this.saDate = saDate;
        this.saBase = saBase;
        this.saPerformance = saPerformance;
        this.saInsurance = saInsurance;
        this.saActual = saActual;
        this.createTime = createTime;
        this.updateTime = updateTime;
    }

    public String getSaId() { 
   
        return saId;
    }

    public void setSaId(String saId) { 
   
        this.saId = saId;
    }

    public String getEmpId() { 
   
        return empId;
    }

    public void setEmpId(String empId) { 
   
        this.empId = empId;
    }
    
    public String getSaDate() { 
   
        return saDate;
    }

    public void setSaDate(String saDate) { 
   
        this.saDate = saDate;
    }

    public double getSaBase() { 
   
        return saBase;
    }

    public void setSaBase(double saBase) { 
   
        this.saBase = saBase;
    }

    public double getSaPerformance() { 
   
        return saPerformance;
    }

    public void setSaPerformance(double saPerformance) { 
   
        this.saPerformance = saPerformance;
    }

    public double getSaInsurance() { 
   
        return saInsurance;
    }

    public void setSaInsurance(double saInsurance) { 
   
        this.saInsurance = saInsurance;
    }

    public double getSaActual() { 
   
        return saActual;
    }

    public void setSaActual(double saActual) { 
   
        this.saActual = saActual;
    }

    public Date getCreateTime() { 
   
        return createTime;
    }

    public void setCreateTime(Date createTime) { 
   
        this.createTime = createTime;
    }

    public Date getUpdateTime() { 
   
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) { 
   
        this.updateTime = updateTime;
    }

    @Override
    public String toString() { 
   
        return "ImsSalary{" +
                "saId='" + saId + '\'' +
                ", empId='" + empId + '\'' +
                ", saDate='" + saDate + '\'' +
                ", saBase=" + saBase +
                ", saPerformance=" + saPerformance +
                ", saInsurance=" + saInsurance +
                ", saActual=" + saActual +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                '}';
    }
}

Terminal层

BaseTerminal(ColorUtil是封装的控制台打印颜色的工具类)

package com.codingfuture.terminal;

import com.codingfuture.utils.ColorUtil;
import java.util.Scanner;

/** * @author wxy */
public class BaseTerminal { 
   
    public static void show(){ 
   
       String i ;
       do{ 
   
           System.out.println(ColorUtil.getFormatLogString(" 🌠 🌠 🌠 🌠 🌠 🌠 🌠 🌠 🌠 🌠",34,0));
           System.out.println(ColorUtil.getFormatLogString(" 🌠 🌠 🌠 🌠 🌠 🌠",34,0));
           System.out.println(ColorUtil.getFormatLogString(" 🌠 🌠 🌠 🌠 🌠 🌠 🌠 🌠",34,0));
           System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=- 🎆 "+ ColorUtil.getFormatLogString("欢迎使用员工薪资管理系统",33,1)  +ColorUtil.getFormatLogString(" 🎆 -=-=-=-=-=-=-=-=-=-=-=-=-=-=",34,0),34,1));
           System.out.println(ColorUtil.getFormatLogString("=-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-🚀-=",34,0));
           System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",33,0));
           System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",33,0));
           System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 1.部门信息管理 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
           System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 2.员工信息管理 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
           System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 3.薪资信息管理 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
           System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 4.退出管理系统 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
           System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",33,0));
           System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",33,0));
           System.out.println(ColorUtil.getFormatLogString("🎯 请输入要执行的功能序号 🎯 ",35,1));
           Scanner scanner = new Scanner(System.in);
           i = scanner.next();
           
           switch (i){ 
   
               case "1" :
                   ImsDepartmentTerminal.show();
                   break;
               case "2":
                   ImsEmployeeTerminal.show();
                   break;
               case "3":
                   ImsSalaryTerminal.show();
                   break;
               case "4":
                    System.out.println(ColorUtil.getFormatLogString("~ ~ ~ 感谢使用员工薪资管理系统 Bye ~ ~ ~ ",33,1));
                   return;
               default:
                   System.out.println(ColorUtil.getFormatLogString("--__-_ __ 序号输入有误,请重新输入 _ -__-__--", 31, 1));
                   break;
               }
       }while (true);

    }
}

  • ImsDepartmentTerminal
package com.codingfuture.terminal;


import com.codingfuture.entity.ImsDepartment;
import com.codingfuture.entity.ImsEmployee;
import com.codingfuture.service.ImsDepartmentService;
import com.codingfuture.service.ImsEmployeeService;
import com.codingfuture.utils.ColorUtil;
import java.util.List;
import java.util.Scanner;

/** * @author wxy */
public class ImsDepartmentTerminal { 
   

    public static void show() { 
   
        while (true) { 
   
            String next = print();

            switch (next) { 
   
                case "1":
                    add();
                    back();
                    break;
                case "2":
                    update();
                    back();
                    break;
                case "3":
                    delete();
// back();
                    break;
                case "4":
                    findAll();
                    back();
                    break;
                case "5":
                    return;
                default:
                    System.out.println(ColorUtil.getFormatLogString("--__-_ __ 输入序号有误,请重新输入 _ -__-__--", 31, 1));
            }
        }
    }

    public static String print() { 
   
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 🎆 "+ ColorUtil.getFormatLogString("部门管理",33,1)  +ColorUtil.getFormatLogString(" 🎆 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",34,0),34,1));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 1.新增部门信息 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 2.修改部门信息 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 3.删除部门信息 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 4.查询部门信息 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 5.退出部门管理 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",33,0));
        System.out.println(ColorUtil.getFormatLogString("🎯 请输入要执行的功能序号 🎯 ",35,1));
        Scanner scanner = new Scanner(System.in);
        return scanner.next();

    }

    public static void findAll(){ 
   
        System.out.println("\033[1;94m" + "🦅__~_~~ __ 部门数据正在查询... __~_~~ __🦅 ");
        List<ImsDepartment> imsDepartmentList = ImsDepartmentService.findAll();
        if (imsDepartmentList.size()<=0){ 
   
            System.out.println(ColorUtil.getFormatLogString("目前没有部门信息快去添加吧!", 31, 1));
            System.out.println(ColorUtil.getFormatLogString("🎯 是否需要添加部门信息 ? 🎯 ",35,1));
            System.out.println("\033[1;94m" + "🦅__~_~~ __ 1.添加部门信息 2.返回上一级 __~_~~ __🦅 ");
            Scanner scanner = new Scanner(System.in);
            String next = scanner.next();
            switch (next){ 
   
                case "1":
                    ImsDepartmentTerminal.add();
                    break;
                case "2":
                    ImsSalaryTerminal.print();
                    break;
                default:
                    System.out.println("您的输入有误,请重新输入");
            }
            return;
        }


        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 32, 0));
        System.out.println(ColorUtil.getFormatLogString("|\t序号\t |\t\t部门名称\t\t|", 32, 0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 32, 0));

        for (int i = 0; i < imsDepartmentList.size(); i++) { 
   
            ImsDepartment imsDepartment = imsDepartmentList.get(i);


            System.out.println(ColorUtil.getFormatLogString("|\t" + (i+1)+ "\t |\t " + imsDepartment.getDptName() + " \t|", 32, 0));
        }
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 32, 0));
    }

    public static void add(){ 
   
        System.out.println(ColorUtil.getFormatLogString("🎯 部门数据新增 🎯 ",35,1));
        System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入要新增的部门名称 __~_~~ __🦅 ");
        Scanner scanner = new Scanner(System.in);
        String dptName = scanner.next();
        int i = ImsDepartmentService.insertImsDepartment(dptName);
        if (i == 1) { 
   
            System.out.println(ColorUtil.getFormatLogString("--__-_ __ 添加成功 👌 👌 👌 _ -__-__--", 32, 1));
        } else if(i==-2){ 
   
            System.out.println(ColorUtil.getFormatLogString("输入的部门名称有误,请输入符合要求的部门名称(部门名称为中文不包含空格、字母、数字)", 31, 1));
            add();
        }else if (i==-3){ 
   
            System.out.println(ColorUtil.getFormatLogString("--__-_ __ 您输入的部门【"+dptName+"】已存在,请更换部门名称 ___ _-__--", 31, 0));
            add();
        } else { 
   
            System.out.println(ColorUtil.getFormatLogString("添加失败 ✖ ✖ ", 31, 1));
        }
    }

    public static void back(){ 
   
        System.out.println(ColorUtil.getFormatLogString("🎯 输入 任意键 + 回车 返回上一级 ↪ ↪ ",35,1));
        Scanner scanner = new Scanner(System.in);
        scanner.next();
    }

    public static void update(){ 
   
        Integer index;
        findAll();
        List<ImsDepartment> list = ImsDepartmentService.findAll();
        System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入要修改的部门序号 __~_~~ __🦅 ");
        Scanner scanner1 = new Scanner(System.in);
        try { 
   
            index = scanner1.nextInt();
            ImsDepartment imsDepartment = list.get(index-1);
            List<ImsEmployee> empList = ImsEmployeeService.findAll();
            for (int i = 0; i < empList.size(); i++) { 
   
                ImsEmployee imsEmployee = empList.get(i);
                if (imsEmployee.getDptName().equals(imsDepartment.getDptName())){ 
   
                    System.out.println(ColorUtil.getFormatLogString("--__-_ __ 修改失败,该部门已关联员工,请先删除对应的员工信息 _ -__-__--", 31, 1));
                    System.out.println(ColorUtil.getFormatLogString("🎯 是否要删除该员工的信息(1.删除 2.不删除,返回上一级 ) 🎯 ",35,1));
                    String isDelete = scanner1.next();
                    switch (isDelete){ 
   
                        case "1":
                            ImsEmployeeTerminal.delete();
                            break;
                        case "2":
                            print();
                            break;
                        default:
                            System.out.println(ColorUtil.getFormatLogString("输入有误,请重新输入", 31, 1));
                    }
                }
            }
            System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入修改的部门名称 __~_~~ __🦅 ");
            String name = scanner1.next();
            imsDepartment.setDptName(name);
            int i = ImsDepartmentService.updateImsDepartment(imsDepartment);
            if (i==1){ 
   
                System.out.println("\033[1;95m" + "--__-_ __ 修改成功 👌 👌 👌 _ -__-__--");
            }else if(i==-2){ 
   
                System.out.println(ColorUtil.getFormatLogString("输入的部门名称有误,请输入符合要求的部门名称(部门名称为中文不包含空格、字母、数字)", 31, 1));
                update();
            }else if (i==-3){ 
   
                System.out.println(ColorUtil.getFormatLogString("您输入的部门【"+name+"】已存在,请更换部门名称", 31, 1));
                update();
            }
            else { 
   
                System.out.println(ColorUtil.getFormatLogString("修改失败 ✖ ✖ ", 31, 1));
            }
        }catch (Exception e){ 
   
            System.out.println(ColorUtil.getFormatLogString("输入有误,请重新输入部门序号", 32, 1));
        }


    }

    public static void delete(){ 
   
        try{ 
   
            Integer index;
            findAll();
            List<ImsDepartment> list = ImsDepartmentService.findAll();
            System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入要删除的部门序号 __~_~~ __🦅 返回上一级,请输入:88 ");
            Scanner scanner1 = new Scanner(System.in);
            index = scanner1.nextInt();
            if (index==88){ 
   
                return;
            }
            
            ImsDepartment imsDepartment = list.get(index-1);
            int i = ImsDepartmentService.deleteImsDepartment(imsDepartment);
            if (i==1){ 
   
                System.out.println(ColorUtil.getFormatLogString("--__-_ __ 删除成功 👌 👌 👌 _ -__-__--", 32, 1));
            }else if (i==-4){ 
   
                System.out.println(ColorUtil.getFormatLogString("--__-_ __ 删除失败,该部门已关联员工,请先删除对应的员工信息 _ -__-__--", 31, 1));
                System.out.println(ColorUtil.getFormatLogString("🎯 是否要删除该员工的信息(1.删除 2.不删除,返回上一级 ) 🎯 ",35,1));
                String isDelete = scanner1.next();
                switch (isDelete){ 
   
                    case "1":
                        ImsEmployeeTerminal.delete();
                        break;
                    case "2":
                        print();
                        break;
                    default:
                        System.out.println(ColorUtil.getFormatLogString("输入有误,请重新输入", 31, 1));
                }
            }
            else { 
   
                System.out.println(ColorUtil.getFormatLogString("--__-_ __ 删除失败 _ -__-__--", 31, 1));
            }
        }catch (Exception e){ 
   
            System.out.println(ColorUtil.getFormatLogString("--__-_ __ 输入有误,无该部门信息删除失败 _ -__-__--", 31, 1));
        }
    }
}

  • ImsEmployeeTerminal
package com.codingfuture.terminal;

import com.codingfuture.entity.ImsDepartment;
import com.codingfuture.entity.ImsEmployee;
import com.codingfuture.service.ImsDepartmentService;
import com.codingfuture.service.ImsEmployeeService;
import com.codingfuture.utils.ColorUtil;
import java.util.List;
import java.util.Scanner;

/** * @author wxy */
public class ImsEmployeeTerminal { 
   

    public static void show() { 
   
        while (true) { 
   
            String next = print();

            switch (next) { 
   
                case "1":
                    add();
                    back();
                    break;
                case "2":
                    update();
                    back();
                    break;
                case "3":
                    delete();
                    back();
                    break;
                case "4":
                    findAll();
                    back();
                    break;
                case "5":
                    return;
                default:
                    System.out.println(ColorUtil.getFormatLogString("--__-_ __ 输入序号有误,请重新输入 _ -__-__--", 31, 1));
            }
        }

    }

    public static String print(){ 
   
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 🎆 "+ ColorUtil.getFormatLogString("员工管理",33,1)  +ColorUtil.getFormatLogString(" 🎆 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",34,0),34,1));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 1.新增员工信息 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 2.修改员工信息 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 3.删除员工信息 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 4.查询员工信息 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 5.退出员工管理 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",33,0));
        System.out.println(ColorUtil.getFormatLogString("🎯 请输入要执行的功能序号 🎯 ",35,1));
        Scanner scanner = new Scanner(System.in);
        return scanner.next();

    }
    
    public static void findAll () { 
   
        System.out.println("\033[1;94m" + "🦅__~_~~ __ 员工数据正在查询... __~_~~ __🦅 ");
        List<ImsEmployee> imsEmployeeList = ImsEmployeeService.findAll();
        if (imsEmployeeList.size()<=0){ 
   
            System.out.println(ColorUtil.getFormatLogString("目前没有员工信息快去添加吧!", 31, 1));
            return;
        }
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 32, 1));
        System.out.println(ColorUtil.getFormatLogString("|\t序号\t |\t\t员工姓名\t\t|\t\t员工性别\t\t|\t\t员工工号\t\t|\t\t部门名称\t\t|", 32, 1));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 32, 1));
        for (int i = 0; i < imsEmployeeList.size(); i++) { 
   
            ImsEmployee imsEmployee = imsEmployeeList.get(i);
            System.out.println(ColorUtil.getFormatLogString("|\t" + (i+1)+ "\t |\t "+"\t "+imsEmployee.getEmpName()+" \t |\t " + imsEmployee.getEmpSex() + " \t|\t "  + imsEmployee.getEmpCode() +" \t| " +
                    imsEmployee.getDptName()  + " \t|",32, 1));
        }
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 32, 1));
    }

    public static void add () { 
   
       try { 
   
           Integer  dptId;
           System.out.println(ColorUtil.getFormatLogString("🎯 员工数据新增 🎯 ",35,1));
           ImsDepartmentTerminal.findAll();
           List<ImsDepartment> list = ImsDepartmentService.findAll();
           System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入要新增员工的部门编号 __~_~~ __🦅 ");

           Scanner scanner = new Scanner(System.in);
           dptId = scanner.nextInt();
           ImsDepartment imsDepartment = list.get(dptId-1);
           String dptName = imsDepartment.getDptName();
           System.out.println("\033[1;94m" + "🦅__~_~~ __ 已选择部门【"+dptName+"】 __~_~~ __🦅 ");
           System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入员工的姓名 __~_~~ __🦅 ");
           String empName = scanner.next();
           System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入员工性别 (1:男 2:女) __~_~~ __🦅 ");
           String sex=scanner.next();
           switch (sex){ 
   
               case "1":
                   sex="男";
                   break;
               case "2":
                   sex="女";
                   break;
               default:
                   System.out.println("输入有误,请重新输入");
           }
           int i = ImsEmployeeService.insertImsEmployee(empName,sex,imsDepartment);
           if (i == 1) { 
   
               System.out.println("\033[1;95m" + "--__-_ __ 添加成功 👌 👌 👌 _ -__-__--");
           } else if (i == -2) { 
   
               System.out.println(ColorUtil.getFormatLogString("--__-_ __ 您的输入有误,请重新输入中文 🔞 🔞 🔞 _ -__-__--",31,1));
               add();
           } else { 
   
               System.out.println(ColorUtil.getFormatLogString("--__-_ __ 添加失败 🔞 🔞 _ -__-__--",31,1));
           }
       }catch (Exception e){ 
   
           System.out.println(ColorUtil.getFormatLogString("输入有误没有该部门信息", 32, 1));
       }
    }

    public static void back () { 
   
        System.out.println(ColorUtil.getFormatLogString("🎯 输入 任意键 + 回车 返回上一级 ↪ ↪ ",35,1));
        Scanner scanner = new Scanner(System.in);
        scanner.next();
    }

    public static void update () { 
   
      try { 
   
          Integer index;
          List<ImsEmployee> list = ImsEmployeeService.findAll();
          ImsEmployeeTerminal.findAll();
          System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入要修改的员工序号 🆔 __~_~~ __🦅 ");
          Scanner scanner1 = new Scanner(System.in);
          index = scanner1.nextInt();
          ImsEmployee imsEmployee = list.get(index - 1);
          String dptName = imsEmployee.getDptName();
          String empName = imsEmployee.getEmpName();
          String empSex = imsEmployee.getEmpSex();

          System.out.println(ColorUtil.getFormatLogString("🎯 已选择 ——【"+dptName+"】 部门员工:——【"+empName+"】 🎯 ",35,1));
          System.out.println(ColorUtil.getFormatLogString("🎯 员工名字 ——【"+ empName +"】 请输入员工的新名字: ",35,1));
          String name = scanner1.next();
          System.out.println(ColorUtil.getFormatLogString("🎯 员工性别:【"+ empSex +"】 请输入修改后的性别(1:男 2:女) ",35,1));
          String sex = scanner1.next();
          switch (sex){ 
   
              case "1":
                  sex="男";
                  break;
              case "2":
                  sex="女";
                  break;
              default:
                  System.out.println("输入有误,请重新输入");
          }
          imsEmployee.setEmpName(name);
          imsEmployee.setEmpSex(sex);
          int i = ImsEmployeeService.updateImsEmployee(imsEmployee);
          if (i == 1) { 
   
              System.out.println("\033[1;95m" + "--__-_ __ 修改成功 👌 👌 👌 _ -__-__--");
          } else if(i==-2){ 
   
              System.out.println(ColorUtil.getFormatLogString("输入的部门名称有误,请输入符合要求的部门名称(部门名称为中文不包含空格、字母、数字)", 31, 1));
            update();
          }
          else { 
   
              System.out.println(ColorUtil.getFormatLogString("修改失败 ✖ ✖ ", 32, 1));
          }
      }catch (Exception e){ 
   
          System.out.println(ColorUtil.getFormatLogString("--__-_ __ 输入有误,无该员工信息,修改失败 _ -__-__--", 31, 1));
      }
    }

    public static void delete () { 
   
        try { 
   
            Integer index;
            List<ImsEmployee> list = ImsEmployeeService.findAll();
            System.out.println(ColorUtil.getFormatLogString("🎯 员工数据删除 🎯 ",35,1));
            ImsEmployeeTerminal.findAll();
            System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入要删除的员工序号 __~_~~ __🦅 ");
            Scanner scanner1 = new Scanner(System.in);
            index = scanner1.nextInt();
            ImsEmployee imsEmployee = list.get(index - 1);

            int i = ImsEmployeeService.deleteImsEmployee(imsEmployee);
            if (i == 1) { 
   
                System.out.println("\033[1;95m" + "--__-_ __ 删除成功 👌 👌 👌 _ -__-__--");
            }else if (i==-2){ 
   
                System.out.println(ColorUtil.getFormatLogString("删除失败 ✖ ✖ 数据库中目前有该员工的薪资信息,请先删除该员工的薪资信息之后再删除该员工", 31, 1));
                System.out.println(ColorUtil.getFormatLogString("🎯 是否要删除该员工的薪资信息(1.删除 2.不删除,返回上一级) 🎯 ",35,1));
                String isDelete = scanner1.next();
                switch (isDelete){ 
   
                    case "1":
                        ImsSalaryTerminal.delete();
                        break;
                    case "2":
                        print();
                        break;
                    default:
                        System.out.println(ColorUtil.getFormatLogString("输入有误,请重新输入", 31, 1));
                }

            } else { 
   
                System.out.println(ColorUtil.getFormatLogString("删除失败 ✖ ✖ ", 31, 1));
            }
        }catch (Exception e){ 
   
            System.out.println(ColorUtil.getFormatLogString("--__-_ __ 输入有误,无该员工信息,删除失败 _ -__-__--", 31, 1));
        }
    }

}

  • ImsSalaryTerminal
package com.codingfuture.terminal;

import com.codingfuture.dto.ImsEmpSalaryDto;
import com.codingfuture.entity.ImsEmployee;
import com.codingfuture.service.ImsEmployeeService;
import com.codingfuture.service.ImsSalaryService;
import com.codingfuture.utils.ColorUtil;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Scanner;

/** * @author wxy */
public class ImsSalaryTerminal { 
   
    
    public static void show() { 
   
        while (true) { 
   
            String next = print();
            switch (next) { 
   
                case "1":
                    add();
                    back();
                    break;
                case "2":
                    update();
                    back();
                    break;
                case "3":
                    delete();
                    back();
                    break;
                case "4":
                    findAll();
                    back();
                    break;
                case "5":
                    return;
                default:
                    System.out.println("要执行的序号有误,请重新输入");
                    print();
            }
        }

    }

    public static String print(){ 
   
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- 🎆 "+ ColorUtil.getFormatLogString("薪资管理",33,1)  +ColorUtil.getFormatLogString(" 🎆 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",34,0),34,1));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 1.新增薪资信息 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 2.修改薪资信息 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 3.删除薪资信息 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 4.查询薪资信息 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-="+ColorUtil.getFormatLogString(" ✈ ✈ ✈ 5.退出薪资管理 ✈ ✈ ✈ ",35,1)+ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=",33,0),33,0));
        System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",33,0));
        System.out.println(ColorUtil.getFormatLogString("🎯 请输入要执行的功能序号 🎯 ",35,1));
        Scanner scanner = new Scanner(System.in);
        return scanner.next();

    }

    public static void findAll (){ 
   
        System.out.println("\033[1;94m" + "🦅__~_~~ __ 薪资数据正在查询... __~_~~ __🦅 ");
        System.out.println("\033[1;94m" + "🦅__~_~~ __ 1.查询某员工历史薪资明细 __~_~~ __🦅 ");
        System.out.println("\033[1;94m" + "🦅__~_~~ __ 2.查询年月历史薪资明细 __~_~~ __🦅 ");
        Scanner scanner = new Scanner(System.in);
        String num = scanner.next();
        switch (num){ 
   
            case "1":
                findById();
                break;
            case "2":
                findByTime();
                break;
            default:
                System.out.println(ColorUtil.getFormatLogString("--__-_ __ 输入序号有误,请重新输入 _ -__-__--", 31, 1));
        }

    }

    public static void add () { 
   
       try { 
   
           Integer  dptId;
           System.out.println(ColorUtil.getFormatLogString("🎯 薪资信息新增 🎯 ",35,1));
           ImsEmployeeTerminal.findAll();
           List<ImsEmployee> list = ImsEmployeeService.findAll();
           System.out.println("\033[1;94m" + "🦅__~_~~ __ 请选择一个员工进行薪资信息添加 __~_~~ __🦅 ");
           Scanner scanner = new Scanner(System.in);
           dptId = scanner.nextInt();
           ImsEmployee imsEmployee = list.get(dptId-1);

           List<ImsEmpSalaryDto> salaryById = ImsSalaryService.findSalaryById(imsEmployee);
           Date date = new Date();
           SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
           String time = sdf.format(date);
           for (int i = 0; i < salaryById.size(); i++) { 
   
               ImsEmpSalaryDto imsEmpSalaryDto = salaryById.get(i);
               String saDate = imsEmpSalaryDto.getSaDate();
               if (saDate.equals(time)){ 
   
                   System.out.println(ColorUtil.getFormatLogString("该员工当月薪资已添加,薪资添加失败 ✖ ✖ ", 31, 1));
                   return;
               }
           }
           String empName = imsEmployee.getEmpName();
           String empId = imsEmployee.getEmpId();
           System.out.println(ColorUtil.getFormatLogString(" -—— ﹃_ —— 当前操作【"+ empName + "】的【"+time+"】薪资信息 -—— ﹃_ ——", 32, 1));
           System.out.println(ColorUtil.getFormatLogString(" —— _ ﹄ —_﹃ 请输入【"+ empName + "】基础薪资 —— _ ﹄ —_﹃", 32, 1));
           Double base = scanner.nextDouble();
           System.out.println(ColorUtil.getFormatLogString(" —— _ ﹄ —_﹃ 请输入【"+ empName + "】绩效薪资 —— _ ﹄ —_﹃", 32, 1));
           Double performance = scanner.nextDouble();
           System.out.println(ColorUtil.getFormatLogString(" —— _ ﹄ —_﹃ 请输入【"+ empName + "】保险扣除薪资 —— _ ﹄ —_﹃", 32, 1));
           Double insurance = scanner.nextDouble();
           int i = ImsSalaryService.insertImsSalary(empId,base,performance,insurance);
           if (i == 1) { 
   
               System.out.println("\033[1;95m" + "--__-_ __ 添加成功 👌 👌 👌 _ -__-__--");
           }
           else if (i==-3){ 
   
               System.out.println(ColorUtil.getFormatLogString("您的输入有误,请输入数字 ✖ ✖ ", 31, 1));
               print();
           }else if (i==-2){ 
   
               System.out.println(ColorUtil.getFormatLogString("该员工当月薪资已添加,薪资添加失败 ✖ ✖ ", 31, 1));
               print();
           }
           else { 
   
               System.err.println("添加失败");
               print();
           }
       }catch (Exception e){ 
   
           System.out.println(ColorUtil.getFormatLogString("输入有误", 32, 1));
       }
    }

    public static void back () { 
   
        System.out.println(ColorUtil.getFormatLogString("🎯 输入 任意键 + 回车 返回上一级 ↪ ↪ ",35,1));
        Scanner scanner = new Scanner(System.in);
        scanner.next();
    }

    public static void update () { 
   
       try{ 
   
           Integer index;
           ImsEmployeeTerminal.findAll();
           List<ImsEmployee> list = ImsEmployeeService.findAll();
           System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入要修改的员工数据序号 __~_~~ __🦅 ");
           Scanner scanner1 = new Scanner(System.in);
           index = scanner1.nextInt();
           ImsEmployee imsEmployee = list.get(index - 1);
           String empId = imsEmployee.getEmpId();
           List<ImsEmpSalaryDto> salaryById = ImsSalaryService.findSalaryById(imsEmployee);
           ImsEmpSalaryDto imsSalary = salaryById.get(0);
           System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入要修改的基础薪资,原薪资为【"+imsSalary.getSaBase()+"】 __~_~~ __🦅 ");
           double base = scanner1.nextDouble();
           System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入要修改的绩效薪资,原薪资为【"+imsSalary.getSaPerformance()+"】 __~_~~ __🦅 ");
           double performance = scanner1.nextDouble();
           System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入要修改的保险扣除薪资,原扣除薪资为【"+imsSalary.getSaInsurance()+"】 __~_~~ __🦅 ");
           double insurance = scanner1.nextDouble();
           int i = ImsSalaryService.updateImsSalary(empId,base,performance,insurance,imsEmployee);
           if (i == 1) { 
   
               System.out.println("\033[1;95m" + "--__-_ __ 修改成功 👌 👌 👌 _ -__-__--");
           }else if (i==-2){ 
   
               System.out.println(ColorUtil.getFormatLogString(" 修改失败,只允许修改当月的薪资信息 ", 31, 1));
               print();
           }
           else { 
   
               System.out.println(ColorUtil.getFormatLogString(" 修改失败 ", 31, 1));
           }
       }catch (IndexOutOfBoundsException e){ 
   
           System.out.println(ColorUtil.getFormatLogString(" 该员工当月薪资信息未填写,数据修改失败 ", 31, 1));
       }catch (InputMismatchException e){ 
   
           System.out.println(ColorUtil.getFormatLogString(" 非法输入,请重新输入 ", 31, 1));
           update();
       }

    }

    public static void delete () { 
   
        try{ 
   
            Integer index;
            System.out.println(ColorUtil.getFormatLogString("🎯 薪资数据删除 🎯 ",35,1));
            List<ImsEmployee> list = ImsEmployeeService.findAll();
            ImsEmployeeTerminal.findAll();
            System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入要删除的员工序号 __~_~~ __🦅 ");
            Scanner scanner1 = new Scanner(System.in);
            index = scanner1.nextInt();
            ImsEmployee imsEmployee = list.get(index - 1);
            int i = ImsSalaryService.deleteImsSalary(imsEmployee);
            if (i == 1||i==0) { 
   
                System.out.println("\033[1;95m" + "--__-_ __ 删除成功 👌 👌 👌 _ -__-__--");
            }else if (i==-2){ 
   
                System.out.println(ColorUtil.getFormatLogString("该员工没有当月薪资信息,删除失败 ✖ ✖ ", 31, 1));
            }
            else if (i==-3){ 
   
                System.out.println(ColorUtil.getFormatLogString("该员工没有当月薪资信息,删除失败 ✖ ✖ ", 31, 1));
            }
            else { 
   
                System.out.println(ColorUtil.getFormatLogString("删除失败 ✖ ✖ ", 31, 1));
            }
        }catch (IndexOutOfBoundsException e){ 
   
            System.out.println(ColorUtil.getFormatLogString("该员工当月薪资信息未填写,数据删除失败 ✖ ✖ ", 31, 1));
        }
    }

    public static void findById(){ 
   
        Integer index;
        System.out.println(ColorUtil.getFormatLogString("🎯 查询某员工历史薪资明细 🎯 ",35,1));
        ImsEmployeeTerminal.findAll();
        List<ImsEmployee> list = ImsEmployeeService.findAll();
        if (list.size()<=0){ 
   
            System.out.println(ColorUtil.getFormatLogString("🎯 是否需要添加员工? 🎯 ",35,1));
            System.out.println("\033[1;94m" + "🦅__~_~~ __ 1.添加员工 2.返回上一级 __~_~~ __🦅 ");
            Scanner scanner = new Scanner(System.in);
            String next = scanner.next();
            switch (next){ 
   
                case "1":
                    ImsEmployeeTerminal.add();
                    break;
                case "2":
                   print();
                   break;
                default:
                    System.out.println("您的输入有误,请重新输入");
            }
            return;
        }
        System.out.println("\033[1;94m" + "🦅__~_~~ __ 请输入一个要查询的员工序号 __~_~~ __🦅 ");
        Scanner scanner = new Scanner(System.in);
        index = scanner.nextInt();
        ImsEmployee imsEmployee = list.get(index - 1);
        List<ImsEmpSalaryDto> salaryByIdList = ImsSalaryService.findSalaryById(imsEmployee);
        if (salaryByIdList.size()<=0){ 
   
            System.out.println(ColorUtil.getFormatLogString("该员工还没有薪资信息,快去添加薪资信息吧", 33, 1));
        }else { 
   
            System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 32, 1));
            System.out.println(ColorUtil.getFormatLogString("|\t序号\t |\t\t员工姓名\t\t|\t\t薪资月份\t\t|\t\t基础薪资\t\t|\t\t绩效薪资\t\t|\t\t保险扣除\t\t|\t\t实发薪资\t\t|",32, 1));
            System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 32, 1));
            for (int i = 0; i < salaryByIdList.size(); i++) { 
   
                ImsEmpSalaryDto imsSalary = salaryByIdList.get(i);
                System.out.println(ColorUtil.getFormatLogString("|\t" + (i+1)+ "\t |\t "+"\t "+imsSalary.getEmpName()+" \t |\t " + imsSalary.getSaDate() + " \t|\t "  + imsSalary.getSaBase() +" \t| " +
                        imsSalary.getSaPerformance()  + " \t|\t "+imsSalary.getSaInsurance()+" \t|\t "+imsSalary.getSaActual()+"\t |\t ", 32, 1));
            }
            System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 32, 1));
        }

    }

    public static void findByTime(){ 
   
        System.out.println(ColorUtil.getFormatLogString("🎯 查询某年月历史薪资明细 🎯 ",35,1));
        System.out.println("\033[1;94m" + "🦅__~_~~ __ 请按照标准格式输入想要查询的年月(例如2022-07) __~_~~ __🦅 ");
        Scanner scanner = new Scanner(System.in);
        String time = scanner.next();
        DateFormat format = new SimpleDateFormat("yyyy-MM");
        try { 
   
            Date startT = format.parse(time);
        } catch (Exception e) { 
   
            e.getMessage();
            System.out.println(ColorUtil.getFormatLogString("您输入的日期格式有误请重新输入", 31, 1));
         return;
        }
        System.out.println("\033[1;94m" + "🦅__~_~~ __ "+time+"员工薪资信息 __~_~~ __🦅 ");
        List<ImsEmpSalaryDto> salaryByTime = ImsSalaryService.findSalaryByTime(time);
        if (salaryByTime.size()<=0){ 
   
            System.out.println(ColorUtil.getFormatLogString("该日期还没有员工薪资信息,快去添加薪资信息吧", 33, 1));
        }else{ 
   
            System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 32, 1));
            System.out.println(ColorUtil.getFormatLogString("|\t序号\t |\t\t员工姓名\t\t|\t\t薪资月份\t\t|\t\t基础薪资\t\t|\t\t绩效薪资\t\t|\t\t保险扣除\t\t|\t\t实发薪资\t\t|", 32, 1));
            System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 32, 1));
            for (int i = 0; i < salaryByTime.size(); i++) { 
   
                ImsEmpSalaryDto imsEmpSalary = salaryByTime.get(i);

                System.out.println(ColorUtil.getFormatLogString("|\t" + (i+1)+ "\t |\t "+"\t "+ imsEmpSalary.getEmpName()+" \t |\t " + imsEmpSalary.getSaDate() + " \t|\t "  + imsEmpSalary.getSaBase() +" \t| " +
                        imsEmpSalary.getSaPerformance()  + " \t|\t "+imsEmpSalary.getSaInsurance()+" \t|\t "+imsEmpSalary.getSaActual()+"\t |\t ", 32, 1));
            }
            System.out.println(ColorUtil.getFormatLogString("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=", 32, 1));
        }

    }
}

  • service层

  • ImsDepartmentService
package com.codingfuture.service;

import com.codingfuture.dao.ImsDepartmentDAO;
import com.codingfuture.dao.impl.ImsDepartmentDAOImpl;
import com.codingfuture.entity.ImsDepartment;
import com.codingfuture.entity.ImsEmployee;
import com.codingfuture.utils.ChineseUtil;
import java.util.*;

/** * 部门业务逻辑层 * @author wxy */

public class ImsDepartmentService { 
   

    /** * 以下是添加部门 * 需求 : 1.部门名称只允许保存中文 Y * 2.部门名称不能与已保存的部门名称重复 Y * @return int */
    public static int insertImsDepartment(String dptName) { 
   
        boolean ifName = ImsDepartmentService.nameRepeat(dptName);
        if (!ChineseUtil.checkName(dptName)){ 
   
            return -2;
        }else if (ifName){ 
   
            return -3;
        }else { 
   ImsDepartmentDAO imsDepartmentDao = new ImsDepartmentDAOImpl();
            ImsDepartment imsDepartment = new ImsDepartment();
            UUID uuid = UUID.randomUUID();
            String id = uuid.toString();
            imsDepartment.setDptId(id);
            imsDepartment.setCreateTime(new Date());
            imsDepartment.setUpdateTime(new Date());
            imsDepartment.setDptName(dptName);
            int i = imsDepartmentDao.insertImsDepartment(imsDepartment);
            return i;
        }
    }

    /** * 以下是修改部门 * 需求 : 1.部门名称只允许保存中文 Y * 2.新修改的部门名称不能与已保存的部门名称重复 Y * @return int */
    public static int updateImsDepartment(ImsDepartment imsDepartment){ 
   
        ImsDepartmentDAO imsDepartmentDao = new ImsDepartmentDAOImpl();
        String dptName = imsDepartment.getDptName();
        boolean ifName = ImsDepartmentService.nameRepeat(dptName);
        if (!ChineseUtil.checkName(dptName)){ 
   
            return -2;
        }
        if (ifName){ 
   
            return -3;
        }
        imsDepartment.setUpdateTime(new Date());
        int i = imsDepartmentDao.updateImsDepartment(imsDepartment);
        return i;
    }

    /** * 以下是删除部门 * 需求 : 1.删除的信息使用逻辑删除的方式,不能够在数据库中直接删除该数据 Y * 2.删除部门信息时,需要考虑已经关联该部门的员工信息 Y * @return int */
    public static int deleteImsDepartment(ImsDepartment imsDepartment) { 
   
        List<ImsEmployee> list = ImsEmployeeService.findAll();
        for (int i = 0; i < list.size(); i++) { 
   
            ImsEmployee imsEmployee = list.get(i);
            String dptName = imsEmployee.getDptName();
            if (dptName.equals(imsDepartment.getDptName())){ 
   
                return -4;
            }
        }
        ImsDepartmentDAO imsDepartmentDao = new ImsDepartmentDAOImpl();
        return imsDepartmentDao.deleteImsDepartment(imsDepartment);

    }

    /** * 以下是查询所有部门 */
    public static List<ImsDepartment> findAll() { 
   
        ImsDepartmentDAO imsDepartmentDao = new ImsDepartmentDAOImpl();
        List<ImsDepartment> imsDepartmentList = imsDepartmentDao.findAll();

        return imsDepartmentList;
    }

    /** * 判断部门名称是否重复 */
    public static boolean nameRepeat(String dptName) { 
   
        List<ImsDepartment> list = ImsDepartmentService.findAll();
        boolean flag=false;
        for (int i = 0; i < list.size(); i++) { 
   
            ImsDepartment imsDepartment = list.get(i);
            if (imsDepartment.getDptName().equals(dptName)) { 
   
             flag=true;
             break;
            } else { 
   
             flag=false;
            }

        }
         return flag;
    }
}
  • ImsEmployeeService
package com.codingfuture.service;

import com.codingfuture.dao.ImsEmployeeDAO;
import com.codingfuture.dao.ImsSalaryDAO;
import com.codingfuture.dao.impl.ImsEmployeeDAOImpl;
import com.codingfuture.dao.impl.ImsSalaryDAOImpl;
import com.codingfuture.entity.ImsDepartment;
import com.codingfuture.dto.ImsEmpSalaryDto;
import com.codingfuture.entity.ImsEmployee;
import com.codingfuture.utils.ChineseCharToEnUtil;
import com.codingfuture.utils.ChineseUtil;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;

/** * 员工业务逻辑层 * @author wxy */

public class ImsEmployeeService { 
   

    /** * 添加员工 *需求 : 需要关联部门信息 Y & 员工编码需要程序自动生成 Y * 生成的编码不允许重复生成,即使该员工已经被删除,也不允许重复使用该员工编码 Y */
    public static int insertImsEmployee(String empName,String sex,ImsDepartment imsDepartment) { 
   
        if (!ChineseUtil.checkName(empName)){ 
   
            return -2;
        }
        ImsEmployeeDAOImpl imsEmployeeDao = new ImsEmployeeDAOImpl();
        ImsEmployee imsEmployee = new ImsEmployee();
        UUID uuid = UUID.randomUUID();
        String id = uuid.toString();
        imsEmployee.setEmpId(id);
        imsEmployee.setDptId(imsDepartment.getDptId());
        imsEmployee.setEmpCode(getEmpCode(imsDepartment));
        imsEmployee.setEmpSex(sex);
        imsEmployee.setEmpName(empName);
        imsEmployee.setCreateTime(new Date());
        imsEmployee.setUpdateTime(new Date());
        imsEmployee.setDptName(imsDepartment.getDptName());
        int i = imsEmployeeDao.insertImsEmployee(imsEmployee);
        return i;
    }

    /** * 更改员工 * 需求 : 员工的ID、部门、编码是不允许修改的 Y * 可以修改:员工名称、员工性别 Y */
    public static int updateImsEmployee(ImsEmployee imsEmployee){ 
   
        if (!ChineseUtil.checkName(imsEmployee.getEmpName())){ 
   
            return -2;
        }
        ImsEmployeeDAOImpl imsEmployeeDao = new ImsEmployeeDAOImpl();
        imsEmployee.setUpdateTime(new Date());
        int i = imsEmployeeDao.updateImsEmployee(imsEmployee);
        return i;
    }

    /** * 查询员工 */
    public static List<ImsEmployee> findAll() { 
   
        ImsEmployeeDAO imsEmployeeDao = new ImsEmployeeDAOImpl();
        List<ImsEmployee> imsEmployeeList = imsEmployeeDao.findAll();

        return imsEmployeeList;
    }

    /** * 删除员工 * 需求 : 逻辑删除的方式,不能够在数据库中直接删除该数据 * 删除员工信息时,需要考虑已经关联该员工的薪资信息 */
    public static int deleteImsEmployee(ImsEmployee imsEmployee) { 
   
        ImsEmployeeDAO imsEmployeeDao = new ImsEmployeeDAOImpl();
        ImsEmpSalaryDto imsEmpSalary = new ImsEmpSalaryDto();
        imsEmpSalary.setEmpId(imsEmployee.getEmpId());
        ImsSalaryDAO imsSalaryDao = new ImsSalaryDAOImpl();
        List<ImsEmpSalaryDto> salaryById = imsSalaryDao.findSalaryById(imsEmpSalary);
        if (salaryById.size()>0){ 
   
           return -2;
        }else { 
   
            imsEmployeeDao.deleteImsEmployee(imsEmployee);
            return 1;
        }
    }

    /** * 获取员工工号 */
    public static String getEmpCode(ImsDepartment imsDepartment){ 
   
        /* 获取年月日 */
        Date date = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd");
        String dateString = formatter.format(date);
        /* 获取部门首字母大写 */
        String allFirstLetter = ChineseCharToEnUtil.getAllFirstLetter(imsDepartment.getDptName());
        /* 获取当日第几个 */

        List<ImsEmployee> imsEmployeeList = ImsEmployeeService.searchAll();
        Integer size = imsEmployeeList.size();
        Integer addsize = size + 1;
        String numId;
        if (addsize<10){ 
   
            numId ="0"+ addsize;
        }else { 
   
            numId =addsize.toString();
        }
        String num=numId;
        return allFirstLetter+dateString+num;
    }

    /** * 查询数据库中is_delete = 1 和 0 的员工 */
    public static List<ImsEmployee> searchAll() { 
   
        ImsEmployeeDAO imsEmployeeDao = new ImsEmployeeDAOImpl();
        List<ImsEmployee> imsEmployeeList = imsEmployeeDao.searchAll();
        return imsEmployeeList;
    }
}

  • ImsSalaryService
package com.codingfuture.service;

import com.codingfuture.dao.ImsSalaryDAO;
import com.codingfuture.dao.impl.ImsSalaryDAOImpl;
import com.codingfuture.dto.ImsEmpSalaryDto;
import com.codingfuture.entity.ImsEmployee;
import com.codingfuture.entity.ImsSalary;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;

/** * 薪资业务逻辑层 * @author wxy */

public class ImsSalaryService { 
   

    /** * 新增薪资 * 要求 : 只能录入当月的薪资,当月薪资只能录入一次,不能重复录入 */
    public static int insertImsSalary(String empId, double base, double performance, double insurance) { 
   
        ImsSalaryDAO imsSalaryDao = new ImsSalaryDAOImpl();
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        String time = sdf.format(date);
        List<ImsEmpSalaryDto> imsSalaryAll = findImsSalaryAll();
        for (int i = 0; i < imsSalaryAll.size(); i++) { 
   
            ImsEmpSalaryDto imsEmpSalary = imsSalaryAll.get(i);
            String empId1 = imsEmpSalary.getEmpId();
            String saDate = imsEmpSalary.getSaDate();
             if (empId1.equals(empId) && saDate.equals(time)){ 
   
                 return -2;
             }
        }
        UUID uuid = UUID.randomUUID();
        String id = uuid.toString();
        ImsSalary imsSalary = new ImsSalary(id,empId,time,base,performance,insurance,base+performance-insurance,new Date(),new Date());
        int i = imsSalaryDao.insertImsSalary(imsSalary);
        return i;
    }

    /** * 修改薪资 * 要求 : 修改薪资时,只允许修改当月的薪资,历史的薪资不允许修改 * 没有录入薪资的人员,不允许修改薪资信息 */
    public static int updateImsSalary( String empId,double base,double performance,double insurance,ImsEmployee imsEmployee) { 
   
        ImsSalaryDAOImpl imsSalaryDao = new ImsSalaryDAOImpl();
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        String time = sdf.format(date);
        List<ImsEmpSalaryDto> salaryById = ImsSalaryService.findSalaryById(imsEmployee);
        // List<ImsEmpSalaryDto> imsSalaryAll = findImsSalaryAll();
        for (int i = 0; i < salaryById.size(); i++) { 
   
            ImsEmpSalaryDto imsEmpSalary = salaryById.get(i);
            if (imsEmpSalary.getSaDate().equals(time)){ 
   
                imsEmpSalary.setEmpId(empId);
                imsEmpSalary.setSaBase(base);
                imsEmpSalary.setSaDate(time);
                imsEmpSalary.setSaActual(base + performance - insurance);
                imsEmpSalary.setSaPerformance(performance);
                imsEmpSalary.setSaInsurance(insurance);
                imsEmpSalary.setUpdateTime(new Date());
                int a = imsSalaryDao.updateImsSalary(imsEmpSalary);
                return a;
            }
        }
        return 0;
        }

    /** * 通过ID查询薪资 */
    public static List<ImsEmpSalaryDto> findSalaryById(ImsEmployee imsEmployee) { 
   
        ImsSalaryDAO imsSalaryDao = new ImsSalaryDAOImpl();
        ImsEmpSalaryDto imsEmpSalary = new ImsEmpSalaryDto();
        imsEmpSalary.setEmpId(imsEmployee.getEmpId());
        List<ImsEmpSalaryDto> imsEmpSalaryList = imsSalaryDao.findSalaryById(imsEmpSalary);
        return imsEmpSalaryList;
    }

    /** * 删除薪资 */
    public static int deleteImsSalary(ImsEmployee imsEmployee) { 
   
        List<ImsEmpSalaryDto> salaryById = ImsSalaryService.findSalaryById(imsEmployee);
        if (salaryById.size()<=0){ 
   
            return -2;
        }

        Date date = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM");
        String dateString = formatter.format(date);
        ImsSalaryDAOImpl imsSalaryDao = new ImsSalaryDAOImpl();
        List<ImsEmpSalaryDto> imsSalaryAll = imsSalaryDao.findImsSalaryAll();
        int a;
        for (int i = 0; i <imsSalaryAll.size() ; i++) { 
   
            ImsEmpSalaryDto imsEmpSalaryDto = imsSalaryAll.get(i);
            if (imsEmpSalaryDto.getSaDate().equals(dateString)&&imsEmpSalaryDto.getEmpId().equals(imsEmployee.getEmpId())){ 
   
                imsSalaryDao.deleteImsSalary(imsEmployee,dateString);
                a=1;
                return a;
            }

        }
     return 0;
    }

    /** * 通过日期查找薪资 */
    public static List<ImsEmpSalaryDto> findSalaryByTime(String time) { 
   
        ImsEmpSalaryDto imsEmpSalary = new ImsEmpSalaryDto();
        imsEmpSalary.setSaDate(time);
        ImsSalaryDAO imsSalaryDao = new ImsSalaryDAOImpl();
        List<ImsEmpSalaryDto> imsSalaryByTime = imsSalaryDao.findImsSalaryByTime(imsEmpSalary);
        return imsSalaryByTime;
    }

    /** * 查询所有薪资 */
    public static List<ImsEmpSalaryDto> findImsSalaryAll(){ 
   
        ImsSalaryDAO imsSalaryDao = new ImsSalaryDAOImpl();
        List<ImsEmpSalaryDto> SalaryList = imsSalaryDao.findImsSalaryAll();
        return SalaryList;
    }
}

一篇写不下啦,剩下的代码另写一篇可以自己到我主页找。

今天的文章员工信息系统 excel_员工信息录入系统分享到此就结束了,感谢您的阅读。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/69422.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注