| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.modular.system.dao.TBroadcastMapper; |
| | | import com.stylefeng.guns.modular.system.enums.StatusEnum; |
| | | import com.stylefeng.guns.modular.system.model.TBroadcast; |
| | | import com.stylefeng.guns.modular.system.model.TCommercial; |
| | | import com.stylefeng.guns.modular.system.dao.TCommercialMapper; |
| | | import com.stylefeng.guns.modular.system.service.ITCommercialService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TCommercialServiceImpl extends ServiceImpl<TCommercialMapper, TCommercial> implements ITCommercialService { |
| | | |
| | | @Autowired |
| | | private TCommercialMapper tCommercialMapper; |
| | | |
| | | @Override |
| | | public Boolean isExit(Integer id,Integer onOffLine) { |
| | | List<TCommercial> list = tCommercialMapper.selectList(new EntityWrapper<TCommercial>() |
| | | .eq("type", 1) |
| | | .eq("onOffLine", onOffLine) |
| | | .ne("status", StatusEnum.DELETE.getCode())); |
| | | if (Objects.nonNull(id)) { |
| | | if(!CollectionUtils.isEmpty(list)){ |
| | | List<Integer> ids = list.stream().map(TCommercial::getId).collect(Collectors.toList()); |
| | | // 修改 |
| | | TCommercial tCommercial = tCommercialMapper.selectById(id); |
| | | return Objects.nonNull(tCommercial) && !ids.contains(id) && list.size() > 3; |
| | | }else { |
| | | return false; |
| | | } |
| | | } else { |
| | | // 新增 |
| | | return list.size() > 3; |
| | | } |
| | | } |
| | | } |