|  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson2.annotation.JSONField; | 
|---|
|  |  |  | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.IdType; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.TableField; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.TableId; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.annotation.TableName; | 
|---|
|  |  |  | import com.dy.common.mybatis.envm.Deleted; | 
|---|
|  |  |  | import com.dy.common.po.BaseEntity; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.util.DistrictLevel; | 
|---|
|  |  |  | import io.swagger.v3.oas.annotations.media.Schema; | 
|---|
|  |  |  | import jakarta.validation.constraints.Max; | 
|---|
|  |  |  | import jakarta.validation.constraints.Min; | 
|---|
|  |  |  | import jakarta.validation.constraints.NotEmpty; | 
|---|
|  |  |  | import jakarta.validation.constraints.NotNull; | 
|---|
|  |  |  | import lombok.*; | 
|---|
|  |  |  | import org.hibernate.validator.constraints.Length; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 行政区划实体 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @TableName(value="ba_district", autoResultMap = true) | 
|---|
|  |  |  | @Data | 
|---|
|  |  |  | @Builder | 
|---|
|  |  |  | @ToString | 
|---|
|  |  |  | @NoArgsConstructor | 
|---|
|  |  |  | @AllArgsConstructor | 
|---|
|  |  |  | @Schema(name = "行政区划实体") | 
|---|
|  |  |  | public class BaDistrict implements BaseEntity { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public static final long serialVersionUID = 202311081046001L; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @JSONField(serializeUsing= ObjectWriterImplToString.class) | 
|---|
|  |  |  | @TableId(type = IdType.INPUT) | 
|---|
|  |  |  | @Schema(description = "实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | public Long id ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 上级行下区ID | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "上级实体id", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @JSONField(serializeUsing= ObjectWriterImplToString.class) | 
|---|
|  |  |  | public Long supperId; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 行政区名称 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "行政区名称", requiredMode = Schema.RequiredMode.REQUIRED) | 
|---|
|  |  |  | @NotEmpty(message = "行政区名称不能为空") //不能为空也不能为null | 
|---|
|  |  |  | @Length(message = "行政区名称不大于{max}字,不小于{min}字", min = 1, max = 25) | 
|---|
|  |  |  | public String name; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 行政区编号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "行政区编号", requiredMode = Schema.RequiredMode.REQUIRED) | 
|---|
|  |  |  | @NotEmpty(message = "行政区编号不能为空") //不能为空也不能为null | 
|---|
|  |  |  | @Max(message = "行政区编号不大于99", value = 99) | 
|---|
|  |  |  | @Min(message = "行政区编号不小于0",value = 0) | 
|---|
|  |  |  | public String num; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 行政区级别 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "行政区级别", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @NotNull(message = "行政区级别不能为空") //不能为空也不能为null | 
|---|
|  |  |  | @Max(message = "行政区级别不大于10", value = 10) | 
|---|
|  |  |  | @Min(message = "行政区级别不小于0",value = 0) | 
|---|
|  |  |  | public DistrictLevel level; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 是否删除: 0表示未删除  1表示删除. | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "删除标识,表单不用填写", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | public Deleted deleted; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 下级行政区集合 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @TableField(exist = false) | 
|---|
|  |  |  | public List<BaDistrict> subDistricts ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 下级行政区集合 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Schema(description = "是否可以添下级,表单不用填写,只在查询列表时有效", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @TableField(exist = false) | 
|---|
|  |  |  | public boolean canAdd ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Schema(description = "是否可以删除,表单不用填写,只在查询列表时有效", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | 
|---|
|  |  |  | @TableField(exist = false) | 
|---|
|  |  |  | public boolean canDelete ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|