|
@@ -1,18 +1,27 @@
|
|
package com.lote.wms.material.service.impl;
|
|
package com.lote.wms.material.service.impl;
|
|
|
|
|
|
|
|
+import com.lote.wms.base.dict.entity.queryvo.MaterialTypeQueryVo;
|
|
|
|
+import com.lote.wms.base.product.entity.Product;
|
|
|
|
+import com.lote.wms.base.product.entity.ProductCriteria;
|
|
|
|
+import com.lote.wms.base.product.entity.queryvo.ProductQueryVo;
|
|
|
|
+import com.lote.wms.common.utils.DateUtil;
|
|
|
|
+import com.lote.wms.common.utils.StringUtil;
|
|
import com.lote.wms.material.dao.MaterialTypeMapper;
|
|
import com.lote.wms.material.dao.MaterialTypeMapper;
|
|
import com.lote.wms.material.entity.MaterialType;
|
|
import com.lote.wms.material.entity.MaterialType;
|
|
-import com.lote.wms.material.entity.MaterialTypeCriteria.Criteria;
|
|
|
|
import com.lote.wms.material.entity.MaterialTypeCriteria;
|
|
import com.lote.wms.material.entity.MaterialTypeCriteria;
|
|
|
|
+import com.lote.wms.material.entity.MaterialTypeCriteria.Criteria;
|
|
import com.lote.wms.material.service.MaterialTypeService;
|
|
import com.lote.wms.material.service.MaterialTypeService;
|
|
-import java.util.List;
|
|
|
|
import org.mybatis.plugin.model.Pager;
|
|
import org.mybatis.plugin.model.Pager;
|
|
import org.mybatis.plugin.util.PagerUtil;
|
|
import org.mybatis.plugin.util.PagerUtil;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
-import javax.annotation.Resource;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
+
|
|
@Service("materialTypeService")
|
|
@Service("materialTypeService")
|
|
public class MaterialTypeServiceImpl implements MaterialTypeService {
|
|
public class MaterialTypeServiceImpl implements MaterialTypeService {
|
|
@Resource
|
|
@Resource
|
|
@@ -21,18 +30,24 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
|
|
private static final Logger logger = LoggerFactory.getLogger(MaterialTypeServiceImpl.class);
|
|
private static final Logger logger = LoggerFactory.getLogger(MaterialTypeServiceImpl.class);
|
|
|
|
|
|
public MaterialType add(MaterialType record) {
|
|
public MaterialType add(MaterialType record) {
|
|
- if(this.materialTypeMapper.insertSelective(record)==1)
|
|
|
|
- return record;
|
|
|
|
|
|
+ if (this.materialTypeMapper.insertSelective(record) == 1)
|
|
|
|
+ return record;
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
- public boolean delete(String id) {
|
|
|
|
- return this.materialTypeMapper.deleteByPrimaryKey(id)==1;
|
|
|
|
|
|
+ public boolean delete(List<String> ids) {
|
|
|
|
+ AtomicBoolean flag = new AtomicBoolean(true);
|
|
|
|
+ ids.forEach(id -> {
|
|
|
|
+ int result = this.materialTypeMapper.deleteByPrimaryKey(id);
|
|
|
|
+ if (result !=1)
|
|
|
|
+ flag.set(false);
|
|
|
|
+ });
|
|
|
|
+ return flag.get();
|
|
}
|
|
}
|
|
|
|
|
|
public MaterialType update(MaterialType record) {
|
|
public MaterialType update(MaterialType record) {
|
|
- if(this.materialTypeMapper.updateByPrimaryKeySelective(record)==1)
|
|
|
|
- return record;
|
|
|
|
|
|
+ if (this.materialTypeMapper.updateByPrimaryKeySelective(record) == 1)
|
|
|
|
+ return record;
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -48,4 +63,30 @@ public class MaterialTypeServiceImpl implements MaterialTypeService {
|
|
List<MaterialType> list = materialTypeMapper.selectByConditionList(criteria);
|
|
List<MaterialType> list = materialTypeMapper.selectByConditionList(criteria);
|
|
return PagerUtil.getPager(list, criteria);
|
|
return PagerUtil.getPager(list, criteria);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Pager<MaterialType> list(MaterialTypeQueryVo materialTypeQueryVo) {
|
|
|
|
+ MaterialTypeCriteria criteria = getCriteria(materialTypeQueryVo);
|
|
|
|
+ List<MaterialType> list = materialTypeMapper.selectByConditionList(criteria);
|
|
|
|
+ return PagerUtil.getPager(list, criteria);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private MaterialTypeCriteria getCriteria(MaterialTypeQueryVo materialTypeQueryVo) {
|
|
|
|
+ MaterialTypeCriteria criteria = new MaterialTypeCriteria();
|
|
|
|
+
|
|
|
|
+ criteria.setOrderByClause("sort desc");
|
|
|
|
+ if (!StringUtil.isEmpty(materialTypeQueryVo.getOrderByClause())) {
|
|
|
|
+ criteria.setOrderByClause(materialTypeQueryVo.getOrderByClause());
|
|
|
|
+ }
|
|
|
|
+ criteria.setPage(materialTypeQueryVo.getPage());
|
|
|
|
+ criteria.setLimit(materialTypeQueryVo.getLimit());
|
|
|
|
+ MaterialTypeCriteria.Criteria cri = criteria.createCriteria();
|
|
|
|
+ if (materialTypeQueryVo.getCode()!=null) {
|
|
|
|
+ cri.andCodeEqualTo(materialTypeQueryVo.getCode());
|
|
|
|
+ }
|
|
|
|
+ if (!StringUtil.isEmpty(materialTypeQueryVo.getName())) {
|
|
|
|
+ cri.andNameLike(materialTypeQueryVo.getName());
|
|
|
|
+ }
|
|
|
|
+ return criteria;
|
|
|
|
+ }
|
|
}
|
|
}
|