Commit ca8b11e9 authored by 廖旭伟's avatar 廖旭伟

产品模块增加参数校验

parent 9050bcae
...@@ -3,6 +3,7 @@ import com.mortals.framework.exception.AppException; ...@@ -3,6 +3,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.module.product.dao.ProductAppsDao; import com.mortals.xhx.module.product.dao.ProductAppsDao;
import com.mortals.xhx.module.product.model.ProductAppsEntity; import com.mortals.xhx.module.product.model.ProductAppsEntity;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
...@@ -29,6 +30,19 @@ public class ProductAppsServiceImpl extends AbstractCRUDServiceImpl<ProductAppsD ...@@ -29,6 +30,19 @@ public class ProductAppsServiceImpl extends AbstractCRUDServiceImpl<ProductAppsD
@Autowired @Autowired
private ProductService productService; private ProductService productService;
@Override
protected void validData(ProductAppsEntity entity, Context context) throws AppException {
if(entity.getProductId()==null){
throw new AppException("产品id不能为空");
}
if(StringUtils.isEmpty(entity.getAppName())){
throw new AppException("应用名称不能为空");
}
if(entity.getDeveLanguage()==null){
throw new AppException("开发语言不能为空");
}
}
@Override @Override
protected ProductAppsEntity findBefore(ProductAppsEntity params, PageInfo pageInfo, Context context) throws AppException { protected ProductAppsEntity findBefore(ProductAppsEntity params, PageInfo pageInfo, Context context) throws AppException {
if(params.getProductId()==null) { if(params.getProductId()==null) {
......
package com.mortals.xhx.module.product.service.impl; package com.mortals.xhx.module.product.service.impl;
import com.mortals.framework.util.StringUtils;
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;
...@@ -16,4 +17,13 @@ import com.mortals.xhx.module.product.service.ProductDocumentService; ...@@ -16,4 +17,13 @@ import com.mortals.xhx.module.product.service.ProductDocumentService;
@Service("productDocumentService") @Service("productDocumentService")
public class ProductDocumentServiceImpl extends AbstractCRUDServiceImpl<ProductDocumentDao, ProductDocumentEntity, Long> implements ProductDocumentService { public class ProductDocumentServiceImpl extends AbstractCRUDServiceImpl<ProductDocumentDao, ProductDocumentEntity, Long> implements ProductDocumentService {
@Override
protected void validData(ProductDocumentEntity entity, Context context) throws AppException {
if(entity.getProductId()==null){
throw new AppException("产品id不能为空");
}
if(StringUtils.isEmpty(entity.getDocName())){
throw new AppException("文档名称不能为空");
}
}
} }
\ No newline at end of file
package com.mortals.xhx.module.product.service.impl; package com.mortals.xhx.module.product.service.impl;
import com.mortals.framework.util.StringUtils;
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;
...@@ -16,4 +17,16 @@ import com.mortals.xhx.module.product.service.ProductInterfaceService; ...@@ -16,4 +17,16 @@ import com.mortals.xhx.module.product.service.ProductInterfaceService;
@Service("productInterfaceService") @Service("productInterfaceService")
public class ProductInterfaceServiceImpl extends AbstractCRUDServiceImpl<ProductInterfaceDao, ProductInterfaceEntity, Long> implements ProductInterfaceService { public class ProductInterfaceServiceImpl extends AbstractCRUDServiceImpl<ProductInterfaceDao, ProductInterfaceEntity, Long> implements ProductInterfaceService {
@Override
protected void validData(ProductInterfaceEntity entity, Context context) throws AppException {
if(entity.getProductId()==null){
throw new AppException("产品id不能为空");
}
if(StringUtils.isEmpty(entity.getInterfaceName())){
throw new AppException("接口名称不能为空");
}
if(StringUtils.isEmpty(entity.getVersionNumber())){
throw new AppException("版本号不能为空");
}
}
} }
\ 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