炫意html5
最早CSS3和HTML5移动技术网站之一

求大神解答mybatis里的SQL语句BUG

<select resultType=”com.ph.entity.ext.Line”>
SELECT
CONVERT(p.create_date,DATE) ‘dateTime’,
SUM(p.poundage_cny) ‘countCNY’,
SUM(p.poundage_bsc) ‘countBSC’
FROM
pa_performance p,
pa_referral_code c
WHERE
p.referral_id = c.id AND
DATE_FORMAT(p.create_date, ‘%Y-%m’) = DATE_FORMAT(NOW(), ‘%Y-%m’) AND
c.partner_code = #{partnerCode} AND
c.agent_code = #{agentCode}
GROUP BY
TO_DAYS(p.create_date)
ORDER BY
TO_DAYS(p.create_date) ASC
</select>

要返回的实体类:

public class Line {

private Date dateTime;
private BigDecimal countBSC;
private BigDecimal countCNY;

public Date getDateTime() {
return dateTime;
}
public void setDateTime(Date dateTime) {
this.dateTime = dateTime;
}
public BigDecimal getCountBSC() {
return countBSC;
}
public void setCountBSC(BigDecimal countBSC) {
this.countBSC = countBSC;
}
public BigDecimal getCountCNY() {
return countCNY;
}
public void setCountCNY(BigDecimal countCNY) {
this.countCNY = countCNY;
}

}

 

数据库里create_date字段是datetime属性,请大神帮忙解答

回答

报什么错误贴出来啊,那个时间类型你可以使用String来接收,要不然就是数据库要和属性对应上.

炫意HTML5 » 求大神解答mybatis里的SQL语句BUG

Java基础教程Android基础教程