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

产品模块增加参数校验

parent 9050bcae
......@@ -3,6 +3,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
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.model.ProductAppsEntity;
import com.mortals.xhx.module.product.model.ProductEntity;
......@@ -29,6 +30,19 @@ public class ProductAppsServiceImpl extends AbstractCRUDServiceImpl<ProductAppsD
@Autowired
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
protected ProductAppsEntity findBefore(ProductAppsEntity params, PageInfo pageInfo, Context context) throws AppException {
if(params.getProductId()==null) {
......
package com.mortals.xhx.module.product.service.impl;
import com.mortals.framework.util.StringUtils;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -15,5 +16,14 @@ import com.mortals.xhx.module.product.service.ProductDocumentService;
*/
@Service("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;
import com.mortals.framework.util.StringUtils;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -15,5 +16,17 @@ import com.mortals.xhx.module.product.service.ProductInterfaceService;
*/
@Service("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