征求意见-查询出来的数据跟数据的查询条件不符合(已解决)
This commit is contained in:
+2
-2
@@ -56,7 +56,7 @@ public class SarPublicIdeaController extends BaseController<SarPublicIdea> {
|
||||
startdate = formater.parse(start);
|
||||
}
|
||||
if (end!=null){
|
||||
enddate=formater.parse(DateUtil.addOneDay(end));
|
||||
enddate=formater.parse(end);
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
@@ -83,7 +83,7 @@ public class SarPublicIdeaController extends BaseController<SarPublicIdea> {
|
||||
//
|
||||
Calendar c2 = Calendar.getInstance();
|
||||
c2.setTime(sarPublicIdea.getEndTime());
|
||||
c2.add(Calendar.DAY_OF_MONTH, 1);// 今天+1天
|
||||
c2.add(Calendar.DAY_OF_MONTH, 0);// 今天+1天
|
||||
sarPublicIdea.setEndTime(c2.getTime());
|
||||
|
||||
sarPublicIdeaService.save(sarPublicIdea);
|
||||
|
||||
+28
-4
@@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@@ -50,6 +51,21 @@ public class SarPublicIdeaServiceImpl extends ServiceImpl<SarPublicIdeaDao, SarP
|
||||
if (start!=null && end !=null){
|
||||
String date1 = (new SimpleDateFormat("yyyy-MM-dd")).format(start);
|
||||
String date2 = (new SimpleDateFormat("yyyy-MM-dd")).format(end);
|
||||
|
||||
// Date classDate = null;
|
||||
// try {
|
||||
// classDate = new SimpleDateFormat("yyyy-MM-dd").parse(date3);
|
||||
// Calendar calendar = Calendar.getInstance(); //使用Calendar日历类对日期进行加减
|
||||
// calendar.setTime(classDate);
|
||||
// calendar.add(Calendar.DAY_OF_MONTH, - 1);
|
||||
// classDate = calendar.getTime();//获取加减以后的Date类型日期
|
||||
//
|
||||
// } catch (ParseException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// ;//把字符串转化成指定格式的日期
|
||||
// String date2 =(new SimpleDateFormat("yyyy-MM-dd")).format(classDate);
|
||||
|
||||
list.like(StringUtils.isNotEmpty(category), "category", category)
|
||||
.like(StringUtils.isNotEmpty(cname), "cid", cname)
|
||||
.ge(start != null, "start_time", date1)
|
||||
@@ -59,15 +75,23 @@ public class SarPublicIdeaServiceImpl extends ServiceImpl<SarPublicIdeaDao, SarP
|
||||
String date1 = (new SimpleDateFormat("yyyy-MM-dd")).format(start);
|
||||
list.like(StringUtils.isNotEmpty(category), "category", category)
|
||||
.like(StringUtils.isNotEmpty(cname), "cid", cname)
|
||||
.le(start != null, "start_time", date1)
|
||||
.ge(start != null, "end_time", date1)
|
||||
// .le(start != null, "start_time", date1)
|
||||
// .ge(start != null, "end_time", date1)
|
||||
|
||||
.ge(start != null, "start_time", date1)
|
||||
// .le(start != null, "end_time", date1)
|
||||
|
||||
.orderByDesc("start_time");
|
||||
}else if (end!=null){
|
||||
String date2 = (new SimpleDateFormat("yyyy-MM-dd")).format(end);
|
||||
list.like(StringUtils.isNotEmpty(category), "category", category)
|
||||
.like(StringUtils.isNotEmpty(cname), "cid", cname)
|
||||
.le(end != null, "start_time", date2)
|
||||
.ge(end != null, "end_time", date2)
|
||||
// .le(end != null, "start_time", date2)
|
||||
// .ge(end != null, "end_time", date2)
|
||||
|
||||
.le(end != null, "end_time", date2)
|
||||
// .ge(end != null, "end_time", date2)
|
||||
|
||||
.orderByDesc("start_time");
|
||||
}else {
|
||||
list.like(StringUtils.isNotEmpty(category), "category", category)
|
||||
|
||||
Reference in New Issue
Block a user