mybatis实体类使用枚举类
增加配置文件
mybatis-plus:
mapper-locations: classpath:mapper/*.xml
type-enums-package: com.bwrj.fuda.common.enums
实体类里面直接使用枚举类就可以
@ApiModelProperty(value = "状态")
private TransportationTaskStatusEnum status;
枚举类做改动
package com.bwrj.fuda.common.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.IEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum TransportationTaskStatusEnum implements IEnum<Integer> {
NOT_START(1, "未开始"),
LOADING(2, "开始装车"),
LOAD_CONFIRM(3, "装车确认"),
IN_WELL(4, "入井"),
TRANSPORTING(5, "进行中"),
END(6, "结束");
@EnumValue
private int status;
private String name;
public int getStatus() {
return status;
}
public String getName() {
return name;
}
@Override
public Integer getValue() {
return status;
}
}