package com.pj.project.tb_item;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;

import lombok.Data;
import lombok.Getter;
import lombok.experimental.Accessors;

/**
 * Model: tb_item -- 作业配置项
 *
 * @author qzy
 */
@Data
@Accessors(chain = true)
@TableName(TbItem.TABLE_NAME)
@EqualsAndHashCode(callSuper = false)
public class TbItem extends Model<TbItem> implements Serializable {

    // ---------- 模块常量 ----------
    /**
     * 序列化版本id
     */
    private static final long serialVersionUID = 1L;
    /**
     * 此模块对应的表名
     */
    public static final String TABLE_NAME = "tb_item";
    /**
     * 此模块对应的权限码
     */
    public static final String PERMISSION_CODE = "tb-item";


    // ---------- 表中字段 ----------
    /**
     * 主键
     */
    private String id;
    private String typeId;

    /**
     * 项目编号
     */
    private String itemCode;

    /**
     * 项目名称
     */
    private String itemName;

    /**
     * 项目金额(元)
     */
    private BigDecimal price;
    private String unit;
    private double carLength;
    private double maxWeight;
    private double minLength;
    private double minWeight;
    private int status;
    private String killId;
    /**
     * 业务分类
     */
    private String businessType;
    private String businessTypeName;
    /**
     * 收费分类
     */
    private Integer payType;
    private String payTypeName;
    private String itemType;
    private Double taxRate;
    @TableField(exist = false)
    private String remark;

    @TableField(exist = false)
    private String typeName;

    @TableField(exist = false)
    private Integer need;

    @TableField(exist = false)
    private int needRemark;

    @TableField(exist = false)
    private int mustRemark;

    @TableField(exist = false)
    private int num=1;

    @TableField(exist = false)
    private int inc;

    @Getter
    @AllArgsConstructor
    public static enum ItemTypeEnum{
        EMPTY_TYPE("空车","空车"),
        WEIGHT_TYPE("载重","载重")
        ;

        private String type;
        private String desc;

        public static List<Map<String, String>> getList() {
            List<Map<String, String>> list = new ArrayList<>();
            for (ItemTypeEnum tbItem : ItemTypeEnum.values()) {
                Map<String, String> map = new HashMap<>();
                map.put("id", tbItem.getType());
                map.put("name", tbItem.getDesc());
                list.add(map);
            }
            return list;
        }

    }

}
