MyBatis中使用DATE_ADD()函数查询一个月的数据

请注明出处:http://blog.csdn.net/qq_23179075/article/details/79005656

MyBatis中使用DATE_ADD()函数查询一个月的数据

MyBatisMapper.xml 文件中使用 DATE_ADD() 函数查询指定月份的数据,DATE_ADD() 函数的使用方式传送门 ↓↓↓

http://www.w3school.com.cn/sql/func_date_add.asp

MySQL: Mapper.xml

<select id="getByMonth" resultMap="RM">
    SELECT
    <include refid="columns"/>
    FROM
    `idata`
    WHERE
    = #{month, jdbcType=TIMESTAMP}]]>
select>

Oracle: Mapper.xml

<select id="getByMonth" resultMap="RM">
    SELECT
    <include refid="columns"/>
    FROM
    "IDATA"
    WHERE
    = #{month, jdbcType=TIMESTAMP}]]>
select>

Dao类

List getByMonth(@Param("month")Date month);

你可能感兴趣的:(spring学习笔记)