FormDataSource
beforeInitRecord
beforeInitRecord 方法在每个用户端 画面上新增对应数据源记录之前触发此方法 一般用于在初始化记录时设置一些默认值(例如:对记录的日期字段和时间字段赋当前时间)
方法签名
protected void beforeInitRecord(CommandArg arg, GongqiRecord record)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
- GongqiRecord record:当前记录
示例代码
@Override
protected void beforeInitRecord(CommandArg arg, GongqiRecord record) {
//设置记录初始值
record.setSubmitDate(SysDateHelper.today());
record.setSubmitTime(SysTimeHelper.now());
}
[!IMPORTANT]
Table上的init方法也存在时,新增记录先调用FormDatasource上的beforeInitRecord方法,再调用Table上的init方法 在调用 afterInitRecord
afterInitRecord
afterInitRecord方法在每个用户端 画面上新增对应数据源记录之后触发此方法 一般用于在初始化记录时设置一些默认值
方法签名
protected CommandResult afterInitRecord(CommandArg arg, GongqiRecord record)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
- GongqiRecord record:当前记录
示例代码
@Override
protected CommandResult afterInitRecord(CommandArg arg, GongqiRecord record) {
ProdReportProdLine line = (ProdReportProdLine)record;
//判断打开画面
if(GOTHelper.getEntityId(Form_ProdInstruction.class).equals(arg0.formParam.callerFormId)) {
//获取关联表的记录
ProdInstruction instruction = (ProdInstruction) arg0.getJoinGroupRecordOrig();
if (instruction != null) {
//设置 记录字段值
line.setProdInstructionId(instruction.getProdInstructionId());
line.setGoodQty(instruction.getRemainQty());
line.setGoodQtyST(instruction.getRemainQtyST());
}
}
return super.afterInitRecord(arg, record);
}
beforeSaveRecord
beforeSaveRecord方法在每个用户端 在画面上保存记录之前触发此方法。一般用于在保存记录时对记录中一些信息的补充
方法签名
protected void beforeSaveRecord(CommandArg arg, GongqiRecord record)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
- GongqiRecord record:当前记录
示例代码
@Override
protected void beforeSaveRecord(CommandArg arg, GongqiRecord record) {
SuperItemTable item = (SuperItemTable)record;
//根据 record 获取 ItemTable
ItemTable it = ItemTable.util.find(ItemTable.class,item.getItemId(),false);
if(it != null){
item.setItemName(it.getItemName());
}
super.beforeSaveRecord(arg, record);
}
afterSaveRecord
afterSaveRecord方法在每个用户端 在画面上保存记录之后触发此方法。一般用于在保存记录后对关联记录进行操作
方法签名
protected void afterSaveRecord(CommandArg arg, GongqiRecord record)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
- GongqiRecord record:当前记录
示例代码
@Override
protected CommandResult afterSaveRecord(CommandArg arg, GongqiRecord record) {
CommandResult result = new CommandResult();
CoatingFormulaTable coatingFormulaTable = (CoatingFormulaTable) record;
//根据 record 获取到 关联的 CoatingFormulaLine 记录
List<CoatingFormulaLine> coatingFormulaLineList =
CoatingFormulaLine.util().findList(CoatingFormulaLine.class, coatingFormulaTable.getRecId(), true);
for (CoatingFormulaLine coatingFormulaLine : coatingFormulaLineList) {
coatingFormulaLine.setNewMaterialWeight(FormulaClass.util()
.calcNewMaterialWeight(coatingFormulaLine.getMainFormula(),
coatingFormulaTable.getNewMaterialRatio()));
coatingFormulaLine.update();
}
//刷新指定数据源的当前选中记录
result.recordRestore().setGroup(Form_CoatingFormulaTable.__DS_CoatingFormulaLine);
return result;
}
beforeExecuteQuery
beforeExecuteQuery方法在每个用户端执行数据加载时执行,常用于在查询前对查询条件进行调整(例如:基于不同用户角 色的数据权限)。方法入参的QueryTable为画面数据源组的CurrentQuery,相较于afterlnit、pluginTreeSelectchang等form二次开发方法改变queryTable过滤相比,beforeExecuteQuery在这些方法的queryTable之后 且 beforeExecuteQuery对于queryTable的更改,不返回到用户端(即:强制过滤) protected 后,且beforeexecutequery方法对于queryTable的更改,不返回到用户端(即:强制过滤)。
方法签名
protected void beforeExecuteQuery(CommandArg arg, QueryTable queryTable)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
- GongqiRecord record:画面查询记录集合
示例代码
@Override
protected void beforeExecuteQuery(CommandArg arg, QueryTable queryTable) {
//把过滤条件清除
queryTable.queryWhere.clear();
//根据父画面的不同 设置不同的 过滤条件
if(arg.formParam.callerMenuItemId.equals(GOTHelper.getEntityId(MenuItem_SalesProcessDesign.class))){
//设置 过滤条件 并且设置该条件 可看不可编辑
queryTable.findOrCreateWhereItem(SalesProcessDesign._SalesKey,
QueryWhereStatus.Lock).setValue(arg.formParam.paramString);
} else if (arg.formParam.callerMenuItemId.equals(GOTHelper.getEntityId(MenuItem_ProdRequire.class))) {
ProdRequire pr = (ProdRequire) arg.getJoinGroupRecordOrig();
if (pr == null || StringHelper.isBlank(pr.getSalesKey())) {
queryTable.findOrCreateWhereItem(SalesProcessDesign._RecVersion,
QueryWhereStatus.Lock).setValue(-1L);
} else {
queryTable.findOrCreateWhereItem(SalesProcessDesign._SalesKey,
QueryWhereStatus.Lock).setValue(pr.getSalesKey());
}
} else if (arg.formParam.callerMenuItemId
.equals(GOTHelper.getEntityId(MenuItem_MasterScheduleTable.class))) {
MasterScheduleTable mst = (MasterScheduleTable) arg.getJoinGroupRecordOrig();
if (mst == null || StringHelper.isBlank(mst.getSalesKey())) {
queryTable.findOrCreateWhereItem(SalesProcessDesign._RecVersion,
QueryWhereStatus.Lock).setValue(-1L);
} else {
queryTable.findOrCreateWhereItem(SalesProcessDesign._SalesKey,
QueryWhereStatus.Lock).setValue(mst.getSalesKey());
}
}
}
afterExecuteQuery
afterExecuteQuery方法在每个用户端 在画面上刷新记录之后触发此方法
方法签名
protected CommandResult afterExecuteQuery(CommandArg arg, List dataList)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
- GongqiRecord record:画面查询记录集合
示例代码
protected CommandResult afterExecuteQuery(CommandArg arg, List dataList) {
CommandResult result = new CommandResult();
//从客户端ContextMap 中 获取到之前存储的 uu
String uuid = (String) arg.getContextMap(uuidKey());
String tableId = formDataSource.tableId;
String mapKey = mapKey(uuid, tableId);
//从全局的 map 里面 根据 key 获取到 list 数据
List<GongqiRecord> records = executeQueryMap.get(mapKey);
executeQueryMap.remove(mapKey);
String dataSource = formDataSource.alias;
//使用命令 清空临时表
result.tmpRecordClear().setGroup(dataSource);
//使用命令 给临时表添加数据
result.tmpRecordAdd(records).setGroup(dataSource);
return result;
}
beforeDeleteRecord
beforeDeleteRecord方法在每个用户端画面上删除记录之前触发此方法。一般用于在删除记录时做一些额外的操作
方法签名
protected void beforeDeleteRecord(CommandArg arg, GongqiRecord record)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
- GongqiRecord record:画面查询记录集合
示例代码
@Override
protected void beforeDeleteRecord(CommandArg arg, GongqiRecord record) {
SalesTable table = (SalesTable)record;
List<SalesLine> lines = (List<SalesLine>)SalesLine.util().findListBySalesId(SalesLine.class,table.getSalesId(),true);
for(SalesLine line : lines){
line.delete();
}
}
afterDeleteRecord
afterDeleteRecord方法在每个用户端画面上删除记录之后触发此方法。一般用于在删除记录时做一些额外的操作
方法签名
protected CommandResult afterDeleteRecord(CommandArg arg, GongqiRecord record)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
- GongqiRecord record:画面查询记录集合
示例代码
@Override
protected CommandResult afterDeleteRecord(CommandArg arg, GongqiRecord record) {
CommandResult result = new CommandResult();
//根据arg 调用util方法 获取 到 formUUID
String formUUID = FormUUIDClass.util().findOrCreateFormUUID(arg, result);
//根据 UUID 获取到 SalesPackingLineTemp 数据
List< SalesPackingLineTemp> allPackingLineTemps = NewDeliveryNoticeUtil.util()
.findSalesPackingLineTemps(SalesPackingLineTemp.class, formUUID);
SalesPackingLineTemp packingLineTemp = (SalesPackingLineTemp) record;
//开启事务
GongqiSession.ttsbegin();
//根据arg 获取到指定数据源的 当前选中记录
DeliverNoticeLineTemp deliverNoticeLineTemp = (DeliverNoticeLineTemp) arg
.getGroupInfo(Form_Fetch_PackDeliverNoticeLine.__DS_DeliverNoticeLineTemp).getCurrentRecord();
deliverNoticeLineTemp = DAOHelper.findByRecId(DeliverNoticeLineTemp.class,
deliverNoticeLineTemp.getRecId(),true);
// 删除明细行对应的发货通知单行(需要更新提取数量的明细行)
BigDecimal currentFetchQty = allPackingLineTemps.stream()
.filter(line -> line.getRecId() != packingLineTemp.getRecId())
.map(l -> l.getQty()).reduce(BigDecimal.ZERO, (q, q2) -> q.add(q2));
deliverNoticeLineTemp.setCurrentFetchQty(currentFetchQty);
deliverNoticeLineTemp.calcRemainFetchQty(currentFetchQty);
deliverNoticeLineTemp.doUpdate();
GongqiSession.ttscommit();
//刷新指定数据的 当前记录
result.doRecordRestore().setGroup(Form_Fetch_PackDeliverNoticeLine.__DS_DeliverNoticeLineTemp);
return result;
}
modifiedField_
modifiedField_ 方法在每个用户端画面有数据有字段变更值时会触发此方法。常用于某字段值变更时,记录的其他字段值也相应变更
方法签名
//下划线(_) 后面 数据源字段的名字(英文)
//注意 当 数据源字段是 PLG 层创建字段时 如 gongqi.df.fetchSales的 name 字段 则是:
// modifiedField_gongqi_df_fetchSales$Name
public void modifiedField_(CommandArg arg, Object oldValue, Object newValue, GongqiRecord baseRecord,
GongqiRecord joinRecord, CommandResult result)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
- Object oldValue:变更前的值
- Object newValue:变更后的值
- GongqiRecord baseRecord:修改的当前记录
- GongqiRecord joinRecord:如果变更的字段有下拉选择,则joinRecord是选择的那条记录
- CommandResult result:CommandResult命令
示例代码
public void modifiedField_Name(CommandArg arg, Object oldValue, Object newValue, GongqiRecord baseRecord,
GongqiRecord joinRecord, CommandResult result) {
ProdRequire prodRequire = (ProdRequire) baseRecord;
String itemDim_Config = EntClass.util().joinItemDim_Config(prodRequire.getItemId(), prodRequire.getItemCode(), prodRequire.getItemDimConfigId_Config(), prodRequire.getItemDimConfigId_DesignRequire(), prodRequire.getItemDimConfigId_EmbossedPattern(),
prodRequire.getItemDimConfigId_FormulaRequire(), prodRequire.getItemDimConfigId_Grade(), prodRequire.getItemDimConfigId_SoftHardness(),
prodRequire.getItemDimConfigId_StandardRollLength(), prodRequire.getItemDimConfigId_Thickness());
prodRequire.getItemDim().setConfig(itemDim_Config);
}
dataMethod_
dataMethod_ 方法在每个用户端打开画面时,有DataMethod字段的每条记录都会触发一次此方法。一般用于给DataMethod字段设置值
dataMethod 是虚拟列或计算列,用于根据数据航计算,例如:根据交期与当前日期对比展示是否超期
方法签名
//下划线(_) 后面 数据源DataMethod字段的名字(英文)
//注意 当 数据源字段是 PLG 层创建字段时 如 gongqi.df.fetchSales的 name 字段 则是:
// dataMethod_gongqi_df_fetchSales$Name
public Object dataMethod_(GongqiRecord record)
方法入参
- GongqiRecord record:对应记录
示例代码
public Object dataMethod_Content(GongqiRecord record) {
ProdTable prodTable = (ProdTable) record;
if(prodTable != null) {
if(SysDateHelper.today().compareTo(ProdTable.getDivDate())>0){
return "超期";
}
}
return "";
}
openLookup_
openLookup_方法在每个用户端画面上有数据源的Editor打开下拉列表时触发此方法。一般用于控制下拉列表中显示的列数(也可以是自定义下拉画面)以及返回方式
方法签名
//下划线(_) 后面 数据源字段的名字(英文)
//注意 当 数据源字段是 PLG 层创建字段时 如 gongqi.df.fetchSales的 name 字段 则是:
// openLookup__gongqi_df_fetchSales$Name
public CommandResult openLookup_(CommandArg arg)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
示例代码
public CommandResult openLookup_CourseId(CommandArg arg) {
CommandResult result = new CommandResult();
FormLookup formLookup = new FormLookup ();
formLookup.addColumn (Course . _CourseId ).setDisplayLength ( 10 );
formLookup.addColumn (Course . _CourseName ).setWidth ( 10 );
result.openLookup (formLookup );
return result;
}
lookup_
lookup_方法在每个用户端画面上有数据源的Editor打开下拉列表后触发此方法。一般用于控制下拉列表中显示的列数(也可以是自定义下拉画面)以及返回方式
方法签名
//下划线(_) 后面 数据源字段的名字(英文)
public void lookup_ProcessId(CommandArg arg, GongqiRecord baseRecord, QueryTable qt, FormDataSourceGroupResult result)
方法入参
CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置:prefetch=false, editors=none, groups=none, joinGroup=no
GongqiRecord baseRecord:主画面记录
- QueryTable qt:下拉画面对应的查询对象 QueryTable
- FormDataSourceGroupResult result:返回给客户端的 CommandResult 一般用 setResult方法直接给下拉列表赋值
示例代码
//根据baseRecord 记录的值 去 修改QueryTable 从而达到过滤数据
public void lookup_ProcessId(CommandArg arg, GongqiRecord baseRecord, QueryTable qt, FormDataSourceGroupResult result) {
CoatingFormulaTable coatingFormulaTable = (CoatingFormulaTable) baseRecord;
Set<String> salesRouteProcessIdList = new HashSet<>();
List<SalesRoute> salesRouteList = SalesRoute.util().findList(SalesRoute.class, coatingFormulaTable.getSalesKey(), false);
for (SalesRoute salesRoute : salesRouteList) {
salesRouteProcessIdList.add(salesRoute.getProcessId());
}
if (salesRouteProcessIdList.size() > 0) {
qt.findOrCreateWhereItem(CoatingFormulaTable._ProcessId).setValue("#in(" + salesRouteProcessIdList.toString().replace("[", "").replace("]", "") + ")");
} else {
qt.findOrCreateWhereItem(CoatingFormulaTable._ProcessId).setValue("''");
}
}
mainForm_
mainForm_ 方法在每个用户端画面上有数据源的Editor进入主表时触发此方法。可用于根据情况进入不同的主表画面
方法签名
//下划线(_) 后面 数据源字段的名字(英文)
public OpenMainFormArg mainForm_(CommandArg arg, OpenMainFormArg openMainFormArg) {
方法入参
CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
OpenMainFormArg openMainFormArg:进入主表窗体参数可对里面的属性进行配置 如menuItemId 等
示例代码
public OpenMainFormArg mainForm_Name(CommandArg arg, OpenMainFormArg openMainFormArg) {
if(UserSession.current().getUserGroups().contains("仓库管理")) {
//指定跳转画面的 menuItemId
openMainFormArg.menuItemId =GOTHelper.getEntityId (MenuItem_InverntManage.class)
}else {
//指定跳转画面的 menuItemId
openMainFormArg.menuItemId =GOTHelper.getEntityId (MenuItem_InverntUserManage.class)
}
return openMainFormArg;
}
dataTip_
dataTip_方法在每个用户端在有数据源的Editor标悬停时触发,一般于获取鼠标悬停时显示的文本
方法签名
//下划线(_) 后面 数据源字段的名字(英文)
public String dataTip_(CommandArg arg)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
示例代码
public String dataTip_Name(CommandArg arg) {
return arg.getCurrentRecord().getFieldValue("name").toString();
}
activeRecord
activeRecord方法在每个用户端画面上切换数据源记录时触发此方法。一般用于根据记录的数据不同去修改编辑性
方法签名
public CommandResult activeRecord(CommandArg arg)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
示例代码
@Override
public CommandResult activeRecord(CommandArg arg) {
CommandResult result = new CommandResult();
//使用 result updateControlAllowEdit命令 更改画面元素的可编辑性
result.updateControlAllowEdit(Form_IPC._ProdTableStart, false);
result.updateControlAllowEdit(Form_IPC._ProdTableComplete, false);
result.updateControlAllowEdit(Form_IPC._Button_Stop, false);
result.updateControlAllowEdit(Form_IPC._Button_ReStop, false);
//使用 result updateControlVisible命令 更改画面元素的可见性
result.updateControlVisible(Form_IPC._ProdTableStart, false);
result.updateControlVisible(Form_IPC._ProdTableComplete, false);
result.updateControlVisible(Form_IPC._Button_Stop, false);
result.updateControlVisible(Form_IPC._Button_ReStop, false);
//获取指定数据源的选中记录
ProdTable prodTable = (ProdTable) arg.getGroupInfo(Form_IPC.__DS_ProdTable).getCurrentRecord();
if (prodTable != null) {
if (!prodTable.getIsStop()) {
result.updateControlAllowEdit(Form_IPC._Button_Stop, true);
result.updateControlVisible(Form_IPC._Button_Stop, true);
} else {
result.updateControlAllowEdit(Form_IPC._Button_ReStop, true);
result.updateControlVisible(Form_IPC._Button_ReStop, true);
}
if(prodTable.getProdStatus() == ProdStatus.Started) {
result.updateControlAllowEdit(Form_IPC._ProdTableComplete, true);
result.updateControlVisible(Form_IPC._ProdTableComplete, true);
}else {
result.updateControlAllowEdit(Form_IPC._ProdTableStart, true);
result.updateControlVisible(Form_IPC._ProdTableStart, true);
}
if (prodTable.getIsSampling()) {
result.updateControlVisible(Form_IPC._ProdTable_IsSampling, true);
result.updateControlVisible(Form_IPC._Button_OpenSamplingReason, true);
} else {
result.updateControlVisible(Form_IPC._ProdTable_IsSampling, false);
result.updateControlVisible(Form_IPC._Button_OpenSamplingReason, false);
}
if (prodTable.getIsStop()) {
result.updateControlVisible(Form_IPC._ProdTable_IsStop, true);
} else {
result.updateControlVisible(Form_IPC._ProdTable_IsStop, false);
}
}
return result;
}
[!IMPORTANT]
打开画面时就会第一次触发此方法 这时候获取的CurrentRecord 一定是null 注意判空
clientActiveRecord
clientActiveRecord方法在每个用户端 在画面上切换记录时触发此方法。常用于切换记录时,根据记录中的某些字段值控制画面上某些控件的编辑性
方法签名
public CommandResult clientActiveRecord(CommandArg arg)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
示例代码
@Override
public CommandResult clientActiveRecord(CommandArg arg) {
CommandResult result = new CommandResult();
//使用 result updateControlAllowEdit命令 更改画面元素的可编辑性
result.updateControlAllowEdit(Form_IPC._Button_ReStop, true);
//使用 result updateControlVisible命令 更改画面元素的可见性
result.updateControlVisible(Form_IPC._ProdTableStart, true);
return result;
}
[!IMPORTANT]
但是除了第一次打开画面时会调用服务端写的clientActiveRecord方法外,这个方法中会保存在客户端,以后切换记录时只会直接使用保存在客户端的方法而不再调用服务端的方法
attachmentUpload
attachmentUpload方法在每个用户端上传附件时触发
方法签名
public CommandResult attachmentUpload(CommandArg arg, String attachmentName)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
- String attachmentName :附件名称
示例代码
@Override
public CommandResult attachmentUpload(CommandArg arg, String attachmentName) {
CommandResult result = new CommandResult();
//获取指定数据源的选中记录
CWBX_Info cwbx_Info=(CWBX_Info) arg.getGroupInfo(Form_Process_CWBX.__DS_CWBX_Info).getCurrentRecord();
if(StringHelper.isNotBlank(attachmentName)) {
GongqiSession.ttsbegin();
//根据 currentRecord 去 从数据源查找其他记录
CWBX_Info findByRecId = DAOHelper.findByRecId(CWBX_Info.class, cwbx_Info.getRecId(),true);
findByRecId.setCWBXFile(attachmentName);
findByRecId.doUpdate();
GongqiSession.ttscommit();
}
return result;
}
attachmentDelete
attachmentUpload方法在每个用户端上附件删除时触发
方法签名
public CommandResult attachmentDelete(CommandArg arg, String attachmentName)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
- String attachmentName :附件名称
示例代码
@Override
public CommandResult attachmentDelete(CommandArg arg, String attachmentName) {
CommandResult result = new CommandResult();
//获取指定数据源的选中记录
CWBX_Info cwbx_Info=(CWBX_Info) arg.getGroupInfo(Form_Process_CWBX.__DS_CWBX_Info).getCurrentRecord();
if(StringHelper.isNotBlank(attachmentName)) {
GongqiSession.ttsbegin();
CWBX_Info findByRecId = DAOHelper.findByRecId(CWBX_Info.class, cwbx_Info.getRecId(),true);
findByRecId.setCWBXFile("");
findByRecId.doUpdate();
GongqiSession.ttscommit();
}
return result;
}
attachmentRename
attachmentRename方法在每个用户端上附件重命名时触发
方法签名
public CommandResult attachmentRename(CommandArg arg, String originalName, String destName)
方法入参
- CommandArg arg:用户端上下文对象。
- 默认CommandArgOption配置: prefetch=false,editors=all,groups=current(cr,sr),joinGroup=yes
- String originalName:附件旧名称
- String destName:附件新名称
示例代码
@Override
public CommandResult attachmentRename(CommandArg arg, String originalName, String destName) {
CommandResult result = new CommandResult();
//获取指定数据源的选中记录
CWBX_Info cwbx_Info=(CWBX_Info) arg.getGroupInfo(Form_Process_CWBX.__DS_CWBX_Info).getCurrentRecord();
if(StringHelper.isNotBlank(destName)) {
GongqiSession.ttsbegin();
CWBX_Info findByRecId = DAOHelper.findByRecId(CWBX_Info.class, cwbx_Info.getRecId(),true);
findByRecId.setCWBXFile(destName);
findByRecId.doUpdate();
GongqiSession.ttscommit();
}
return result;
}