Mybatis-plus doesn't work! ERROR INFO:org.mybatis.spring.MyBatisSystemException

23 Views Asked by At

I called the newsList() method, in which I wanted to query the news with ID 1 in the database.

public CallResult<Object> newsList() {
        log.info("In NewsDomain");
        int page = newsParam.getPage();
        int pageSize = newsParam.getPageSize();
        Integer tab = newsParam.getTab();
        News news = new News();
        log.info("find id = 1 news");
        news = this.newsDomainRepository.findNewsById((long)1);
        log.info("find!");

Then, I called the this.newsDomainRepository.findNewsById method to complete the query.

public class NewsDomainRepository {
    @Resource
    private NewsMapper newsMapper;

    public News findNewsById(Long id) {
        log.info("In NewsDomainRepository-findNewsById");
        return newsMapper.selectById(id);
    }

In this method, I injected a newsMapper and used it to query the database, but an error was reported during the query.

This is my NewsMapper:

public interface NewsMapper extends BaseMapper<News> {
}

This is my News data:

@Data
public class News {
    private Long id;
    private String title;
    private String summary;
    private String imageUrl;
    private String content;

    private Integer tab;
    private Long createTime;
    private String author;

    @TableField("n_status")
    private Integer status;
}

This is MYSQL table: enter image description here

THE ERROR INFO: enter image description here

please help me, please.I spent the whole afternoon but still couldn't find the problem.

0

There are 0 best solutions below