From 179c4d64313c9b7572778da4aaaf6c6584fe457d Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期二, 20 五月 2025 23:48:08 +0800 Subject: [PATCH] 修改文件上传类型限制 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComChangeCarBrandServiceImpl.java | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComChangeCarBrandServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComChangeCarBrandServiceImpl.java index 1358988..1820f6f 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComChangeCarBrandServiceImpl.java +++ b/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); -- Gitblit v1.7.1