| | |
| | | import com.doumee.dao.admin.request.JkLineImport; |
| | | import com.doumee.dao.business.CarsMapper; |
| | | import com.doumee.dao.business.CategoryMapper; |
| | | import com.doumee.dao.business.JkCustomerMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import io.swagger.models.auth.In; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | |
| | | @Autowired |
| | | private CategoryMapper categoryMapper; |
| | | @Autowired |
| | | private JkCustomerMapper jkCustomerMapper; |
| | | @Autowired |
| | | private CarsMapper carsMapper; |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public void deleteById(Integer id, LoginUserInfo user) { |
| | | JkLine c = jkLineMapper.selectById(id); |
| | | if(c == null||Constants.equalsInteger(c.getIsdeleted(),Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | //如果是新线路,检查是否有子线路,有则不允许删除 |
| | | if(jkCustomerMapper.selectCount(new MPJLambdaWrapper<JkCustomer>().eq(JkCustomer::getIsdeleted,Constants.ZERO) |
| | | .eq(JkCustomer::getLineId,id)) >0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"线路【"+c.getName()+"】下已存在客户信息,不允许删除!"); |
| | | } |
| | | jkLineMapper.update(null,new UpdateWrapper<JkLine>().lambda() |
| | | .set(JkLine::getIsdeleted,Constants.ONE) |
| | | .set(JkLine::getEditor,user.getId()) |
| | |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | for(Integer id :ids){ |
| | | JkLine c = jkLineMapper.selectById(id); |
| | | if(c == null||Constants.equalsInteger(c.getIsdeleted(),Constants.ONE)){ |
| | | continue; |
| | | } |
| | | //如果是新线路,检查是否有子线路,有则不允许删除 |
| | | if(jkCustomerMapper.selectCount(new MPJLambdaWrapper<JkCustomer>().eq(JkCustomer::getIsdeleted,Constants.ZERO) |
| | | .eq(JkCustomer::getLineId,id)) >0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"线路【"+c.getName()+"】下已存在客户信息,不允许删除!"); |
| | | } |
| | | } |
| | | jkLineMapper.update(null,new UpdateWrapper<JkLine>().lambda() |
| | | .set(JkLine::getIsdeleted,Constants.ONE) |
| | | .set(JkLine::getEditor,user.getId()) |