TsukuyoMiya
TsukuyoMiya
2019-10-15 14:59

mybatis添加语句一直报空指针

  • java
  • mysql

传入的实体类

public class F728040Req {
    private Long clientId;
    private String prodId;
    private Long orderNum;

    public Long getClientId() {
        return clientId;
    }

    public void setClientId(Long clientId) {
        this.clientId = clientId;
    }

    public String getProdId() {
        return prodId;
    }

    public void setProdId(String prodId) {
        this.prodId = prodId;
    }

    public Long getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(Long orderNum) {
        this.orderNum = orderNum;
    }
}

SQL语句

<insert id="save">
        INSERT INTO PRODUCT_CONCERNS ( CLIENT_ID, PROD_ID, ORDER_NUM, CREATE_TIME)
        VALUES
            ( #{clientId}, #{prodId}, #{orderNum}, date_format(now(), '%Y%m%d%H%i%s'));
    </insert>

三个值全部都是有的,SQL语句也没有问题,放数据库就能跑,但就是报空指针的错误,即使把参数全都用常量替代,直接放数据库能成功,但这就是报空指针

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

4条回答