1. 程式人生 > 實用技巧 >springcloud根據日期區間查詢同時其他欄位模糊查詢

springcloud根據日期區間查詢同時其他欄位模糊查詢

/**
	 * 分頁查詢完工送檢單
	 * @param entity
	 * @param query
	 * @return
	 */
	@GetMapping("getQcProInsAppOverList")
	public R<IPage<QcProInsAppOverVO>> getQcProInsAppOverList(@ApiIgnore @RequestParam Map<String, Object> entity, Query query){
		log.info("分頁查詢完工送檢單entity======"+entity);
		QueryWrapper<QcProInsAppOver> queryWrapper=Condition.getQueryWrapper(entity,QcProInsAppOver.class).orderByDesc("id");
		if(entity.containsKey("startDateTime")&&entity.containsKey("endDateTime") && Func.isNotEmpty(entity.get("startDateTime"))&&Func.isNotEmpty(entity.get("endDateTime"))){
			Map<String,Object>map=new HashMap<>();
			map.putAll(entity);
			map.remove("startDateTime");
			map.remove("endDateTime");
			map.remove("current");
			map.remove("size");
			queryWrapper=Condition.getQueryWrapper(map, QcProInsAppOver.class).orderByDesc("id").between("create_date",entity.get("startDateTime"),entity.get("endDateTime"));
		}
		IPage<QcProInsAppOver> pages = qcProInsAppOverService.page(Condition.getPage(query),queryWrapper);
		return R.data(QcProInsAppOverWrapper.build().pageVO(pages));
	}