Commit 74eeec93 authored by hanfeng's avatar hanfeng

修改车型列表

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