Commit e4289e0e authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_tzs_test' into develop_tzs_register

# Conflicts: # amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/edit/event/listener/ChangeEquipImpactCertListener.java
parents 940dcba0 62616758
......@@ -10,6 +10,7 @@ import java.lang.annotation.*;
public @interface FieldDisplayDefine {
String value();
/**
* 字段别名 兼容前端使用
*
......@@ -21,15 +22,53 @@ public @interface FieldDisplayDefine {
String format() default "yyyy-MM-dd";
/**
* 是否是数据库字典
*
* @return 是否
*/
boolean isExist() default true;
/**
* 处理器bean 名称
*
* @return bean 名称唯一
*/
String typeHandler() default "defaultTypeHandler";
/**
* 字典 key
*
* @return 字典key
*/
String dictCode() default "";
/**
* 字典类型
*
* @return 平台字典、还是业务字典
*/
DictType dictType() default DictType.no;
/**
* 是否冗余字段,如行政区划名称,冗余时则该字段不再记录变更日志
*
* @return 是否冗余
*/
boolean isRepeatColumn() default false;
enum DictType {
/**
* 业务字典
*/
cb,
/**
* 平台字典
*/
platform,
/**
* 非字典
*/
no
}
}
......@@ -219,4 +219,10 @@ public class ESEquipmentCategoryDto {
*/
@Field(type = FieldType.Keyword)
private String whetherSphericalTank;
/**
* 版本号
*/
@Field(type = FieldType.Keyword)
private String version;
}
......@@ -36,7 +36,7 @@ public class TechParamsVesselChangeFieldDto extends BaseTechParamsFieldDto {
@FieldDisplayDefine(value = "总容积")
private String totalVolume;
@FieldDisplayDefine(value = "充装介质")
@FieldDisplayDefine(value = "充装介质", dictCode = "FILLING_MEDIUM", dictType = FieldDisplayDefine.DictType.platform)
private String chargingMedium;
@FieldDisplayDefine(value = "规格")
......
......@@ -52,5 +52,5 @@ public interface JgChangeRegistrationUnitMapper extends CustomBaseMapper<JgChang
List<CompanyEquipCountDto> queryForFlowingEquipList();
List<Map<String, Object>> getEstateUnitInfo(List<String> records);
List<Map<String, Object>> getEstateUnitInfo(@Param("records") List<String> records);
}
......@@ -126,21 +126,4 @@
and a.audit_status in ('三级待受理', '二级待受理', '一级待受理')
GROUP BY a.use_unit_credit_code
</select>
<select id="getEstateUnitInfo" resultType="java.util.Map">
SELECT
CONCAT(jui.ESTATE_UNIT_CREDIT_CODE, '_', jui.ESTATE_UNIT_NAME) AS estateUnitName
FROM
idx_biz_jg_register_info ri
LEFT JOIN idx_biz_jg_use_info jui on ri.RECORD = jui.RECORD
WHERE ri."EQU_CATEGORY" = '2300'
AND jui."DATA_SOURCE" like 'jg%'
AND ri.whether_vehicle_cylinder = 1
AND jui."ESTATE_UNIT_NAME" IS NOT NULL
AND jui."ESTATE_UNIT_CREDIT_CODE" IS NOT NULL
AND jui.record in
<foreach collection="records" item="record" open="(" close=")" separator=",">
#{record}
</foreach>
</select>
</mapper>
......@@ -178,4 +178,21 @@
and a.status in ('三级待受理', '二级待受理', '一级待受理')
GROUP BY a.use_unit_credit_code
</select>
<select id="getEstateUnitInfo" resultType="java.util.Map">
SELECT
CONCAT(jui.ESTATE_UNIT_CREDIT_CODE, '_', jui.ESTATE_UNIT_NAME) AS estateUnitName
FROM
idx_biz_jg_register_info ri
LEFT JOIN idx_biz_jg_use_info jui on ri.RECORD = jui.RECORD
WHERE ri."EQU_CATEGORY" = '2300'
AND jui."DATA_SOURCE" like 'jg%'
AND ri.whether_vehicle_cylinder = 1
AND jui."ESTATE_UNIT_NAME" IS NOT NULL
AND jui."ESTATE_UNIT_CREDIT_CODE" IS NOT NULL
AND jui.record in
<foreach collection="records" item="record" open="(" close=")" separator=",">
#{record}
</foreach>
</select>
</mapper>
......@@ -421,4 +421,25 @@ public class DataHandlerController extends BaseController {
dataHandlerService.addDbData2EsBatch(paramMap);
return ResponseHelper.buildResponse(true);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/sync/es2db/org-branches")
@ApiOperation(httpMethod = "PUT", value = "1.将属地监管部门以es老索引为准刷数据库", notes = "属地监管部门以es为准刷数据库")
public ResponseModel<Long> orgBranchCode2Db(@ApiParam(value = "设备种类code") @RequestParam String equListCode,
@ApiParam(value = "设备类别code") @RequestParam(required = false) String equCategoryCode,
@ApiParam(value = "属地code") @RequestParam String orgBranchCode ,
@ApiParam(value = "序列号,不能重复") @RequestParam Integer seq) {
return ResponseHelper.buildResponse(dataHandlerService.orgBranchCode2Db(equListCode, equCategoryCode, orgBranchCode, seq));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/sync/db2es/equipments")
@ApiOperation(httpMethod = "PUT", value = "2.同步设备数据到es新旧索引", notes = "同步设备数据到es新旧索引")
public ResponseModel<Integer> syncEquipFromDb2Es(@ApiParam(value = "设备种类code") @RequestParam String equListCode,
@ApiParam(value = "设备类别code") @RequestParam(required = false) String equCategoryCode,
@ApiParam(value = "属地code") @RequestParam String orgBranchCode) {
return ResponseHelper.buildResponse(dataHandlerService.synEquipFromDb2Es(equListCode, equCategoryCode, orgBranchCode));
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.jg.biz.data.fix.patcher;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgUseInfoServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.util.StopWatch;
import java.util.List;
import java.util.Map;
@Slf4j
public abstract class FilterableBatchDataPatcher implements HistoricalDataPatcher<Map<String, Object>> {
private final ApplicationContext applicationContext;
protected FilterableBatchDataPatcher(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
@Override
public Integer patchBatchData(Map<String, Object> params) {
StopWatch watch = new StopWatch();
watch.start();
IdxBizJgUseInfoServiceImpl useInfoService = applicationContext.getBean(IdxBizJgUseInfoServiceImpl.class);
Integer maxVersion = useInfoService.getBaseMapper().selectMaxVersionWithParams(buildFilter(params));
Integer nextVersion = maxVersion + 1;
List<String> refreshRecords = useInfoService.getBaseMapper().selectUseInfoOfOneVersionWithParams(nextVersion, buildFilter(params));
int patchSize = refreshRecords.size();
while (!refreshRecords.isEmpty()) {
try {
refreshRecords.parallelStream().forEach(record -> {
try {
beforePatching(record);
patchSingleRecord(record);
afterPatching(record);
} catch (Exception e) {
// 异常数据跳过
log.error("单个方式数据修补失败,设备:{}", record, e);
}
});
patchBatchRecord(refreshRecords);
} catch (Exception e) {
// 本批次异常数据跳过
log.error("数据修补失败,设备:{}", refreshRecords, e);
} finally {
StopWatch watch1 = new StopWatch();
watch1.start();
useInfoService.getBaseMapper().updateVersionBatch(refreshRecords, nextVersion);
watch1.stop();
log.info("版本号批量更新条数:「{}」, 耗时:「{}」", refreshRecords.size(), watch1.getTotalTimeSeconds());
refreshRecords = useInfoService.getBaseMapper().selectUseInfoOfOneVersionWithParams(nextVersion, buildFilter(params));
patchSize = patchSize + refreshRecords.size();
}
}
watch.stop();
log.warn("数据修补完成,共处理{}条记录,耗时: {}秒", patchSize, watch.getTotalTimeSeconds());
return patchSize;
}
protected abstract void patchBatchRecord(List<String> refreshRecords);
protected abstract Map<String, Object> buildFilter(Map<String, Object> params);
protected abstract void beforePatching(String record);
protected abstract void patchSingleRecord(String record);
protected abstract void afterPatching(String record);
}
......@@ -6,18 +6,19 @@ import org.springframework.context.ApplicationContext;
import org.springframework.util.StopWatch;
import java.util.List;
import java.util.Map;
@Slf4j
public abstract class BatchDataPatcher implements HistoricalDataPatcher {
public abstract class FullBatchDataPatcher implements HistoricalDataPatcher<Map<String, Object>> {
private final ApplicationContext applicationContext;
protected BatchDataPatcher(ApplicationContext applicationContext) {
protected FullBatchDataPatcher(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}
@Override
public Integer patchBatchData() {
public Integer patchBatchData(Map<String, Object> params) {
StopWatch watch = new StopWatch();
watch.start();
IdxBizJgUseInfoServiceImpl useInfoService = applicationContext.getBean(IdxBizJgUseInfoServiceImpl.class);
......
package com.yeejoin.amos.boot.module.jg.biz.data.fix.patcher;
public interface HistoricalDataPatcher {
public interface HistoricalDataPatcher<T> {
/**
* 执行批量修补
*
* @return 处理成功的记录数,如果不可计算则返回null
*/
Integer patchBatchData();
Integer patchBatchData(T params);
}
......@@ -5,7 +5,7 @@ import com.yeejoin.amos.boot.biz.common.entity.TzsBaseEntity;
import com.yeejoin.amos.boot.module.common.api.constant.TZSCommonConstant;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.jg.biz.data.fix.patcher.BatchDataPatcher;
import com.yeejoin.amos.boot.module.jg.biz.data.fix.patcher.FullBatchDataPatcher;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.IdxBizJgRegisterInfoServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import lombok.extern.slf4j.Slf4j;
......@@ -19,14 +19,14 @@ import java.util.Optional;
*/
@Component
@Slf4j
public class WeatherTankFieldPatcher extends BatchDataPatcher {
public class WeatherTankFieldPatcherFull extends FullBatchDataPatcher {
private final IdxBizJgRegisterInfoServiceImpl registerInfoService;
private final ESEquipmentCategory equipmentCategory;
protected WeatherTankFieldPatcher(ApplicationContext applicationContext, IdxBizJgRegisterInfoServiceImpl registerInfoService, ESEquipmentCategory equipmentCategory) {
protected WeatherTankFieldPatcherFull(ApplicationContext applicationContext, IdxBizJgRegisterInfoServiceImpl registerInfoService, ESEquipmentCategory equipmentCategory) {
super(applicationContext);
this.registerInfoService = registerInfoService;
this.equipmentCategory = equipmentCategory;
......
......@@ -168,11 +168,11 @@ public class ChangeEquipImpactCertListener {
manage.setReceiveCompanyCode(afterValue);
manage.setReceiveOrgName(CommonCustomConverter.CompanyCodeConverter.getNameByCode(afterValue));
break;
case "fillingMedium":
case "chargingMedium":
manage.setFillingMedium(
Arrays.stream(manage.getFillingMedium().split(","))
.map(String::trim)
.map(v -> v.equals(beforeValue) ? afterValue : v)
.map(v -> v.equals(meta.getDisplayOldValue()) ? meta.getDisplayNewValue() : v)
.distinct()
.collect(Collectors.joining(","))
);
......
......@@ -21,6 +21,8 @@ public class FormatService {
private final CbDataDictTypeHandler dataDictTypeHandler;
private final PlatformDictTypeHandler platformDictTypeHandler;
private final Map<String, TypeHandler<String>> handlerCache = new ConcurrentHashMap<>();
@Value("${type-handler.default:defaultTypeHandler}")
......@@ -28,9 +30,15 @@ public class FormatService {
public String format(FieldDisplayDefine displayDefine, String value) {
// 字典优先
if (StringUtils.isNotEmpty(displayDefine.dictCode())) {
// 1.1兼容之前的业务字典,有字典配置时默认是业务字典
if(StringUtils.isNotEmpty(displayDefine.dictCode()) && (displayDefine.dictType().equals(FieldDisplayDefine.DictType.no) || displayDefine.dictType().equals(FieldDisplayDefine.DictType.cb))){
return dataDictTypeHandler.handle(displayDefine.dictCode(), value);
}
// 1.2平台字典
if(StringUtils.isNotEmpty(displayDefine.dictCode()) && displayDefine.dictType().equals(FieldDisplayDefine.DictType.platform)){
return platformDictTypeHandler.handle(displayDefine.dictCode(), value);
}
// 其次是自定义的处理器
try {
TypeHandler<String> handler = handlerCache.computeIfAbsent(displayDefine.typeHandler(),
......
......@@ -28,7 +28,8 @@ public class PlatformDictTypeHandler implements DictTypeHandler {
if (StringUtils.isEmpty(dictCode)){
return null;
}
return cache.computeIfAbsent(dictCode, k -> {
String key = dictType + "_" + dictCode;
return cache.computeIfAbsent(key, k -> {
try {
List<DictionarieValueModel> result = Systemctl.dictionarieClient.dictValues(dictType).getResult();
......
......@@ -88,11 +88,11 @@ public class EquipmentRefreshHandler implements IDataRefreshHandler {
}
private List<ESEquipmentInfo.TechParam> buildTechParamByEquList(String record, String equListCode) {
public List<ESEquipmentInfo.TechParam> buildTechParamByEquList(String record, String equListCode) {
return StringUtils.isNotEmpty(equListCode) ? statisticsDataUpdateService.getTechParams(equListCode, record) : new ArrayList<>();
}
private LocalDate getIssueDate(String useRegistrationCode) {
public LocalDate getIssueDate(String useRegistrationCode) {
if (StringUtils.isEmpty(useRegistrationCode)) {
return null;
}
......
package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.common.api.entity.EsEntity;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.xcontent.XContentType;
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component
......@@ -22,15 +21,18 @@ public class EsBulkService {
private final RestHighLevelClient restHighLevelClient;
private final ElasticsearchConverter converter; // 依赖注入
public <T> void bulkUpsert(String index, List<EsEntity<T>> list) {
BulkRequest request = new BulkRequest();
list.forEach(item -> {
Map<String, Object> docData = converter.mapObject(item.getData());
request.add(new UpdateRequest(index, item.getId())
.doc(JSON.toJSONString(item.getData()), XContentType.JSON)
.upsert(JSON.toJSONString(item.getData()), XContentType.JSON));
.doc(docData)
.upsert(docData));
});
try {
// request.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
restHighLevelClient.bulk(request, RequestOptions.DEFAULT);
} catch (Exception e) {
log.error("批量写入数据失败:{}", e.getMessage(), e);
......
......@@ -4808,18 +4808,14 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
}
batchInsert(idxBizJgUseInfoMapper, useInfoList, "使用信息");
batchInsert(idxBizJgRegisterInfoMapper, registerInfoList, "注册信息");
List<CompletableFuture<Void>> futures = new ArrayList<>();
futures.add(CompletableFuture.runAsync(() -> batchInsert(idxBizJgSupervisionInfoMapper, supervisionInfoList, "监督信息"), executor));
futures.add(CompletableFuture.runAsync(() -> batchInsert(idxBizJgDesignInfoMapper, designInfoList, "设计信息"), executor));
futures.add(CompletableFuture.runAsync(() -> batchInsert(idxBizJgFactoryInfoMapper, factoryInfoList, "制造信息"), executor));
futures.add(CompletableFuture.runAsync(() -> batchInsert(otherInfoMapper, otherInfoList, "其他信息"), executor));
futures.add(CompletableFuture.runAsync(() -> batchInsert(idxBizJgTechParamsVesselMapper, paramsVesselList, "容器参数信息"), executor));
futures.add(CompletableFuture.runAsync(() -> batchInsert(idxBizJgInspectionDetectionInfoMapper, inspectionDetectionInfoList, "检验检测信息"), executor));
futures.add(CompletableFuture.runAsync(() -> batchInsert(certificateChangeRecordEqMapper, jgCertificateChangeRecordEqList, "登记证关系信息"), executor));
futures.add(CompletableFuture.runAsync(() -> esEquipmentCategory.saveAll(esEquipmentCategoryList), executor));
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
batchInsert(idxBizJgSupervisionInfoMapper, supervisionInfoList, "监督信息");
batchInsert(idxBizJgDesignInfoMapper, designInfoList, "设计信息");
batchInsert(idxBizJgFactoryInfoMapper, factoryInfoList, "制造信息");
batchInsert(otherInfoMapper, otherInfoList, "其他信息");
batchInsert(idxBizJgTechParamsVesselMapper, paramsVesselList, "容器参数信息");
batchInsert(idxBizJgInspectionDetectionInfoMapper, inspectionDetectionInfoList, "检验检测信息");
batchInsert(certificateChangeRecordEqMapper, jgCertificateChangeRecordEqList, "登记证关系信息");
esEquipmentCategory.saveAll(esEquipmentCategoryList);
// 使用事务同步回调确保事件在事务提交后发送
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
......@@ -4836,8 +4832,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
});
return String.format("导入完成,成功导入: %d 条数据!", useInfoList.size());
}
// 定义线程池,CPU 核数 * 2,避免阻塞主线程
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
/** 通用批量插入方法 */
public <T> void batchInsert(CustomBaseMapper<T> mapper, List<T> list, String name) {
......
......@@ -33,6 +33,7 @@ import com.yeejoin.amos.boot.module.jg.biz.context.FlowingEquipRedisContext;
import com.yeejoin.amos.boot.module.jg.biz.edit.permission.FillingEditPermForCurrentUser;
import com.yeejoin.amos.boot.module.jg.biz.event.publisher.EventPublisher;
import com.yeejoin.amos.boot.module.jg.biz.feign.TzsServiceFeignClient;
import com.yeejoin.amos.boot.module.jg.biz.utils.CodeUtil;
import com.yeejoin.amos.boot.module.ymt.api.entity.*;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum;
......@@ -135,6 +136,8 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
@Autowired
private JgResumeInfoServiceImpl jgResumeInfoService;
@Autowired
private CodeUtil codeUtil;
public void changeData(JgChangeVehicleRegistrationUnit dto, CompanyBo company) {
if (!ObjectUtils.isEmpty(dto.getReceiveCompanyCode())) {
......@@ -589,8 +592,8 @@ public class JgChangeVehicleRegistrationUnitServiceImpl extends BaseService<JgCh
jgCertificateChangeRecord.setRoutePath(taskV2Model.getRoutePath());
if ("0".equals(jgChangeVehicleRegistrationUnit.getChangeType()) && !ObjectUtils.isEmpty(collect)) {
// 区外变更
// 生成使用登记证编号
String receiveCompanyCode = jgChangeVehicleRegistrationUnit.getReceiveCompanyCode();
// 生成使用登记证编号,根据行政审批局单位code获取行政区划code
String receiveCompanyCode = codeUtil.getCityRegionCode(jgChangeVehicleRegistrationUnit.getReceiveCompanyCode());
CompanyModel receiveCompanyResult = Privilege.companyClient.queryByCompanyCode(receiveCompanyCode).getResult();
//查询到局级
// 如果不是局级公司,则查询其上级公司信息
......
......@@ -457,7 +457,11 @@ public class JyjcInspectionResultServiceImpl extends BaseService<JyjcInspectionR
* @return null or 非空的字符串
*/
private String nullIfNullOrEmpty(String str) {
return CompareUtils.isNullOrEmpty(str) ? null : str;
return CompareUtils.isNullOrEmpty(str) ? null : trimNoIllegalChar(str);
}
private String trimNoIllegalChar(String str) {
return "\\".equals(str) || "/".equals(str) ? null : str;
}
private String getTableName(String paramType) {
......
package com.yeejoin.amos.boot.module.ymt.api.mapper;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.mapper.CustomBaseMapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgSupervisionInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 监督管理信息表 Mapper 接口
......@@ -11,4 +15,5 @@ import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgSupervisionInfo;
*/
public interface IdxBizJgSupervisionInfoMapper extends CustomBaseMapper<IdxBizJgSupervisionInfo> {
void updateOrgBranchCodeBatch(@Param("dtos") List<ESEquipmentCategoryDto> esEquipmentCategoryDtos);
}
......@@ -29,6 +29,8 @@ public interface IdxBizJgUseInfoMapper extends CustomBaseMapper<IdxBizJgUseInfo>
Integer selectMaxVersion();
Integer selectMaxVersionWithParams(@Param("params") Map<String, Object> params);
void updateDataQualityScoreBatch(@Param("equips") List<EquipWaitRefreshDataQualityScore> refreshDataQualityScores, @Param("version") int version);
void updateVersionBatch(@Param("records") List<String> records, @Param("version") int version);
......@@ -52,4 +54,6 @@ public interface IdxBizJgUseInfoMapper extends CustomBaseMapper<IdxBizJgUseInfo>
List<IdxBizJgOtherInfo> selectOneMockRecord(@Param("equList") String equList, @Param("equCategory") String equCategory, @Param("equDefine") String equDefine, @Param("useUnitCode") String useUnitCode, @Param("size") Integer size);
List<String> selectEquipsClaimStatus();
List<String> selectUseInfoOfOneVersionWithParams(@Param("version") Integer version,@Param("params") Map<String, Object> params);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgSupervisionInfoMapper">
<update id="updateOrgBranchCodeBatch">
UPDATE idx_biz_jg_supervision_info SET
"ORG_BRANCH_CODE" = temp_table."ORG_BRANCH_CODE",
"ORG_BRANCH_NAME" = temp_table."ORG_BRANCH_NAME"
FROM (
VALUES
<foreach collection="dtos" separator="," item="dto" index="index">
(#{dto.orgBranchCode}, #{dto.ORG_BRANCH_NAME}, #{dto.SEQUENCE_NBR})
</foreach>
) AS temp_table("ORG_BRANCH_CODE", "ORG_BRANCH_NAME", "RECORD")
WHERE idx_biz_jg_supervision_info."RECORD" = temp_table."RECORD"
</update>
</mapper>
......@@ -59,11 +59,53 @@
ui.VERSION <![CDATA[ <> ]]> #{version} or ui.VERSION is null
limit 10000
</select>
<select id="selectUseInfoOfOneVersionWithParams" resultType="java.lang.String">
SELECT
u.record
from
"idx_biz_jg_use_info" u,
"idx_biz_jg_supervision_info" s,
idx_biz_jg_register_info r
where
(u.VERSION <![CDATA[ <> ]]> #{version} or u.VERSION is null)
and u."RECORD" = s."RECORD"
and s."RECORD" = r."RECORD"
<if test="params.equListCode != null and params.equListCode != ''">
and r."EQU_LIST" = #{params.equListCode}
</if>
<if test="params.equCategoryCode != null and params.equCategoryCode != ''">
and r."EQU_CATEGORY" = #{params.equCategoryCode}
</if>
<if test="params.orgBranchCode != null and params.orgBranchCode != ''">
and s."ORG_BRANCH_CODE" like concat(#{params.orgBranchCode},'%')
</if>
limit 1000
</select>
<select id="selectMaxVersion" resultType="java.lang.Integer">
SELECT
COALESCE(MAX(version),0) as version
FROM "idx_biz_jg_use_info"
</select>
<select id="selectMaxVersionWithParams" resultType="java.lang.Integer">
SELECT
COALESCE(MAX(version),0) as version
FROM
"idx_biz_jg_use_info" u,
"idx_biz_jg_supervision_info" s,
idx_biz_jg_register_info r
where
u."RECORD" = s."RECORD"
and s."RECORD" = r."RECORD"
<if test="params.equListCode != null and params.equListCode != ''">
and r."EQU_LIST" = #{params.equListCode}
</if>
<if test="params.equCategoryCode != null and params.equCategoryCode != ''">
and r."EQU_CATEGORY" = #{params.equCategoryCode}
</if>
<if test="params.orgBranchCode != null and params.orgBranchCode != ''">
and s."ORG_BRANCH_CODE" like concat(#{params.orgBranchCode},'%')
</if>
</select>
<select id="queryDetail" resultType="java.util.Map">
<include refid="equip-detail-es"/>
WHERE
......@@ -78,9 +120,16 @@
WHERE ibjui."RECORD" = #{record}
</select>
<update id="updateVersionBatch">
<foreach collection="records" separator=";" item="record" open="" close="">
UPDATE idx_biz_jg_use_info SET "VERSION"=#{version} WHERE record = #{record}
</foreach>
UPDATE
idx_biz_jg_use_info
SET
"VERSION"=#{version}
WHERE
record = ANY(ARRAY[
<foreach collection="records" separator="," item="record" open="" close="">
#{record}
</foreach>
])
</update>
<sql id="equip-detail-es">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment