3 changed files with 110 additions and 0 deletions
@ -0,0 +1,50 @@ |
|||
package com.threecloud.dataserviceyy.entity; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** FTP索引来源单位与系统机构的映射。 */ |
|||
public class FtpOrgMapping { |
|||
private String cityCode; |
|||
private String cityName; |
|||
private String sourceOrgId; |
|||
private String sourceOrgName; |
|||
private String sourceDeviceNo; |
|||
private String ftpDeviceNo; |
|||
private String mappedOrgCode; |
|||
private String mappedOrgName; |
|||
private String mappingStatus; |
|||
private Date firstSeenTime; |
|||
private Date lastSeenTime; |
|||
private Date createTime; |
|||
private Date updateTime; |
|||
private String remarks; |
|||
|
|||
public String getCityCode() { return cityCode; } |
|||
public void setCityCode(String cityCode) { this.cityCode = cityCode; } |
|||
public String getCityName() { return cityName; } |
|||
public void setCityName(String cityName) { this.cityName = cityName; } |
|||
public String getSourceOrgId() { return sourceOrgId; } |
|||
public void setSourceOrgId(String sourceOrgId) { this.sourceOrgId = sourceOrgId; } |
|||
public String getSourceOrgName() { return sourceOrgName; } |
|||
public void setSourceOrgName(String sourceOrgName) { this.sourceOrgName = sourceOrgName; } |
|||
public String getSourceDeviceNo() { return sourceDeviceNo; } |
|||
public void setSourceDeviceNo(String sourceDeviceNo) { this.sourceDeviceNo = sourceDeviceNo; } |
|||
public String getFtpDeviceNo() { return ftpDeviceNo; } |
|||
public void setFtpDeviceNo(String ftpDeviceNo) { this.ftpDeviceNo = ftpDeviceNo; } |
|||
public String getMappedOrgCode() { return mappedOrgCode; } |
|||
public void setMappedOrgCode(String mappedOrgCode) { this.mappedOrgCode = mappedOrgCode; } |
|||
public String getMappedOrgName() { return mappedOrgName; } |
|||
public void setMappedOrgName(String mappedOrgName) { this.mappedOrgName = mappedOrgName; } |
|||
public String getMappingStatus() { return mappingStatus; } |
|||
public void setMappingStatus(String mappingStatus) { this.mappingStatus = mappingStatus; } |
|||
public Date getFirstSeenTime() { return firstSeenTime; } |
|||
public void setFirstSeenTime(Date firstSeenTime) { this.firstSeenTime = firstSeenTime; } |
|||
public Date getLastSeenTime() { return lastSeenTime; } |
|||
public void setLastSeenTime(Date lastSeenTime) { this.lastSeenTime = lastSeenTime; } |
|||
public Date getCreateTime() { return createTime; } |
|||
public void setCreateTime(Date createTime) { this.createTime = createTime; } |
|||
public Date getUpdateTime() { return updateTime; } |
|||
public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } |
|||
public String getRemarks() { return remarks; } |
|||
public void setRemarks(String remarks) { this.remarks = remarks; } |
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
package com.threecloud.dataserviceyy.mapper; |
|||
|
|||
import com.threecloud.dataserviceyy.entity.FtpOrgMapping; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
@Mapper |
|||
public interface FtpOrgMappingMapper { |
|||
int upsert(FtpOrgMapping mapping); |
|||
|
|||
FtpOrgMapping selectBySourceOrg(@Param("cityCode") String cityCode, |
|||
@Param("sourceOrgId") String sourceOrgId); |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
<?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.threecloud.dataserviceyy.mapper.FtpOrgMappingMapper"> |
|||
<resultMap id="BaseResultMap" type="com.threecloud.dataserviceyy.entity.FtpOrgMapping"> |
|||
<id column="city_code" property="cityCode"/> |
|||
<id column="source_org_id" property="sourceOrgId"/> |
|||
<result column="city_name" property="cityName"/> |
|||
<result column="source_org_name" property="sourceOrgName"/> |
|||
<result column="source_device_no" property="sourceDeviceNo"/> |
|||
<result column="ftp_device_no" property="ftpDeviceNo"/> |
|||
<result column="mapped_org_code" property="mappedOrgCode"/> |
|||
<result column="mapped_org_name" property="mappedOrgName"/> |
|||
<result column="mapping_status" property="mappingStatus"/> |
|||
<result column="first_seen_time" property="firstSeenTime"/> |
|||
<result column="last_seen_time" property="lastSeenTime"/> |
|||
<result column="create_time" property="createTime"/> |
|||
<result column="update_time" property="updateTime"/> |
|||
<result column="remarks" property="remarks"/> |
|||
</resultMap> |
|||
|
|||
<!-- 人大金仓V8R3:联合主键冲突时仅刷新厂家原始信息,绝不覆盖人工映射结果。 --> |
|||
<insert id="upsert"> |
|||
INSERT INTO mid_ftp_org_mapping ( |
|||
city_code, city_name, source_org_id, source_org_name, source_device_no, |
|||
ftp_device_no, mapping_status, first_seen_time, last_seen_time, |
|||
create_time, update_time |
|||
) VALUES ( |
|||
#{cityCode}, #{cityName}, #{sourceOrgId}, #{sourceOrgName}, #{sourceDeviceNo}, |
|||
#{ftpDeviceNo}, '0', NOW(), NOW(), NOW(), NOW() |
|||
) |
|||
ON CONFLICT (city_code, source_org_id) |
|||
DO UPDATE SET |
|||
city_name = EXCLUDED.city_name, |
|||
source_org_name = EXCLUDED.source_org_name, |
|||
source_device_no = COALESCE(NULLIF(EXCLUDED.source_device_no, ''), mid_ftp_org_mapping.source_device_no), |
|||
last_seen_time = NOW(), |
|||
update_time = NOW() |
|||
</insert> |
|||
|
|||
<select id="selectBySourceOrg" resultMap="BaseResultMap"> |
|||
SELECT * |
|||
FROM mid_ftp_org_mapping |
|||
WHERE city_code = #{cityCode} |
|||
AND source_org_id = #{sourceOrgId} |
|||
LIMIT 1 |
|||
</select> |
|||
</mapper> |
|||
Loading…
Reference in new issue