给商品相关的模块优化接口

This commit is contained in:
jishenghua
2025-02-23 14:49:34 +08:00
parent db090f8dd5
commit 8e3a971a04
30 changed files with 413 additions and 714 deletions

View File

@@ -6,6 +6,7 @@ import com.jsh.erp.datasource.entities.MaterialExtend;
import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
import com.jsh.erp.service.materialExtend.MaterialExtendService;
import com.jsh.erp.utils.BaseResponseInfo;
import com.jsh.erp.utils.ErpInfo;
import com.jsh.erp.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -20,6 +21,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
import static com.jsh.erp.utils.ResponseJsonUtil.returnStr;
/**
* @author jijiaqing
*/
@@ -31,12 +35,57 @@ public class MaterialExtendController {
@Resource
private MaterialExtendService materialExtendService;
@GetMapping(value = "/info")
@ApiOperation(value = "根据id获取信息")
public String getList(@RequestParam("id") Long id,
HttpServletRequest request) throws Exception {
MaterialExtend materialExtend = materialExtendService.getMaterialExtend(id);
Map<String, Object> objectMap = new HashMap<>();
if(materialExtend != null) {
objectMap.put("info", materialExtend);
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
@PostMapping(value = "/add")
@ApiOperation(value = "新增")
public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int insert = materialExtendService.insertMaterialExtend(obj, request);
return returnStr(objectMap, insert);
}
@PutMapping(value = "/update")
@ApiOperation(value = "修改")
public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int update = materialExtendService.updateMaterialExtend(obj, request);
return returnStr(objectMap, update);
}
@DeleteMapping(value = "/delete")
@ApiOperation(value = "删除")
public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialExtendService.deleteMaterialExtend(id, request);
return returnStr(objectMap, delete);
}
@DeleteMapping(value = "/deleteBatch")
@ApiOperation(value = "批量删除")
public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int delete = materialExtendService.batchDeleteMaterialExtendByIds(ids, request);
return returnStr(objectMap, delete);
}
@GetMapping(value = "/getDetailList")
@ApiOperation(value = "价格信息列表")
public BaseResponseInfo getDetailList(@RequestParam("materialId") Long materialId,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<String, Object>();
try {
List<MaterialExtendVo4List> dataList = new ArrayList<MaterialExtendVo4List>();
if(materialId!=0) {