这篇博文来介绍一下ofbiz对数据的修改操作
正文:
- 编写service类,对数据库进行持久化操作
public static Map<String, Object> updateUser(DispatchContext ctx, Map<String, ? extends Object> context){
Map<String, Object> result = ServiceUtil.returnSuccess();
GenericDelegator delegator = ctx.getDelegator();
//添加需要修改的字段
Map<String,Object> updateFields = FastMap.newInstance();
updateFields.put("username", context.get("username"));
updateFields.put("password", context.get("password"));
updateFields.put("nickname", context.get("nickname"));
/*.... 如果有其它字段需要修改, 还可以继续把要修改的值放到updateFields中.*/
//设置修改条件
EntityCondition updateCon = EntityCondition.makeCondition("id", EntityComparisonOperator.EQUALS, context.get("id"));
try