Commit 6d868f69 authored by 周健威's avatar 周健威

Merge branch 'base-modify' into 'dev'

base-dev-merge

See merge request !3
parents af44b34c fed9a4b8
...@@ -123,4 +123,9 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail ...@@ -123,4 +123,9 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
criteria.andIn("userid", userIds); criteria.andIn("userid", userIds);
mapper.deleteByExample(example); mapper.deleteByExample(example);
} }
@CacheClear(pre = "user{1}")
public void updateUserPositionByUserId(Integer userId, Integer positionId) {
mapper.updateUserPositionByUserId(userId,positionId);
}
} }
...@@ -18,4 +18,5 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> { ...@@ -18,4 +18,5 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
void updateUserMemberStatusByUserId(@Param("userId") Integer userId,@Param("status") Integer status); void updateUserMemberStatusByUserId(@Param("userId") Integer userId,@Param("status") Integer status);
void updateUserPositionByUserId(@Param("userId") Integer id, @Param("positionId") Integer positionId);
} }
\ No newline at end of file
...@@ -16,6 +16,7 @@ import com.github.wxiaoqi.security.common.msg.TableResultResponse; ...@@ -16,6 +16,7 @@ import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.rest.CommonBaseController; import com.github.wxiaoqi.security.common.rest.CommonBaseController;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.process.ResultCode; import com.github.wxiaoqi.security.common.util.process.ResultCode;
import com.xxfc.platform.order.feign.OrderFeign;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
...@@ -63,6 +64,9 @@ public class AppUserController extends CommonBaseController { ...@@ -63,6 +64,9 @@ public class AppUserController extends CommonBaseController {
@Autowired @Autowired
private MyWaterBiz myWaterBiz; private MyWaterBiz myWaterBiz;
@Autowired
private OrderFeign orderFeign;
@GetMapping("page") @GetMapping("page")
...@@ -141,6 +145,7 @@ public class AppUserController extends CommonBaseController { ...@@ -141,6 +145,7 @@ public class AppUserController extends CommonBaseController {
UserMemberVo memberVo=userMemberBiz.getMemberInfoByUserId(userid); UserMemberVo memberVo=userMemberBiz.getMemberInfoByUserId(userid);
if(memberVo!=null){ if(memberVo!=null){
BeanUtils.copyProperties(userDTO,memberVo); BeanUtils.copyProperties(userDTO,memberVo);
// userDTO.setPayCount(orderFeign.baseOrderEntityList(new BaseOrder()));
Integer level=memberVo.getMemberLevel(); Integer level=memberVo.getMemberLevel();
BaseUserMemberLevel memberLevel=userMemberLevelBiz.getLevel(level); BaseUserMemberLevel memberLevel=userMemberLevelBiz.getLevel(level);
if (memberLevel!=null){ if (memberLevel!=null){
......
package com.github.wxiaoqi.security.admin.rest; package com.github.wxiaoqi.security.admin.rest;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.biz.AppUserDetailBiz;
import com.github.wxiaoqi.security.admin.biz.AppUserLoginBiz; import com.github.wxiaoqi.security.admin.biz.AppUserLoginBiz;
import com.github.wxiaoqi.security.admin.biz.AppUserManageBiz; import com.github.wxiaoqi.security.admin.biz.AppUserManageBiz;
import com.github.wxiaoqi.security.admin.constant.Status; import com.github.wxiaoqi.security.admin.constant.Status;
...@@ -38,6 +39,9 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap ...@@ -38,6 +39,9 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
@Autowired @Autowired
private AppUserLoginBiz appUserLoginBiz; private AppUserLoginBiz appUserLoginBiz;
@Autowired
private AppUserDetailBiz appUserDetailBiz;
@Autowired @Autowired
protected UserAuthConfig userAuthConfig; protected UserAuthConfig userAuthConfig;
...@@ -126,5 +130,11 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap ...@@ -126,5 +130,11 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
appUserLoginBiz.deleteAppUserById(id); appUserLoginBiz.deleteAppUserById(id);
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
@PutMapping("/user_position")
public ObjectRestResponse<Void> setUserPositionById(@RequestParam("id") Integer id,@RequestParam("positionId") Integer positionId){
appUserDetailBiz.updateUserPositionByUserId(id,positionId);
return ObjectRestResponse.succ();
}
} }
...@@ -125,4 +125,7 @@ ...@@ -125,4 +125,7 @@
<update id="updateUserMemberStatusByUserId"> <update id="updateUserMemberStatusByUserId">
update `app_user_detail` set `is_member`={status} where `userid`=#{userId} update `app_user_detail` set `is_member`={status} where `userid`=#{userId}
</update> </update>
<update id="updateUserPositionByUserId">
update `app_user_detail` set `position_id`=#{positionId} where `userid`=#{userId}
</update>
</mapper> </mapper>
\ No newline at end of file
package com.xxfc.platform.app.rest.admin;
import com.xxfc.platform.app.biz.BuyVehicleFormBiz;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/9 13:55
*/
@RestController
public class BuyVehicleFormAdminController {
@Autowired
private BuyVehicleFormBiz vehicleFormBiz;
}
package com.xxfc.platform.order.feign;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.GoodDataVO;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.*;
import com.xxfc.platform.vehicle.pojo.*;
import com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Created by ace on 2017/9/15.
*/
@FeignClient(name = "vehicle")
public interface OrderFeign {
@GetMapping("/baseOrder/entityList")
public ObjectRestResponse<List<BaseOrder>> baseOrderEntityList(@RequestParam("entity") Map<String, Object> entity);
}
...@@ -19,6 +19,7 @@ import com.xxfc.platform.universal.feign.ThirdFeign; ...@@ -19,6 +19,7 @@ import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.universal.vo.OrderRefundVo; import com.xxfc.platform.universal.vo.OrderRefundVo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.jexl2.MapContext; import org.apache.commons.jexl2.MapContext;
import org.mockito.internal.util.collections.Sets;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -96,18 +97,24 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> { ...@@ -96,18 +97,24 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper,OrderRefund> {
}}); }});
if(null == crosstown) { if(null == crosstown) {
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, new HashSet<String>(){{ throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet("退款第一部分押金失败,获取不了还车/定损记录,订单号:"+ orderMQDTO.getId()));
add("退款第一部分押金失败,获取不了还车/定损记录,订单号:"+ orderMQDTO.getId()); }
}});
if(null == crosstown.getRestDeposit()
|| crosstown.getRestDeposit().subtract(illegalReserve).compareTo(BigDecimal.ZERO) < 0 ){
throw new BaseException(ResultCode.PARAM_ILLEGAL_CODE, Sets.newSet("退第一笔押金剩余金额异常,异常记录为:"+ crosstown.getId()));
} }
//还车扣除款 剩余的 钱,再减去违章预备金 //还车扣除款 剩余的 钱,再减去违章预备金
BigDecimal refundAmont = crosstown.getRestDeposit().subtract(illegalReserve); BigDecimal refundAmont = crosstown.getRestDeposit().subtract(illegalReserve);
BigDecimal originalRefundAmount = crosstown.getRestDeposit().add(crosstown.getDeductionCost()).subtract(illegalReserve); BigDecimal originalRefundAmount = crosstown.getRestDeposit().add(crosstown.getDeductionCost()).subtract(illegalReserve);
List<DedDetailDTO> dddList = JSONUtil.toBean(crosstown.getDedDetail(), List.class);
String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章预备金:"+ illegalReserve.toString(); String refundDesc = "退还押金:"+ refundAmont.toString()+ "(已扣除 违章预备金:"+ illegalReserve.toString();
if(null != crosstown.getDedDetail()) {
List<DedDetailDTO> dddList = JSONUtil.toBean(crosstown.getDedDetail(), List.class);
for(DedDetailDTO ddd : dddList) { for(DedDetailDTO ddd : dddList) {
refundDesc += ", "+ ddd.getDeductions()+ ":"+ ddd.getCost(); refundDesc += ", "+ ddd.getDeductions()+ ":"+ ddd.getCost();
} }
}
refundDesc += ")"; refundDesc += ")";
refundTrigger(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), illegalReserve, originalRefundAmount, refundAmont, refundDesc, RefundStatusEnum.RESIDUE_ILLEGAL.getCode(), RefundTypeEnum.PART_DEPOSIT); refundTrigger(orderMQDTO, orderMQDTO.getOrderRentVehicleDetail(), illegalReserve, originalRefundAmount, refundAmont, refundDesc, RefundStatusEnum.RESIDUE_ILLEGAL.getCode(), RefundTypeEnum.PART_DEPOSIT);
......
...@@ -165,7 +165,6 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -165,7 +165,6 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
return ObjectRestResponse.createFailedResult(3501, "无收车权限"); return ObjectRestResponse.createFailedResult(3501, "无收车权限");
} }
} }
if(baseOrder.getStatus() != -1) { if(baseOrder.getStatus() != -1) {
Vehicle vehicle = null; Vehicle vehicle = null;
RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderRentVehicleDetail.getVehicleId()); RestResponse<Vehicle> restResponse = vehicleFeign.findById(orderRentVehicleDetail.getVehicleId());
...@@ -236,6 +235,9 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -236,6 +235,9 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
orderVehicleCrosstownDto.setDeductionCost(amount); orderVehicleCrosstownDto.setDeductionCost(amount);
//扣除费用 //扣除费用
orderVehicleCrosstownDto.setRestDeposit(orderRentVehicleDetail.getDeposit().subtract(amount)); orderVehicleCrosstownDto.setRestDeposit(orderRentVehicleDetail.getDeposit().subtract(amount));
if(orderVehicleCrosstownDto.getRestDeposit().compareTo(getAmount()) == -1) { //剩余金额小于保证金
return ObjectRestResponse.createFailedResult(500,"押金不足,不能交车,请联系客服!");
}
//出车成功后修改订单状态 //出车成功后修改订单状态
List<OrderVehicleCrosstownDto> oldValue = orderVehicleCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto); List<OrderVehicleCrosstownDto> oldValue = orderVehicleCrosstownBiz.selectByOrderId(orderVehicleCrosstownDto);
if (oldValue.size() == 1) { if (oldValue.size() == 1) {
...@@ -271,6 +273,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp ...@@ -271,6 +273,7 @@ public class OrderVehicleCrosstownBiz extends BaseBiz<OrderVehicaleCrosstownMapp
//总押金-保留金 //总押金-保留金
totalAmount = objectRestResponse.getData().getOrderRentVehicleDetail().getDeposit(); totalAmount = objectRestResponse.getData().getOrderRentVehicleDetail().getDeposit();
} }
if (baseOrder.getStatus() == OrderStatusEnum.ORDER_TOSTART.getCode()) {//交车 if (baseOrder.getStatus() == OrderStatusEnum.ORDER_TOSTART.getCode()) {//交车
baseOrder.setStatus(OrderStatusEnum.ORDER_WAIT.getCode()); baseOrder.setStatus(OrderStatusEnum.ORDER_WAIT.getCode());
baseOrderBiz.updateSelectiveById(baseOrder); baseOrderBiz.updateSelectiveById(baseOrder);
......
...@@ -155,6 +155,14 @@ public class BaseOrderController extends CommonBaseController implements UserRes ...@@ -155,6 +155,14 @@ public class BaseOrderController extends CommonBaseController implements UserRes
return new ObjectRestResponse<>().data(pages); return new ObjectRestResponse<>().data(pages);
} }
@ApiOperation("根据参数查询,等于")
@RequestMapping(value = "/entityList",method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse<List<BaseOrder>> entityList(BaseOrder entity){
//查询列表数据
return ObjectRestResponse.succ(baseOrderBiz.selectList(entity));
}
@ApiOperation("订单详情") @ApiOperation("订单详情")
@RequestMapping(value = "/{no}", method = RequestMethod.GET) @RequestMapping(value = "/{no}", method = RequestMethod.GET)
@IgnoreClientToken @IgnoreClientToken
......
...@@ -419,6 +419,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl ...@@ -419,6 +419,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
rentVehicleBookDTO.setUserName(BaseContextHandler.getName()); rentVehicleBookDTO.setUserName(BaseContextHandler.getName());
rentVehicleBookDTO.setLiftCompany(detail.getStartCompanyId()); rentVehicleBookDTO.setLiftCompany(detail.getStartCompanyId());
rentVehicleBookDTO.setLiftAddr(detail.getStartAddr()); rentVehicleBookDTO.setLiftAddr(detail.getStartAddr());
rentVehicleBookDTO.setRetCompany(detail.getEndCompanyId());
if(null != detail.getAccompanyItems()) { if(null != detail.getAccompanyItems()) {
rentVehicleBookDTO.setSelectedAccItem(detail.getAccompanyItems().parallelStream().collect(Collectors.toMap(OrderAccompanyDTO::getId, OrderAccompanyDTO::getNum))); rentVehicleBookDTO.setSelectedAccItem(detail.getAccompanyItems().parallelStream().collect(Collectors.toMap(OrderAccompanyDTO::getId, OrderAccompanyDTO::getNum)));
} }
......
...@@ -36,6 +36,12 @@ public class RentVehicleBookDTO extends PageParam { ...@@ -36,6 +36,12 @@ public class RentVehicleBookDTO extends PageParam {
@ApiModelProperty("提车公司") @ApiModelProperty("提车公司")
private Integer liftCompany; private Integer liftCompany;
/**
* 还车分公司
*/
@ApiModelProperty("还车分公司")
private Integer retCompany;
/** /**
* 目的地 * 目的地
*/ */
......
...@@ -41,6 +41,12 @@ public class UsableVeicleDTO extends PageParam { ...@@ -41,6 +41,12 @@ public class UsableVeicleDTO extends PageParam {
@ApiModelProperty("停靠公司") @ApiModelProperty("停靠公司")
String parkBranchCompanyId; String parkBranchCompanyId;
@ApiModelProperty("开始公司Id")
String startCompanyId;
@ApiModelProperty("结束公司Id")
String endCompanyId;
@ApiModelProperty(hidden = true) @ApiModelProperty(hidden = true)
Boolean yearNo4Where; Boolean yearNo4Where;
......
...@@ -362,73 +362,7 @@ ...@@ -362,73 +362,7 @@
where id = #{vehicleId} and status = #{lastStatus} where id = #{vehicleId} and status = #{lastStatus}
</update> </update>
<select id="searchUsableModel" parameterType="java.util.Map"
resultMap="searchUsableModelMap">
select distinct vm.id as model_id, bc.id as company_id
<if test=" catas != null ">
,GROUP_CONCAT(vc.cata_id) as catas
</if>
<!-- yearNo4Where 标识时间参数不用于where条件,用于select部分 -->
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
,max(
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation" separator="and">
<include refid="yearMonthAndParamSql"></include>
</foreach>
) as hasVehicle
</if>
<if test="lon != null and lat != null">
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
</if>
<include refid="searchUsableSql"/>
and vm.id is not null
and vm.status = 1
and vm.isdel = 0
and bc.id is not null
GROUP BY model_id, company_id
<if test="lon != null and lat != null">, distance</if>
<!--<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">, hasVehicle</if>-->
<!-- 循环 相同父级 数据做并集, 不同父级做或集 -->
<if test=" catas != null ">
having ( 1
<foreach collection="catas" index="key" item="cataList">
&amp; (
<foreach collection="cataList" index="cIndex" item="cata">
<if test=" cIndex != 0">
|
</if>
(case when FIND_IN_SET(#{cata.id},catas) > 0 then 1 else 0 end)
</foreach>
)
</foreach>
) > 0
</if>
<if test="lon != null and lat != null">
order by
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
hasVehicle desc,
</if>
distance asc
</if>
</select>
<select id="searchUsableVehicle" parameterType="java.util.Map"
resultType="com.xxfc.platform.vehicle.entity.Vehicle">
select v.*
<if test="lon != null and lat != null">
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
</if>
<if test=" yearMonthAndParam !=null ">
,ifnull(vbi.booked_date,0) as booked_date
</if>
<include refid="searchUsableSql"/>
<if test="lon != null and lat != null">
order by
distance asc
</if>
</select>
<select id="getAllVehicle" parameterType="java.util.Map" resultMap="searchModel"> <select id="getAllVehicle" parameterType="java.util.Map" resultMap="searchModel">
select v1.*, bc2.name subordinateBranchName, bc3.name parkCompanyName, bc4.name destinationBranchCompanyName select v1.*, bc2.name subordinateBranchName, bc3.name parkCompanyName, bc4.name destinationBranchCompanyName
from vehicle v1 from vehicle v1
...@@ -564,6 +498,74 @@ ...@@ -564,6 +498,74 @@
</where> </where>
</select> </select>
<select id="searchUsableModel" parameterType="java.util.Map"
resultMap="searchUsableModelMap">
select distinct vm.id as model_id, bc.id as company_id
<if test=" catas != null ">
,GROUP_CONCAT(vc.cata_id) as catas
</if>
<!-- yearNo4Where 标识时间参数不用于where条件,用于select部分 -->
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
,max(
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation" separator="and">
<include refid="yearMonthAndParamSql"></include>
</foreach>
) as hasVehicle
</if>
<if test="lon != null and lat != null">
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
</if>
<include refid="searchUsableSql"/>
and vm.id is not null
and vm.status = 1
and vm.isdel = 0
and bc.id is not null
GROUP BY model_id, company_id
<if test="lon != null and lat != null">, distance</if>
<!--<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">, hasVehicle</if>-->
<!-- 循环 相同父级 数据做并集, 不同父级做或集 -->
<if test=" catas != null ">
having ( 1
<foreach collection="catas" index="key" item="cataList">
&amp; (
<foreach collection="cataList" index="cIndex" item="cata">
<if test=" cIndex != 0">
|
</if>
(case when FIND_IN_SET(#{cata.id},catas) > 0 then 1 else 0 end)
</foreach>
)
</foreach>
) > 0
</if>
<if test="lon != null and lat != null">
order by
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
hasVehicle desc,
</if>
distance asc
</if>
</select>
<select id="searchUsableVehicle" parameterType="java.util.Map"
resultType="com.xxfc.platform.vehicle.entity.Vehicle">
select v.*
<if test="lon != null and lat != null">
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
</if>
<if test=" yearMonthAndParam !=null ">
,ifnull(vbi.booked_date,0) as booked_date
</if>
<include refid="searchUsableSql"/>
<if test="lon != null and lat != null">
order by
distance asc
</if>
</select>
<!-- 查询可用车辆/车型 的公用 from 和 where 部分条件 --> <!-- 查询可用车辆/车型 的公用 from 和 where 部分条件 -->
<sql id="searchUsableSql"> <sql id="searchUsableSql">
from vehicle v from vehicle v
...@@ -573,10 +575,19 @@ ...@@ -573,10 +575,19 @@
</if> </if>
left join vehicle_model vm on v.model_id = vm.id left join vehicle_model vm on v.model_id = vm.id
left join branch_company bc on v.park_branch_company_id = bc.id left join branch_company bc on v.park_branch_company_id = bc.id
<if test="startCompanyId != null and endCompanyId != null ">
left join (
<include refid="aroundBookRecord"></include>
) abr on v.`id` = abr.vehicle_id
</if>
<if test=" catas != null "> <if test=" catas != null ">
left join vehicle_cata vc on vm.id = vc.vehicle_model_id left join vehicle_cata vc on vm.id = vc.vehicle_model_id
</if> </if>
<where> <where>
<!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- yearNo4Where 标识时间参数是否用于where条件 -->
(abr.to_lift_company = null or (abr.to_lift_company = ))
<!-- 若需根据预定日期条件查询,针对换为位操作 --> <!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- yearNo4Where 标识时间参数是否用于where条件 --> <!-- yearNo4Where 标识时间参数是否用于where条件 -->
<if test=" yearMonthAndParam !=null and yearNo4Where == null"> <if test=" yearMonthAndParam !=null and yearNo4Where == null">
...@@ -585,7 +596,13 @@ ...@@ -585,7 +596,13 @@
<include refid="yearMonthAndParamSql"></include> <include refid="yearMonthAndParamSql"></include>
</foreach> </foreach>
</if> </if>
<if test="startCompanyId != null and endCompanyId != null ">
and (
(abr.to_lift_company = null or abr.to_lift_company = #{startCompanyId})
and
(abr.to_return_company = null or abr.to_return_company = #{endCompanyId})
)
</if>
<if test=" modelId != null "> <if test=" modelId != null ">
and v.model_id = #{modelId} and v.model_id = #{modelId}
</if> </if>
...@@ -611,4 +628,17 @@ ...@@ -611,4 +628,17 @@
) )
</sql> </sql>
<!-- 前后被预定的情况 -->
<sql id = "aroundBookRecord">
select sevbr.*
, vbre.ret_company as to_lift_company
, vbrs.lift_company as to_return_company
from
(select vehicle_id, max(if(book_end_date &lt; #{start_date_extend}, book_end_date, null)) as max_book_end_date, min(if(book_start_date &gt; #{end_date_extend}, book_start_date, null)) as min_book_start_date from vehicle_book_record where status != 4 and status != 6 group by vehicle_id) sevbr
left join vehicle_book_record vbre
on sevbr.vehicle_id = vbre.vehicle_id and sevbr.max_book_end_date = vbre.book_end_date and vbre.status != 4 and vbre.status != 6
left join vehicle_book_record vbrs
on sevbr.vehicle_id = vbrs.vehicle_id and sevbr.min_book_start_date = vbrs.book_start_date and vbrs.status != 4 and vbrs.status != 6;
</sql>
</mapper> </mapper>
\ No newline at end of file
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