当前位置: 代码迷 >> 综合 >> 【遇到问题】使用lombok的@Builder注解导致获取数据时mybatis映射出错
  详细解决方案

【遇到问题】使用lombok的@Builder注解导致获取数据时mybatis映射出错

热度:45   发布时间:2024-01-27 05:23:46.0
实体上使用了lombok的@Builder注解,如果不select所有字段,就会报错。
解决方法:使用lombok的@Builder注解的时候必须必须同时在pojo对象中使用注解@Tolerate添加一个无参构造。如下:
package org.tangxz.modules.logistics.manage.sj_info.entity;import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import lombok.experimental.Tolerate;
import org.tangxz.modules.logistics.manage.wljd_info.entity.WljdInfo;
import org.tangxz.modules.logistics.table.cl.entity.Cl;
import org.tangxz.modules.logistics.table.hfqz.entity.Hfqz;
import org.tangxz.modules.logistics.table.ht.entity.Ht;
import org.tangxz.modules.logistics.table.hz_sj_pj.entity.HzSjPj;
import org.tangxz.modules.logistics.table.pltz.entity.Pltz;
import org.tangxz.modules.logistics.table.sj_hz_pj.entity.SjHzPj;
import org.tangxz.modules.logistics.table.tlht.entity.Tlht;
import org.tangxz.modules.logistics.table.tz.entity.Tz;
import org.tangxz.modules.logistics.table.user.entity.User;
import org.tangxz.modules.logistics.table.wljd.entity.Wljd;import java.util.List;/*** @Description: 一个司机的司机全部信息* @Author: 唐小尊* @Date: 2019-11-04* @Version: V1.0*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="司机全部信息关联表", description="司机信息")
@Builder
public class SjInfo {/**司机基本信息*/@ApiModelProperty(value = "司机基本信息")private User sjUser;/**司机接单数*/@ApiModelProperty(value = "司机接单数")private Integer sjJdNum;/**司机好评数pj_fs>=6*/@ApiModelProperty(value = "司机好评数pj_fs>=6")private Integer sjHpNum;/**司机差评数pj_fs<6*/@ApiModelProperty(value = "司机差评数pj_fs<6")private Integer sjCpNum;/**司机车辆*/@ApiModelProperty(value = "司机车辆")private List<Cl> sjClList;/**司机接单信息*/@ApiModelProperty(value = "司机接单信息")private List<WljdInfo> sjWljdInfoList;/**司机发表的帖子*/@ApiModelProperty(value = "司机发表的帖子")private List<Tz> sjTzList;/**司机评论帖子*/@ApiModelProperty(value = "司机评论帖子")private List<Pltz> sjPltzList;/**司机发表的话题*/@ApiModelProperty(value = "司机发表的话题")private List<Ht> sjHtList;/**司机发表的讨论*/@ApiModelProperty(value = "司机发表的讨论")private List<Tlht> sjTlhtList;/**司机发表的求助*/@ApiModelProperty(value = "司机发表的求助")private List<QzAll> sjQzList;/**司机回复的求助*/@ApiModelProperty(value = "司机回复的求助")private List<Hfqz> sjHfqzList;/**司机被评价*/@ApiModelProperty(value = "货主被评价")private List<HzSjPj> sjBeiPj;/**司机评价*/@ApiModelProperty(value = "司机评价")private List<SjHzPj> sjPj;@Toleratepublic SjInfo(){ }
}
  相关解决方案