Commit 0415c4b3 authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/dev' into dev

parents f49c021d a0de74b0
......@@ -35,8 +35,9 @@ public class CompanyPerformanceBo {
private BigDecimal extralAmount;
private Integer departureNum;
private Integer arrivalNum;
private Date startDate;
private Date endDate;
private String startDate;
private String endDate;
private String dateStr;
public BigDecimal getMemberAmount() {
return memberAmount==null?BigDecimal.ZERO:memberAmount;
......
......@@ -32,4 +32,15 @@ public class CompanyPerformanceFindDTO extends PageParam {
private String companyName;
private Integer companyId;
private long startIndex;
private long endInex;
public long getStartIndex() {
return getPage()==null?0:getPage()==0?0:(getPage()-1)*getLimit();
}
public long getEndInex() {
return getLimit()==null?20:getLimit()==0?20:(getStartIndex()+getLimit());
}
}
......@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.order.bo.CompanyPerformanceBo;
import com.xxfc.platform.order.contant.enumerate.ReceivedStatisticsEnum;
import com.xxfc.platform.order.entity.OrderReceivedStatistics;
import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.RequiredArgsConstructor;
......@@ -43,8 +44,7 @@ public class CompanyPerformanceBiz {
*/
public void exportOrderReceivedStatisticsData(CompanyPerformanceFindDTO companyPerformanceFindDTO, ServletOutputStream outputStream) throws IOException {
//1.查询数据
PageDataVO<CompanyPerformanceBo> pageDataVO = selectCompanyPerformancePage(companyPerformanceFindDTO);
List<CompanyPerformanceBo> data = pageDataVO.getData();
List<CompanyPerformanceBo> companyPerformanceBos = selectCompanyPerformances(companyPerformanceFindDTO);
//excel相关
XSSFWorkbook hssfWorkbook = new XSSFWorkbook();
......@@ -58,7 +58,7 @@ public class CompanyPerformanceBiz {
}
//设置数据
CellStyle generalCellStyle = createGeneralCellStyle(hssfWorkbook);
List<String[]> companyStatisticsData = getCompanyStatisticsData(data, companyPerformanceFindDTO.getStatisticalWay());
List<String[]> companyStatisticsData = getCompanyStatisticsData(companyPerformanceBos, companyPerformanceFindDTO.getStatisticalWay());
createCompnayStatisticsCellData(sheet, 1, generalCellStyle, companyStatisticsData);
hssfWorkbook.write(outputStream);
hssfWorkbook.close();
......@@ -93,15 +93,13 @@ public class CompanyPerformanceBiz {
private String[] getData(CompanyPerformanceBo companyPerformanceBo, Integer statisticalWay) {
String dateStr = "";
if (statisticalWay == ReceivedStatisticsEnum.DAY.getWayCode()) {
dateStr = DateUtil.format(companyPerformanceBo.getDate(),"yyyy.MM.dd");
dateStr = companyPerformanceBo.getDateStr();
}
if (statisticalWay == ReceivedStatisticsEnum.WEEK.getWayCode()) {
String startDateStr = DateUtil.format(companyPerformanceBo.getStartDate(), "yyyy.MM.dd");
String endDateStr = DateUtil.format(companyPerformanceBo.getEndDate(), "yyyy.MM.dd");
dateStr=String.format("%s~%s",startDateStr,endDateStr);
dateStr=String.format("%s~%s",companyPerformanceBo.getStartDate(),companyPerformanceBo.getEndDate());
}
if (statisticalWay == ReceivedStatisticsEnum.MONTH.getWayCode()) {
dateStr = String.format("%d.%s",companyPerformanceBo.getYear(),companyPerformanceBo.getMonth().replace(companyPerformanceBo.getYear()+"",""));
dateStr = companyPerformanceBo.getMonth();
}
return new String[]{
dateStr,
......@@ -151,6 +149,32 @@ public class CompanyPerformanceBiz {
return font;
}
public List<CompanyPerformanceBo> selectCompanyPerformances(CompanyPerformanceFindDTO companyPerformanceFindDTO){
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
List<CompanyPerformanceBo> companyPerformanceBos = new ArrayList<>();
//日统计
if (companyPerformanceFindDTO.getStatisticalWay() == ReceivedStatisticsEnum.DAY.getWayCode()) {
companyPerformanceBos = orderReceivedStatisticsBiz.selectCompanyPerformanceWithDay(companyPerformanceFindDTO);
}
//按周
if (companyPerformanceFindDTO.getStatisticalWay() == ReceivedStatisticsEnum.WEEK.getWayCode()) {
companyPerformanceBos = orderReceivedStatisticsBiz.selectCompanyPerformanceWithWeek(companyPerformanceFindDTO);
}
//按月
if (companyPerformanceFindDTO.getStatisticalWay() == ReceivedStatisticsEnum.MONTH.getWayCode()) {
companyPerformanceBos = orderReceivedStatisticsBiz.selectCompanyPerformanceWithMonth(companyPerformanceFindDTO);
}
if (CollectionUtils.isEmpty(companyPerformanceBos)) {
return companyPerformanceBos;
}
companyPerformanceBos = wrapCompanyPermanceBo(companyPerformanceBos, companyMap, companyPerformanceFindDTO.getStatisticalWay());
return companyPerformanceBos;
}
/**
* 分页查询公司业绩
*
......@@ -179,10 +203,28 @@ public class CompanyPerformanceBiz {
if (CollectionUtils.isEmpty(data)) {
return pageDataVO;
}
for (CompanyPerformanceBo companyPerformanceBo : data) {
List<CompanyPerformanceBo> companyPerformanceBos = wrapCompanyPermanceBo(data, companyMap, companyPerformanceFindDTO.getStatisticalWay());
pageDataVO.setData(companyPerformanceBos);
if (companyPerformanceFindDTO.getPage() == 1) {
OrderReceivedStatistics orderReceivedStatistics = new OrderReceivedStatistics();
if (Objects.nonNull(companyPerformanceFindDTO.getCompanyId())) {
orderReceivedStatistics.setCompanyId(companyPerformanceFindDTO.getCompanyId());
}
Long totlCount = orderReceivedStatisticsBiz.selectCount(orderReceivedStatistics);
long isZero = totlCount % companyPerformanceFindDTO.getLimit();
long totalPage = isZero == 0 ? totlCount / companyPerformanceFindDTO.getLimit() : totlCount / companyPerformanceFindDTO.getLimit() + 1;
pageDataVO.setTotalCount(totlCount);
pageDataVO.setTotalPage(Integer.valueOf(String.valueOf(totalPage)));
}
return pageDataVO;
}
public List<CompanyPerformanceBo> wrapCompanyPermanceBo(List<CompanyPerformanceBo> companyPerformanceBos,Map<Integer,String> companyMap,Integer statisticsWay){
for (CompanyPerformanceBo companyPerformanceBo : companyPerformanceBos) {
String companyName = companyMap == null ? "" : companyMap.get(companyPerformanceBo.getCompanyId());
companyPerformanceBo.setCompanyName(companyName);
if (companyPerformanceFindDTO.getStatisticalWay() == ReceivedStatisticsEnum.WEEK.getWayCode()) {
if (statisticsWay == ReceivedStatisticsEnum.WEEK.getWayCode()) {
Calendar cal = Calendar.getInstance();
cal.setFirstDayOfWeek(Calendar.MONDAY);
cal.set(Calendar.YEAR, companyPerformanceBo.getYear());
......@@ -191,11 +233,19 @@ public class CompanyPerformanceBiz {
Date startDate = cal.getTime();
cal.add(Calendar.DAY_OF_WEEK, 6);
Date endDate = cal.getTime();
companyPerformanceBo.setStartDate(DateUtil.beginOfDay(startDate));
companyPerformanceBo.setEndDate(DateUtil.beginOfDay(endDate));
companyPerformanceBo.setStartDate(DateUtil.format(startDate,"yyyy.MM.dd"));
companyPerformanceBo.setEndDate(DateUtil.format(endDate,"yyyy.MM.dd"));
companyPerformanceBo.setWeekOfYear(String.format("%s.%s",companyPerformanceBo.getYear()+"",companyPerformanceBo.getWeekOfYear().replace(companyPerformanceBo.getYear()+"","")));
}
if(statisticsWay == ReceivedStatisticsEnum.DAY.getWayCode()) {
companyPerformanceBo.setDateStr(DateUtil.format(companyPerformanceBo.getDate(),"yyyy.MM.dd"));
}
if (statisticsWay == ReceivedStatisticsEnum.MONTH.getWayCode()){
companyPerformanceBo.setMonth(String.format("%s.%s",companyPerformanceBo.getYear()+"",companyPerformanceBo.getMonth().replace(companyPerformanceBo.getYear()+"","")));
}
}
return pageDataVO;
return companyPerformanceBos;
}
}
......@@ -60,8 +60,17 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
* @return
*/
public PageDataVO<CompanyPerformanceBo> selectCompanyPerformanceWithDayPage(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(),
() -> mapper.selectCompanyPerformanceWithDay(companyPerformanceFindDTO));
List<CompanyPerformanceBo> companyPerformanceBos = mapper.selectCompanyPerformanceWithDay(companyPerformanceFindDTO);
PageDataVO<CompanyPerformanceBo> pageDataVO = new PageDataVO<>();
pageDataVO.setData(companyPerformanceBos);
return pageDataVO;
/* return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(),
() -> mapper.selectCompanyPerformanceWithDay(companyPerformanceFindDTO));*/
}
public List<CompanyPerformanceBo> selectCompanyPerformanceWithDay(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
List<CompanyPerformanceBo> companyPerformanceBos = mapper.selectCompanyPerformanceWithDay(companyPerformanceFindDTO);
return CollectionUtils.isEmpty(companyPerformanceBos)?Collections.EMPTY_LIST:companyPerformanceBos;
}
/**
......@@ -71,10 +80,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
* @return
*/
public PageDataVO<CompanyPerformanceBo> selectCompanyPerformanceWithMonthPage(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(),
() -> mapper.selectCompanyPerformanceWithMonth(companyPerformanceFindDTO));
/* return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(),
() -> mapper.selectCompanyPerformanceWithMonth(companyPerformanceFindDTO));*/
List<CompanyPerformanceBo> companyPerformanceBos = mapper.selectCompanyPerformanceWithMonth(companyPerformanceFindDTO);
PageDataVO<CompanyPerformanceBo> pageDataVO = new PageDataVO<>();
pageDataVO.setData(companyPerformanceBos);
return pageDataVO;
}
public List<CompanyPerformanceBo> selectCompanyPerformanceWithMonth(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
List<CompanyPerformanceBo> companyPerformanceBos = mapper.selectCompanyPerformanceWithMonth(companyPerformanceFindDTO);
return CollectionUtils.isEmpty(companyPerformanceBos)?Collections.EMPTY_LIST:companyPerformanceBos;
}
/**
* 公司业绩(按周统计)
*
......@@ -82,11 +99,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
* @return
*/
public PageDataVO<CompanyPerformanceBo> selectCompanyPerformanceWithWeekPage(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(),
() -> mapper.selectCompanyPerformanceWithWeek(companyPerformanceFindDTO));
/*return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(),
() -> mapper.selectCompanyPerformanceWithWeek(companyPerformanceFindDTO));*/
List<CompanyPerformanceBo> companyPerformanceBos = mapper.selectCompanyPerformanceWithWeek(companyPerformanceFindDTO);
PageDataVO<CompanyPerformanceBo> pageDataVO = new PageDataVO<>();
pageDataVO.setData(companyPerformanceBos);
return pageDataVO;
}
public List<CompanyPerformanceBo> selectCompanyPerformanceWithWeek(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
List<CompanyPerformanceBo> companyPerformanceBos = mapper.selectCompanyPerformanceWithWeek(companyPerformanceFindDTO);
return CollectionUtils.isEmpty(companyPerformanceBos)?Collections.EMPTY_LIST:companyPerformanceBos;
}
/**
* 订单统计数据导出
*
......
......@@ -101,7 +101,7 @@ public class OrderViolationBiz extends BaseBiz<OrderViolationMapper, OrderViolat
String filePath = ovUpload + realFileRelPath;
// FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return ObjectRestResponse.succ(filePath);
}
......
......@@ -103,6 +103,7 @@
`company_id` ,
`year`,
`date`
limit #{startIndex},#{endInex}
) AS `ors`
LEFT JOIN (
SELECT
......@@ -134,8 +135,10 @@
`company_id`,
`count_year`,
`count_date`
limit #{startIndex},#{endInex}
) AS `ovss` ON ovss.cyid = ors.companyId
AND ovss.count_date = ors.date
<!-- order by ors.rentVehilceAmount desc,ors.memberAmount desc,ors.travelAmount desc,ors.depositAmount desc,ors.noDeductibleAmount desc ,rentDays desc,departureNum desc, arrivalNum desc-->
</select>
<!--按月统计-->
......@@ -184,6 +187,7 @@
company_id,
`year`,
`month`
limit #{startIndex},#{endInex}
) AS `ors`
LEFT JOIN (
SELECT
......@@ -215,8 +219,10 @@
`company_id`,
`count_year`,
`count_month`
limit #{startIndex},#{endInex}
) AS `ovss` ON ovss.cyid = ors.companyId
AND ovss.count_month = ors.month
<!--order by ors.rentVehilceAmount desc,ors.memberAmount desc,ors.travelAmount desc,ors.depositAmount desc,ors.noDeductibleAmount desc ,rentDays desc,departureNum desc, arrivalNum desc-->
</select>
<!--按周统计-->
......@@ -264,6 +270,7 @@
company_id,
`year`,
`week_of_year`
limit #{startIndex},#{endInex}
) AS `ors`
LEFT JOIN (
SELECT
......@@ -296,8 +303,10 @@
`company_id`,
`count_year`,
`count_week`
limit #{startIndex},#{endInex}
) AS `ovss` ON ovss.cyid = ors.companyId
AND ovss.count_week = ors.weekOfYear
<!-- order by ors.rentVehilceAmount desc,ors.memberAmount desc,ors.travelAmount desc,ors.depositAmount desc,ors.noDeductibleAmount desc ,rentDays desc,departureNum desc, arrivalNum desc-->
</select>
</mapper>
\ No newline at end of file
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import com.xxfc.platform.order.OrderApplication;
import com.xxfc.platform.order.biz.*;
......@@ -15,6 +16,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Map;
......@@ -123,6 +126,17 @@ public class ServiceTest {
@Test
@SneakyThrows
public void testOrderReceivedStatisticsJobHandler(){
orderReceivedStatisticsJobHandler.execute("");
cn.hutool.core.date.DateTime dateTime = DateUtil.parse("2019-10-01", "yyyy-MM-dd");
cn.hutool.core.date.DateTime offset = DateUtil.offset(dateTime, DateField.DAY_OF_MONTH, 1);
LocalDate startLocalDate = LocalDate.of(2019, 10, 1);
LocalDate endLocalDate = LocalDate.of(2019,11,29);
while (startLocalDate.isBefore(endLocalDate)){
String dateStr = startLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
startLocalDate = startLocalDate.plusDays(1);
orderReceivedStatisticsJobHandler.execute(dateStr);
}
}
}
......@@ -101,4 +101,6 @@ public class VehicleDepartureLog {
String departureRemark;
String arrivalRemark;
}
......@@ -32,4 +32,32 @@ public class DepartureLogVo extends VehicleDepartureLog {
*/
private String numberPlate;
/**
* 接受公司
*/
private String arrivalName;
/**
* 出车公司
*/
private String departureName;
/**
* 公里数统计
*/
private Integer mileage;
/**
* 时间天数统计
*/
private String departureDay;
/**
* 内部用途备注
*/
private String remark;
}
......@@ -86,17 +86,23 @@
</select>
<select id="selectVoAll" resultMap="searchBookRecord">
select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date,
/* IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天',
IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
- unix_timestamp(vehicle_departure_log.departure_time)) MOD 86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date,bc2.remark,
IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0),
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天',
IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
- unix_timestamp(vehicle_departure_log.departure_time)) MOD
86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
as departureDay,bc.name as departureName,bc1.name as arrivalName,
IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0) as mileage
IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0)
as mileage
from vehicle_departure_log
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id
LEFT JOIN branch_company bc ON vehicle_departure_log.departure_branch_company_id = bc.id
LEFT JOIN branch_company bc1 ON vehicle_departure_log.arrival_branch_company_id = bc1.id
LEFT JOIN vehicle_book_record bc2 ON vehicle_departure_log.book_record_id = bc2.id
<trim prefix="where">
1=1
<if test="numberPlate != null and numberPlate != ''">
......@@ -107,32 +113,44 @@
vehicle_departure_log.departure_time &gt;= str_to_date(#{startTime}, '%Y-%m-%d %H')
</if>
<if test="endTime != null and endTime != ''">
and vehicle_departure_log.arrival_time &gt;= str_to_date(#{endTime}, '%Y-%m-%d %H')
and vehicle_departure_log.arrival_time &gt;= str_to_date(#{endTime}, '%Y-%m-%d %H')
</if>
<if test="code!=null">
and vehicle.code=#{code}
and vehicle.code=#{code}
</if>
<if test="zoneId!=null">
and bc.zone_id=#{zoneId}
and bc.zone_id=#{zoneId}
</if>
<if test="departureId!=null">
and vehicle_departure_log.departure_branch_company_id=#{departureId}
and vehicle_departure_log.departure_branch_company_id=#{departureId}
</if>
<if test="use!=null">
and bc2.book_type=#{use}
</if>
<if test="arrivalBranchCompanyId!=null">
and vehicle_departure_log.arrival_branch_company_id=#{arrivalBranchCompanyId}
</if>
</trim>
order by create_time desc
</select>
<select id="selectVoAllNotAllData" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo">
select vehicle_departure_log.*,vehicle.number_plate,
/*IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天',
IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
- unix_timestamp(vehicle_departure_log.departure_time)) MOD 86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
<select id="selectVoAllNotAllData" resultMap="searchBookRecord">
select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date,bc2.remark,
IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0),
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天',
IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
- unix_timestamp(vehicle_departure_log.departure_time)) MOD
86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
as departureDay,bc.name as departureName,bc1.name as arrivalName,
IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0) as mileage
IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0)
as mileage
from vehicle_departure_log
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id
LEFT JOIN branch_company bc ON vehicle_departure_log.departure_branch_company_id = bc.id
LEFT JOIN branch_company bc1 ON vehicle_departure_log.arrival_branch_company_id = bc1.id
LEFT JOIN vehicle_book_record bc2 ON vehicle_departure_log.book_record_id = bc2.id
<trim prefix="where" suffixOverrides="and">
<if test="numberPlate != null and numberPlate != ''">
vehicle.number_plate = #{numberPlate} and
......@@ -162,18 +180,24 @@
</if>
<if test="endTime != null and endTime != ''">
and vehicle_departure_log.arrival_time >= str_to_date(#{endTime}, '%Y-%m-%d %H')
and vehicle_departure_log.arrival_time >= str_to_date(#{endTime}, '%Y-%m-%d %H')
or TO_DAYS(vehicle_departure_log.arrival_time)=TO_DAYS(str_to_date(#{endTime}, '%Y-%m-%d %H'))
or vehicle_departure_log.arrival_time is null
</if>
<if test="code!=null">
and vehicle.code=#{code}
and vehicle.code=#{code}
</if>
<if test="zoneId!=null">
and bc.zone_id=#{zoneId}
and bc.zone_id=#{zoneId}
</if>
<if test="departureId!=null">
and vehicle_departure_log.departure_branch_company_id=#{departureId}
and vehicle_departure_log.departure_branch_company_id=#{departureId}
</if>
<if test="use!=null">
and bc2.book_type=#{use}
</if>
<if test="arrivalBranchCompanyId!=null">
and vehicle_departure_log.arrival_branch_company_id=#{arrivalBranchCompanyId}
</if>
</trim>
order by create_time desc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment