| | |
| | | public Long getCountByVersion (Character character, String maintainId, String tableName,String tableTempName,Integer fromOrderNo, Integer toOrderNo, String whereSegment) { |
| | | try{ |
| | | Maintain maintain = maintainService.selectById(maintainId); |
| | | |
| | | String fields = getFields(character,tableName, maintain); |
| | | String Hfields = getFields(character, tableName, Constant.H, maintain); |
| | | String tempFields = getTempFields(character, tableName, Constant.MT, maintain); |
| | | String tempFields = getTempFields(character, tableName, Constant.A1, maintain); |
| | | String A1fields = getFields(character, tableName, Constant.A1, maintain); |
| | | String A2fields = getFields(character, tableName, Constant.A2, maintain); |
| | | String tempHFields = getTempFields(character, tableName, Constant.H, maintain); |
| | | |
| | | if (StringUtils.isEmpty(whereSegment)) { |
| | | whereSegment = Constant.WHERE_DEFAULT; |
| | | } |
| | |
| | | if (StringUtils.isEmpty(fields)) { |
| | | return 0L; |
| | | } |
| | | count = mapper.getCountByVersion(tableName, tableTempName, fields, tempFields, Hfields, A1fields,A2fields,tempHFields, fromOrderNo, toOrderNo, DbUtils.quotedStr(maintainId), whereSegment); |
| | | count = mapper.getCountByVersion(tableName, tableTempName, fields, tempFields, A1fields,fromOrderNo, toOrderNo, whereSegment); |
| | | return count; |
| | | } |
| | | catch (Exception e) { |
| | |
| | | } |
| | | } |
| | | |
| | | public Long getCountByMaxVersion (Character character, String maintainId, String tableName,String tableTempName,Integer fromOrderNo, Integer toOrderNo, String whereSegment) { |
| | | public Long getCountByMaxVersion (Character character, String maintainId, String tableName,String tableTempName,Integer fromOrderNo, String whereSegment) { |
| | | try{ |
| | | Maintain maintain = maintainService.selectById(maintainId); |
| | | |
| | | String fields = getFields(character, tableName, maintain); |
| | | String Hfields = getFields(character, tableName, Constant.H, maintain); |
| | | String tempFields = getTempFields(character, tableName, Constant.MT, maintain); |
| | | |
| | | String tempFields = getTempFields(character, tableName, Constant.A1, maintain); |
| | | String A1fields = getFields(character, tableName, Constant.A1, maintain); |
| | | String A2fields = getFields(character, tableName, Constant.A2, maintain); |
| | | String tempHFields = getTempFields(character, tableName, Constant.H, maintain); |
| | | |
| | | if (StringUtils.isEmpty(whereSegment)) { |
| | | whereSegment = Constant.WHERE_DEFAULT; |
| | | } |
| | | Long count = mapper.getCountByMaxVersion(tableName, tableTempName, fields, tempFields, Hfields, A1fields,A2fields,tempHFields, fromOrderNo, toOrderNo, DbUtils.quotedStr(maintainId), whereSegment); |
| | | |
| | | Long count = mapper.getCountByMaxVersion(tableName, tableTempName, fields, tempFields, A1fields, fromOrderNo, whereSegment); |
| | | return count; |
| | | } |
| | | catch (Exception e) { |
| | |
| | | |
| | | String fields; |
| | | String tempFields; |
| | | String Hfields; |
| | | String A1fields; |
| | | String A2fields; |
| | | String A1Fields; |
| | | |
| | | String tempHfields; |
| | | |
| | | if (fieldList == null || fieldList.size() == 0) { |
| | | fields = getFields(character, tableName, maintainFromVersion); |
| | | Hfields = getFields(character, tableName,Constant.H, maintainFromVersion); |
| | | A1fields = getFields(character, tableName,Constant.A1, maintainFromVersion); |
| | | A2fields = getFields(character, tableName,Constant.A2, maintainFromVersion); |
| | | tempFields = getTempFields(character, tableName, maintainFromVersion); |
| | | tempHfields = getTempFields(character, tableName, Constant.H, maintainFromVersion); |
| | | A1Fields = getFields(character, tableName, Constant.A1, maintainFromVersion); |
| | | tempFields = getTempFields(character, tableName, Constant.A1, maintainFromVersion); |
| | | } else { |
| | | fields = fieldList.stream().collect(Collectors.joining(Constant.COMMA)); |
| | | Hfields = fieldList.stream().map(s -> MessageFormat.format(Constant.Alias,Constant.H, s)).collect(Collectors.joining(Constant.COMMA)); |
| | | A1fields = fieldList.stream().map(s -> MessageFormat.format(Constant.Alias,Constant.A1, s)).collect(Collectors.joining(Constant.COMMA)); |
| | | A2fields = fieldList.stream().map(s -> MessageFormat.format(Constant.Alias,Constant.A2, s)).collect(Collectors.joining(Constant.COMMA)); |
| | | A1Fields = fieldList.stream() |
| | | .map(s -> MessageFormat.format(Constant.Alias,Constant.A1, s)) |
| | | .collect(Collectors.joining(Constant.COMMA)); |
| | | tempFields = fieldList.stream() |
| | | .map(s -> |
| | | s.equalsIgnoreCase(Constant.ID) ? MessageFormat.format("{0} as id",Constant.STD_ID): s) |
| | | .collect(Collectors.joining(Constant.COMMA)); |
| | | |
| | | tempHfields = fieldList.stream() |
| | | .map(s -> |
| | | s.equalsIgnoreCase(Constant.ID) ? MessageFormat.format("{0} as id",Constant.STD_ID): s) |
| | | .map(s -> MessageFormat.format(Constant.Alias,Constant.H,s)) |
| | | .map(s -> MessageFormat.format(Constant.Alias,Constant.A1, s)) |
| | | .collect(Collectors.joining(Constant.COMMA)); |
| | | |
| | | } |
| | |
| | | long con = maintainIds.stream().map(s -> builder.append(DbUtils.quotedStr(s))).count(); |
| | | } |
| | | |
| | | result = mapper.selectByPageByMaxVersion(tableName,tableTempName,fields,tempFields, Hfields, A1fields, A2fields, tempHfields, fromVersionOrderNo, nowVersionOrderNo, DbUtils.quotedStr(maintainFromVersion.getId()), whereSegment, null); |
| | | result = mapper.selectByPageByMaxVersion(tableName,tableTempName,fields, A1Fields, tempFields, nowVersionOrderNo, whereSegment, null); |
| | | |
| | | }else { |
| | | result = mapper.selectByPageByVersion(tableName,tableTempName,fields,tempFields, Hfields, A1fields, A2fields, tempHfields, nowVersionOrderNo, fromVersionOrderNo, DbUtils.quotedStr(maintainFromVersion.getId()), whereSegment, null); |
| | | result = mapper.selectByPageByVersion(tableName,tableTempName,fields, A1Fields, tempFields, nowVersionOrderNo, fromVersionOrderNo, whereSegment, null); |
| | | } |
| | | |
| | | return result; |
| | |
| | | nowVersionOrderNo = nowVersionOrderNo - 1; |
| | | } |
| | | |
| | | count = getCountByMaxVersion(character, maintainFromVersion.getId(), tableName, tableTempName, fromVersionOrderNo, nowVersionOrderNo, whereSegment); |
| | | count = getCountByMaxVersion(character, maintainFromVersion.getId(), tableName, tableTempName, nowVersionOrderNo, whereSegment); |
| | | }else { |
| | | count = getCountByVersion(character, maintainFromVersion.getId(), tableName, tableTempName, nowVersionOrderNo, fromVersionOrderNo, whereSegment); |
| | | } |
| | |
| | | nowVersionOrderNo = nowVersionOrderNo - 1; |
| | | } |
| | | |
| | | count = getCountByMaxVersion(character, maintainFromVersion.getId(), tableName, tableTempName, fromVersionOrderNo, nowVersionOrderNo, whereSegment); |
| | | count = getCountByMaxVersion(character, maintainFromVersion.getId(), tableName, tableTempName, nowVersionOrderNo, whereSegment); |
| | | }else { |
| | | count = getCountByVersion(character, maintainFromVersion.getId(), tableName, tableTempName, nowVersionOrderNo, fromVersionOrderNo, whereSegment); |
| | | } |
| | |
| | | String limitSQL = page.getLimitSQL(); |
| | | String fields; |
| | | String tempFields; |
| | | String Hfields; |
| | | String A1fields; |
| | | String A2fields; |
| | | |
| | | String tempHfields; |
| | | String A1Fields; |
| | | |
| | | if (fieldList == null || fieldList.size() == 0) { |
| | | fields = getFields(character, tableName, maintainFromVersion, uuid); |
| | | A1Fields = getFields(character, tableName, Constant.A1, maintainFromVersion, uuid); |
| | | List<String> fieldStrList = DbUtils.split(fields, Constant.COMMA); |
| | | |
| | | Hfields = fieldStrList.stream().map(s -> MessageFormat.format(Constant.Alias,Constant.H, s)).collect(Collectors.joining(Constant.COMMA)); |
| | | A1fields = fieldStrList.stream().map(s -> MessageFormat.format(Constant.Alias,Constant.A1, s)).collect(Collectors.joining(Constant.COMMA)); |
| | | A2fields = fieldStrList.stream().map(s -> MessageFormat.format(Constant.Alias,Constant.A2, s)).collect(Collectors.joining(Constant.COMMA)); |
| | | tempFields = fieldStrList.stream() |
| | | .map(s -> |
| | | s.equalsIgnoreCase(Constant.ID) ? MessageFormat.format("{0} as id",Constant.STD_ID): s) |
| | | .map(s -> MessageFormat.format(Constant.Alias,Constant.MT, s)) |
| | | .collect(Collectors.joining(Constant.COMMA)); |
| | | |
| | | tempHfields = fieldStrList.stream() |
| | | .map(s -> |
| | | s.equalsIgnoreCase(Constant.ID) ? MessageFormat.format("{0} as id",Constant.STD_ID): s) |
| | | .map(s -> MessageFormat.format(Constant.Alias,Constant.H,s)) |
| | | .map(s -> MessageFormat.format(Constant.Alias,Constant.A1, s)) |
| | | .collect(Collectors.joining(Constant.COMMA)); |
| | | |
| | | } else { |
| | |
| | | fieldList.add(Constant.ID); |
| | | } |
| | | fields = fieldList.stream().collect(Collectors.joining(Constant.COMMA)); |
| | | Hfields = fieldList.stream().map(s -> MessageFormat.format(Constant.Alias,Constant.H, s)).collect(Collectors.joining(Constant.COMMA)); |
| | | A1fields = fieldList.stream().map(s -> MessageFormat.format(Constant.Alias,Constant.A1, s)).collect(Collectors.joining(Constant.COMMA)); |
| | | A2fields = fieldList.stream().map(s -> MessageFormat.format(Constant.Alias,Constant.A2, s)).collect(Collectors.joining(Constant.COMMA)); |
| | | A1Fields = fieldList.stream() |
| | | .map(s -> MessageFormat.format(Constant.Alias,Constant.A1, s)) |
| | | .collect(Collectors.joining(Constant.COMMA)); |
| | | tempFields = fieldList.stream() |
| | | .map(s -> |
| | | s.equalsIgnoreCase(Constant.ID) ? MessageFormat.format("{0} as id",Constant.STD_ID): s) |
| | | .map(s -> MessageFormat.format(Constant.Alias,Constant.MT, s)) |
| | | .collect(Collectors.joining(Constant.COMMA)); |
| | | |
| | | tempHfields = fieldList.stream() |
| | | .map(s -> |
| | | s.equalsIgnoreCase(Constant.ID) ? MessageFormat.format("{0} as id",Constant.STD_ID): s) |
| | | .map(s -> MessageFormat.format(Constant.Alias,Constant.H,s)) |
| | | .map(s -> MessageFormat.format(Constant.Alias,Constant.A1, s)) |
| | | .collect(Collectors.joining(Constant.COMMA)); |
| | | |
| | | } |
| | |
| | | long con = maintainIds.stream().map(s -> builder.append(DbUtils.quotedStr(s))).count(); |
| | | } |
| | | |
| | | result = mapper.selectByPageByMaxVersion(tableName,tableTempName,fields,tempFields, Hfields, A1fields, A2fields, tempHfields, fromVersionOrderNo, nowVersionOrderNo, DbUtils.quotedStr(maintainFromVersion.getId()), whereSegment, limitSQL); |
| | | result = mapper.selectByPageByMaxVersion(tableName,tableTempName,fields, A1Fields, tempFields, nowVersionOrderNo, whereSegment, limitSQL); |
| | | |
| | | }else { |
| | | result = mapper.selectByPageByVersion(tableName,tableTempName,fields,tempFields, Hfields, A1fields, A2fields, tempHfields, nowVersionOrderNo, fromVersionOrderNo, DbUtils.quotedStr(maintainFromVersion.getId()), whereSegment, limitSQL); |
| | | result = mapper.selectByPageByVersion(tableName,tableTempName,fields, A1Fields, tempFields, nowVersionOrderNo, fromVersionOrderNo, whereSegment, limitSQL); |
| | | } |
| | | endDate = new Date(); |
| | | log.info(MessageFormat.format("master tag:{0} MASTER-- select dataMap :{1} ms",uuid, (endDate.getTime() - startDate.getTime()))); |
| | |
| | | .setDesp("批量上传数据"); |
| | | |
| | | maintain.insert(); |
| | | connection.commit(); |
| | | } |
| | | catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | // 读数据库 |
| | | String tempTableName = tableName + Constant.RECORD; |
| | | List<Map<String, Object>> maps = mapper.selectByPage(tableName, MessageFormat.format(Constant.DISTINCT, field), Constant.WHERE_DEFAULT, null); |
| | | // List<Map<String, Object>> maps = mapper.selectByPage(tableName, MessageFormat.format(Constant.DISTINCT, field), Constant.WHERE_DEFAULT, null); |
| | | |
| | | List<Map<String, Object>> tempMaps = mapper.selectByPage(tempTableName, MessageFormat.format(Constant.DISTINCT, field), Constant.WHERE_DEFAULT, null); |
| | | maps.addAll(tempMaps); |
| | | List<Map<String, Object>> maps = mapper.selectDistinct(tempTableName, field, Constant.WHERE_DEFAULT); |
| | | |
| | | if (maps.size() == 0) { |
| | | return null; |
| | | } |
| | |
| | | .map(stringObjectMap -> stringObjectMap.get("index_name").toString()) |
| | | .filter(s -> idxName.equalsIgnoreCase(s)).count(); |
| | | if (existsIdx == 0) { |
| | | mapper.createIdx(recordTableName, idxName, Constant.STD_ID); |
| | | |
| | | mapper.createIdx(recordTableName, idxName, Constant.STD_ID + Constant.COMMA + Constant.DEAL); |
| | | } |
| | | } |
| | | } |