tangxiaobao
2022-04-14 b78911d4645cc3cba16d3bb0312223f0c8aa3f68
修改bug
7个文件已修改
179 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/ComChangeCarModelApi.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/ComChangeCarModelFeign.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/ComChangeCarModelRelationFeign.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComChangeCarModelRelationMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComChangeCarBrandServiceImpl.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComChangeCarModelRelationServiceImpl.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComChangeCarModelRelationMapper.xml 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/ComChangeCarModelApi.java
@@ -1,12 +1,13 @@
package com.panzhihua.applets.api;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.common.AddComChangeCarModelDto;
import com.panzhihua.common.model.dtos.common.EditComChangeCarModelDto;
import com.panzhihua.common.model.dtos.common.PageComChangeCarModelDto;
import com.panzhihua.common.model.dtos.common.*;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.common.ComChangeCarModelSpecsVo;
import com.panzhihua.common.model.vos.common.ComChangeCarModelVo;
import com.panzhihua.common.service.community.ComChangeCarModelFeign;
import com.panzhihua.common.service.community.ComChangeCarModelRelationFeign;
import com.panzhihua.common.service.community.ComChangeCarModelSpecsFeign;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -33,19 +34,23 @@
    @Resource
    private ComChangeCarModelFeign comChangeCarModelService;
    @Resource
    private ComChangeCarModelSpecsFeign carModelSpecsService;
    @Resource
    private ComChangeCarModelRelationFeign carModelRelationService;
    /**
     * description  queryByPage  分页查询
     *
     * @param comChangeCarModel 请求参数
     * @param comChangeCarModelRelation 请求参数
     * @return 分页查询返回参数
     * @author lyq
     * @date 2022-04-07 13:41:54
     */
    @ApiOperation(value = "分页查询车型管理列表",response = ComChangeCarModelVo.class)
    @PostMapping("/page")
    public R queryByPage(@RequestBody PageComChangeCarModelDto comChangeCarModel) {
        return this.comChangeCarModelService.queryByAppletsPage(comChangeCarModel);
    public R queryByPage(@RequestBody PageComChangeCarModelRelationDto comChangeCarModelRelation) {
        return this.carModelRelationService.queryByAppletsPage(comChangeCarModelRelation);
    }
    /**
@@ -76,5 +81,11 @@
        return this.comChangeCarModelService.queryByList(comChangeCarModel);
    }
    @ApiOperation(value = "查询规格管理级联列表",response = ComChangeCarModelSpecsVo.class)
    @PostMapping("/specs/list")
    public R getSpecsList(@RequestBody PageComChangeCarModelSpecsDto comChangeCarModel) {
        return this.carModelSpecsService.queryByList(comChangeCarModel);
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/ComChangeCarModelFeign.java
@@ -93,15 +93,4 @@
     */
    @GetMapping("/updateStatus")
    R updateStatus(@RequestParam("id") Long id,@RequestParam("status") Integer status);
    /**
     * description  queryByPage  小程序分页查询
     *
     * @param comChangeCarModel 请求参数
     * @return 小程序分页查询列表数据
     * @author lyq
     * @date 2022-04-07 13:41:57
     */
    @PostMapping("/applets/page")
    R queryByAppletsPage(@RequestBody PageComChangeCarModelDto comChangeCarModel);
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/ComChangeCarModelRelationFeign.java
@@ -84,4 +84,15 @@
     */
    @PostMapping("/list")
    R queryByList(@RequestBody PageComChangeCarModelRelationDto comChangeCarModelRelation);
    /**
     * description  queryByPage  小程序分页查询
     *
     * @param comChangeCarModelRelation 请求参数
     * @return 小程序分页查询列表数据
     * @author lyq
     * @date 2022-04-07 13:41:57
     */
    @PostMapping("/applets/page")
    R queryByAppletsPage(@RequestBody PageComChangeCarModelRelationDto comChangeCarModelRelation);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComChangeCarModelRelationMapper.java
@@ -71,6 +71,7 @@
     * @author lyq
     * @date 2022-04-07 13:55:29
     */
    IPage<ComChangeCarModelRelationVo> queryAllByAppletsLimit(@Param("dto") PageComChangeCarModelRelationDto comChangeCarModelRelation, Page page);
    IPage<ComChangeCarModelVo> queryAllByAppletsLimit(@Param("dto") PageComChangeCarModelRelationDto comChangeCarModelRelation, Page page);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComChangeCarBrandServiceImpl.java
@@ -1,7 +1,10 @@
package com.panzhihua.service_community.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.panzhihua.service_community.dao.ComChangeCarModelMapper;
import com.panzhihua.service_community.entity.ComChangeCarBrand;
import com.panzhihua.service_community.dao.ComChangeCarBrandMapper;
import com.panzhihua.service_community.entity.ComChangeCarModel;
import com.panzhihua.service_community.service.ComChangeCarBrandService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
@@ -9,6 +12,8 @@
import com.panzhihua.common.model.vos.R;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import javax.annotation.Resource;
/**
 * title: 换新车-品牌表表服务实现类
@@ -22,6 +27,9 @@
 */
@Service("comChangeCarBrandService")
public class ComChangeCarBrandServiceImpl extends ServiceImpl<ComChangeCarBrandMapper, ComChangeCarBrand> implements ComChangeCarBrandService {
    @Resource
    private ComChangeCarModelMapper carModelMapper;
    /**
     * description  queryByPage  分页查询
@@ -85,6 +93,12 @@
     */
    @Override
    public R deleteById(Long id) {
        //判断是否有车型关联
        Integer count = carModelMapper.selectCount(new QueryWrapper<ComChangeCarModel>().lambda().eq(ComChangeCarModel::getBrandId,id)
                .eq(ComChangeCarModel::getIsDel,ComChangeCarModel.IsDel.NO));
        if(count > 0){
            return R.fail("该品牌已被引用,不可删除");
        }
        ComChangeCarBrand entity = new ComChangeCarBrand();
        entity.setId(id);
        entity.setIsDel(ComChangeCarBrand.IsDel.YES);
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComChangeCarModelRelationServiceImpl.java
@@ -1,6 +1,9 @@
package com.panzhihua.service_community.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.panzhihua.common.model.vos.common.ComChangeCarModelRelationVo;
import com.panzhihua.common.model.vos.common.ComChangeCarModelVo;
import com.panzhihua.service_community.entity.ComChangeCarModelRelation;
import com.panzhihua.service_community.dao.ComChangeCarModelRelationMapper;
import com.panzhihua.service_community.service.ComChangeCarModelRelationService;
@@ -10,6 +13,8 @@
import com.panzhihua.common.model.vos.R;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
 * title: 换新车-车型与规格关联表表服务实现类
@@ -48,7 +53,7 @@
    @Override
    public R insert(AddComChangeCarModelRelationDto comChangeCarModelRelation) {
        ComChangeCarModelRelation entity = this.baseMapper.selectOne(new QueryWrapper<ComChangeCarModelRelation>().lambda()
                .eq(ComChangeCarModelRelation::getModelId,comChangeCarModelRelation.getModelSpecsId())
                .eq(ComChangeCarModelRelation::getModelId,comChangeCarModelRelation.getModelId())
                .eq(ComChangeCarModelRelation::getModelSpecsId,comChangeCarModelRelation.getModelSpecsId()));
        if(entity == null){
            entity = new ComChangeCarModelRelation();
@@ -142,6 +147,12 @@
     */
    @Override
    public R queryByAppletsPage(PageComChangeCarModelRelationDto comChangeCarModelRelation) {
        return R.ok(this.baseMapper.queryAllByAppletsLimit(comChangeCarModelRelation, new Page(comChangeCarModelRelation.getPageNum(), comChangeCarModelRelation.getPageSize())));
        IPage<ComChangeCarModelVo> carModelVoIPage = this.baseMapper.queryAllByAppletsLimit(comChangeCarModelRelation, new Page(comChangeCarModelRelation.getPageNum(), comChangeCarModelRelation.getPageSize()));
        carModelVoIPage.getRecords().forEach(carModel -> {
            //查询车型规格列表
            List<ComChangeCarModelRelationVo> carModelRelationVoList = this.baseMapper.queryAllByModelId(carModel.getId());
            carModel.setCarModelRelationList(carModelRelationVoList);
        });
        return R.ok(carModelVoIPage);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComChangeCarModelRelationMapper.xml
@@ -12,39 +12,81 @@
    <!--查询单个-->
    <select id="queryById" resultType="com.panzhihua.common.model.vos.common.ComChangeCarModelRelationVo">
        select
          id, model_id, model_specs_id, model_specs_children_id
        from com_change_car_model_relation
        where id = #{id}
        SELECT
            cccmr.id,
            cccmr.model_id,
            cccmr.model_specs_id,
            cccmr.model_specs_children_id,
            cccm.`name` as modelName,
            cccm.`min_price` as minPrice,
            cccm.`images`,
            cccb.`name` as brandName,
            cccms.`name` as specsName,
            cccmsc.`name` as specsChildrenName
        FROM
            com_change_car_model_relation as cccmr
                left join com_change_car_model as cccm on cccm.id = cccmr.model_id
                left join com_change_car_model_specs as cccms on cccms.id = cccmr.model_specs_id
                left join com_change_car_model_specs_children as cccmsc on cccmsc.id = cccmr.model_specs_children_id
                left join com_change_car_brand as cccb on cccb.id = cccm.brand_id
        where cccmr.id = #{id}
    </select>
    <!--查询指定行数据-->
    <select id="queryAllByLimit" resultType="com.panzhihua.common.model.vos.common.ComChangeCarModelRelationVo">
        select
        id, model_id, model_specs_id, model_specs_children_id
        from com_change_car_model_relation
        SELECT
        cccmr.id,
        cccmr.model_id,
        cccmr.model_specs_id,
        cccmr.model_specs_children_id,
        cccm.`name` as modelName,
        cccm.`min_price` as minPrice,
        cccm.`images`,
        cccb.`name` as brandName,
        cccms.`name` as specsName,
        cccmsc.`name` as specsChildrenName
        FROM
        com_change_car_model_relation as cccmr
        left join com_change_car_model as cccm on cccm.id = cccmr.model_id
        left join com_change_car_model_specs as cccms on cccms.id = cccmr.model_specs_id
        left join com_change_car_model_specs_children as cccmsc on cccmsc.id = cccmr.model_specs_children_id
        left join com_change_car_brand as cccb on cccb.id = cccm.brand_id
        <where>
            <if test="dto.id != null">
                and id = #{dto.id}
                and cccmr.id = #{dto.id}
            </if>
            <if test="dto.modelId != null">
                and model_id = #{dto.modelId}
                and cccmr.model_id = #{dto.modelId}
            </if>
            <if test="dto.modelSpecsId != null">
                and model_specs_id = #{dto.modelSpecsId}
                and cccmr.model_specs_id = #{dto.modelSpecsId}
            </if>
            <if test="dto.modelSpecsChildrenId != null">
                and model_specs_children_id = #{dto.modelSpecsChildrenId}
                and cccmr.model_specs_children_id = #{dto.modelSpecsChildrenId}
            </if>
        </where>
        order by create_at desc
        order by cccmr.id desc
    </select>
    <!--查询所有数据-->
    <select id="queryAllByList" resultType="com.panzhihua.common.model.vos.common.ComChangeCarModelRelationVo">
        select
        id, model_id, model_specs_id, model_specs_children_id
        from com_change_car_model_relation
        SELECT
        cccmr.id,
        cccmr.model_id,
        cccmr.model_specs_id,
        cccmr.model_specs_children_id,
        cccm.`name` as modelName,
        cccm.`min_price` as minPrice,
        cccm.`images`,
        cccb.`name` as brandName,
        cccms.`name` as specsName,
        cccmsc.`name` as specsChildrenName
        FROM
        com_change_car_model_relation as cccmr
        left join com_change_car_model as cccm on cccm.id = cccmr.model_id
        left join com_change_car_model_specs as cccms on cccms.id = cccmr.model_specs_id
        left join com_change_car_model_specs_children as cccmsc on cccmsc.id = cccmr.model_specs_children_id
        left join com_change_car_brand as cccb on cccb.id = cccm.brand_id
        <where>
            <if test="dto.id != null">
                and id = #{dto.id}
@@ -59,7 +101,7 @@
                and model_specs_children_id = #{dto.modelSpecsChildrenId}
            </if>
        </where>
        order by create_at desc
        order by cccmr.id desc
    </select>
    <select id="queryAllByModelId" resultType="com.panzhihua.common.model.vos.common.ComChangeCarModelRelationVo">
@@ -83,24 +125,19 @@
        where cccmr.model_id = #{modelId}
    </select>
    <select id="queryAllByAppletsLimit" resultType="com.panzhihua.common.model.vos.common.ComChangeCarModelRelationVo">
    <select id="queryAllByAppletsLimit" resultType="com.panzhihua.common.model.vos.common.ComChangeCarModelVo">
        SELECT
            cccmr.id,
            cccmr.model_id,
            cccmr.model_specs_id,
            cccmr.model_specs_children_id,
            cccm.`name` as modelName,
            cccm.`min_price` as minPrice,
            cccm.`images`,
            cccb.`name` as brandName,
            cccms.`name` as specsName,
            cccmsc.`name` as specsChildrenName
        cccm.`name`,
        cccm.`min_price`,
        cccm.`images`,
        cccb.`name` AS brandName,
        cccm.id
        FROM
            com_change_car_model_relation as cccmr
            left join com_change_car_model as cccm on cccm.id = cccmr.model_id
            left join com_change_car_model_specs as cccms on cccms.id = cccmr.model_specs_id
            left join com_change_car_model_specs_children as cccmsc on cccmsc.id = cccmr.model_specs_children_id
            left join com_change_car_brand as cccb on cccb.id = cccm.brand_id
        com_change_car_model AS cccm
        LEFT JOIN com_change_car_model_relation AS cccmr ON cccm.id = cccmr.model_id
        LEFT JOIN com_change_car_model_specs AS cccms ON cccms.id = cccmr.model_specs_id
        LEFT JOIN com_change_car_model_specs_children AS cccmsc ON cccmsc.id = cccmr.model_specs_children_id
        LEFT JOIN com_change_car_brand AS cccb ON cccb.id = cccm.brand_id
        <where>
            <if test="dto.brandIds != null and dto.brandIds.size > 0">
                and cccm.brand_id in
@@ -118,6 +155,7 @@
                and cccm.`name` like concat('%',#{dto.keyWord},'%')
            </if>
        </where>
        group by cccm.id
        <if test="dto.priceSort != null and dto.priceSort == 1">
            order by cccm.`min_price` asc
        </if>