根据日期获取某一时间段内的数据

2019-08-19

根据日期时间查询某一时间段的数据可以按照以下操作,仅仅是一个sql语句的问题:

1、mapper.xml层代码

 1 <select id="findTaxDetails" resultType="com.example.pojo.TaxDetails">
 2        select td_tax_date, td_tax_payable, td_detail from tax_details
 3        inner join contractor 
 4        on contractor.ct_id = tax_details.ct_id
 5        where contractor.mobile = #{mobile}
 6        <if test="startDate != null and startDate != ''">    //关键位置
 7        and td_tax_date <![CDATA[>=]]> #{startDate}
 8        </if>
 9        <if test="endDate != null and endDate != ''">
10        and td_tax_date <![CDATA[<=]]> #{endDate}
11        </if>
12     </select>    

2、mapper.java层代码

 1     /**
 2      * 收入查看,根据公司名称或者月份匹配
 3      * @param startDate  查询的开始时间
 4      * @param endDate    查询的结束时间 
5
* @return 6 */ 7 List<IncomeDetails> findIncomeDetails(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("mobile")String mobile, @Param("customerId")Integer customerId);

转载于:https://www.cnblogs.com/H-Dream/p/11380151.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值