mirror of https://gitee.com/stylefeng/roses
【7.2.5】【rule】标记枚举,设置可直接和mp交互
parent
6bde52fcfb
commit
b3b8948531
|
@ -17,6 +17,17 @@
|
|||
|
||||
<dependencies>
|
||||
|
||||
<!-- 通用注解 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-annotation</artifactId>
|
||||
<version>${mp.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- spring boot -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package cn.stylefeng.roses.kernel.rule.enums;
|
||||
|
||||
import cn.stylefeng.roses.kernel.rule.base.ReadableEnum;
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
|
@ -46,6 +47,7 @@ public enum StatusEnum implements ReadableEnum {
|
|||
*/
|
||||
DISABLE(2, "禁用");
|
||||
|
||||
@EnumValue
|
||||
private final Integer code;
|
||||
|
||||
private final String message;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
package cn.stylefeng.roses.kernel.rule.enums;
|
||||
|
||||
import cn.stylefeng.roses.kernel.rule.base.ReadableEnum;
|
||||
import com.baomidou.mybatisplus.annotation.EnumValue;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
|
@ -39,20 +41,28 @@ public enum YesOrNotEnum implements ReadableEnum {
|
|||
/**
|
||||
* 是
|
||||
*/
|
||||
Y("Y", "是"),
|
||||
Y("Y", "是", true),
|
||||
|
||||
/**
|
||||
* 否
|
||||
*/
|
||||
N("N", "否");
|
||||
N("N", "否", false);
|
||||
|
||||
/**
|
||||
* 使用@EnumValue注解,标记mybatis-plus保存到库中使用code值
|
||||
*/
|
||||
@EnumValue
|
||||
private final String code;
|
||||
|
||||
private final String message;
|
||||
|
||||
YesOrNotEnum(String code, String message) {
|
||||
@JsonValue
|
||||
private final Boolean boolFlag;
|
||||
|
||||
YesOrNotEnum(String code, String message, Boolean boolFlag) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
this.boolFlag = boolFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue