| | |
| | | if (StringUtils.isEmpty(uploadType)) { |
| | | uploadType = Constant.All; |
| | | } |
| | | MenuMapping menuMapping = menuMappingService.selectOne(new EntityWrapper<MenuMapping>().eq("table_name",tableName)); |
| | | SysOperateLog operateLog = new SysOperateLog(); |
| | | |
| | | Maintain maxVersion = maintainService.getMaxVersion(tableName); |
| | | Maintain maintain = new Maintain(); |
| | | String biggerVersion = null; |
| | | if (maxVersion == null) { |
| | | biggerVersion = Constant.VERSION_Default; |
| | | maintain.setOrderNo(0); |
| | | operateLog.setOperate("初始化主题数据"); |
| | | } else { |
| | | operateLog.setOperate("更新主题"); |
| | | String flowId = maxVersion.getFlowId(); |
| | | String mVersion = maxVersion.getVersion(); |
| | | if (StringUtils.isEmpty(flowId)) { |
| | |
| | | Long aLong = tableInfoMapper.tempDeal(maintain.getTableName() + Constant.RECORD, DbUtils.quotedStr(maintain.getId())); |
| | | |
| | | maintain.setDesp(MessageFormat.format("上传数据{0}条", aLong)); |
| | | MenuMapping menuMapping = menuMappingService.selectOne(new EntityWrapper<MenuMapping>().eq("table_name", maintain.getTableName())); |
| | | |
| | | SysOperateLog operateLog = new SysOperateLog(); |
| | | operateLog.setCreateTime(new Date()) |
| | | .setMaintainId(maintain.getId()) |
| | | .setId(DbUtils.getUUID()) |
| | |
| | | return masterDataService.selectList(tableName,whereSegment); |
| | | } |
| | | |
| | | @RequestMapping(value = "{maintainId}/modify/{operateStr}", method = RequestMethod.GET) |
| | | public Result modify(@PathVariable String maintainId, @PathVariable String operateStr, HttpServletRequest request) throws UnsupportedEncodingException { |
| | | @RequestMapping(value = "{maintainId}/modify/{operateStr}", method = RequestMethod.POST) |
| | | public Result modify(@RequestParam String datas, @PathVariable String maintainId, @PathVariable String operateStr, HttpServletRequest request) throws UnsupportedEncodingException { |
| | | Result result = null; |
| | | Operate operate = Operate.parse(operateStr); |
| | | String datas = request.getParameter("datas"); |
| | | Maintain maintain = maintainService.selectById(maintainId); |
| | | switch (operate) { |
| | | case delete: |
| | | //datas is id; |
| | | result = deleteById(maintain.getTableName() + Constant.RECORD, datas); |
| | | Integer deleteCount = tableInfoMapper.deleteRecordByMaintainId(maintain.getTableName() + Constant.RECORD, DbUtils.quotedStr(datas), DbUtils.quotedStr(maintainId)); |
| | | |
| | | result = Result.success(deleteCount); |
| | | break; |
| | | case update: |
| | | JSONObject jsonObject = JSONObject.parseObject(datas); |
| | | Object id = jsonObject.get("id"); |
| | | String updateSegment = masterDataService.getUpdateSegment(maintain.getTableName(), datas); |
| | | result = masterDataService.update(maintain.getTableName() + Constant.RECORD, updateSegment, false); |
| | | String id = (String) jsonObject.get("id"); |
| | | jsonObject.remove(Constant.ID); |
| | | datas = jsonObject.toJSONString(); |
| | | String updateSegment = masterDataService.getUpdateSegment(maintain.getTableName(), maintain.getTableName() + Constant.RECORD, datas); |
| | | |
| | | Integer updateCount = tableInfoMapper.updateRecordByMaintainId(maintain.getTableName() + Constant.RECORD, updateSegment, DbUtils.quotedStr(maintainId)); |
| | | result = Result.success(updateCount); |
| | | break; |
| | | case create: |
| | | JSONObject createObject = JSONObject.parseObject(datas); |
| | | String recordId = DbUtils.getUUID(); |
| | | createObject.fluentPut(Constant.ID, recordId); |
| | | createObject.fluentPut(Constant.STD_ID, DbUtils.getUUID()); |
| | | datas = createObject.toJSONString(); |
| | | |
| | | MaintainDetail maintainDetail = new MaintainDetail(); |
| | | maintainDetail.setParentId(maintainId); |
| | | maintainDetail.setId(DbUtils.getUUID()); |
| | | maintainDetail.setPreMergeId(recordId); |
| | | maintainDetail.setCreateTime(new Date()); |
| | | maintainDetail.setOperate(Operate.create); |
| | | |
| | | result = masterDataService.insert(maintain.getTableName() + Constant.RECORD, datas); |
| | | if (result.getSuccess()) { |
| | | maintainDetail.insert(); |
| | | } |
| | | break; |
| | | default: |
| | | result = Result.error(CodeMsg.OPERATR_ERROR); |