泛微OA E9开发:通过代码插入建模表数据
直接通过操作数据库的方式添加建模表数据,建模表是不会展示出来的。需要通过标准方法新增后,然后获取新增的空数据id,再通过update语句去改字段的值
private static final BaseBean baseBean = new BaseBean();
// SYN_PERSON_TABLE_NAME 建模表名
private static final String SYN_PERSON_TABLE_NAME = baseBean.getPropValue("kq_qc2802264","SYN_PERSON_TABLE_NAME");
// SYN_PERSON_FLOW_ID 模块id
private static final int SYN_PERSON_FLOW_ID = Integer.parseInt(baseBean.getPropValue("kq_qc2802264","SYN_PERSON_FLOW_ID"));
// 获取现在的时间
LocalDate currentDate = LocalDate.now();
LocalTime currentTime = LocalTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH-mm-ss");
String _currentTime = currentTime.format(formatter);
int id = ModeDataIdUpdate.getInstance().getModeDataNewIdByUUID(SYN_PERSON_TABLE_NAME, SYN_PERSON_FLOW_ID, 1, 1, currentDate.toString(), _currentTime);
ModeRightInfo ModeRightInfo = new ModeRightInfo();
ModeRightInfo.setNewRight(true);
// 新建的时候添加共享
ModeRightInfo.editModeDataShare(1, SYN_PERSON_FLOW_ID, id);
// 新建的时候添加文档共享
ModeRightInfo.addDocShare(1, SYN_PERSON_FLOW_ID, id);
String updateSql = "update " + SYN_PERSON_TABLE_NAME + " set kqdate=?,resourceid=?,forgotcheckMins=?,workmins=?,attendanceMins=?,belatemins=?,leaveearlymins=?,absenteeismins=? where id=" + id;
recordSet.executeUpdate(updateSql, kqExceptionBean.getKqdate(), kqExceptionBean.getResourceid(), kqExceptionBean.getForgotcheckMins(), kqExceptionBean.getWorkmins(), kqExceptionBean.getAttendanceMins(), kqExceptionBean.getBelatemins(), kqExceptionBean.getLeaveearlymins(), Math.max(kqExceptionBean.getAbsenteeismins(), 0));
新增完数据之后之后其实还是只有创建人有权限查看,如果需要给默认共享的人员查看的话需要权限重构一下。