| | |
| | | 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()) |
| | |
| | | public void deleteByIdInBatch(List<Integer> ids, LoginUserInfo user) { |
| | | 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) |
| | |
| | | |
| | | @Override |
| | | public List<JkLine> findList(JkLine jkLine) { |
| | | |
| | | MPJLambdaWrapper<JkLine> queryWrapper = new MPJLambdaWrapper<>(); |
| | | jkLine.setIsdeleted(Constants.ZERO); |
| | | QueryWrapper<JkLine> wrapper = new QueryWrapper<>(jkLine); |
| | | wrapper.lambda().orderByAsc(JkLine::getCode); |
| | | return jkLineMapper.selectList(wrapper); |
| | | queryWrapper.selectAll(JkLine.class ) |
| | | .selectAs(Member::getName,JkLine::getMemberName) |
| | | .selectAs(Cars::getCode,JkLine::getCarCode) |
| | | .leftJoin(Cars.class,Cars::getId,JkLine::getCarId ) |
| | | .leftJoin(Member.class,Member::getId,Cars::getMemberId ); |
| | | jkLine.setIsdeleted(Constants.ZERO); |
| | | if (jkLine.getIsdeleted() != null) { |
| | | queryWrapper.eq(JkLine::getIsdeleted, jkLine.getIsdeleted()); |
| | | } |
| | | if (jkLine.getCategoryId() != null) { |
| | | queryWrapper.eq(JkLine::getCategoryId, jkLine.getCategoryId()); |
| | | } |
| | | if (jkLine.getCarId() != null) { |
| | | queryWrapper.eq(JkLine::getCarId, jkLine.getCarId()); |
| | | } |
| | | if (jkLine.getStatus() != null) { |
| | | queryWrapper.eq(JkLine::getStatus, jkLine.getStatus()); |
| | | } |
| | | if (jkLine.getSortnum() != null) { |
| | | queryWrapper.eq(JkLine::getSortnum, jkLine.getSortnum()); |
| | | } |
| | | queryWrapper.orderByAsc(JkLine::getCode); |
| | | return jkLineMapper.selectJoinList(JkLine.class,queryWrapper); |
| | | } |
| | | |
| | | @Override |