select timestamp(date_add(curdate(), interval - day(curdate()) + 1 day))
当月0点时间:2015-12-01 00:00:00
select timestamp(date_add(NOW(), interval - day(NOW()) + 1 day))
当月1号时间:2015-12-01 10:45:22
select date_add(curdate(), interval - day(curdate()) + 1 day)
2015-12-01
<!-- 查询上月债权额度 -->
<select id="getLastMonthSubCreditAmount" parameterType="int" resultType="java.math.BigDecimal">
<![CDATA[SELECT COUNT(si.subCreditAmount) FROM subcredit_info si
INNER JOIN order_info oi ON si.subCreditId = oi.subCreditId
WHERE
si.`addTime` < TIMESTAMP (
date_add(
curdate(),
INTERVAL - DAY (curdate()) + 1 DAY
)
)
AND oi.`status` > 5
AND year(si.interestEndDate)<=year(now())
AND month(si.interestEndDate)<(month(now())-1)
AND si.companyId = #{companyId} ]]>
</select>