String expenseIds = resourceRequest.getParameter("expenseIds");
JSONArray expenseArray = JSONFactoryUtil.createJSONArray(expenseIds);
LOG.info("JSON ARRAY" + expenseArray);
if (Validator.isNotNull(expenseIds)) {
for (int i = 0; i < expenseArray.length(); i++) {
LOG.info("Expense Id"+expenseArray.getInt(i));
}
这是我的代码,我可以获得expenseIds。我想使用数组ID
更新特定字段答案 0 :(得分:0)
Liferay使用ORM,这意味着您在service.xml中定义对象,并作为构建过程的一部分,Liferay创建对象,持久层和用于访问该持久层的实用工具方法。
假设您有一个费用对象,定义如下
<service-builder package-path="com.latham.request">
<entity name="Expense" local-service="true" remote-service="true">
<column name="expenseId" type="long" primary="true" />
</entity>
</service-builder>
要更新您基本上会执行以下操作
Expense e = ExpenseLocalServiceUtil.getExpense(id);
e.setWhateverAttribute("helloWhateverAttribute");
ExpenseLocalServiceUtil.updateExpense(e);