Commit 6add0b51 authored by hanfeng's avatar hanfeng

修改车型列表

parent 16ee86e0
......@@ -27,14 +27,11 @@ public class VehicleModelQueryCondition {
@ApiModelProperty(value = "是否删除")
private Integer isDel;
@ApiModelProperty(value = "状态")
private Integer status;
private Integer status=1;
@ApiModelProperty("分类逗号分割")
String catasStr;
@ApiModelProperty("排除的车型id")
String notInIds;
@ApiModelProperty(value = "分类列表", hidden = true)
Map<Integer, List<VehiclePlatCata>> catas;
@ApiModelProperty(value = "分类列表(1-后台,2-app和小程序)", hidden = true)
private Integer pathType=2;
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.xxfc.platform.vehicle.mapper.VehicleModelMapper">
<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,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
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
<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,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
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}
</if>
<if test="pathType ==2">
and status = 1
</if>
<if test="pathType!=2">
<if test="status != null">
and status = #{status}
</if>
</if>
<if test="isDel !=null ">
and isdel=#{isDel}
</if>
<if test="vehicleName !=null and vehicleName !=''">
AND vmqc.name LIKE CONCAT('%',#{vehicleName},'%')
</if>
<if test="vehicleType!=null and vehicleType!=''">
AND EXISTS (SELECT vc.vehicle_model_id FROM vehicle_cata vc WHERE vc.cata_id=#{vehicleType} AND vmqc.id=vc.vehicle_model_id )
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="takeALieTheNumber!=null and takeALieTheNumber!=''">
AND EXISTS(SELECT vc2.vehicle_model_id FROM vehicle_cata vc2 WHERE vc2.cata_id=#{takeALieTheNumber} AND vmqc.id=vc2.vehicle_model_id)
</if>
<if test="catas != null">
AND ( 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},vmqc.config) > 0 then 1 else 0 end)
</foreach>
)
</foreach>
) > 0
</if>
<if test="notInIds != null">
and vmqc.id not in (
<if test="vehicleName !=null and vehicleName !=''">
AND vmqc.name LIKE CONCAT('%',#{vehicleName},'%')
</if>
<if test="vehicleType!=null and vehicleType!=''">
AND EXISTS (SELECT vc.vehicle_model_id FROM vehicle_cata vc WHERE vc.cata_id=#{vehicleType} AND
vmqc.id=vc.vehicle_model_id )
</if>
<if test="takeALieTheNumber!=null and takeALieTheNumber!=''">
AND EXISTS(SELECT vc2.vehicle_model_id FROM vehicle_cata vc2 WHERE vc2.cata_id=#{takeALieTheNumber} AND
vmqc.id=vc2.vehicle_model_id)
</if>
<if test="catas != null">
AND ( 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},vmqc.config) > 0 then 1 else 0 end)
</foreach>
)
</foreach>
) > 0
</if>
<if test="notInIds != null">
and vmqc.id not in (
<foreach collection="notInIds.split(',')" item="noIdItem" index="noIdIndex">
#{noIdItem}
</foreach>
)
</if>
ORDER BY vmqc.sort ASC
</select>
)
</if>
ORDER BY vmqc.sort ASC
</select>
<update id="updateScoreByModelIdAndavgScore">
update `vehicle_model` set `score`=(`score`+#{avgScore})/2 where `id`=#{modelId}
......
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