Commit 46eca9c4 authored by 季圣华's avatar 季圣华
Browse files

增加批量更新商品信息的接口

parent ad9ee39c
......@@ -624,4 +624,24 @@ public class MaterialController {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
/**
* 批量更新商品信息
* @param jsonObject
* @param request
* @return
* @throws Exception
*/
@PostMapping(value = "/batchUpdate")
@ApiOperation(value = "批量更新商品信息")
public String batchUpdate(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Map<String, Object> objectMap = new HashMap<>();
int res = materialService.batchUpdate(jsonObject);
if(res > 0) {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} else {
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
}
}
}
......@@ -1080,4 +1080,14 @@ public class MaterialService {
}
return res;
}
public int batchUpdate(JSONObject jsonObject) {
String ids = jsonObject.getString("ids");
String materialStr = jsonObject.getString("material");
List<Long> idList = StringUtil.strToLongList(ids);
Material material = JSONObject.parseObject(materialStr, Material.class);
MaterialExample example = new MaterialExample();
example.createCriteria().andIdIn(idList).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
return materialMapper.updateByExampleSelective(material, example);
}
}
Supports Markdown
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