Commit 6f3806c3 authored by jiaorz's avatar jiaorz

Merge branch 'master-vehicle-bg' into dev

parents 689b4731 16d00b54
package com.xxfc.platform.vehicle.pojo;
import lombok.Data;
@Data
public class BranchCompanyVehicleCount {
private String parkBranchCompanyName;
private Integer count;
}
......@@ -1516,7 +1516,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return vehicles.stream().map(Vehicle::getId).collect(Collectors.toList());
}
public List<VehicleExcelVo> getAllVehicleInfo() {
public List<BranchCompanyVehicleCount> getAllVehicleInfo() {
return mapper.getAllVehicleInfo();
}
......
......@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.google.common.collect.Lists;
import com.xxfc.platform.vehicle.entity.Vehicle;
import com.xxfc.platform.vehicle.mapper.VehicleMapper;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCount;
import com.xxfc.platform.vehicle.pojo.ResultVehicleVo;
import com.xxfc.platform.vehicle.pojo.VehicleExcelVo;
import com.xxfc.platform.vehicle.pojo.VehiclePageQueryVo;
......@@ -93,7 +94,7 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
}
public List<VehicleExcelVo> getAllVehicleInfo() {
public List<BranchCompanyVehicleCount> getAllVehicleInfo() {
return vehicleBiz.getAllVehicleInfo();
}
......
......@@ -54,5 +54,5 @@ public interface VehicleMapper extends Mapper<Vehicle> {
@Select("select `id` from `vehicle` where `is_del`=0")
List<String> findExistVehicleIds();
List<VehicleExcelVo> getAllVehicleInfo();
List<BranchCompanyVehicleCount> getAllVehicleInfo();
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import com.github.wxiaoqi.security.common.exception.BaseException;
import com.xxfc.platform.vehicle.biz.VehicleBiz;
import com.xxfc.platform.vehicle.biz.VehicleInformationDownloadBiz;
import com.xxfc.platform.vehicle.common.BaseController;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCount;
import com.xxfc.platform.vehicle.pojo.VehicleExcelVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -70,11 +71,10 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
@GetMapping("/app/unauth/import")
public void exportVehicleInfo() throws Exception {
List<VehicleExcelVo> rows = baseBiz.getAllVehicleInfo();
List<BranchCompanyVehicleCount> rows = baseBiz.getAllVehicleInfo();
ExcelWriter writer = ExcelUtil.getWriter(true);
writer.addHeaderAlias("numberPlate", "车牌号");
writer.addHeaderAlias("code", "车辆编码");
writer.addHeaderAlias("parkBranchCompanyName", "停靠分公司");
writer.addHeaderAlias("count", "车辆数量");
// 一次性写出内容,使用默认样式,强制输出标题
writer.write(rows, true);
//response为HttpServletResponse对象
......
......@@ -591,10 +591,18 @@
</select>
<!--导出分公司停靠所有车辆-->
<select id="getAllVehicleInfo" resultType="com.xxfc.platform.vehicle.pojo.VehicleExcelVo">
select b1.name as parkBranchCompanyName, v1.number_plate as numberPlate, v1.code as code from branch_company b1
left join vehicle v1 on v1.park_branch_company_id = b1.id
where b1.is_del = 0 and v1.is_del = 0
<select id="getAllVehicleInfo" resultType="com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCount">
SELECT
b1. NAME AS parkBranchCompanyName,
count(v1.id) as count
FROM
branch_company b1
LEFT JOIN vehicle v1 ON v1.park_branch_company_id = b1.id
WHERE
b1.is_del = 0
AND v1.is_del = 0
GROUP BY b1.`name`
order by b1.`name`
</select>
<select id="lockByCode" resultType="com.xxfc.platform.vehicle.entity.Vehicle"
......
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