[SpringBoot] [Mybatis] Unsupported conversion from xx to xx and Error attempting to get column 'xx' error

There are two reasons for this error

1. A certain attribute name of your entity class does not correspond to the field name of the database (either use the same name, or use ResultMap to establish a mapping relationship) 2.
If you make sure that you are all corresponding, that is: entity class No no-argument constructs! !

It is really a very inexplicable problem. After all, I made sure that I did not convert the xx type to xx type and the name of the attribute column of the database is also correct.

Because I want to pass parameters to save trouble, I customized the construction methods of some entity classes without writing no-argument structures, which would cause problems like the title when selecting, so you add
a no-argument structure to your entity class and you are done.

/**
 * @ClassName Cart
 * @Description TODO 购物车实体类
 * @Date 2022/7/19
 * @Author JayeXue
 * @Version 1.0
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class Cart extends BaseEntity{
    
    
    @ApiModelProperty("购物车id")
    private Integer cid;
    @ApiModelProperty("商品id")
    private Integer pid;
    @ApiModelProperty("用户id")
    private Integer uid;
    @ApiModelProperty("价格")
    private Long price;
    @ApiModelProperty("数量")
    private Integer num;

    public Cart() {
    
    
    }

    public Cart(String createdUser, Date createdTime, String changeUser, Date changeTime, Integer pid, Integer uid, Long price, Integer num) {
    
    
        super(createdUser, createdTime, changeUser, changeTime);
        this.pid = pid;
        this.uid = uid;
        this.price = price;
        this.num = num;
    }
}

Guess you like

Origin blog.csdn.net/Jaye_xxx/article/details/125869206