增加批量更新商品信息的接口
This commit is contained in:
@@ -624,4 +624,24 @@ public class MaterialController {
|
|||||||
return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
|
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;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user