Commit 3e39bf39 authored by 赵啸非's avatar 赵啸非

添加材料分类字段

parent 6ae3e085
package com.mortals.xhx.module.datum.service.impl; package com.mortals.xhx.module.datum.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.mortals.xhx.module.matter.model.MatterCategoryEntity;
import com.mortals.xhx.module.matter.service.MatterCategoryService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -7,15 +14,36 @@ import com.mortals.xhx.module.datum.dao.DatumCategoryDao; ...@@ -7,15 +14,36 @@ import com.mortals.xhx.module.datum.dao.DatumCategoryDao;
import com.mortals.xhx.module.datum.model.DatumCategoryEntity; import com.mortals.xhx.module.datum.model.DatumCategoryEntity;
import com.mortals.xhx.module.datum.service.DatumCategoryService; import com.mortals.xhx.module.datum.service.DatumCategoryService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
/** /**
* DatumCategoryService * DatumCategoryService
* 材料分类 service实现 * 材料分类 service实现
* *
* @author zxfei * @author zxfei
* @date 2023-06-21 * @date 2023-06-21
*/ */
@Service("datumCategoryService") @Service("datumCategoryService")
@Slf4j @Slf4j
public class DatumCategoryServiceImpl extends AbstractCRUDServiceImpl<DatumCategoryDao, DatumCategoryEntity, Long> implements DatumCategoryService { public class DatumCategoryServiceImpl extends AbstractCRUDServiceImpl<DatumCategoryDao, DatumCategoryEntity, Long> implements DatumCategoryService {
@Autowired
private MatterCategoryService matterCategoryService;
@Override
protected void validData(DatumCategoryEntity entity, Context context) throws AppException {
updateCategoryName(entity);
log.info("validData:{}", JSONObject.toJSONString(entity));
}
private void updateCategoryName(DatumCategoryEntity entity) {
if (!ObjectUtils.isEmpty(entity.getCategoryId())) {
MatterCategoryEntity matterCategoryEntity = matterCategoryService.get(entity.getCategoryId());
if (!ObjectUtils.isEmpty(matterCategoryEntity)) {
entity.setCategoryName(matterCategoryEntity.getCategoryName());
}
}
}
} }
\ 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