rev:物料编辑出错及基础分类异常
This commit is contained in:
@@ -38,7 +38,7 @@ public interface IBmClassStandardService extends IService<BmClassStandard> {
|
||||
List<Map> loadClass(Map whereJson);
|
||||
|
||||
|
||||
List<Map> queryClassBycode(Map whereJson);
|
||||
List<Map<String, Object>>queryClassBycode(Map<String, Object> whereJson);
|
||||
|
||||
List<Map> queryClassById(Map whereJson);
|
||||
|
||||
|
||||
@@ -97,25 +97,50 @@ public class BmClassStandardServiceImpl extends ServiceImpl<BmClassStandardMappe
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map> queryClassBycode(Map whereJson) {
|
||||
BmClassStandard classstandard = null;
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("parent_class_code"))) {
|
||||
classstandard = this.getOne(new QueryWrapper<BmClassStandard>().eq("class_code", whereJson.get("parent_class_code")));
|
||||
if (classstandard == null) {
|
||||
throw new BadRequestException("请输入正确的父节点编号!");
|
||||
public List<Map<String, Object>> queryClassBycode(Map<String, Object> whereJson) {
|
||||
Object parent_class_code = whereJson.get("parent_class_code");
|
||||
String parent_class_id = "0";
|
||||
if (!ObjectUtil.isEmpty(parent_class_code)) {
|
||||
LambdaQueryWrapper<BmClassStandard> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(BmClassStandard::getClass_code, parent_class_code.toString());
|
||||
BmClassStandard bmClassStandard = this.baseMapper.selectOne(lqw);
|
||||
if (bmClassStandard != null) {
|
||||
parent_class_id = bmClassStandard.getClass_id();
|
||||
}
|
||||
}
|
||||
QueryWrapper<BmClassStandard> query = new QueryWrapper<BmClassStandard>().eq("is_delete", false);
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("class_code"))) {
|
||||
query.in("class_code", whereJson.get("class_code"));
|
||||
LambdaQueryWrapper<BmClassStandard> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(BmClassStandard::getParent_class_id, parent_class_id);
|
||||
List<BmClassStandard> bmClassStandardsFather = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (BmClassStandard bmClassStandard : bmClassStandardsFather) {
|
||||
List<Map<String, Object>> sonList = getSonList(bmClassStandard.getClass_id());
|
||||
Map<String, Object> node = new HashMap<>();
|
||||
node.put("id", bmClassStandard.getClass_id());
|
||||
node.put("label", bmClassStandard.getClass_name());
|
||||
node.put("hasChildren", CollectionUtils.isEmpty(sonList) ? false : true);
|
||||
node.put("leaf", CollectionUtils.isEmpty(sonList) ? false : true);
|
||||
node.put("children", sonList);
|
||||
result.add(node);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("parent_class_code")) && !whereJson.get("parent_class_code").equals("0")) {
|
||||
query.eq("class_id", classstandard.getClass_id());
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> getSonList(String parentClassId) {
|
||||
LambdaQueryWrapper<BmClassStandard> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(BmClassStandard::getParent_class_id, parentClassId);
|
||||
List<BmClassStandard> bmClassStandards = this.baseMapper.selectList(lambdaQueryWrapper);
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (BmClassStandard bmClassStandard : bmClassStandards) {
|
||||
List<Map<String, Object>> sonList = getSonList(bmClassStandard.getClass_id());
|
||||
Map<String, Object> node = new HashMap<>();
|
||||
node.put("id", bmClassStandard.getClass_id());
|
||||
node.put("label", bmClassStandard.getClass_name());
|
||||
node.put("hasChildren", CollectionUtils.isEmpty(sonList) ? false : true);
|
||||
node.put("leaf", CollectionUtils.isEmpty(sonList) ? false : true);
|
||||
node.put("children", sonList);
|
||||
result.add(node);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(whereJson.get("parent_class_code")) || whereJson.get("parent_class_code").equals("0")) {
|
||||
query.eq("parent_class_id", "0").or().isNull("parent_class_id");
|
||||
}
|
||||
return getMaps(this.listMaps(query));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,8 @@ package org.nl.wms.base_manage.material.service.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
@@ -123,6 +125,7 @@ public class MdMeMaterialbase implements Serializable {
|
||||
/**
|
||||
* 单重
|
||||
*/
|
||||
@TableField(insertStrategy = FieldStrategy.NEVER,updateStrategy = FieldStrategy.NEVER)
|
||||
private BigDecimal single_weight;
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,10 +15,12 @@ public class MaterialQuery extends BaseQuery<MdMeMaterialbase> {
|
||||
|
||||
|
||||
private String search;
|
||||
private String material_type_id;
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("search", QParam.builder().k(new String[]{"material_code","material_name"}).type(QueryTEnum.EQ).build());
|
||||
super.doP.put("material_type_id", QParam.builder().k(new String[]{"material_type_id"}).type(QueryTEnum.EQ).build());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user