级联(数据字典)

二级级联:

一:新建两个Bean

父级:

/**
 * @Description 数据字典
 * @Author WangKun
 * @Date 2023/7/25 10:15
 * @Version
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("HW_DICT_KEY")
public class DictKey implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private String id;

    private Timestamp created;

    private Timestamp modified;

    private String dictKey;

    private String dictName;

    private List dictItemValues;
}

子级:

/**
 * @Description 数据字段
 * @Author WangKun
 * @Date 2023/7/25 10:15
 * @Version
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("HW_DICT_ITEM_VALUE")
public class DictItemValue implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private String id;

    private Timestamp created;

    private Timestamp modified;

    private String dictKey;

    private String itemCode;

    private String itemName;

}

mybatis 或者 mybatisplus



    
            
            
        
            
            
            
        
    

    

级联(数据字典)_第1张图片

三级级联:

新建三个Bean

父级:

/**
 * @Description 数据字典
 * @Author WangKun
 * @Date 2023/7/25 10:15
 * @Version
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("HW_DICT")
public class Dict implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private String id;

    private String key;

    private String name;

    private String parentId;

    private List children;
}

子级:

/**
 * @Description 数据字典
 * @Author WangKun
 * @Date 2023/7/25 10:15
 * @Version
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("HW_DICT_VALUE")
public class DictValue implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private String id;

    private String key;

    private String name;

    private String parentId;

    private List children;
}

孙级:

/**
 * @Description 数据字典
 * @Author WangKun
 * @Date 2023/7/25 10:15
 * @Version
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("HW_DICT_VALUE_ITEM")
public class DictValueItem implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private String id;

    private String key;

    private String name;

    private String parentId;
}

mybatis 或者 mybatisplus



    
        
        
        
        
            
            
            
            
                
                
                
            
        

    
    


级联(数据字典)_第2张图片

 

你可能感兴趣的:(java,spring,boot)