MyBatis-Mapper中错误No constructor found...

不说了,直接上代码

@Data
public class BarterGoodsDto implements Serializable {

    private String barterCommoditynumber; //商品编号

    private String barterCommodityname;// 商品名称

    private BigDecimal barterSellingprice; //出售价格

    private Byte barterSeveralnew;//商品几成新

    private String barterCommodityaddress;// 商品地址

    private String barterShowpictures;//推荐图片地址

    private Byte barterCommoditystatus;//商品状态

    private List barterFiles;//商品的图片信息
}
@Data
public class BarterFile implements Serializable {

    private String barterFilemd5;//md5值

    private String barterShowpictures; //展示图片地址

    private Date barterCreatedata;//上传日期

    private String barterCommoditynumber;//所属商品id

    public BarterFile() {

    }
public BarterFile(String barterFilemd5, String barterShowpictures, Date barterCreatedata, String barterCommoditynumber) {
        this.barterFilemd5 = barterFilemd5;
        this.barterCommoditynumber = barterCommoditynumber;
        this.barterCreatedata = barterCreatedata;
        this.barterShowpictures = barterShowpictures;
    }
}

上面是俩个model类 BarterGoodsDto 中要有多个BarterFile(图片文件,图片在图片服务器上,这里是地址)

  id="BaseResultMapAndFile" type="com.dlnu.barter.service.goods.dto.BarterGoodsDto">
        <id column="barter_commodityNumber" jdbcType="VARCHAR" property="barterCommoditynumber"/>
        <result column="barter_commodityName" jdbcType="VARCHAR" property="barterCommodityname"/>
        <result column="barter_sellingPrice" jdbcType="DECIMAL" property="barterSellingprice"/>
        <result column="barter_commodityStatus" jdbcType="TINYINT" property="barterCommoditystatus"/>
        <result column="barter_showPictures" jdbcType="VARCHAR" property="barterShowpictures"/>
        <result column="barter_severalnew" jdbcType="TINYINT" property="barterSeveralnew"/>
        property="barterFiles" ofType="com.dlnu.barter.service.goods.entity.BarterFile">
            <id column="barter_filemd5" jdbcType="VARCHAR" property="barterFilemd5"/>
            <result column="barter_showPictures" jdbcType="VARCHAR" property="barterShowpictures"/>
            <result column="barter_createdata" jdbcType="TIMESTAMP" property="barterCreatedata"/>
            <result column="barterfileId" jdbcType="VARCHAR" property="barterCommoditynumber"/>
        
    

一开始BarterFile 没有添加无参构造函数(我以为lombok会自动添加无参构造函数)然后就一直报No constructor found…这个错误,然后无意中发现没有无参构造函数(可能是我自己添加了一个有参构造函数导致无参被覆盖了)然后添加上一个无参构造函数之后就不报哪个错误了,这里记录一下

你可能感兴趣的:(MyBatis-Mapper中错误No constructor found...)