Commit 2c21cd50 authored by 赵啸非's avatar 赵啸非

添加材料分类字段

parent 5ce2b0ae
...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.datum.service.impl; ...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.datum.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.mortals.xhx.module.datum.model.DatumCategoryQuery;
import com.mortals.xhx.module.matter.model.MatterCategoryEntity; import com.mortals.xhx.module.matter.model.MatterCategoryEntity;
import com.mortals.xhx.module.matter.service.MatterCategoryService; import com.mortals.xhx.module.matter.service.MatterCategoryService;
import org.checkerframework.checker.units.qual.A; import org.checkerframework.checker.units.qual.A;
...@@ -37,6 +38,13 @@ public class DatumCategoryServiceImpl extends AbstractCRUDServiceImpl<DatumCateg ...@@ -37,6 +38,13 @@ public class DatumCategoryServiceImpl extends AbstractCRUDServiceImpl<DatumCateg
log.info("validData:{}", JSONObject.toJSONString(entity)); log.info("validData:{}", JSONObject.toJSONString(entity));
} }
@Override
protected void saveBefore(DatumCategoryEntity entity, Context context) throws AppException {
//判读添加的材料 是否已经存在
super.saveBefore(entity, context);
}
private void updateCategoryName(DatumCategoryEntity entity) { private void updateCategoryName(DatumCategoryEntity entity) {
if (!ObjectUtils.isEmpty(entity.getCategoryId())) { if (!ObjectUtils.isEmpty(entity.getCategoryId())) {
MatterCategoryEntity matterCategoryEntity = matterCategoryService.get(entity.getCategoryId()); MatterCategoryEntity matterCategoryEntity = matterCategoryService.get(entity.getCategoryId());
......
package com.mortals.xhx.module.datum.web; package com.mortals.xhx.module.datum.web;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.datum.model.DatumCategoryQuery;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -46,4 +49,18 @@ public class DatumCategoryController extends BaseCRUDJsonBodyMappingController<D ...@@ -46,4 +49,18 @@ public class DatumCategoryController extends BaseCRUDJsonBodyMappingController<D
} }
@Override
protected void batchSaveBefore(List<DatumCategoryEntity> list, Map<String, Object> model, Context context) throws AppException {
super.batchSaveBefore(list, model, context);
for (DatumCategoryEntity entity : list) {
DatumCategoryQuery datumCategoryQuery = new DatumCategoryQuery();
datumCategoryQuery.setMaterialId(entity.getMaterialId());
datumCategoryQuery.setCategoryId(entity.getCategoryId());
DatumCategoryEntity datumCategoryEntity = this.service.selectOne(datumCategoryQuery, context);
if(!ObjectUtils.isEmpty(datumCategoryEntity)){
entity.setId(datumCategoryEntity.getId());
}
}
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment