start_num = 5 end_num=10(数据库值)
start end(条件)
四种情况:
//1、start = 6 end = 8
#{start} >= start_num and #{end} <= end_num
//2、start = 4 end = 7
#{start} <= start_num and (#{end} between start_num and end_num)
//3、start = 7 end = 9
(#{start} between start_num and end_num) and #{end} <= end_num
//4、start = 3 end = 12
#{start} <= start_num and #{end} >= end_num
组合起来
(
(#{start} >= start_num and #{end} <= end_num)
or (#{start} <= start_num and (#{end} between start_num and end_num))
or ((#{start} between start_num and end_num) and #{end} <= end_num)
or (#{start} <= start_num and #{end} >= valid_date)
)