Commit 74eeec93 authored by hanfeng's avatar hanfeng

修改车型列表

parent 275710c2
......@@ -42,11 +42,11 @@ public class VehicleModelVo extends VehicleModel implements Serializable {
private String config;
@Column(name = "number")
@ApiModelProperty(value = "乘卧数")
@ApiModelProperty(value = "乘卧数id")
private String number;
@Column(name = "brand")
@ApiModelProperty(value = "品牌")
@ApiModelProperty(value = "品牌id")
private String brand;
//关键标签,code逗号分割
......@@ -158,4 +158,14 @@ public class VehicleModelVo extends VehicleModel implements Serializable {
@ApiModelProperty(value = "车辆")
private Vehicle vehicle;
@Column(name = "numberName")
@ApiModelProperty(value = "乘卧数")
private String numberName;
@Column(name = "brandName")
@ApiModelProperty(value = "品牌")
private String brandName;
}
......@@ -12,6 +12,7 @@ import com.xxfc.platform.vehicle.mapper.VehicleModelMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.List;
import java.util.stream.Collectors;
/**
* 车型
......@@ -41,7 +42,7 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper, VehicleModel> {
try {
PageDataVO<VehicleModel> mPageDataVO = PageDataVO.pageInfo(vmqc.getPage(),
PageDataVO<VehicleModelVo> mPageDataVO = PageDataVO.pageInfo(vmqc.getPage(),
vmqc.getLimit(), () -> mapper.findVehicleModelPage(vmqc));
return ObjectRestResponse.succ(mPageDataVO);
......
......@@ -172,6 +172,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
VehicleCata vc = new VehicleCata();
vc.setVehicleModelId(vmId);
vc.setCataId(Integer.parseInt(con));
vc.setCrtTime(System.currentTimeMillis());
vcs.add(vc);
}
......@@ -179,6 +180,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
return ObjectRestResponse.succ();
} catch (NumberFormatException e) {
e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
throw new BaseException(ResultCode.FAILED_CODE);
}
......@@ -266,6 +268,10 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
// ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "该车型,无法删除");
// }
if (id==1||id==14) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"The label cannot be deleted");
}
//2.进行逻辑删除
VehicleModel vm = new VehicleModel();
vm.setId(id);
......
......@@ -17,7 +17,8 @@
<resultMap id="searchModel" type="com.xxfc.platform.vehicle.pojo.VehicleAndModelInfoVo">
<association property="vehicleModel" column="model_id"
select="com.xxfc.platform.vehicle.mapper.VehicleModelMapper.selectByPrimaryKey"/>
<association property="vehicleBookRecord" column="id" select="com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper.getByVehicleId" />
<association property="vehicleBookRecord" column="id"
select="com.xxfc.platform.vehicle.mapper.VehicleBookRecordMapper.getByVehicleId"/>
</resultMap>
<update id="updateStatusById" parameterType="java.util.Map">
......@@ -108,6 +109,11 @@
<if test="useType !=null">
and v.use_type = #{useType}
</if>
-- 添加所属大区搜索条件
<if test="zoneId !=null">
and bc.zone_id=#{zoneId}
</if>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<if test=" yearMonthAndParam !=null ">
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation">
......@@ -217,6 +223,10 @@
<if test="useType !=null">
and v.use_type = #{useType}
</if>
-- 添加所属大区搜索条件
<if test="zoneId !=null">
and bc.zone_id=#{zoneId}
</if>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<if test=" yearMonthAndParam !=null ">
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation">
......@@ -310,7 +320,7 @@
</if>
</select>
<select id="getAllVehicle" parameterType="java.util.Map" resultMap="searchModel">
select *
select *
from vehicle v1
<where>
<if test="startTime != null">
......@@ -333,30 +343,30 @@
<select id="countVehicleByParam" parameterType="com.xxfc.platform.vehicle.pojo.dto.VehiclePlanDto"
resultType="com.xxfc.platform.vehicle.pojo.VehicleCountVo">
SELECT count(*) total ,
CASE
WHEN travel_status = 1 THEN
'1'
WHEN travel_status = 2 THEN
'2'
WHEN travel_status = 3 THEN
'3'
WHEN travel_status = 4 THEN
'4'
ELSE
'-1'
END travel_status,
CASE
WHEN travel_status = 1 THEN
'出行中'
WHEN travel_status = 2 THEN
'预约中'
WHEN travel_status = 3 THEN
'空闲中'
WHEN travel_status = 4 THEN
'保养中'
ELSE
'不可用'
END detail
CASE
WHEN travel_status = 1 THEN
'1'
WHEN travel_status = 2 THEN
'2'
WHEN travel_status = 3 THEN
'3'
WHEN travel_status = 4 THEN
'4'
ELSE
'-1'
END travel_status,
CASE
WHEN travel_status = 1 THEN
'出行中'
WHEN travel_status = 2 THEN
'预约中'
WHEN travel_status = 3 THEN
'空闲中'
WHEN travel_status = 4 THEN
'保养中'
ELSE
'不可用'
END detail
from vehicle v1
<where>
<if test="startTime != null">
......@@ -377,7 +387,7 @@
</where>
GROUP BY travel_status
union all
SELECT count(*) total, '0' travel_status, '总数' detail from vehicle v2
SELECT count(*) total, '0' travel_status, '总数' detail from vehicle v2
<where>
<if test="startTime != null">
and v2.create_time between #{startTime} and #{endTime}
......@@ -396,23 +406,23 @@
</if>
</where>
union all
SELECT count(*) total,
CASE
WHEN status = 1 THEN
'5'
WHEN status = 2 THEN
'6'
ELSE
'7'
END travel_status,
CASE
WHEN status = 1 THEN
'正常运行'
WHEN status = 2 THEN
'维修'
ELSE
'报废'
END travel_status
SELECT count(*) total,
CASE
WHEN status = 1 THEN
'5'
WHEN status = 2 THEN
'6'
ELSE
'7'
END travel_status,
CASE
WHEN status = 1 THEN
'正常运行'
WHEN status = 2 THEN
'维修'
ELSE
'报废'
END travel_status
FROM vehicle v3
<where>
<if test="startTime != null">
......
......@@ -4,11 +4,15 @@
<select id="findVehicleModelPage" parameterType="com.xxfc.platform.vehicle.pojo.VehicleModelQueryCondition"
resultType="com.xxfc.platform.vehicle.pojo.VehicleModelVo">
SELECT * from
(select vm.*,v.sum,v2.leasableQuantity from vehicle_model vm left JOIN
(select vm.*,v.sum,v2.leasableQuantity,vpc.`name` brandName,vpc2.name numberName from vehicle_model vm left JOIN
(select model_id as mid, count(1) as sum FROM vehicle GROUP BY mid) v
on vm.id=v.mid left JOIN
(select model_id as mid2, count(1) as leasableQuantity FROM vehicle where`use_type`=1 GROUP BY model_id) v2
on v.mid=v2.mid2 ) vmqc WHERE 1=1
on v.mid=v2.mid2
left join (SELECT id,name FROM vehicle_plat_cata where state=0) vpc on vm.brand=vpc.id
left join (SELECT id,name FROM vehicle_plat_cata where state=0) vpc2 on vm.number=vpc2.id
where isdel = 0
) vmqc WHERE 1=1
<if test="isDel !=null ">
and isdel=#{isDel}
......
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