package org.jeecg.modules.eam.service.impl;
|
|
import java.util.Arrays;
|
import java.util.List;
|
|
import org.apache.commons.lang.StringUtils;
|
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.modules.eam.entity.ProductionLine;
|
import org.jeecg.modules.eam.mapper.ProductionLineMapper;
|
import org.jeecg.modules.eam.service.IAreaService;
|
import org.jeecg.modules.eam.service.IProductionLineService;
|
import org.jeecg.modules.eam.service.ISiteService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.context.annotation.Lazy;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
/**
|
*
|
* @ClassName: ProductionLineServiceImpl
|
* @Description: 产线信息业务接口实现
|
* @author Wang Mingchao
|
* @date 2020-10-20 09:28:16
|
*/
|
@Service
|
public class ProductionLineServiceImpl extends ServiceImpl<ProductionLineMapper, ProductionLine>
|
implements IProductionLineService {
|
|
@Autowired
|
@Lazy
|
private ISiteService siteService;
|
|
@Autowired
|
@Lazy
|
private IAreaService areaService;
|
|
@Override
|
public List<ProductionLine> list() {
|
return super.lambdaQuery().eq(ProductionLine::getStatus, CommonConstant.STATUS_1)
|
.orderByAsc(ProductionLine::getNum).list();
|
}
|
|
@Override
|
@Transactional(rollbackFor = { Exception.class })
|
public boolean removeByAreaId(String areaId) {
|
if (StringUtils.isBlank(areaId)) {
|
return false;
|
}
|
LambdaQueryWrapper<ProductionLine> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
lambdaQueryWrapper.eq(ProductionLine::getAreaId, areaId);
|
return super.remove(lambdaQueryWrapper);
|
}
|
|
@Override
|
@Transactional(rollbackFor = { Exception.class })
|
public boolean removeByAreaIds(String[] areaIds) {
|
if (areaIds == null || areaIds.length < 1) {
|
return false;
|
}
|
LambdaQueryWrapper<ProductionLine> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
List<String> strings = Arrays.asList(areaIds);
|
lambdaQueryWrapper.in(ProductionLine::getAreaId, strings);
|
return super.remove(lambdaQueryWrapper);
|
}
|
|
@Override
|
@Transactional(rollbackFor = { Exception.class })
|
public boolean removeBySiteId(String siteId) {
|
if (StringUtils.isBlank(siteId)) {
|
return false;
|
}
|
LambdaQueryWrapper<ProductionLine> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
lambdaQueryWrapper.eq(ProductionLine::getSiteId, siteId);
|
return super.remove(lambdaQueryWrapper);
|
}
|
|
@Override
|
@Transactional(rollbackFor = { Exception.class })
|
public boolean removeBySiteIds(String[] siteIds) {
|
if (siteIds == null || siteIds.length < 1)
|
return false;
|
LambdaQueryWrapper<ProductionLine> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
lambdaQueryWrapper.in(ProductionLine::getSiteId, Arrays.asList(siteIds));
|
return super.remove(lambdaQueryWrapper);
|
}
|
|
@Override
|
@Transactional(rollbackFor = { Exception.class })
|
public boolean activeByAreaId(String areaId, String status) {
|
if (StringUtils.isBlank(areaId) || StringUtils.isBlank(status))
|
return false;
|
LambdaUpdateWrapper<ProductionLine> updateWrapper = Wrappers.lambdaUpdate();
|
updateWrapper.set(ProductionLine::getStatus, status).eq(ProductionLine::getAreaId, areaId);
|
return super.update(updateWrapper);
|
}
|
|
@Override
|
@Transactional(rollbackFor = { Exception.class })
|
public boolean activeByAreaIds(String[] areaIds, String status) {
|
if (areaIds == null || areaIds.length < 1 || StringUtils.isBlank(status))
|
return false;
|
LambdaUpdateWrapper<ProductionLine> updateWrapper = Wrappers.lambdaUpdate();
|
updateWrapper.set(ProductionLine::getStatus, status).in(ProductionLine::getAreaId, Arrays.asList(areaIds));
|
return super.update(updateWrapper);
|
}
|
|
@Override
|
@Transactional(rollbackFor = { Exception.class })
|
public boolean activeBySiteId(String siteId, String status) {
|
if (StringUtils.isBlank(siteId) || StringUtils.isBlank(status))
|
return false;
|
LambdaUpdateWrapper<ProductionLine> updateWrapper = Wrappers.lambdaUpdate();
|
updateWrapper.set(ProductionLine::getStatus, status).eq(ProductionLine::getSiteId, siteId);
|
return super.update(updateWrapper);
|
}
|
|
@Override
|
public List<ProductionLine> listByAreaId(String areaId) {
|
return super.lambdaQuery().eq(ProductionLine::getAreaId, areaId)
|
.eq(ProductionLine::getStatus, CommonConstant.STATUS_1).list();
|
}
|
|
}
|