亲宝软件园·资讯

展开

Vue开始时间和结束时间的范围查询 Vue实现开始时间和结束时间范围查询

impl柴猿滚滚 人气:0
想了解Vue实现开始时间和结束时间范围查询的相关内容吗,impl柴猿滚滚在本文为您仔细讲解Vue开始时间和结束时间的范围查询的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:vue开始结束时间范围查询,vue时间范围查询,vue开始结束时间查询,下面大家一起来学习吧。

效果图:

代码实现:

OrderList.Vue

<a-col :xl="6" :lg="7" :md="8" :sm="24">
 <a-form-item label="下单日期">
  <a-range-picker size="large" format="YYYY-MM-DD" @change="onDateChange" />
 </a-form-item>
</a-col>
methods: {
 onDateChange(date, dateString) {
        console.log(dateString[0])
        console.log(dateString[1])
        this.beginDate = dateString[0]
        this.finishDate = dateString[1]
     }
}

OrderConntroller.java

 /**
     * 分页列表查询
     *
     * @param order
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @AutoLog(value = "订单-分页列表查询")
    @ApiOperation(value = "订单-分页列表查询", notes = "订单-分页列表查询")
    @GetMapping(value = "/list")
    public Result<?> queryPageList(Order order,
                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                   HttpServletRequest req) {
        QueryWrapper<Order> queryWrapper = QueryGenerator.initQueryWrapper(order, req.getParameterMap());
        if(req.getParameterMap().get("beginDate") !=null){
            String beginDate = req.getParameterMap().get("beginDate")[0];
            String finishDate = req.getParameterMap().get("finishDate")[0];
            if (!StringUtils.isEmpty(beginDate) || StringUtils.isEmpty(finishDate)) {
                DateTime beginOfDay = DateUtil.beginOfDay(DateUtil.parse(beginDate));
                DateTime endOfDay = DateUtil.endOfDay(DateUtil.parse(finishDate));
                queryWrapper.ge("create_time", beginOfDay).le("create_time", endOfDay);
            }
        }
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        Set<String> roles = sysUserService.getUserRolesSet(sysUser.getUsername());
        if(!roles.contains("admin")){
            queryWrapper.eq("user_name",sysUser.getUsername());
        }
        Page<Order> page = new Page<Order>(pageNo, pageSize);
        IPage<Order> pageList = orderService.page(page, queryWrapper);
        return Result.ok(pageList);
    }

加载全部内容

相关教程
猜你喜欢
用户评论