All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.shoulder.web.template.dictionary.model.DictionaryItemEntity Maven / Gradle / Ivy

Go to download

shoulder WEB 模块,基于Spring Boot Web提供了 Controller AOP 日志、AOP异常处理,统一返回值,健康检查,租户、用户解析,Web 安全防护,通用CrudController,动态字典,标签管理,HTTP client AOP日志、AOP异常处理等能力,助力Web飞速开发。

The newest version!
package org.shoulder.web.template.dictionary.model;

import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.NotEmpty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.shoulder.core.dictionary.model.DictionaryItem;
import org.shoulder.data.constant.DataBaseConsts;
import org.shoulder.data.mybatis.template.entity.BizTreeEntity;

import java.io.Serial;

/**
 * 字典项
 * itemId 用 bizId 实现
 *
 * @author lym
 */
@Getter
@Setter
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@TableName("tb_dictionary_item")
public class DictionaryItemEntity
        extends BizTreeEntity
        implements DictionaryItem {

    @Serial private static final long serialVersionUID = -6634573176500294047L;

    /**
     * 字典类型 / 业务类型,关联到 {@link DictionaryTypeEntity#getCode()}
     */
    @TableField("dictionary_type")
    // @BizIdSource
    protected String dictionaryType;

    /**
     * 名称
     */
    @NotEmpty(message = "name can't be null")
    @Length(max = 255, message = "name length must less than 255")
    @TableField(value = DataBaseConsts.COLUMN_LABEL, condition = SqlCondition.LIKE)
    // @BizIdSource
    protected String name;

    /**
     * 排序
     */
    @TableField(value = DataBaseConsts.COLUMN_DISPLAY_ORDER)
    protected Integer displayOrder;

    /**
     * 展示名称
     */
    @TableField("display_name")
    private String displayName;

    /**
     * 备注
     */
    @TableField("description")
    private String description;

    @Override
    public String getItemId() {
        return name;
    }

    @Override
    public Integer getDisplayOrder() {
        return displayOrder;
    }

    @Override
    public String getDisplayName() {
        return displayName;
    }

    @Override
    public String getObjectName() {
        return name;
    }

    @Override
    public String getDictionaryType() {
        return dictionaryType;
    }

    @Override
    public String getObjectType() {
        // 这里如果过长,数据库保存时可能报错,强烈建议实现该接口
        return "objectType.shoulder.dictionaryItem";
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy