Commit c22fbd38 authored by hanfeng's avatar hanfeng

修改车型管理

parent c51f9687
......@@ -109,4 +109,5 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
}
}
......@@ -138,6 +138,12 @@ public class Vehicle {
/**
* 车型id
*/
@Column(name = "model_id")
private Integer modelId;
/**
* 车辆当前出行状态: 1-出行中 2-预约中 3-空闲中 4-保养中
*/
@Column(name = "travel_status")
private Integer travelStatus;
}
\ No newline at end of file
......@@ -122,4 +122,13 @@ public class AddOrUpdateVehicleVo {
* 生产商
*/
private Date receiveTime;
/**
* 车型
*/
private Integer modeLId;
/**
* 车辆状态
*/
private Integer travelStatus;
}
\ No newline at end of file
......@@ -115,6 +115,13 @@ public class VehiclePageQueryVo {
*/
private Integer haveViolation;
/**
* 所属大区
*/
private Integer zoneId;
// public Integer getMileageRangeStart() {
// return mileageRangeStart;
// }
......
......@@ -73,4 +73,9 @@ public class VehicleModelBiz extends BaseBiz<VehicleModelMapper, VehicleModel> {
public int updateScoreByModelIdAndavgScore(Integer modelId, int avgScore) {
return mapper.updateScoreByModelIdAndavgScore(modelId,avgScore);
}
public void updateByPrimaryKeySelective(VehicleModel vm){
mapper.updateByPrimaryKeySelective(vm);
}
}
\ No newline at end of file
......@@ -28,12 +28,15 @@ import org.apache.commons.lang.StringUtils;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.TransactionManagementConfigurationSelector;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.weekend.WeekendSqls;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -152,6 +155,7 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
vm.setCrtTime(new Date());
vm.setCrtHost(host);
vm.setIsdel(0);
vm.setVioDeposit(BigDecimal.valueOf(500));
try {
//插入数据到车型并返回id
Integer vmId = vehicleModelBiz.insertAndGetId(vm);
......@@ -208,9 +212,10 @@ public class VehicleModelController extends BaseController<VehicleModelBiz, Vehi
vm.setUpdHost(host);
vm.setUpdTime(new Date());
try {
//修改车型
vehicleModelBiz.updateSelectiveById(vm);
vehicleModelBiz.updateByPrimaryKeySelective(vm);
VehicleCata vcDelete = new VehicleCata();
vcDelete.setVehicleModelId(vm.getId());
// 删除车型对应的标签
......@@ -231,6 +236,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);
}
......
......@@ -7,7 +7,7 @@
(select vm.*,v.sum,v2.leasableQuantity 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`status`=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
<if test="isDel !=null ">
......
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