给商品相关的模块优化接口
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
package com.jsh.erp.service.materialAttribute;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jsh.erp.service.ICommonQuery;
|
||||
import com.jsh.erp.utils.Constants;
|
||||
import com.jsh.erp.utils.QueryUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service(value = "materialAttribute_component")
|
||||
@MaterialAttributeResource
|
||||
public class MaterialAttributeComponent implements ICommonQuery {
|
||||
|
||||
@Resource
|
||||
private MaterialAttributeService materialAttributeService;
|
||||
|
||||
@Override
|
||||
public Object selectOne(Long id) throws Exception {
|
||||
return materialAttributeService.getMaterialAttribute(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<?> select(Map<String, String> map)throws Exception {
|
||||
return getMaterialList(map);
|
||||
}
|
||||
|
||||
private List<?> getMaterialList(Map<String, String> map) throws Exception{
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String attributeName = StringUtil.getInfo(search, "attributeName");
|
||||
return materialAttributeService.select(attributeName, QueryUtils.offset(map), QueryUtils.rows(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long counts(Map<String, String> map)throws Exception {
|
||||
String search = map.get(Constants.SEARCH);
|
||||
String attributeField = StringUtil.getInfo(search, "attributeField");
|
||||
return materialAttributeService.countMaterialAttribute(attributeField);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insert(JSONObject obj, HttpServletRequest request) throws Exception{
|
||||
return materialAttributeService.insertMaterialAttribute(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
return materialAttributeService.updateMaterialAttribute(obj, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(Long id, HttpServletRequest request)throws Exception {
|
||||
return materialAttributeService.deleteMaterialAttribute(id, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(String ids, HttpServletRequest request)throws Exception {
|
||||
return materialAttributeService.batchDeleteMaterialAttribute(ids, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsNameExist(Long id, String name)throws Exception {
|
||||
return materialAttributeService.checkIsNameExist(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.jsh.erp.service.materialAttribute;
|
||||
|
||||
import com.jsh.erp.service.ResourceInfo;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author jishenghua qq752718920 2021-07-21 22:26:27
|
||||
*/
|
||||
@ResourceInfo(value = "materialAttribute")
|
||||
@Inherited
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface MaterialAttributeResource {
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.jsh.erp.datasource.mappers.MaterialAttributeMapperEx;
|
||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
||||
import com.jsh.erp.exception.JshException;
|
||||
import com.jsh.erp.service.log.LogService;
|
||||
import com.jsh.erp.utils.PageUtils;
|
||||
import com.jsh.erp.utils.StringUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -19,9 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class MaterialAttributeService {
|
||||
@@ -59,27 +58,17 @@ public class MaterialAttributeService {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<MaterialAttribute> select(String attributeName, int offset, int rows)
|
||||
throws Exception{
|
||||
public List<MaterialAttribute> select(String attributeName) throws Exception{
|
||||
List<MaterialAttribute> list = new ArrayList<>();
|
||||
try{
|
||||
list = materialAttributeMapperEx.selectByConditionMaterialAttribute(attributeName, offset, rows);
|
||||
PageUtils.startPage();
|
||||
list = materialAttributeMapperEx.selectByConditionMaterialAttribute(attributeName);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public Long countMaterialAttribute(String attributeField)throws Exception {
|
||||
Long result =null;
|
||||
try{
|
||||
result= 5L;
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int insertMaterialAttribute(JSONObject obj, HttpServletRequest request)throws Exception {
|
||||
MaterialAttribute m = JSONObject.parseObject(obj.toJSONString(), MaterialAttribute.class);
|
||||
|
||||
Reference in New Issue
Block a user