forked from rongchao/epmet-cloud-rizhao
18 changed files with 431 additions and 132 deletions
@ -0,0 +1,48 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.dao.evaluationindex.screen; |
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.entity.evaluationindex.screen.DimLastSyncRecordEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-12-28 |
|||
*/ |
|||
@Mapper |
|||
public interface DimLastSyncRecordDao extends BaseDao<DimLastSyncRecordEntity> { |
|||
/** |
|||
* 查询最后一次同步时间 |
|||
* @return |
|||
*/ |
|||
Date getDimLastSyncEndTime(@Param("subject") String subject); |
|||
|
|||
/** |
|||
* 更新最后一次同步时间 |
|||
* @param subject |
|||
* @param statsEndTime |
|||
* @return |
|||
*/ |
|||
int updateLastSyncEndTime(@Param("subject") String subject, @Param("statsEndTime") Date statsEndTime); |
|||
} |
@ -0,0 +1,51 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.entity.evaluationindex.screen; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2021-12-28 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("dim_last_sync_record") |
|||
public class DimLastSyncRecordEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主体。agency:机关,department:部门,grid:网格 |
|||
*/ |
|||
private String subject; |
|||
|
|||
/** |
|||
* 最后一次同步时间 |
|||
*/ |
|||
private Date lastSyncTime; |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
create table dim_last_sync_record |
|||
( |
|||
`ID` varchar(64) primary key comment '主键', |
|||
`SUBJECT` varchar(32) not null comment '主体。agency:机关,department:部门,grid:网格', |
|||
`LAST_SYNC_TIME` datetime not null comment '最后一次同步时间', |
|||
`DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', |
|||
`REVISION` int(11) NOT NULL COMMENT '乐观锁', |
|||
`CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', |
|||
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间', |
|||
`UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', |
|||
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间' |
|||
) default character set utf8mb4 engine InnoDB; |
|||
|
|||
create unique index dim_last_sync_record_SUBJECT_uindex |
|||
on dim_last_sync_record (SUBJECT); |
@ -0,0 +1,31 @@ |
|||
<?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.epmet.dao.evaluationindex.screen.DimLastSyncRecordDao"> |
|||
|
|||
<resultMap type="com.epmet.entity.evaluationindex.screen.DimLastSyncRecordEntity" id="dimLastSyncRecordMap"> |
|||
<result property="id" column="ID"/> |
|||
<result property="subject" column="SUBJECT"/> |
|||
<result property="lastSyncTime" column="LAST_SYNC_TIME"/> |
|||
<result property="delFlag" column="DEL_FLAG"/> |
|||
<result property="revision" column="REVISION"/> |
|||
<result property="createdBy" column="CREATED_BY"/> |
|||
<result property="createdTime" column="CREATED_TIME"/> |
|||
<result property="updatedBy" column="UPDATED_BY"/> |
|||
<result property="updatedTime" column="UPDATED_TIME"/> |
|||
</resultMap> |
|||
<update id="updateLastSyncEndTime"> |
|||
update dim_last_sync_record |
|||
set LAST_SYNC_TIME = #{statsEndTime} |
|||
where SUBJECT = #{subject} |
|||
and DEL_FLAG = '0' |
|||
</update> |
|||
|
|||
<!--查询最后一次维度同步时间--> |
|||
<select id="getDimLastSyncEndTime" resultType="java.util.Date"> |
|||
select LAST_SYNC_TIME |
|||
from dim_last_sync_record |
|||
where SUBJECT = #{subject} |
|||
and DEL_FLAG = '0' |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue