| | |
| | | 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; |
| | |
| | | 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: 换新车-品牌表表服务实现类 |
| | |
| | | */ |
| | | @Service("comChangeCarBrandService") |
| | | public class ComChangeCarBrandServiceImpl extends ServiceImpl<ComChangeCarBrandMapper, ComChangeCarBrand> implements ComChangeCarBrandService { |
| | | |
| | | @Resource |
| | | private ComChangeCarModelMapper carModelMapper; |
| | | |
| | | /** |
| | | * description queryByPage 分页查询 |
| | |
| | | */ |
| | | @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); |