JAVA后台开发_从入门到精通

1 公用

2019-11-13  本文已影响0人  笑Skr人啊

1 实体类

package com.gp6.bean;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import java.math.BigDecimal;

/**
 * 员工
 *
 * @author gp6
 * @date 2019-04-30
 */
@Getter
@Setter
@ToString
@AllArgsConstructor
public class Employee {

    /**
     * 主键id
     */
    private int id;

    /**
     * 姓名
     */
    private String name;

    /**
     * 性别 1:男 2:女 3:未知
     */
    private int sex;

    /**
     * 年龄
     */
    private int age;

    /**
     * 薪资
     */
    private long salary;

    /**
     * 体重
     */
    private BigDecimal weight;
}

2 工具类

package com.gp6.list.utils;

import com.gp6.bean.Employee;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 列表工具
 *
 * @author gp6
 * @date 2019-07-23
 */
public class ListUtil {

    /**
     * 封装员工列表
     *
     * @return 员工列表
     */
    public static List<Employee> packEmployeeList() {
        List<Employee> employeeList = new ArrayList<>();
        employeeList.add(new Employee(1,"鸣人",1,17,5000,new BigDecimal(62.35)));
        employeeList.add(new Employee(2,"佐助",1,17,6000,new BigDecimal(62.35)));
        employeeList.add(new Employee(3,"小樱",2,17,7000,new BigDecimal(52.35)));
        employeeList.add(new Employee(4,"小李",1,17,8000,new BigDecimal(62.35)));
        employeeList.add(new Employee(5,"天天",2,17,9000,new BigDecimal(52.35)));
        employeeList.add(new Employee(6,"路飞",1,18,10000,new BigDecimal(62.35)));
        employeeList.add(new Employee(7,"索隆",1,18,11000,new BigDecimal(62.35)));
        return employeeList;
    }
}

上一篇下一篇

猜你喜欢

热点阅读