NorthLan 7 years ago
parent
commit
19dc6db5df
33 changed files with 1540 additions and 38 deletions
  1. 15 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/mapper/MgrArchivesDocumentMapper.kt
  2. 15 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/mapper/ShareDirectoryRecMgrMapper.kt
  3. 15 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/mapper/ShareInformationRecMgrMapper.kt
  4. 15 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/mapper/ShareTimeMapper.kt
  5. 15 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/mapper/SharedSysDicMapper.kt
  6. 244 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/model/MgrArchivesDocument.kt
  7. 127 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/model/ShareDirectoryRecMgr.kt
  8. 217 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/model/ShareInformationRecMgr.kt
  9. 31 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/model/ShareTime.kt
  10. 32 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/model/SharedSysDic.kt
  11. 140 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/AbstractSharedService.kt
  12. 13 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/IMgrArchivesDocumentService.kt
  13. 13 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/IShareDirectoryRecMgrService.kt
  14. 13 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/IShareInformationRecMgrService.kt
  15. 13 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/IShareTimeService.kt
  16. 13 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/ISharedSysDicService.kt
  17. 68 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/TestSharedService.kt
  18. 20 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/impl/MgrArchivesDocumentServiceImpl.kt
  19. 20 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/impl/ShareDirectoryRecMgrServiceImpl.kt
  20. 20 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/impl/ShareInformationRecMgrServiceImpl.kt
  21. 20 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/impl/ShareTimeServiceImpl.kt
  22. 20 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/impl/SharedSysDicServiceImpl.kt
  23. 16 0
      zen-api/src/main/kotlin/com/gxzc/zen/api/util/ShareTimeUtil.kt
  24. 72 0
      zen-api/src/main/resources/mapping/shared/MgrArchivesDocumentMapper.xml
  25. 39 0
      zen-api/src/main/resources/mapping/shared/ShareDirectoryRecMgrMapper.xml
  26. 64 0
      zen-api/src/main/resources/mapping/shared/ShareInformationRecMgrMapper.xml
  27. 19 0
      zen-api/src/main/resources/mapping/shared/ShareTimeMapper.xml
  28. 20 0
      zen-api/src/main/resources/mapping/shared/SharedSysDicMapper.xml
  29. 3 2
      zen-orm/src/main/kotlin/com/gxzc/zen/Generator.kt
  30. 150 0
      zen-orm/src/main/resources/templates/entity.java.vm
  31. 38 31
      zen-orm/src/main/resources/templates/entity.kt.vm
  32. 16 1
      zen-web/src/main/kotlin/com/gxzc/zen/web/sys/controller/TestController.kt
  33. 4 4
      zen-web/src/main/resources/application-orm.yml

+ 15 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/mapper/MgrArchivesDocumentMapper.kt

@@ -0,0 +1,15 @@
+package com.gxzc.zen.api.shared.mapper
+
+import com.gxzc.zen.api.shared.model.MgrArchivesDocument
+import com.gxzc.zen.common.base.BaseMapper
+import org.springframework.stereotype.Repository
+/**
+ * <p>
+ * 文书档案文件 Mapper 接口
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@Repository
+interface MgrArchivesDocumentMapper : BaseMapper<MgrArchivesDocument>

+ 15 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/mapper/ShareDirectoryRecMgrMapper.kt

@@ -0,0 +1,15 @@
+package com.gxzc.zen.api.shared.mapper
+
+import com.gxzc.zen.api.shared.model.ShareDirectoryRecMgr
+import com.gxzc.zen.common.base.BaseMapper
+import org.springframework.stereotype.Repository
+/**
+ * <p>
+ * 案卷文件 Mapper 接口
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@Repository
+interface ShareDirectoryRecMgrMapper : BaseMapper<ShareDirectoryRecMgr>

+ 15 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/mapper/ShareInformationRecMgrMapper.kt

@@ -0,0 +1,15 @@
+package com.gxzc.zen.api.shared.mapper
+
+import com.gxzc.zen.api.shared.model.ShareInformationRecMgr
+import com.gxzc.zen.common.base.BaseMapper
+import org.springframework.stereotype.Repository
+/**
+ * <p>
+ * 卷内文件 Mapper 接口
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@Repository
+interface ShareInformationRecMgrMapper : BaseMapper<ShareInformationRecMgr>

+ 15 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/mapper/ShareTimeMapper.kt

@@ -0,0 +1,15 @@
+package com.gxzc.zen.api.shared.mapper
+
+import com.gxzc.zen.api.shared.model.ShareTime
+import com.gxzc.zen.common.base.BaseMapper
+import org.springframework.stereotype.Repository
+/**
+ * <p>
+ * 共享时间表 Mapper 接口
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@Repository
+interface ShareTimeMapper : BaseMapper<ShareTime>

+ 15 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/mapper/SharedSysDicMapper.kt

@@ -0,0 +1,15 @@
+package com.gxzc.zen.api.shared.mapper
+
+import com.gxzc.zen.api.shared.model.SharedSysDic
+import com.gxzc.zen.common.base.BaseMapper
+import org.springframework.stereotype.Repository
+/**
+ * <p>
+ * 字典表 Mapper 接口
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@Repository
+interface SharedSysDicMapper : BaseMapper<SharedSysDic>

+ 244 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/model/MgrArchivesDocument.kt

@@ -0,0 +1,244 @@
+package com.gxzc.zen.api.shared.model
+
+import com.baomidou.mybatisplus.annotations.TableName
+import com.fasterxml.jackson.annotation.JsonFormat
+import java.util.Date
+import com.gxzc.zen.common.base.BaseModel
+
+/**
+ * <p>
+ * 文书档案文件
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@TableName("mgr_archives_document")
+open class MgrArchivesDocument : BaseModel() {
+    /**
+     * 案卷id
+     */
+    var fileId: Long? = null
+    /**
+     * 目录树节点id
+     */
+    var treeNodeId: Long? = null
+    /**
+     * 标识自己是什么(如:1案卷、2卷内文件、3件、4其他)。其中没有案卷时卷内文件改名为件。
+     */
+    var selfFlag: Int? = null
+    /**
+     * 归档人
+     */
+    var filingBy: String? = null
+    /**
+     * 归档日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    var filingTime: Date? = null
+    /**
+     * 全宗号
+     */
+    var fondsNo: String? = null
+    /**
+     * 档案类型id
+     */
+    var typeId: Long? = null
+    /**
+     * 案卷目录号
+     */
+    var catalogueCode: Int? = null
+    /**
+     * 案卷号
+     */
+    var fileCode: String? = null
+    /**
+     * 案卷级档号
+     */
+    var archivalCode: String? = null
+    /**
+     * 页号
+     */
+    var pageCode: String? = null
+    /**
+     * 件号
+     */
+    var partNo: String? = null
+    /**
+     * 责任者
+     */
+    var responsiblePerson: String? = null
+    /**
+     * 文件编号
+     */
+    var documentCode: String? = null
+    /**
+     * 文件题名
+     */
+    var documentTitle: String? = null
+    /**
+     * 页数
+     */
+    var pagesCount: Int? = null
+    /**
+     * 成文时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    var writtenTime: Date? = null
+    /**
+     * 年度
+     */
+    var year: String? = null
+    /**
+     * 盒号
+     */
+    var boxCode: String? = null
+    /**
+     * 密级。(0无密;1秘密;2机密;3绝密;4其他)
+     */
+    var securityClassification: Int? = null
+    /**
+     * 分类号
+     */
+    var archivesTypeCode: Int? = null
+    /**
+     * 电子档案名称
+     */
+    var electronicRecordTitle: String? = null
+    /**
+     * 主题词
+     */
+    var descriptor: String? = null
+    /**
+     * 机构(问题)
+     */
+    var organizationProblem: String? = null
+    /**
+     * 人物
+     */
+    var personage: String? = null
+    /**
+     * 档案馆名称
+     */
+    var archivesName: String? = null
+    /**
+     * 附件题名
+     */
+    var attachmentTitle: String? = null
+    /**
+     * 控制标识
+     */
+    var controlSign: String? = null
+    /**
+     * 档案馆代码
+     */
+    var archivesCode: String? = null
+    /**
+     * 电子档案生成方式
+     */
+    var produceWay: String? = null
+    /**
+     * 保密期限
+     */
+    var secrecyPeriod: String? = null
+    /**
+     * 保管期限
+     */
+    var retentionPeriod: String? = null
+    /**
+     * 档案归档状态(0未归档;1归档)
+     */
+    var filingStatus: Int? = null
+    /**
+     * 删除标识(0未删除;1删除)
+     */
+    var delFlag: Int? = null
+    /**
+     * 是否开放。默认为0,未开放,1为开放。
+     */
+    var isOpen: Long? = null
+    /**
+     * 是否可申请开放鉴定
+     */
+    var openEnable: Long? = null
+    /**
+     * 数字化时间
+     */
+    var digitizationTime: String? = null
+    /**
+     * 数字化对象描述
+     */
+    var digitizationObjDescribe: String? = null
+    /**
+     * 数字化授权描述
+     */
+    var digitizationAuthorizeDescribe: String? = null
+    /**
+     * 格式名称
+     */
+    var formatName: String? = null
+    /**
+     * 格式版本
+     */
+    var formatVersion: String? = null
+    /**
+     * 色彩空间
+     */
+    var colorSpace: String? = null
+    /**
+     * 压缩方案
+     */
+    var compressScheme: String? = null
+    /**
+     * 压缩率
+     */
+    var compressionRatio: String? = null
+    /**
+     * 水平分辨率
+     */
+    var horizontalResolution: String? = null
+    /**
+     * 垂直分辨率
+     */
+    var verticalResolution: String? = null
+    /**
+     * 图像宽度
+     */
+    var imageWidth: String? = null
+    /**
+     * 图像高度
+     */
+    var imageHeight: String? = null
+    /**
+     * 设备类型
+     */
+    var equipmentType: String? = null
+    /**
+     * 设备制造商
+     */
+    var equipmentManufacturer: String? = null
+    /**
+     * 设备型号
+     */
+    var equipmentModel: String? = null
+    /**
+     * 设备系列号
+     */
+    var equipmentSeriesNumber: String? = null
+    /**
+     * 设备感光器
+     */
+    var equipmentPhotoreceptor: String? = null
+    /**
+     * 数字化软件名称
+     */
+    var digitalSoftwareName: String? = null
+    /**
+     * 数字化软件版本
+     */
+    var digitalSoftwareVersion: String? = null
+    /**
+     * 数字化软件生产商
+     */
+    var digitalSoftwareManufacturer: String? = null
+}

+ 127 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/model/ShareDirectoryRecMgr.kt

@@ -0,0 +1,127 @@
+package com.gxzc.zen.api.shared.model
+
+import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotations.TableField
+import com.gxzc.zen.common.base.BaseModel
+
+/**
+ * <p>
+ * 案卷文件
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@TableName("share_directory_rec_mgr")
+open class ShareDirectoryRecMgr : BaseModel() {
+    /**
+     * 案卷级档号
+     */
+@TableField("filesNo")
+    var filesNo: String? = null
+    /**
+     * 全宗号
+     */
+@TableField("fondsId")
+    var fondsId: String? = null
+    /**
+     * 案卷号
+     */
+@TableField("filesId")
+    var filesId: String? = null
+    /**
+     * 目录号
+     */
+    var directory: String? = null
+    /**
+     * 年度
+     */
+    var year: String? = null
+    /**
+     * 保管期限
+     */
+@TableField("retentionPeriod")
+    var retentionPeriod: String? = null
+    /**
+     * 保管期限代码
+     */
+@TableField("custodyCode")
+    var custodyCode: String? = null
+    /**
+     * 文件编号
+     */
+@TableField("fileNumber")
+    var fileNumber: String? = null
+    /**
+     * 案卷题名
+     */
+@TableField("archivesNominate")
+    var archivesNominate: String? = null
+    /**
+     * 起时间
+     */
+@TableField("beginTime")
+    var beginTime: String? = null
+    /**
+     * 止时间
+     */
+@TableField("stopTime")
+    var stopTime: String? = null
+    /**
+     * 责任者
+     */
+    var responsible: String? = null
+    /**
+     * 成文时间
+     */
+@TableField("formaationTime")
+    var formaationTime: String? = null
+    /**
+     * 页数
+     */
+@TableField("pageNumber")
+    var pageNumber: String? = null
+    /**
+     * 人物
+     */
+    var people: String? = null
+    /**
+     * 盒号
+     */
+@TableField("boxId")
+    var boxId: String? = null
+    /**
+     * 附注
+     */
+    var appendix: String? = null
+    /**
+     * 保密期限
+     */
+@TableField("ConfidentialityTime")
+    var ConfidentialityTime: String? = null
+    /**
+     * 密级
+     */
+@TableField("securityClassification")
+    var securityClassification: String? = null
+    /**
+     * 档案馆名称
+     */
+@TableField("archivesName")
+    var archivesName: String? = null
+    /**
+     * 主题词
+     */
+@TableField("subjectTerm")
+    var subjectTerm: String? = null
+    /**
+     * 档案馆代码
+     */
+@TableField("archiveId")
+    var archiveId: String? = null
+    /**
+     * 附件题名
+     */
+@TableField("appendixName")
+    var appendixName: String? = null
+}

+ 217 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/model/ShareInformationRecMgr.kt

@@ -0,0 +1,217 @@
+package com.gxzc.zen.api.shared.model
+
+import com.baomidou.mybatisplus.annotations.TableName
+import com.baomidou.mybatisplus.annotations.TableField
+import com.gxzc.zen.common.base.BaseModel
+
+/**
+ * <p>
+ * 卷内文件
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@TableName("share_information_rec_mgr")
+open class ShareInformationRecMgr : BaseModel() {
+    /**
+     * 档案归档状态(0未归档;1归档)
+     */
+    var singn: String? = null
+    /**
+     * 全宗号
+     */
+@TableField("fonds_Id")
+    var fondsId: String? = null
+    /**
+     * 案卷目录号
+     */
+    var directory: String? = null
+    /**
+     * 案卷号
+     */
+@TableField("files_Id")
+    var filesId: String? = null
+    /**
+     * 案卷级档号
+     */
+    var filesNo: String? = null
+    /**
+     * 文件级档号
+     */
+    var doumentNo: String? = null
+    /**
+     * 页号
+     */
+@TableField("page_Id")
+    var pageId: String? = null
+    /**
+     * 件号
+     */
+@TableField("doument_Id")
+    var doumentId: String? = null
+    /**
+     * 责任者
+     */
+    var responsible: String? = null
+    /**
+     * 文件编号
+     */
+    var fileNumber: String? = null
+    /**
+     * 文件题名
+     */
+    var fileName: String? = null
+    /**
+     * 页数
+     */
+    var pageNumber: String? = null
+    /**
+     * 成文时间
+     */
+    var formationTime: String? = null
+    /**
+     * 年度
+     */
+    var year: String? = null
+@TableField("box_Id")
+    var boxId: String? = null
+    /**
+     * 密级
+     */
+    var securityClassification: String? = null
+    /**
+     * 电子档案名
+     */
+    var electronicName: String? = null
+    /**
+     * 主题词
+     */
+    var subjectHeadings: String? = null
+    /**
+     * 机构(问题)
+     */
+    var institution: String? = null
+    /**
+     * 人物
+     */
+    var people: String? = null
+    /**
+     * 档案馆名称
+     */
+    var archivesName: String? = null
+    /**
+     * 附件题名
+     */
+    var adjunct: String? = null
+    /**
+     * 控制标识
+     */
+@TableField("controlIndicators")
+    var controlIndicators: String? = null
+    /**
+     * 档案馆代码
+     */
+@TableField("archive_Id")
+    var archiveId: String? = null
+    /**
+     * 档案生成方式
+     */
+    var archiveGeneration: String? = null
+    /**
+     * 附注
+     */
+    var note: String? = null
+    /**
+     * 保密期限
+     */
+    var confidentialityTime: String? = null
+    /**
+     * 保管期限
+     */
+@TableField("retentionPeriod")
+    var retentionPeriod: String? = null
+    /**
+     * 数字化时间
+     */
+    var digitalTime: String? = null
+    /**
+     * 数字化授权描述
+     */
+    var digitalDescription: String? = null
+    /**
+     * 格式名称
+     */
+    var formatName: String? = null
+    /**
+     * 格式版本
+     */
+    var formatVersion: String? = null
+    /**
+     * 色彩空间
+     */
+    var colorSpace: String? = null
+    /**
+     * 压缩方式
+     */
+    var compressionScheme: String? = null
+    /**
+     * 压缩率
+     */
+    var compressionRatio: String? = null
+    /**
+     * 水平分辨率
+     */
+    var horizontalResolution: String? = null
+    /**
+     * 垂直分辨率
+     */
+    var verticalResolution: String? = null
+    /**
+     * 图像高度
+     */
+    var imageHeight: String? = null
+    /**
+     * 图像宽度
+     */
+    var imageWidth: String? = null
+    /**
+     * 设备类型
+     */
+    var deviceType: String? = null
+    /**
+     * 设备制造商
+     */
+    var deviceManufacturers: String? = null
+    /**
+     * 设备型号
+     */
+    var devicModle: String? = null
+    /**
+     * 设备系列号
+     */
+@TableField("devic_Id")
+    var devicId: String? = null
+    /**
+     * 设备感光器
+     */
+    var photoreceptor: String? = null
+    /**
+     * 数字化软件名称
+     */
+    var softwareName: String? = null
+    /**
+     * 数字化软件版本
+     */
+@TableField("softwareVersion")
+    var softwareVersion: String? = null
+    /**
+     * 数值化软件生产商
+     */
+    var manufacturers: String? = null
+    /**
+     * 数字化对象描述
+     */
+@TableField("digital_Object")
+    var digitalObject: String? = null
+}

+ 31 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/model/ShareTime.kt

@@ -0,0 +1,31 @@
+package com.gxzc.zen.api.shared.model
+
+import com.baomidou.mybatisplus.annotations.TableName
+import com.fasterxml.jackson.annotation.JsonFormat
+import java.util.Date
+import com.gxzc.zen.common.base.BaseModel
+
+/**
+ * <p>
+ * 共享时间表
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@TableName("share_time")
+open class ShareTime : BaseModel() {
+    /**
+     * 平台ID
+     */
+    var platformId: Int? = null
+    /**
+     * 键
+     */
+    var key: String? = null
+    /**
+     * 时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    var time: Date? = null
+}

+ 32 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/model/SharedSysDic.kt

@@ -0,0 +1,32 @@
+package com.gxzc.zen.api.shared.model
+
+import com.baomidou.mybatisplus.annotations.TableName
+import com.gxzc.zen.common.base.BaseModel
+
+/**
+ * <p>
+ * 字典表
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@TableName("shared_sys_dic")
+open class SharedSysDic : BaseModel() {
+    /**
+     * 字典代码
+     */
+    var key: String? = null
+    /**
+     * 字典值
+     */
+    var value: String? = null
+    /**
+     * 标签
+     */
+    var label: String? = null
+    /**
+     * 排序号
+     */
+    var sort: Int? = null
+}

+ 140 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/AbstractSharedService.kt

@@ -0,0 +1,140 @@
+package com.gxzc.zen.api.shared.service
+
+import com.baomidou.mybatisplus.mapper.EntityWrapper
+import com.baomidou.mybatisplus.mapper.Wrapper
+import com.gxzc.zen.api.shared.model.ShareTime
+import com.gxzc.zen.common.base.BaseModel
+import com.gxzc.zen.common.exception.ZenException
+import com.gxzc.zen.common.util.PlatformUtil
+import com.gxzc.zen.orm.annotation.ZenTransactional
+import com.xxl.job.core.log.XxlJobLogger
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+import java.util.*
+
+/**
+ * 公共数据流转 抽象类<br>
+ * 单表业务(单表作为主要流转对象的场景)
+ * @author NorthLan
+ * @date 2018/4/14
+ * @url https://noahlan.com
+ */
+@Service
+abstract class AbstractSharedService<T : BaseModel, K : BaseModel> {
+    @Autowired
+    private lateinit var shareTimeService: IShareTimeService
+
+    /**
+     * 获取最新共享时间
+     */
+    protected fun getLastTime(key: String): ShareTime {
+        val conditionEntity = ShareTime().apply {
+            this.platformId = PlatformUtil.getPlatformId()
+            this.key = key
+        }
+        var lastTime: ShareTime? = shareTimeService.selectOne(EntityWrapper<ShareTime>(conditionEntity))
+        if (lastTime == null) {
+            if (shareTimeService.insert(conditionEntity)) {
+                lastTime = conditionEntity
+            } else {
+                val e = ZenException(999, "公共表 [share_time] 数据插入失败!")
+                XxlJobLogger.log(e)
+                throw e
+            }
+        }
+        if (lastTime.time == null) {
+            lastTime.time = Date(0L)
+        }
+        return lastTime
+    }
+
+    /**
+     * 从数据中获取最近的时间
+     * 由于条件构造为: 按时间进行降序排列
+     * 故 直接取第一条数据即可
+     */
+    private fun <A : BaseModel> getLastTimeFromDataList(data: List<A>): Date? {
+        return if (data.isEmpty()) {
+            null
+        } else {
+            data[0].updateTime ?: data[0].createTime
+        }
+    }
+
+    /**
+     * 更新共享时间
+     */
+    private fun updateShareTime(lastTime: ShareTime) {
+        shareTimeService.updateById(lastTime)
+    }
+
+    /**
+     * 构造时间查询条件
+     * 结果 降序排列
+     */
+    protected fun <A : BaseModel> queryConditionWrapper(time: Date): Wrapper<A> {
+        return EntityWrapper<A>()
+                .where("(update_time is null and create_time > {0}) or (update_time is not null and update_time > {1})", time, time)
+                .orderBy("create_time", false)
+                .orderBy("update_time", false)
+    }
+
+    /**
+     * 插入数据逻辑
+     * (定时)
+     */
+    @ZenTransactional
+    fun insert() {
+        val lastTime = getLastTimeInsert()
+
+        val result = innerInsert(lastTime)
+
+        if (result != null) {
+            val last = getLastTimeFromDataList(result)
+            if (last != null) {
+                updateShareTime(lastTime.apply { time = last })
+            }
+        }
+    }
+
+    abstract fun getLastTimeInsert(): ShareTime
+
+    abstract fun innerInsert(lastTime: ShareTime): MutableList<T>?
+
+
+    /**
+     * 读取数据逻辑
+     * (定时)
+     */
+    fun select() {
+        val lastTime = getLastTimeSelect()
+
+        val result = innerSelect(lastTime)
+
+        if (result != null) {
+            val last = getLastTimeFromDataList(result)
+            if (last != null) {
+                updateShareTime(lastTime.apply { time = last })
+            }
+        }
+    }
+
+    abstract fun getLastTimeSelect(): ShareTime
+
+    abstract fun innerSelect(lastTime: ShareTime): MutableList<K>?
+
+    /**
+     * 公共字段 克隆
+     */
+    protected fun commonFieldClone(from: BaseModel, to: BaseModel) {
+        to.apply {
+            this.updateBy = from.updateBy
+            this.createBy = from.createBy
+            this.updateTime = from.updateTime
+            this.createTime = from.createTime
+            this.remark = from.remark
+            this.enable = from.enable
+//            this.id = from.id
+        }
+    }
+}

+ 13 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/IMgrArchivesDocumentService.kt

@@ -0,0 +1,13 @@
+package com.gxzc.zen.api.shared.service
+
+import com.gxzc.zen.api.shared.model.MgrArchivesDocument
+import com.gxzc.zen.common.base.BaseService
+/**
+ * <p>
+ * 文书档案文件 服务类
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+interface IMgrArchivesDocumentService : BaseService<MgrArchivesDocument>

+ 13 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/IShareDirectoryRecMgrService.kt

@@ -0,0 +1,13 @@
+package com.gxzc.zen.api.shared.service
+
+import com.gxzc.zen.api.shared.model.ShareDirectoryRecMgr
+import com.gxzc.zen.common.base.BaseService
+/**
+ * <p>
+ * 案卷文件 服务类
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+interface IShareDirectoryRecMgrService : BaseService<ShareDirectoryRecMgr>

+ 13 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/IShareInformationRecMgrService.kt

@@ -0,0 +1,13 @@
+package com.gxzc.zen.api.shared.service
+
+import com.gxzc.zen.api.shared.model.ShareInformationRecMgr
+import com.gxzc.zen.common.base.BaseService
+/**
+ * <p>
+ * 卷内文件 服务类
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+interface IShareInformationRecMgrService : BaseService<ShareInformationRecMgr>

+ 13 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/IShareTimeService.kt

@@ -0,0 +1,13 @@
+package com.gxzc.zen.api.shared.service
+
+import com.gxzc.zen.api.shared.model.ShareTime
+import com.gxzc.zen.common.base.BaseService
+/**
+ * <p>
+ * 共享时间表 服务类
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+interface IShareTimeService : BaseService<ShareTime>

+ 13 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/ISharedSysDicService.kt

@@ -0,0 +1,13 @@
+package com.gxzc.zen.api.shared.service
+
+import com.gxzc.zen.api.shared.model.SharedSysDic
+import com.gxzc.zen.common.base.BaseService
+/**
+ * <p>
+ * 字典表 服务类
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+interface ISharedSysDicService : BaseService<SharedSysDic>

+ 68 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/TestSharedService.kt

@@ -0,0 +1,68 @@
+package com.gxzc.zen.api.shared.service
+
+import com.gxzc.zen.api.shared.model.ShareTime
+import com.gxzc.zen.api.shared.model.SharedSysDic
+import com.gxzc.zen.api.sys.model.SysDic
+import com.gxzc.zen.api.sys.service.ISysDicService
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.stereotype.Service
+
+/**
+ *
+ * @author NorthLan
+ * @date 2018/4/16
+ * @url https://noahlan.com
+ */
+@Service
+class TestSharedService : AbstractSharedService<SysDic, SharedSysDic>() {
+    @Autowired
+    private lateinit var sysDicService: ISysDicService
+
+    @Autowired
+    private lateinit var sharedSysDicService: ISharedSysDicService
+
+    override fun innerInsert(lastTime: ShareTime): MutableList<SysDic>? {
+        //
+        val data = sysDicService.selectList(queryConditionWrapper(lastTime.time!!))
+        data.forEach {
+            sharedSysDicService.insert(clone(it))
+        }
+        return data
+    }
+
+    override fun getLastTimeInsert(): ShareTime {
+        return getLastTime("dic_insert")
+    }
+
+    fun clone(entity: SysDic): SharedSysDic {
+        return SharedSysDic().apply {
+            this.sort = entity.sort
+            this.label = entity.label
+            this.key = entity.key
+            this.value = entity.value
+            commonFieldClone(entity, this)
+        }
+    }
+
+    override fun getLastTimeSelect(): ShareTime {
+        return getLastTime("dic_select")
+    }
+
+    override fun innerSelect(lastTime: ShareTime): MutableList<SharedSysDic>? {
+        val data = sharedSysDicService.selectList(queryConditionWrapper(lastTime.time!!))
+        data.forEach {
+            sysDicService.insert(cloneSelect(it))
+        }
+        return data
+    }
+
+    fun cloneSelect(entity: SharedSysDic): SysDic {
+        return SysDic().apply {
+            this.sort = entity.sort
+            this.label = entity.label
+            this.key = entity.key
+            this.value = entity.value
+            commonFieldClone(entity, this)
+        }
+    }
+}

+ 20 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/impl/MgrArchivesDocumentServiceImpl.kt

@@ -0,0 +1,20 @@
+package com.gxzc.zen.api.shared.service.impl
+
+import com.gxzc.zen.api.shared.model.MgrArchivesDocument
+import com.gxzc.zen.api.shared.mapper.MgrArchivesDocumentMapper
+import com.gxzc.zen.api.shared.service.IMgrArchivesDocumentService
+import com.baomidou.mybatisplus.service.impl.ServiceImpl
+import org.springframework.stereotype.Service
+
+/**
+ * <p>
+ * 文书档案文件 服务实现类
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@Service
+class MgrArchivesDocumentServiceImpl : ServiceImpl<MgrArchivesDocumentMapper, MgrArchivesDocument>(), IMgrArchivesDocumentService {
+
+}

+ 20 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/impl/ShareDirectoryRecMgrServiceImpl.kt

@@ -0,0 +1,20 @@
+package com.gxzc.zen.api.shared.service.impl
+
+import com.gxzc.zen.api.shared.model.ShareDirectoryRecMgr
+import com.gxzc.zen.api.shared.mapper.ShareDirectoryRecMgrMapper
+import com.gxzc.zen.api.shared.service.IShareDirectoryRecMgrService
+import com.baomidou.mybatisplus.service.impl.ServiceImpl
+import org.springframework.stereotype.Service
+
+/**
+ * <p>
+ * 案卷文件 服务实现类
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@Service
+class ShareDirectoryRecMgrServiceImpl : ServiceImpl<ShareDirectoryRecMgrMapper, ShareDirectoryRecMgr>(), IShareDirectoryRecMgrService {
+
+}

+ 20 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/impl/ShareInformationRecMgrServiceImpl.kt

@@ -0,0 +1,20 @@
+package com.gxzc.zen.api.shared.service.impl
+
+import com.gxzc.zen.api.shared.model.ShareInformationRecMgr
+import com.gxzc.zen.api.shared.mapper.ShareInformationRecMgrMapper
+import com.gxzc.zen.api.shared.service.IShareInformationRecMgrService
+import com.baomidou.mybatisplus.service.impl.ServiceImpl
+import org.springframework.stereotype.Service
+
+/**
+ * <p>
+ * 卷内文件 服务实现类
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@Service
+class ShareInformationRecMgrServiceImpl : ServiceImpl<ShareInformationRecMgrMapper, ShareInformationRecMgr>(), IShareInformationRecMgrService {
+
+}

+ 20 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/impl/ShareTimeServiceImpl.kt

@@ -0,0 +1,20 @@
+package com.gxzc.zen.api.shared.service.impl
+
+import com.gxzc.zen.api.shared.model.ShareTime
+import com.gxzc.zen.api.shared.mapper.ShareTimeMapper
+import com.gxzc.zen.api.shared.service.IShareTimeService
+import com.baomidou.mybatisplus.service.impl.ServiceImpl
+import org.springframework.stereotype.Service
+
+/**
+ * <p>
+ * 共享时间表 服务实现类
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@Service
+class ShareTimeServiceImpl : ServiceImpl<ShareTimeMapper, ShareTime>(), IShareTimeService {
+
+}

+ 20 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/shared/service/impl/SharedSysDicServiceImpl.kt

@@ -0,0 +1,20 @@
+package com.gxzc.zen.api.shared.service.impl
+
+import com.gxzc.zen.api.shared.model.SharedSysDic
+import com.gxzc.zen.api.shared.mapper.SharedSysDicMapper
+import com.gxzc.zen.api.shared.service.ISharedSysDicService
+import com.baomidou.mybatisplus.service.impl.ServiceImpl
+import org.springframework.stereotype.Service
+
+/**
+ * <p>
+ * 字典表 服务实现类
+ * </p>
+ *
+ * @author NorthLan
+ * @since 2018-04-14
+ */
+@Service
+class SharedSysDicServiceImpl : ServiceImpl<SharedSysDicMapper, SharedSysDic>(), ISharedSysDicService {
+
+}

+ 16 - 0
zen-api/src/main/kotlin/com/gxzc/zen/api/util/ShareTimeUtil.kt

@@ -0,0 +1,16 @@
+package com.gxzc.zen.api.util
+
+import com.gxzc.zen.api.shared.service.IShareTimeService
+import com.gxzc.zen.common.util.SpringContextHolder
+
+/**
+ *
+ * @author NorthLan
+ * @date 2018/4/16
+ * @url https://noahlan.com
+ */
+object ShareTimeUtil {
+    private val shareTimeService: IShareTimeService = SpringContextHolder.getBean(IShareTimeService::class.java)
+
+
+}

+ 72 - 0
zen-api/src/main/resources/mapping/shared/MgrArchivesDocumentMapper.xml

@@ -0,0 +1,72 @@
+<?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.gxzc.zen.api.shared.mapper.MgrArchivesDocumentMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gxzc.zen.api.shared.model.MgrArchivesDocument">
+    <result column="id" property="id" />
+    <result column="enable" property="enable" />
+    <result column="remark" property="remark" />
+    <result column="create_by" property="createBy" />
+    <result column="create_time" property="createTime" />
+    <result column="update_by" property="updateBy" />
+    <result column="update_time" property="updateTime" />
+        <result column="file_id" property="fileId" />
+        <result column="tree_node_id" property="treeNodeId" />
+        <result column="self_flag" property="selfFlag" />
+        <result column="filing_by" property="filingBy" />
+        <result column="filing_time" property="filingTime" />
+        <result column="fonds_no" property="fondsNo" />
+        <result column="type_id" property="typeId" />
+        <result column="catalogue_code" property="catalogueCode" />
+        <result column="file_code" property="fileCode" />
+        <result column="archival_code" property="archivalCode" />
+        <result column="page_code" property="pageCode" />
+        <result column="part_no" property="partNo" />
+        <result column="responsible_person" property="responsiblePerson" />
+        <result column="document_code" property="documentCode" />
+        <result column="document_title" property="documentTitle" />
+        <result column="pages_count" property="pagesCount" />
+        <result column="written_time" property="writtenTime" />
+        <result column="year" property="year" />
+        <result column="box_code" property="boxCode" />
+        <result column="security_classification" property="securityClassification" />
+        <result column="archives_type_code" property="archivesTypeCode" />
+        <result column="electronic_record_title" property="electronicRecordTitle" />
+        <result column="descriptor" property="descriptor" />
+        <result column="organization_problem" property="organizationProblem" />
+        <result column="personage" property="personage" />
+        <result column="archives_name" property="archivesName" />
+        <result column="attachment_title" property="attachmentTitle" />
+        <result column="control_sign" property="controlSign" />
+        <result column="archives_code" property="archivesCode" />
+        <result column="produce_way" property="produceWay" />
+        <result column="secrecy_period" property="secrecyPeriod" />
+        <result column="retention_period" property="retentionPeriod" />
+        <result column="filing_status" property="filingStatus" />
+        <result column="del_flag" property="delFlag" />
+        <result column="is_open" property="isOpen" />
+        <result column="open_enable" property="openEnable" />
+        <result column="digitization_time" property="digitizationTime" />
+        <result column="digitization_obj_describe" property="digitizationObjDescribe" />
+        <result column="digitization_authorize_describe" property="digitizationAuthorizeDescribe" />
+        <result column="format_name" property="formatName" />
+        <result column="format_version" property="formatVersion" />
+        <result column="color_space" property="colorSpace" />
+        <result column="compress_scheme" property="compressScheme" />
+        <result column="compression_ratio" property="compressionRatio" />
+        <result column="horizontal_resolution" property="horizontalResolution" />
+        <result column="vertical_resolution" property="verticalResolution" />
+        <result column="image_width" property="imageWidth" />
+        <result column="image_height" property="imageHeight" />
+        <result column="equipment_type" property="equipmentType" />
+        <result column="equipment_manufacturer" property="equipmentManufacturer" />
+        <result column="equipment_model" property="equipmentModel" />
+        <result column="equipment_series_number" property="equipmentSeriesNumber" />
+        <result column="equipment_photoreceptor" property="equipmentPhotoreceptor" />
+        <result column="digital_software_name" property="digitalSoftwareName" />
+        <result column="digital_software_version" property="digitalSoftwareVersion" />
+        <result column="digital_software_manufacturer" property="digitalSoftwareManufacturer" />
+    </resultMap>
+
+</mapper>

+ 39 - 0
zen-api/src/main/resources/mapping/shared/ShareDirectoryRecMgrMapper.xml

@@ -0,0 +1,39 @@
+<?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.gxzc.zen.api.shared.mapper.ShareDirectoryRecMgrMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gxzc.zen.api.shared.model.ShareDirectoryRecMgr">
+    <result column="id" property="id" />
+    <result column="enable" property="enable" />
+    <result column="remark" property="remark" />
+    <result column="create_time" property="createTime" />
+    <result column="create_by" property="createBy" />
+    <result column="update_time" property="updateTime" />
+    <result column="update_by" property="updateBy" />
+        <result column="filesNo" property="filesNo" />
+        <result column="fondsId" property="fondsId" />
+        <result column="filesId" property="filesId" />
+        <result column="directory" property="directory" />
+        <result column="year" property="year" />
+        <result column="retentionPeriod" property="retentionPeriod" />
+        <result column="custodyCode" property="custodyCode" />
+        <result column="fileNumber" property="fileNumber" />
+        <result column="archivesNominate" property="archivesNominate" />
+        <result column="beginTime" property="beginTime" />
+        <result column="stopTime" property="stopTime" />
+        <result column="responsible" property="responsible" />
+        <result column="formaationTime" property="formaationTime" />
+        <result column="pageNumber" property="pageNumber" />
+        <result column="people" property="people" />
+        <result column="boxId" property="boxId" />
+        <result column="appendix" property="appendix" />
+        <result column="ConfidentialityTime" property="ConfidentialityTime" />
+        <result column="securityClassification" property="securityClassification" />
+        <result column="archivesName" property="archivesName" />
+        <result column="subjectTerm" property="subjectTerm" />
+        <result column="archiveId" property="archiveId" />
+        <result column="appendixName" property="appendixName" />
+    </resultMap>
+
+</mapper>

+ 64 - 0
zen-api/src/main/resources/mapping/shared/ShareInformationRecMgrMapper.xml

@@ -0,0 +1,64 @@
+<?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.gxzc.zen.api.shared.mapper.ShareInformationRecMgrMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gxzc.zen.api.shared.model.ShareInformationRecMgr">
+    <result column="id" property="id" />
+    <result column="enable" property="enable" />
+    <result column="remark" property="remark" />
+    <result column="create_by" property="createBy" />
+    <result column="create_time" property="createTime" />
+    <result column="update_by" property="updateBy" />
+    <result column="update_time" property="updateTime" />
+        <result column="singn" property="singn" />
+        <result column="fonds_Id" property="fondsId" />
+        <result column="directory" property="directory" />
+        <result column="files_Id" property="filesId" />
+        <result column="files_no" property="filesNo" />
+        <result column="doument_no" property="doumentNo" />
+        <result column="page_Id" property="pageId" />
+        <result column="doument_Id" property="doumentId" />
+        <result column="responsible" property="responsible" />
+        <result column="file_number" property="fileNumber" />
+        <result column="file_name" property="fileName" />
+        <result column="page_number" property="pageNumber" />
+        <result column="formation_time" property="formationTime" />
+        <result column="year" property="year" />
+        <result column="box_Id" property="boxId" />
+        <result column="security_classification" property="securityClassification" />
+        <result column="electronic_name" property="electronicName" />
+        <result column="subject_headings" property="subjectHeadings" />
+        <result column="institution" property="institution" />
+        <result column="people" property="people" />
+        <result column="archives_name" property="archivesName" />
+        <result column="adjunct" property="adjunct" />
+        <result column="controlIndicators" property="controlIndicators" />
+        <result column="archive_Id" property="archiveId" />
+        <result column="archive_generation" property="archiveGeneration" />
+        <result column="note" property="note" />
+        <result column="confidentiality_time" property="confidentialityTime" />
+        <result column="retentionPeriod" property="retentionPeriod" />
+        <result column="digital_time" property="digitalTime" />
+        <result column="digital_description" property="digitalDescription" />
+        <result column="format_name" property="formatName" />
+        <result column="format_version" property="formatVersion" />
+        <result column="color_space" property="colorSpace" />
+        <result column="compression_scheme" property="compressionScheme" />
+        <result column="compression_ratio" property="compressionRatio" />
+        <result column="horizontal_resolution" property="horizontalResolution" />
+        <result column="vertical_resolution" property="verticalResolution" />
+        <result column="image_height" property="imageHeight" />
+        <result column="image_width" property="imageWidth" />
+        <result column="device_type" property="deviceType" />
+        <result column="device_manufacturers" property="deviceManufacturers" />
+        <result column="devic_modle" property="devicModle" />
+        <result column="devic_Id" property="devicId" />
+        <result column="photoreceptor" property="photoreceptor" />
+        <result column="software_name" property="softwareName" />
+        <result column="softwareVersion" property="softwareVersion" />
+        <result column="manufacturers" property="manufacturers" />
+        <result column="digital_Object" property="digitalObject" />
+    </resultMap>
+
+</mapper>

+ 19 - 0
zen-api/src/main/resources/mapping/shared/ShareTimeMapper.xml

@@ -0,0 +1,19 @@
+<?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.gxzc.zen.api.shared.mapper.ShareTimeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gxzc.zen.api.shared.model.ShareTime">
+    <result column="id" property="id" />
+    <result column="enable" property="enable" />
+    <result column="remark" property="remark" />
+    <result column="create_time" property="createTime" />
+    <result column="create_by" property="createBy" />
+    <result column="update_time" property="updateTime" />
+    <result column="update_by" property="updateBy" />
+        <result column="platform_id" property="platformId" />
+        <result column="key" property="key" />
+        <result column="time" property="time" />
+    </resultMap>
+
+</mapper>

+ 20 - 0
zen-api/src/main/resources/mapping/shared/SharedSysDicMapper.xml

@@ -0,0 +1,20 @@
+<?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.gxzc.zen.api.shared.mapper.SharedSysDicMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gxzc.zen.api.shared.model.SharedSysDic">
+    <result column="id" property="id" />
+    <result column="enable" property="enable" />
+    <result column="remark" property="remark" />
+    <result column="create_time" property="createTime" />
+    <result column="create_by" property="createBy" />
+    <result column="update_time" property="updateTime" />
+    <result column="update_by" property="updateBy" />
+        <result column="key" property="key" />
+        <result column="value" property="value" />
+        <result column="label" property="label" />
+        <result column="sort" property="sort" />
+    </resultMap>
+
+</mapper>

+ 3 - 2
zen-orm/src/main/kotlin/com/gxzc/zen/Generator.kt

@@ -27,7 +27,7 @@ fun main(args: Array<String>) {
         it.driverName = "com.mysql.jdbc.Driver"
         it.username = "archives"
         it.password = "archives"
-        it.url = "jdbc:mysql://192.168.1.124:3307/archives_mgr?characterEncoding=utf8"
+        it.url = "jdbc:mysql://192.168.1.92:30002/archives_shared?characterEncoding=utf8"
 //        it.url = "jdbc:mysql://127.0.0.1:3306/archives_mgr?characterEncoding=utf8"
 //        it.username = "root"
 //        it.password = "root"
@@ -73,6 +73,7 @@ fun generate(isKotlin: Boolean, author: String, pkgType: String, dataSourceConfi
     // 策略配置
     mpg.strategy = StrategyConfig().also {
         it.setDbColumnUnderline(true)
+        it.isEntityLombokModel = true
         it.isCapitalMode = false
         it.naming = NamingStrategy.underline_to_camel
         //            setTablePrefix()
@@ -113,7 +114,7 @@ fun generate(isKotlin: Boolean, author: String, pkgType: String, dataSourceConfi
     mpg.template = TemplateConfig().also {
         it.controller = null // 不生成controller
         it.xml = null
-        // it.service = null
+//        it.service = null
 //        it.mapper = null
     }
 

+ 150 - 0
zen-orm/src/main/resources/templates/entity.java.vm

@@ -0,0 +1,150 @@
+package ${package.Entity};
+
+#foreach($field in ${table.fields})
+#if(${field.propertyType} == "Date")
+import com.fasterxml.jackson.annotation.JsonFormat;
+#end
+#end
+#foreach($pkg in ${table.importPackages})
+import ${pkg};
+#end
+#if(${entityLombokModel})
+
+import com.baomidou.mybatisplus.annotations.Version;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+#end
+
+/**
+ * <p>
+ * $!{table.comment}
+ * </p>
+ *
+ * @author ${author}
+ * @since ${date}
+ */
+#if(${entityLombokModel})
+@Data
+    #if(${superEntityClass})
+    @EqualsAndHashCode(callSuper = true)
+    #end
+@Accessors(chain = true)
+#end
+###if(${table.convert})
+@TableName("${table.name}")
+###end
+#if(${superEntityClass})
+public class ${entity} extends ${superEntityClass}#if(${activeRecord})<${entity}>#end {
+#elseif(${activeRecord})
+public class ${entity} extends Model<${entity}> {
+#else
+public class ${entity} implements Serializable {
+#end
+
+private static final long serialVersionUID = 1L;
+
+## ----------  BEGIN 字段循环遍历  ----------
+#foreach($field in ${table.fields})
+    #if(${field.keyFlag})
+        #set($keyPropertyName=${field.propertyName})
+    #end
+    #if("$!field.comment" != "")
+    /**
+     * ${field.comment}
+     */
+    #end
+    #if(${field.keyFlag})
+    ## 主键
+        #if(${field.keyIdentityFlag})
+        @TableId(value = "${field.name}", type = IdType.AUTO)
+        #elseif(!$null.isNull(${idType}) && "$!idType" != "")
+        @TableId(value = "${field.name}", type = IdType.${idType})
+        #elseif(${field.convert})
+        @TableId("${field.name}")
+        #end
+    ## 普通字段
+    #elseif(${field.fill})
+    ## -----   存在字段填充设置   -----
+        #if(${field.convert})
+        @TableField(value = "${field.name}", fill = FieldFill.${field.fill})
+        #else
+        @TableField(fill = FieldFill.${field.fill})
+        #end
+    #elseif(${field.convert})
+    @TableField("${field.name}")
+    #end
+## 乐观锁注解
+    #if(${versionFieldName}==${field.name})
+    @Version
+    #end
+## 逻辑删除注解
+    #if(${logicDeleteFieldName}==${field.name})
+    @TableLogic
+    #end
+## 日期格式化注解
+    #if(${field.propertyType}=="Date")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    #end
+private ${field.propertyType} ${field.propertyName};
+#end
+## ----------  END 字段循环遍历  ----------
+
+#if(!${entityLombokModel})
+    #foreach($field in ${table.fields})
+        #if(${field.propertyType.equals("boolean")})
+            #set($getprefix="is")
+        #else
+            #set($getprefix="get")
+        #end
+
+    public ${field.propertyType} ${getprefix}${field.capitalName}() {
+            return ${field.propertyName};
+            }
+
+        #if(${entityBuilderModel})
+        public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
+        #else
+        public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
+        #end
+            this.${field.propertyName} = ${field.propertyName};
+        #if(${entityBuilderModel})
+                return this;
+        #end
+            }
+    #end
+#end
+
+#if(${entityColumnConstant})
+    #foreach($field in ${table.fields})
+    public static final String ${field.name.toUpperCase()} = "${field.name}";
+
+    #end
+#end
+#if(${activeRecord})
+@Override
+protected Serializable pkVal() {
+    #if(${keyPropertyName})
+            return this.${keyPropertyName};
+    #else
+            return this.id;
+    #end
+        }
+
+#end
+#if(!${entityLombokModel})
+@Override
+public String toString() {
+        return "${entity}{" +
+    #foreach($field in ${table.fields})
+        #if($!{velocityCount}==1)
+                "${field.propertyName}=" + ${field.propertyName} +
+        #else
+                ", ${field.propertyName}=" + ${field.propertyName} +
+        #end
+    #end
+        "}";
+        }
+#end
+        }

+ 38 - 31
zen-orm/src/main/resources/templates/entity.kt.vm

@@ -1,6 +1,11 @@
 package ${package.Entity}
 
 import com.baomidou.mybatisplus.annotations.TableName
+#foreach($field in ${table.fields})
+#if(${field.propertyType} == "Date")
+import com.fasterxml.jackson.annotation.JsonFormat
+#end
+#end
 #foreach($pkg in ${table.importPackages})
 import ${pkg}
 #end
@@ -16,60 +21,62 @@ import ${pkg}
 ###if(${table.convert})
 @TableName("${table.name}")
 ###end
-data class ${entity}(
+open class ${entity} : #if(${superEntityClass})${superEntityClass}#if(${activeRecord})<${entity}>#end() {
+#elseif(${activeRecord}) Model<${entity}>() {
+#else Serializable {
+#end
+#if(${entityColumnConstant})
+    companion object {
+    #foreach($field in ${table.fields})
+        const val ${field.name.toUpperCase()} : String = "${field.name}"
+    #end
+}
+#end
 ## ----------  BEGIN 字段循环遍历  ----------
 #foreach($field in ${table.fields})
 #if(${field.keyFlag})
     #set($keyPropertyName=${field.propertyName})
 #end
 #if("$!field.comment" != "")
-        /**
-         * ${field.comment}
-         */
+    /**
+     * ${field.comment}
+     */
 #end
 #if(${field.keyFlag})
 ## 主键
-#if(${field.keyIdentityFlag})
-        @TableId(value = "${field.name}", type = IdType.AUTO)
-#elseif(!$null.isNull(${idType}) && "$!idType" != "")
-        @TableId(value = "${field.name}", type = IdType.${idType})
-#elseif(${field.convert})
-        @TableId("${field.name}")
-#end
+    #if(${field.keyIdentityFlag})
+    @TableId(value = "${field.name}", type = IdType.AUTO)
+    #elseif(!$null.isNull(${idType}) && "$!idType" != "")
+    @TableId(value = "${field.name}", type = IdType.${idType})
+    #elseif(${field.convert})
+    @TableId("${field.name}")
+    #end
 ## 普通字段
 #elseif(${field.fill})
 ## -----   存在字段填充设置   -----
-#if(${field.convert})
-        @TableField(value = "${field.name}", fill = FieldFill.${field.fill})
-#else
-        @TableField(fill = FieldFill.${field.fill})
-#end
+    #if(${field.convert})
+    @TableField(value = "${field.name}", fill = FieldFill.${field.fill})
+    #else
+    @TableField(fill = FieldFill.${field.fill})
+    #end
 #elseif(${field.convert})
-        @TableField("${field.name}")
+@TableField("${field.name}")
 #end
 ## 乐观锁注解
 #if(${versionFieldName}==${field.name})
-        @Version
+@Version
 #end
 ## 逻辑删除注解
 #if(${logicDeleteFieldName}==${field.name})
-        @TableLogic
+@TableLogic
+#end
+#if(${field.propertyType}=="Date")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 #end
-        var ${field.propertyName}: #if(${field.propertyType} == "Integer")Int#else${field.propertyType}#end? = null#if($foreach.count!=${table.fields.size()}),#end
+    var ${field.propertyName}: #if(${field.propertyType} == "Integer")Int#else${field.propertyType}#end? = null#if($foreach.count!=${table.fields.size()})#end
 
 #end
 ## ----------  END 字段循环遍历  ----------
-) : #if(${superEntityClass})${superEntityClass}#if(${activeRecord})<${entity}>#end() {
-#elseif(${activeRecord}) Model<${entity}>() {
-#else Serializable {
-#end
-#if(${entityColumnConstant})
-    companion object {
-    #foreach($field in ${table.fields})
-        const val ${field.name.toUpperCase()} : String = "${field.name}"
-    #end
-}
-#end
 #if(${activeRecord})
     override fun pkVal(): Serializable {
         #if(${keyPropertyName})

+ 16 - 1
zen-web/src/main/kotlin/com/gxzc/zen/web/sys/controller/TestController.kt

@@ -4,6 +4,7 @@ import com.baomidou.kisso.annotation.Action
 import com.baomidou.kisso.annotation.Login
 import com.baomidou.kisso.annotation.Permission
 import com.baomidou.mybatisplus.mapper.EntityWrapper
+import com.gxzc.zen.api.shared.service.TestSharedService
 import com.gxzc.zen.api.sys.mapper.SysDicMapper
 import com.gxzc.zen.api.sys.model.SysDic
 import com.gxzc.zen.api.sys.model.SysRole
@@ -17,7 +18,6 @@ import com.gxzc.zen.common.config.request.annotation.ZenRequestTypes
 import com.gxzc.zen.common.dto.RequestDto
 import com.gxzc.zen.orm.annotation.ZenTransactional
 import com.xxl.job.core.biz.AdminBiz
-import com.xxl.job.core.biz.model.ReturnT
 import com.xxl.job.core.rpc.netcom.NetComClientProxy
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.core.io.InputStreamResource
@@ -46,6 +46,9 @@ class TestController : BaseController() {
     @Autowired
     private lateinit var sysParamService: ISysParamService
 
+    @Autowired
+    private lateinit var testSharedService: TestSharedService
+
     @GetMapping("logicDel")
     @Login(action = Action.Skip)
     fun testLogicDelete() {
@@ -154,4 +157,16 @@ class TestController : BaseController() {
         println(result)
         println(result.toString())
     }
+
+    @GetMapping("jobInsert")
+    @Login(action = Action.Skip)
+    fun jobInsert() {
+        testSharedService.insert()
+    }
+
+    @GetMapping("jobSelect")
+    @Login(action = Action.Skip)
+    fun jobSelect() {
+        testSharedService.select()
+    }
 }

+ 4 - 4
zen-web/src/main/resources/application-orm.yml

@@ -1,5 +1,5 @@
 orm:
-  multi-datasource-enable: false # 多数据源开关
+  multi-datasource-enable: true # 多数据源开关
 
 
 
@@ -25,7 +25,7 @@ spring:
 datasource:
   sys:
     name: system
-    url: jdbc:mysql://192.168.1.92:30002/archives_sys?pinGlobalTxToPhysicalConnection=true&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&zeroDateTimeBehavior=convertToNull
+    url: jdbc:mysql://192.168.1.10:3306/archives_sys?pinGlobalTxToPhysicalConnection=true&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&zeroDateTimeBehavior=convertToNull
     driver-class-name: com.mysql.jdbc.Driver
     username: archives
     password: archives
@@ -43,7 +43,7 @@ datasource:
     min-evictable-idle-time-millis: 30000
   bus:
     name: business
-    url: jdbc:mysql://192.168.1.92:30002/archives_mgr?pinGlobalTxToPhysicalConnection=true&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&zeroDateTimeBehavior=convertToNull
+    url: jdbc:mysql://192.168.1.10:3306/archives_mgr?pinGlobalTxToPhysicalConnection=true&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&zeroDateTimeBehavior=convertToNull
     driver-class-name: com.mysql.jdbc.Driver
     username: archives
     password: archives
@@ -61,7 +61,7 @@ datasource:
     min-evictable-idle-time-millis: 30000
   shared:
     name: shared
-    url: jdbc:mysql://192.168.1.92:30002/archives_shared?pinGlobalTxToPhysicalConnection=true&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&zeroDateTimeBehavior=convertToNull
+    url: jdbc:mysql://192.168.1.10:3306/archives_shared?pinGlobalTxToPhysicalConnection=true&autoReconnect=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC&zeroDateTimeBehavior=convertToNull
     driver-class-name: com.mysql.jdbc.Driver
     username: archives
     password: archives