欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Mybatis-plus使用注解 @TableField(exist = false)

 更新時間:2021年03月15日 09:24:22   作者:前路無畏  
這篇文章主要介紹了Mybatis-plus使用注解 @TableField(exist = false),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

當(dāng)表中午字段,但是實體類中需要這個成員變量時怎么辦,可以使用mybatis-plus中@TableField(exist=false)

如下:

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

/**
 * 商品三級分類
 * 
 * @author yuhl
 * @email fsjwin@163.com
 * @date 2020-09-04 14:12:07
 */
@Data
@TableName("pms_category")
public class CategoryEntity implements Serializable {
 private static final long serialVersionUID = 1L;

 /**
 * 分類id
 */
 @TableId
 private Long catId;
 /**
 * 分類名稱
 */
 private String name;
 /**
 * 父分類id
 */
 private Long parentCid;
 /**
 * 層級
 */
 private Integer catLevel;
 /**
 * 是否顯示[0-不顯示,1顯示]
 */
 @TableLogic(value = "1",delval = "0")
 private Integer showStatus;
 /**
 * 排序
 */
 private Integer sort;
 /**
 * 圖標(biāo)地址
 */
 private String icon;
 /**
 * 計量單位
 */
 private String productUnit;
 /**
 * 商品數(shù)量
 */
 private Integer productCount;

 @JsonInclude(JsonInclude.Include.NON_EMPTY) //children不為空則顯示,要不然就不展示了。解決了,樹下沒有子樹但是會有個空白的占位的情況
 @TableField(exist=false) //樹形展示用的,表中無此字段標(biāo)識表中無次字段
 private List<CategoryEntity> children;
}

@TableField(exist=false) //樹形展示用的,表中無此字段標(biāo)識表中無次字段即為此用法

注意: @JsonInclude(JsonInclude.Include.NON_EMPTY) //children不為空則顯示,要不然就不展示了。解決了,樹下沒有子樹但是會有個空白的占位的情況

到此這篇關(guān)于Mybatis-plus使用注解 @TableField(exist = false)的文章就介紹到這了,更多相關(guān)Mybatis-plus @TableField(exist = false) 內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論