GongqiRecordHelper

工企记录处理类

getFieldValue(GongqiRecord, String)

根据传入的record对象 和 字段key 获取到对应字段的值

方法签名

gongqi.erp.gotmodel.table.GongqiRecordHelper.getFieldValue(GongqiRecord, String)

方法入参

  • GongqiRecord record:GongqiRecord 对象
  • String filedName:字段 一般为 字段引用 如 SysUser._UserId

示例代码

    public CommandResult buttonOK_Button(CommandArg arg) {
        CommandResult result = new CommandResult(); 
        //从 arg 里获取到当前选择记录对象
        GongqiRecord record = arg.getCurrentRecord();
        //使用 getFieldValue方法 获取到 userId的值
        Object value = GongqiRecordHelper.getFieldValue(record,SysUser._UserId)
        return result;
    }

setFieldValue(GongqiRecord, String, Object)

根据传入String key 和 Object Value 设置GongqiRecord对应字段的值

方法签名

gongqi.erp.gotmodel.table.GongqiRecordHelper.setFieldValue(GongqiRecord, String, Object)

方法入参

  • GongqiRecord record:GongqiRecord 对象
  • String filedName:字段 一般为 字段引用 如 SysUser._UserId
  • Object value:值

示例代码

    public CommandResult buttonOK_Button(CommandArg arg) {
        CommandResult result = new CommandResult(); 
        //从 arg 里获取到当前选择记录对象
        GongqiRecord record = arg.getCurrentRecord();
        //使用 getFieldValue方法 获取到 userId的值
        GongqiRecordHelper.setFieldValue(record,SysUser._UserId,"admin");
        //继续执行业务逻辑
        return result;
    }

listRecordRef(GongqiRecord, String)

根据传入的Record和字段 查找该字段在其他表内的引用

方法签名

gongqi.erp.gotmodel.table.GongqiRecordHelper.listRecordRef(GongqiRecord, String)

方法入参

  • GongqiRecord record:GongqiRecord 对象
  • String filedName:字段 一般为 字段引用 如 SysUser._UserId

示例代码

    public CommandResult buttonOK_Button(CommandArg arg) {
        CommandResult result = new CommandResult(); 
        //从 arg 里获取到当前选择记录对象
        GongqiRecord record = arg.getCurrentRecord();
        //使用 listRecordRef 获取到其他表内 userId 引用表中的值
        List<String> values = GongqiRecordHelper.listRecordRef(record,SysUser._UserId);
        //继续执行业务逻辑
        return result;
    }

updateRecordRef(GongqiRecord, String, String)

根据传入的Record和字段 查找该字段在其他表内的引用 然后 修改 其值变成新值

方法签名

gongqi.erp.gotmodel.table.GongqiRecordHelper.updateRecordRef(GongqiRecord, String, String)

方法入参

  • GongqiRecord record:GongqiRecord 对象
  • String filedName:字段 一般为 字段引用 如 SysUser._UserId
  • String string:新值

示例代码

    public CommandResult buttonOK_Button(CommandArg arg) {
        CommandResult result = new CommandResult(); 
        //从 arg 里获取到当前选择记录对象
        GongqiRecord record = arg.getCurrentRecord();
        //使用 updateRecordRef 修改引用 admin  变成 admin123
        GongqiRecordHelper.updateRecordRef(record,SysUser._UserId,"admin123");
        //继续执行业务逻辑
        return result;
    }

fetchNextNumSeq(String, GongqiRecord)

根据传入的编号序列ID 和 GongqiRecord对象获取到 下一个编号序列

方法签名

gongqi.erp.gotmodel.table.GongqiRecordHelper.fetchNextNumSeq(String, GongqiRecord)

方法入参

  • String NumSeqId:在编号序列表中的Id
  • GongqiRecord record:GongqiRecord 对象

示例代码

   //在表记录 init 的时候 根据 StudentID 编号序列的配置 设置 表Number字段为下一个编号序列值
    @Override
    public void init() {
        super.init();
        this.setNumber(GongqiRecordHelper.fetchNextNumSeq("StudentID", this));
    }

fetchNextNumSeqByMap(String, Map)

根据传入的map和字段 查找该字段在其他表内的引用 然后 修改 其值变成新值

方法签名

gongqi.erp.gotmodel.table.GongqiRecordHelper.fetchNextNumSeqByMap(String, Map<String, Object>)

方法入参

  • String NumSeqId:在编号序列表中的Id
  • Map map:map对象

示例代码

   // 根据 StudentID 编号序列的配置 设置 表Number字段为下一个编号序列值
    public CommandResult buttonOK_Button(CommandArg arg) {
        CommandResult result = new CommandResult(); 
        //从 arg 里获取到当前选择记录对象
        Student record = (Student)arg.getCurrentRecord();
        Map<String,Object> map = record.castToMap();
        //使用 updateRecordRef 修改引用 admin  变成 admin123
        GongqiSession.ttsbegin();
        Student newInstance = Student.newInstance();
        newInstance.init();
        newInstance.setNumber(GongqiRecordHelper.fetchNextNumSeqByMap("StudentID", map));
        newInstance.insert();
        GongqiSession.ttscommit();
        //继续执行业务逻辑
        return result;
    }

releaseNumSeq(String, GongqiRecord, String)

根据传入的编号序列ID GongqiRecord对象 和 编号序列值 释放该值

方法签名

gongqi.erp.gotmodel.table.GongqiRecordHelper.releaseNumSeq(String, GongqiRecord, String)

方法入参

  • String NumSeqId:在编号序列表中的Id
  • GongqiRecord record:GongqiRecord 对象
  • String releaseId:需要释放的值
   // 根据 StudentID 编号序列的配置 释放Number 的值
    public CommandResult buttonOK_Button(CommandArg arg) {
        CommandResult result = new CommandResult(); 
        //从 arg 里获取到当前选择记录对象
        Student record = (Student)arg.getCurrentRecord();
        GongqiRecordHelper.releaseNumSeq("StudentID", record, record.getNumber());
        //继续执行业务逻辑
        return result;
    }

[!NOTE]

如果 释放的 不是 该编号序列的最后一个值 则 释放无效

releaseNumSeqByMap(String, Map, String)

根据传入的编号序列ID Map对象 和 编号序列值 释放该值

方法签名

gongqi.erp.gotmodel.table.GongqiRecordHelper.releaseNumSeqByMap(String, Map<String,Object>, String)

方法入参

  • String NumSeqId:在编号序列表中的Id
  • Map map:map对象
  • String releaseId:需要释放的值
   // 根据 StudentID 编号序列的配置 释放Number 的值
    public CommandResult buttonOK_Button(CommandArg arg) {
        CommandResult result = new CommandResult(); 
        //从 arg 里获取到当前选择记录对象
        Student record = (Student)arg.getCurrentRecord();
        GongqiRecordHelper.releaseNumSeqByMap("StudentID", record.castToMap(), record.getNumber());
        //继续执行业务逻辑
        return result;
    }

[!NOTE]

如果 释放的 不是 该编号序列的最后一个值 则 释放无效

results matching ""

    No results matching ""