Просмотр исходного кода

feat(database): 迁移到PostgreSQL数据库并集成MyBatis-Plus

- 修改多个XML映射文件中的MySQL特有函数为PostgreSQL兼容语法
- 替换DATE_FORMAT为TO_CHAR,TIMESTAMPDIFF为EXTRACT(EPOCH FROM)
- 更新sysdate()为CURRENT_TIMESTAMP以适配PostgreSQL
- 修改find_in_set函数为POSITION函数以支持PostgreSQL
- 在实体类中添加MyBatis-Plus的@TableId注解配置
- 集成IdWorker工具类用于生成分布式ID
- 更新INSERT语句以支持显式ID插入而非自动生成
- 在多个模块的pom.xml中添加mybatis-plus-core依赖
林仔 1 месяц назад
Родитель
Сommit
e81902f432
47 измененных файлов с 293 добавлено и 192 удалено
  1. 5 0
      pipe-network-service/pom.xml
  2. 4 0
      pipe-network-service/zksy-common/pom.xml
  3. 4 0
      pipe-network-service/zksy-common/src/main/java/com/zksy/common/core/domain/entity/SysDictData.java
  4. 4 0
      pipe-network-service/zksy-common/src/main/java/com/zksy/common/core/domain/entity/SysDictType.java
  5. 4 1
      pipe-network-service/zksy-generator/pom.xml
  6. 3 0
      pipe-network-service/zksy-generator/src/main/java/com/zksy/generator/domain/GenTable.java
  7. 3 0
      pipe-network-service/zksy-generator/src/main/java/com/zksy/generator/domain/GenTableColumn.java
  8. 4 0
      pipe-network-service/zksy-generator/src/main/java/com/zksy/generator/service/GenTableServiceImpl.java
  9. 21 6
      pipe-network-service/zksy-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml
  10. 43 37
      pipe-network-service/zksy-generator/src/main/resources/mapper/generator/GenTableMapper.xml
  11. 4 1
      pipe-network-service/zksy-quartz/pom.xml
  12. 3 0
      pipe-network-service/zksy-quartz/src/main/java/com/zksy/quartz/domain/SysJob.java
  13. 3 0
      pipe-network-service/zksy-quartz/src/main/java/com/zksy/quartz/domain/SysJobLog.java
  14. 3 0
      pipe-network-service/zksy-quartz/src/main/java/com/zksy/quartz/service/impl/SysJobLogServiceImpl.java
  15. 2 0
      pipe-network-service/zksy-quartz/src/main/java/com/zksy/quartz/service/impl/SysJobServiceImpl.java
  16. 3 3
      pipe-network-service/zksy-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml
  17. 3 3
      pipe-network-service/zksy-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml
  18. 3 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/system/domain/SysConfig.java
  19. 3 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/system/domain/SysLogininfor.java
  20. 3 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/system/domain/SysNotice.java
  21. 3 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/system/domain/SysOperLog.java
  22. 2 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/system/service/impl/SysConfigServiceImpl.java
  23. 2 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/system/service/impl/SysDictDataServiceImpl.java
  24. 2 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/system/service/impl/SysDictTypeServiceImpl.java
  25. 2 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/system/service/impl/SysLogininforServiceImpl.java
  26. 2 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/system/service/impl/SysNoticeServiceImpl.java
  27. 2 0
      pipe-network-service/zksy-system/src/main/java/com/zksy/system/service/impl/SysOperLogServiceImpl.java
  28. 1 1
      pipe-network-service/zksy-system/src/main/resources/mapper/WaterSupply/WaterPipeInfo/WaterPipeInfoMapper.xml
  29. 1 1
      pipe-network-service/zksy-system/src/main/resources/mapper/WaterSupply/WaterPlantInfo/WaterPlantInfoMapper.xml
  30. 1 1
      pipe-network-service/zksy-system/src/main/resources/mapper/WaterSupply/WaterPumpStation/WaterPumpStationMapper.xml
  31. 1 1
      pipe-network-service/zksy-system/src/main/resources/mapper/WaterSupply/WaterSourceInfo/WaterSourceInfoMapper.xml
  32. 1 1
      pipe-network-service/zksy-system/src/main/resources/mapper/WaterSupply/WaterUserInfo/WaterUserInfoMapper.xml
  33. 3 1
      pipe-network-service/zksy-system/src/main/resources/mapper/base/AlarmAssignDetailMapper.xml
  34. 3 1
      pipe-network-service/zksy-system/src/main/resources/mapper/base/AlarmAssignListMapper.xml
  35. 4 4
      pipe-network-service/zksy-system/src/main/resources/mapper/base/manhole/ManholeDataMapper.xml
  36. 21 19
      pipe-network-service/zksy-system/src/main/resources/mapper/system/SysConfigMapper.xml
  37. 4 4
      pipe-network-service/zksy-system/src/main/resources/mapper/system/SysDeptMapper.xml
  38. 27 25
      pipe-network-service/zksy-system/src/main/resources/mapper/system/SysDictDataMapper.xml
  39. 19 17
      pipe-network-service/zksy-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
  40. 2 2
      pipe-network-service/zksy-system/src/main/resources/mapper/system/SysLogininforMapper.xml
  41. 8 8
      pipe-network-service/zksy-system/src/main/resources/mapper/system/SysMenuMapper.xml
  42. 19 17
      pipe-network-service/zksy-system/src/main/resources/mapper/system/SysNoticeMapper.xml
  43. 2 2
      pipe-network-service/zksy-system/src/main/resources/mapper/system/SysOperLogMapper.xml
  44. 3 3
      pipe-network-service/zksy-system/src/main/resources/mapper/system/SysPostMapper.xml
  45. 5 5
      pipe-network-service/zksy-system/src/main/resources/mapper/system/SysRoleMapper.xml
  46. 7 7
      pipe-network-service/zksy-system/src/main/resources/mapper/system/SysUserMapper.xml
  47. 21 21
      pipe-network-service/zksy-system/src/main/resources/mapper/warning/EarlyWarningMapper.xml

+ 5 - 0
pipe-network-service/pom.xml

@@ -243,6 +243,11 @@
                 <artifactId>minioutil</artifactId>
                 <version>${minioutil.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.baomidou</groupId>
+                <artifactId>mybatis-plus-core</artifactId>
+                <version>${mybatis-plus.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 

+ 4 - 0
pipe-network-service/zksy-common/pom.xml

@@ -135,6 +135,10 @@
             <artifactId>alibabacloud-dysmsapi20170525</artifactId>
             <version>4.0.3</version>
         </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-core</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 4 - 0
pipe-network-service/zksy-common/src/main/java/com/zksy/common/core/domain/entity/SysDictData.java

@@ -2,6 +2,9 @@ package com.zksy.common.core.domain.entity;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Size;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.zksy.common.annotation.Excel;
@@ -20,6 +23,7 @@ public class SysDictData extends BaseEntity
 
     /** 字典编码 */
     @Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
+    @TableId(type = IdType.ASSIGN_ID)
     private Long dictCode;
 
     /** 字典排序 */

+ 4 - 0
pipe-network-service/zksy-common/src/main/java/com/zksy/common/core/domain/entity/SysDictType.java

@@ -3,6 +3,9 @@ package com.zksy.common.core.domain.entity;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.zksy.common.annotation.Excel;
@@ -20,6 +23,7 @@ public class SysDictType extends BaseEntity
 
     /** 字典主键 */
     @Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
+    @TableId(type = IdType.ASSIGN_ID)
     private Long dictId;
 
     /** 字典名称 */

+ 4 - 1
pipe-network-service/zksy-generator/pom.xml

@@ -34,7 +34,10 @@
             <groupId>com.alibaba</groupId>
             <artifactId>druid-spring-boot-starter</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-core</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 3 - 0
pipe-network-service/zksy-generator/src/main/java/com/zksy/generator/domain/GenTable.java

@@ -3,6 +3,8 @@ package com.zksy.generator.domain;
 import com.zksy.common.constant.GenConstants;
 import com.zksy.common.core.domain.BaseEntity;
 import com.zksy.common.utils.StringUtils;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import org.apache.commons.lang3.ArrayUtils;
 
 import javax.validation.Valid;
@@ -19,6 +21,7 @@ public class GenTable extends BaseEntity
     private static final long serialVersionUID = 1L;
 
     /** 编号 */
+    @TableId(type = IdType.ASSIGN_ID)
     private Long tableId;
 
     /** 表名称 */

+ 3 - 0
pipe-network-service/zksy-generator/src/main/java/com/zksy/generator/domain/GenTableColumn.java

@@ -2,6 +2,8 @@ package com.zksy.generator.domain;
 
 import com.zksy.common.core.domain.BaseEntity;
 import com.zksy.common.utils.StringUtils;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 
 import javax.validation.constraints.NotBlank;
 
@@ -15,6 +17,7 @@ public class GenTableColumn extends BaseEntity
     private static final long serialVersionUID = 1L;
 
     /** 编号 */
+    @TableId(type = IdType.ASSIGN_ID)
     private Long columnId;
 
     /** 归属表编号 */

+ 4 - 0
pipe-network-service/zksy-generator/src/main/java/com/zksy/generator/service/GenTableServiceImpl.java

@@ -14,6 +14,7 @@ import com.zksy.generator.mapper.GenTableMapper;
 import com.zksy.generator.util.GenUtils;
 import com.zksy.generator.util.VelocityInitializer;
 import com.zksy.generator.util.VelocityUtils;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.velocity.Template;
@@ -177,6 +178,7 @@ public class GenTableServiceImpl implements IGenTableService
             {
                 String tableName = table.getTableName();
                 GenUtils.initTable(table, operName);
+                table.setTableId(IdWorker.getId());
                 int row = genTableMapper.insertGenTable(table);
                 if (row > 0)
                 {
@@ -185,6 +187,7 @@ public class GenTableServiceImpl implements IGenTableService
                     for (GenTableColumn column : genTableColumns)
                     {
                         GenUtils.initColumnField(column, table);
+                        column.setColumnId(IdWorker.getId());
                         genTableColumnMapper.insertGenTableColumn(column);
                     }
                 }
@@ -331,6 +334,7 @@ public class GenTableServiceImpl implements IGenTableService
             }
             else
             {
+                column.setColumnId(IdWorker.getId());
                 genTableColumnMapper.insertGenTableColumn(column);
             }
         });

+ 21 - 6
pipe-network-service/zksy-generator/src/main/resources/mapper/generator/GenTableColumnMapper.xml

@@ -40,12 +40,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult">
-		select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else '0' end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type
-		from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
-		order by ordinal_position
+		select 
+			c.column_name, 
+			(case when c.is_nullable = 'NO' and pk.column_name is null then '1' else '0' end) as is_required, 
+			(case when pk.column_name is not null then '1' else '0' end) as is_pk, 
+			c.ordinal_position as sort, 
+			pg_catalog.col_description(pc.oid, c.ordinal_position::int) as column_comment, 
+			(case when c.column_default like 'nextval%' then '1' else '0' end) as is_increment, 
+			c.udt_name as column_type
+		from information_schema.columns c
+		left join (
+			select ku.column_name 
+			from information_schema.table_constraints tc
+			join information_schema.key_column_usage ku on tc.constraint_name = ku.constraint_name
+			where tc.constraint_type = 'PRIMARY KEY' and tc.table_name = #{tableName}
+		) pk on c.column_name = pk.column_name
+		join pg_catalog.pg_class pc on pc.relname = #{tableName}
+		where c.table_name = #{tableName}
+		order by c.ordinal_position
 	</select>
 
-    <insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">
+    <insert id="insertGenTableColumn" parameterType="GenTableColumn">
         insert into gen_table_column (
 			<if test="tableId != null and tableId != ''">table_id,</if>
 			<if test="columnName != null and columnName != ''">column_name,</if>
@@ -85,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="dictType != null and dictType != ''">#{dictType},</if>
 			<if test="sort != null">#{sort},</if>
 			<if test="createBy != null and createBy != ''">#{createBy},</if>
-			sysdate()
+			CURRENT_TIMESTAMP
          )
     </insert>
 
@@ -105,7 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="dictType != null">dict_type = #{dictType},</if>
             <if test="sort != null">sort = #{sort},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
-            update_time = sysdate()
+            update_time = CURRENT_TIMESTAMP
         </set>
         where column_id = #{columnId}
     </update>

+ 43 - 37
pipe-network-service/zksy-generator/src/main/resources/mapper/generator/GenTableMapper.xml

@@ -68,47 +68,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
 			</if>
 			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				AND date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
+				AND TO_CHAR(create_time, 'YYYYMMDD') &gt;= TO_CHAR(#{params.beginTime}::TIMESTAMP, 'YYYYMMDD')
 			</if>
 			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				AND date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
+				AND TO_CHAR(create_time, 'YYYYMMDD') &lt;= TO_CHAR(#{params.endTime}::TIMESTAMP, 'YYYYMMDD')
 			</if>
 		</where>
 	</select>
 
 	<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
-		select table_name, table_comment, create_time, update_time from information_schema.tables
-		where table_schema = (select database())
-		AND table_name NOT LIKE 'qrtz\_%' AND table_name NOT LIKE 'gen\_%'
-		AND table_name NOT IN (select table_name from gen_table)
+		select t.table_name, pg_catalog.obj_description(pc.oid) as table_comment, t.create_time, t.update_time 
+		from information_schema.tables t
+		join pg_catalog.pg_class pc on pc.relname = t.table_name
+		where t.table_schema = current_database()
+		AND t.table_name NOT LIKE 'qrtz\_%' AND t.table_name NOT LIKE 'gen\_%'
+		AND t.table_name NOT IN (select table_name from gen_table)
 		<if test="tableName != null and tableName != ''">
-			AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
+			AND lower(t.table_name) like lower(concat('%', #{tableName}, '%'))
 		</if>
 		<if test="tableComment != null and tableComment != ''">
-			AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
+			AND lower(pg_catalog.obj_description(pc.oid)) like lower(concat('%', #{tableComment}, '%'))
 		</if>
 		<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-			AND date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
+			AND TO_CHAR(t.create_time, 'YYYYMMDD') &gt;= TO_CHAR(#{params.beginTime}::TIMESTAMP, 'YYYYMMDD')
 		</if>
 		<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-			AND date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
+			AND TO_CHAR(t.create_time, 'YYYYMMDD') &lt;= TO_CHAR(#{params.endTime}::TIMESTAMP, 'YYYYMMDD')
 		</if>
-        order by create_time desc
+        order by t.create_time desc
 	</select>
 	
 	<select id="selectDbTableListByNames" resultMap="GenTableResult">
-		select table_name, table_comment, create_time, update_time from information_schema.tables
-		where table_name NOT LIKE 'qrtz\_%' and table_name NOT LIKE 'gen\_%' and table_schema = (select database())
-		and table_name in
+		select t.table_name, pg_catalog.obj_description(pc.oid) as table_comment, t.create_time, t.update_time 
+		from information_schema.tables t
+		join pg_catalog.pg_class pc on pc.relname = t.table_name
+		where t.table_name NOT LIKE 'qrtz\_%' and t.table_name NOT LIKE 'gen\_%' and t.table_schema = current_database()
+		and t.table_name in
 	    <foreach collection="array" item="name" open="(" separator="," close=")">
  			#{name}
         </foreach> 
 	</select>
 	
 	<select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
-		select table_name, table_comment, create_time, update_time from information_schema.tables
-		where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
-		and table_name = #{tableName}
+		select t.table_name, pg_catalog.obj_description(pc.oid) as table_comment, t.create_time, t.update_time 
+		from information_schema.tables t
+		join pg_catalog.pg_class pc on pc.relname = t.table_name
+		where pg_catalog.obj_description(pc.oid) <![CDATA[ <> ]]> '' and t.table_schema = current_database()
+		and t.table_name = #{tableName}
 	</select>
 	
 	<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult">
@@ -135,7 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		order by c.sort
 	</select>
 	
-	<insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId">
+	<insert id="insertGenTable" parameterType="GenTable">
         insert into gen_table (
 			<if test="tableName != null">table_name,</if>
 			<if test="tableComment != null and tableComment != ''">table_comment,</if>
@@ -151,24 +157,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="genPath != null and genPath != ''">gen_path,</if>
 			<if test="remark != null and remark != ''">remark,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
-			create_time
-         )values(
-			<if test="tableName != null">#{tableName},</if>
-			<if test="tableComment != null and tableComment != ''">#{tableComment},</if>
-			<if test="className != null and className != ''">#{className},</if>
-			<if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if>
-			<if test="tplWebType != null and tplWebType != ''">#{tplWebType},</if>
-			<if test="packageName != null and packageName != ''">#{packageName},</if>
-			<if test="moduleName != null and moduleName != ''">#{moduleName},</if>
-			<if test="businessName != null and businessName != ''">#{businessName},</if>
-			<if test="functionName != null and functionName != ''">#{functionName},</if>
-			<if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
-			<if test="genType != null and genType != ''">#{genType},</if>
-			<if test="genPath != null and genPath != ''">#{genPath},</if>
-			<if test="remark != null and remark != ''">#{remark},</if>
- 			<if test="createBy != null and createBy != ''">#{createBy},</if>
-			sysdate()
-         )
+				create_time
+	         )values(
+				<if test="tableName != null">#{tableName},</if>
+				<if test="tableComment != null and tableComment != ''">#{tableComment},</if>
+				<if test="className != null and className != ''">#{className},</if>
+				<if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if>
+				<if test="tplWebType != null and tplWebType != ''">#{tplWebType},</if>
+				<if test="packageName != null and packageName != ''">#{packageName},</if>
+				<if test="moduleName != null and moduleName != ''">#{moduleName},</if>
+				<if test="businessName != null and businessName != ''">#{businessName},</if>
+				<if test="functionName != null and functionName != ''">#{functionName},</if>
+				<if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if>
+				<if test="genType != null and genType != ''">#{genType},</if>
+				<if test="genPath != null and genPath != ''">#{genPath},</if>
+				<if test="remark != null and remark != ''">#{remark},</if>
+	 			<if test="createBy != null and createBy != ''">#{createBy},</if>
+				CURRENT_TIMESTAMP
+	         )
     </insert>
     
     <update id="createTable">
@@ -195,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="options != null and options != ''">options = #{options},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             <if test="remark != null">remark = #{remark},</if>
-            update_time = sysdate()
+            update_time = CURRENT_TIMESTAMP
         </set>
         where table_id = #{tableId}
     </update>

+ 4 - 1
pipe-network-service/zksy-quartz/pom.xml

@@ -34,7 +34,10 @@
             <groupId>com.zksy</groupId>
             <artifactId>zksy-common</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-core</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 3 - 0
pipe-network-service/zksy-quartz/src/main/java/com/zksy/quartz/domain/SysJob.java

@@ -12,6 +12,8 @@ import com.zksy.common.constant.ScheduleConstants;
 import com.zksy.common.core.domain.BaseEntity;
 import com.zksy.common.utils.StringUtils;
 import com.zksy.quartz.util.CronUtils;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 
 /**
  * 定时任务调度表 sys_job
@@ -23,6 +25,7 @@ public class SysJob extends BaseEntity
     private static final long serialVersionUID = 1L;
 
     /** 任务ID */
+    @TableId(type = IdType.ASSIGN_ID)
     @Excel(name = "任务序号", cellType = ColumnType.NUMERIC)
     private Long jobId;
 

+ 3 - 0
pipe-network-service/zksy-quartz/src/main/java/com/zksy/quartz/domain/SysJobLog.java

@@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.zksy.common.annotation.Excel;
 import com.zksy.common.core.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 
 /**
  * 定时任务调度日志表 sys_job_log
@@ -16,6 +18,7 @@ public class SysJobLog extends BaseEntity
     private static final long serialVersionUID = 1L;
 
     /** ID */
+    @TableId(type = IdType.ASSIGN_ID)
     @Excel(name = "日志序号")
     private Long jobLogId;
 

+ 3 - 0
pipe-network-service/zksy-quartz/src/main/java/com/zksy/quartz/service/impl/SysJobLogServiceImpl.java

@@ -1,6 +1,8 @@
 package com.zksy.quartz.service.impl;
 
 import java.util.List;
+
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.zksy.quartz.domain.SysJobLog;
@@ -50,6 +52,7 @@ public class SysJobLogServiceImpl implements ISysJobLogService
     @Override
     public void addJobLog(SysJobLog jobLog)
     {
+        jobLog.setJobLogId(IdWorker.getId());
         jobLogMapper.insertJobLog(jobLog);
     }
 

+ 2 - 0
pipe-network-service/zksy-quartz/src/main/java/com/zksy/quartz/service/impl/SysJobServiceImpl.java

@@ -16,6 +16,7 @@ import com.zksy.quartz.mapper.SysJobMapper;
 import com.zksy.quartz.service.ISysJobService;
 import com.zksy.quartz.util.CronUtils;
 import com.zksy.quartz.util.ScheduleUtils;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 
 /**
  * 定时任务调度信息 服务层
@@ -201,6 +202,7 @@ public class SysJobServiceImpl implements ISysJobService
     @Transactional(rollbackFor = Exception.class)
     public int insertJob(SysJob job) throws SchedulerException, TaskException
     {
+        job.setJobId(IdWorker.getId());
         job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
         int rows = jobMapper.insertJob(job);
         if (rows > 0)

+ 3 - 3
pipe-network-service/zksy-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml

@@ -36,10 +36,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND invoke_target like concat('%', #{invokeTarget}, '%')
 			</if>
 			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
+				and TO_CHAR(create_time, 'YYYYMMDD') &gt;= TO_CHAR(#{params.beginTime}::TIMESTAMP, 'YYYYMMDD')
 			</if>
 			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
+				and TO_CHAR(create_time, 'YYYYMMDD') &lt;= TO_CHAR(#{params.endTime}::TIMESTAMP, 'YYYYMMDD')
 			</if>
 		</where>
 		order by create_time desc
@@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="jobMessage != null and jobMessage != ''">#{jobMessage},</if>
  			<if test="status != null and status != ''">#{status},</if>
  			<if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if>
- 			sysdate()
+ 			CURRENT_TIMESTAMP
  		)
 	</insert>
 

+ 3 - 3
pipe-network-service/zksy-quartz/src/main/resources/mapper/quartz/SysJobMapper.xml

@@ -75,12 +75,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status !=null">status = #{status},</if>
  			<if test="remark != null and remark != ''">remark = #{remark},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = sysdate()
+ 			update_time = CURRENT_TIMESTAMP
  		</set>
  		where job_id = #{jobId}
 	</update>
  	
- 	<insert id="insertJob" parameterType="SysJob" useGeneratedKeys="true" keyProperty="jobId">
+ 	<insert id="insertJob" parameterType="SysJob">
  		insert into public.sys_job(
  			<if test="jobId != null and jobId != 0">job_id,</if>
  			<if test="jobName != null and jobName != ''">job_name,</if>
@@ -104,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null and status != ''">#{status},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
- 			sysdate()
+ 			CURRENT_TIMESTAMP
  		)
 	</insert>
 

+ 3 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/system/domain/SysConfig.java

@@ -3,6 +3,8 @@ package com.zksy.system.domain;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Size;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
@@ -21,6 +23,7 @@ public class SysConfig extends BaseEntity
     private static final long serialVersionUID = 1L;
 
     /** 参数主键 */
+    @TableId(type = IdType.ASSIGN_ID)
     @Excel(name = "参数主键", cellType = ColumnType.NUMERIC)
     private Long configId;
 

+ 3 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/system/domain/SysLogininfor.java

@@ -2,6 +2,8 @@ package com.zksy.system.domain;
 
 import java.util.Date;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.zksy.common.annotation.Excel;
@@ -19,6 +21,7 @@ public class SysLogininfor extends BaseEntity
     private static final long serialVersionUID = 1L;
 
     /** ID */
+    @TableId(type = IdType.ASSIGN_ID)
     @Excel(name = "序号", cellType = ColumnType.NUMERIC)
     private Long infoId;
 

+ 3 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/system/domain/SysNotice.java

@@ -3,6 +3,8 @@ package com.zksy.system.domain;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Size;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
@@ -20,6 +22,7 @@ public class SysNotice extends BaseEntity
     private static final long serialVersionUID = 1L;
 
     /** 公告ID */
+    @TableId(type = IdType.ASSIGN_ID)
     private Long noticeId;
 
     /** 公告标题 */

+ 3 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/system/domain/SysOperLog.java

@@ -2,6 +2,8 @@ package com.zksy.system.domain;
 
 import java.util.Date;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.zksy.common.annotation.Excel;
@@ -19,6 +21,7 @@ public class SysOperLog extends BaseEntity
     private static final long serialVersionUID = 1L;
 
     /** 日志主键 */
+    @TableId(type = IdType.ASSIGN_ID)
     @Excel(name = "操作序号", cellType = ColumnType.NUMERIC)
     private Long operId;
 

+ 2 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/system/service/impl/SysConfigServiceImpl.java

@@ -16,6 +16,7 @@ import com.zksy.common.utils.StringUtils;
 import com.zksy.system.domain.SysConfig;
 import com.zksy.system.mapper.SysConfigMapper;
 import com.zksy.system.service.ISysConfigService;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 
 /**
  * 参数配置 服务层实现
@@ -117,6 +118,7 @@ public class SysConfigServiceImpl implements ISysConfigService
     @Override
     public int insertConfig(SysConfig config)
     {
+        config.setConfigId(IdWorker.getId());
         int row = configMapper.insertConfig(config);
         if (row > 0)
         {

+ 2 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/system/service/impl/SysDictDataServiceImpl.java

@@ -3,6 +3,7 @@ package com.zksy.system.service.impl;
 import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.zksy.common.core.domain.entity.SysDictData;
 import com.zksy.common.utils.DictUtils;
 import com.zksy.system.mapper.SysDictDataMapper;
@@ -82,6 +83,7 @@ public class SysDictDataServiceImpl implements ISysDictDataService
     @Override
     public int insertDictData(SysDictData data)
     {
+        data.setDictCode(IdWorker.getId());
         int row = dictDataMapper.insertDictData(data);
         if (row > 0)
         {

+ 2 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/system/service/impl/SysDictTypeServiceImpl.java

@@ -8,6 +8,7 @@ import javax.annotation.PostConstruct;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.zksy.common.constant.UserConstants;
 import com.zksy.common.core.domain.entity.SysDictData;
 import com.zksy.common.core.domain.entity.SysDictType;
@@ -174,6 +175,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
     @Override
     public int insertDictType(SysDictType dict)
     {
+        dict.setDictId(IdWorker.getId());
         int row = dictTypeMapper.insertDictType(dict);
         if (row > 0)
         {

+ 2 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/system/service/impl/SysLogininforServiceImpl.java

@@ -3,6 +3,7 @@ package com.zksy.system.service.impl;
 import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.zksy.system.domain.SysLogininfor;
 import com.zksy.system.mapper.SysLogininforMapper;
 import com.zksy.system.service.ISysLogininforService;
@@ -27,6 +28,7 @@ public class SysLogininforServiceImpl implements ISysLogininforService
     @Override
     public void insertLogininfor(SysLogininfor logininfor)
     {
+        logininfor.setInfoId(IdWorker.getId());
         logininforMapper.insertLogininfor(logininfor);
     }
 

+ 2 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/system/service/impl/SysNoticeServiceImpl.java

@@ -3,6 +3,7 @@ package com.zksy.system.service.impl;
 import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.zksy.system.domain.SysNotice;
 import com.zksy.system.mapper.SysNoticeMapper;
 import com.zksy.system.service.ISysNoticeService;
@@ -51,6 +52,7 @@ public class SysNoticeServiceImpl implements ISysNoticeService
     @Override
     public int insertNotice(SysNotice notice)
     {
+        notice.setNoticeId(IdWorker.getId());
         return noticeMapper.insertNotice(notice);
     }
 

+ 2 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/system/service/impl/SysOperLogServiceImpl.java

@@ -3,6 +3,7 @@ package com.zksy.system.service.impl;
 import java.util.List;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.zksy.system.domain.SysOperLog;
 import com.zksy.system.mapper.SysOperLogMapper;
 import com.zksy.system.service.ISysOperLogService;
@@ -26,6 +27,7 @@ public class SysOperLogServiceImpl implements ISysOperLogService
     @Override
     public void insertOperlog(SysOperLog operLog)
     {
+        operLog.setOperId(IdWorker.getId());
         operLogMapper.insertOperlog(operLog);
     }
 

+ 1 - 1
pipe-network-service/zksy-system/src/main/resources/mapper/WaterSupply/WaterPipeInfo/WaterPipeInfoMapper.xml

@@ -123,7 +123,7 @@
         UPDATE water_pipe_info
         SET del_flag = '0',
         update_by = #{updateBy},
-        update_time = NOW()
+        update_time = CURRENT_TIMESTAMP
         WHERE id IN
         <foreach collection="ids" item="id" open="(" separator="," close=")">
             #{id}

+ 1 - 1
pipe-network-service/zksy-system/src/main/resources/mapper/WaterSupply/WaterPlantInfo/WaterPlantInfoMapper.xml

@@ -83,7 +83,7 @@
         UPDATE water_plant_info
         SET del_flag = '0',
         update_by = #{updateBy},
-        update_time = NOW()
+        update_time = CURRENT_TIMESTAMP
         WHERE id IN
         <foreach collection="ids" item="id" open="(" separator="," close=")">
             #{id}

+ 1 - 1
pipe-network-service/zksy-system/src/main/resources/mapper/WaterSupply/WaterPumpStation/WaterPumpStationMapper.xml

@@ -82,7 +82,7 @@
         UPDATE water_pump_station
         SET del_flag = '0',
         update_by = #{updateBy},
-        update_time = NOW()
+        update_time = CURRENT_TIMESTAMP
         WHERE id IN
         <foreach collection="ids" item="id" open="(" separator="," close=")">
             #{id}

+ 1 - 1
pipe-network-service/zksy-system/src/main/resources/mapper/WaterSupply/WaterSourceInfo/WaterSourceInfoMapper.xml

@@ -81,7 +81,7 @@
         UPDATE water_source_info
         SET del_flag = '0',
         update_by = #{updateBy},
-        update_time = NOW()
+        update_time = CURRENT_TIMESTAMP
         WHERE id IN
         <foreach collection="ids" item="id" open="(" separator="," close=")">
             #{id}

+ 1 - 1
pipe-network-service/zksy-system/src/main/resources/mapper/WaterSupply/WaterUserInfo/WaterUserInfoMapper.xml

@@ -81,7 +81,7 @@
         UPDATE water_user_info
         SET del_flag = '0',
         update_by = #{updateBy},
-        update_time = NOW()
+        update_time = CURRENT_TIMESTAMP
         WHERE id IN
         <foreach collection="ids" item="id" open="(" separator="," close=")">
             #{id}

+ 3 - 1
pipe-network-service/zksy-system/src/main/resources/mapper/base/AlarmAssignDetailMapper.xml

@@ -31,9 +31,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where alarm_assign_detail_id = #{alarmAssignDetailId}
     </select>
 
-    <insert id="insertAlarmAssignDetail" parameterType="com.zksy.base.domain.AlarmAssignDetail" useGeneratedKeys="true" keyProperty="alarmAssignDetailId">
+    <insert id="insertAlarmAssignDetail" parameterType="com.zksy.base.domain.AlarmAssignDetail">
         insert into alarm_assign_detail
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="alarmAssignDetailId != null">alarm_assign_detail_id,</if>
             <if test="alarmAssignId != null">alarm_assign_id,</if>
             <if test="handleUserId != null">handle_user_id,</if>
             <if test="handleUserName != null">handle_user_name,</if>
@@ -42,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="remark != null">remark,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="alarmAssignDetailId != null">#{alarmAssignDetailId},</if>
             <if test="alarmAssignId != null">#{alarmAssignId},</if>
             <if test="handleUserId != null">#{handleUserId},</if>
             <if test="handleUserName != null">#{handleUserName},</if>

+ 3 - 1
pipe-network-service/zksy-system/src/main/resources/mapper/base/AlarmAssignListMapper.xml

@@ -40,9 +40,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where alarm_assign_id = #{alarmAssignId}
     </select>
 
-    <insert id="insertAlarmAssignList" parameterType="com.zksy.base.domain.AlarmAssignList" useGeneratedKeys="true" keyProperty="alarmAssignId">
+    <insert id="insertAlarmAssignList" parameterType="com.zksy.base.domain.AlarmAssignList">
         insert into alarm_assign_list
         <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="alarmAssignId != null">alarm_assign_id,</if>
             <if test="deviceCode != null and deviceCode != ''">device_code,</if>
             <if test="deviceName != null and deviceName != ''">device_name,</if>
             <if test="manufacturer != null">manufacturer,</if>
@@ -56,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="assignRemark != null">assign_remark,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="alarmAssignId != null">#{alarmAssignId},</if>
             <if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
             <if test="deviceName != null and deviceName != ''">#{deviceName},</if>
             <if test="manufacturer != null">#{manufacturer},</if>

+ 4 - 4
pipe-network-service/zksy-system/src/main/resources/mapper/base/manhole/ManholeDataMapper.xml

@@ -47,7 +47,7 @@
 
     <select id="statAlarmTrendByHour" resultType="java.util.Map">
         SELECT 
-            DATE_FORMAT(create_time, '%Y-%m-%d %H:00:00') as hourTime,
+            TO_CHAR(create_time, 'YYYY-MM-DD HH24:00:00') as hourTime,
             COUNT(*) as dataCount,
             SUM(CASE WHEN alarm_status = '1' THEN 1 ELSE 0 END) as alarmCount,
             SUM(CASE WHEN water_infiltration_alarm_status = '1' THEN 1 ELSE 0 END) as waterInfiltrationCount,
@@ -55,20 +55,20 @@
         FROM jg_device_data
         WHERE imei_card_number = #{imeiCardNumber}
           AND create_time BETWEEN #{startTime} AND #{endTime}
-        GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d %H')
+        GROUP BY TO_CHAR(create_time, 'YYYY-MM-DD HH24')
         ORDER BY hourTime
     </select>
 
     <select id="statTemperatureTrendByHour" resultType="java.util.Map">
         SELECT 
-            DATE_FORMAT(create_time, '%Y-%m-%d %H:00:00') as hourTime,
+            TO_CHAR(create_time, 'YYYY-MM-DD HH24:00:00') as hourTime,
             AVG(CAST(temperature_value AS DECIMAL(10,2))) as avgTemperature,
             AVG(CAST(tilt_angle AS DECIMAL(10,2))) as avgTiltAngle,
             AVG(CAST(battery_level AS DECIMAL(10,2))) as avgBatteryLevel
         FROM jg_device_data
         WHERE imei_card_number = #{imeiCardNumber}
           AND create_time BETWEEN #{startTime} AND #{endTime}
-        GROUP BY DATE_FORMAT(create_time, '%Y-%m-%d %H')
+        GROUP BY TO_CHAR(create_time, 'YYYY-MM-DD HH24')
         ORDER BY hourTime
     </select>
 

+ 21 - 19
pipe-network-service/zksy-system/src/main/resources/mapper/system/SysConfigMapper.xml

@@ -51,10 +51,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND config_key like concat('%', #{configKey}, '%')
 			</if>
 			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
+				and TO_CHAR(create_time, 'YYYYMMDD') &gt;= TO_CHAR(#{params.beginTime}::TIMESTAMP, 'YYYYMMDD')
 			</if>
 			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
+				and TO_CHAR(create_time, 'YYYYMMDD') &lt;= TO_CHAR(#{params.endTime}::TIMESTAMP, 'YYYYMMDD')
 			</if>
 		</where>
     </select>
@@ -71,22 +71,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     
     <insert id="insertConfig" parameterType="SysConfig">
         insert into public.sys_config (
-			<if test="configName != null and configName != '' ">config_name,</if>
-			<if test="configKey != null and configKey != '' ">config_key,</if>
-			<if test="configValue != null and configValue != '' ">config_value,</if>
-			<if test="configType != null and configType != '' ">config_type,</if>
-			<if test="createBy != null and createBy != ''">create_by,</if>
-			<if test="remark != null and remark != ''">remark,</if>
- 			create_time
-        )values(
-			<if test="configName != null and configName != ''">#{configName},</if>
-			<if test="configKey != null and configKey != ''">#{configKey},</if>
-			<if test="configValue != null and configValue != ''">#{configValue},</if>
-			<if test="configType != null and configType != ''">#{configType},</if>
-			<if test="createBy != null and createBy != ''">#{createBy},</if>
-			<if test="remark != null and remark != ''">#{remark},</if>
- 			sysdate()
-		)
+			config_id,
+				<if test="configName != null and configName != '' ">config_name,</if>
+				<if test="configKey != null and configKey != '' ">config_key,</if>
+				<if test="configValue != null and configValue != '' ">config_value,</if>
+				<if test="configType != null and configType != '' ">config_type,</if>
+				<if test="createBy != null and createBy != ''">create_by,</if>
+				<if test="remark != null and remark != ''">remark,</if>
+	 			create_time
+	        )values(
+	        	#{configId},
+				<if test="configName != null and configName != ''">#{configName},</if>
+				<if test="configKey != null and configKey != ''">#{configKey},</if>
+				<if test="configValue != null and configValue != ''">#{configValue},</if>
+				<if test="configType != null and configType != ''">#{configType},</if>
+				<if test="createBy != null and createBy != ''">#{createBy},</if>
+				<if test="remark != null and remark != ''">#{remark},</if>
+	 			CURRENT_TIMESTAMP
+			)
     </insert>
 	 
     <update id="updateConfig" parameterType="SysConfig">
@@ -98,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="configType != null and configType != ''">config_type = #{configType},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             <if test="remark != null">remark = #{remark},</if>
- 			update_time = sysdate()
+ 			update_time = CURRENT_TIMESTAMP
         </set>
         where config_id = #{configId}
     </update>

+ 4 - 4
pipe-network-service/zksy-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -75,11 +75,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	
 	<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
-		select * from public.sys_dept where find_in_set(#{deptId}, ancestors)
+		select * from public.sys_dept where POSITION(',' || #{deptId} || ',' IN ',' || ancestors || ',') > 0
 	</select>
 	
 	<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
-		select count(*) from public.sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
+		select count(*) from public.sys_dept where status = 0 and del_flag = '0' and POSITION(',' || #{deptId} || ',' IN ',' || ancestors || ',') > 0
 	</select>
 	
 	<select id="checkDeptNameUnique" resultMap="SysDeptResult">
@@ -111,7 +111,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="email != null and email != ''">#{email},</if>
  			<if test="status != null">#{status},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
- 			sysdate()
+ 			CURRENT_TIMESTAMP
  		)
 	</insert>
 	
@@ -127,7 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="email != null">email = #{email},</if>
  			<if test="status != null and status != ''">status = #{status},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = sysdate()
+ 			update_time = CURRENT_TIMESTAMP
  		</set>
  		where dept_id = #{deptId}
 	</update>

+ 27 - 25
pipe-network-service/zksy-system/src/main/resources/mapper/system/SysDictDataMapper.xml

@@ -84,7 +84,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null">status = #{status},</if>
  			<if test="remark != null">remark = #{remark},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = sysdate()
+ 			update_time = CURRENT_TIMESTAMP
  		</set>
  		where dict_code = #{dictCode}
 	</update>
@@ -95,30 +95,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  	
  	<insert id="insertDictData" parameterType="SysDictData">
  		insert into public.sys_dict_data(
- 			<if test="dictSort != null">dict_sort,</if>
- 			<if test="dictLabel != null and dictLabel != ''">dict_label,</if>
- 			<if test="dictValue != null and dictValue != ''">dict_value,</if>
- 			<if test="dictType != null and dictType != ''">dict_type,</if>
- 			<if test="cssClass != null and cssClass != ''">css_class,</if>
- 			<if test="listClass != null and listClass != ''">list_class,</if>
- 			<if test="isDefault != null and isDefault != ''">is_default,</if>
- 			<if test="status != null">status,</if>
- 			<if test="remark != null and remark != ''">remark,</if>
- 			<if test="createBy != null and createBy != ''">create_by,</if>
- 			create_time
- 		)values(
- 		    <if test="dictSort != null">#{dictSort},</if>
- 		    <if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
- 			<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
- 			<if test="dictType != null and dictType != ''">#{dictType},</if>
- 			<if test="cssClass != null and cssClass != ''">#{cssClass},</if>
- 			<if test="listClass != null and listClass != ''">#{listClass},</if>
- 			<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
- 			<if test="status != null">#{status},</if>
- 			<if test="remark != null and remark != ''">#{remark},</if>
- 			<if test="createBy != null and createBy != ''">#{createBy},</if>
- 			sysdate()
- 		)
+	 			dict_code,
+	 			<if test="dictSort != null">dict_sort,</if>
+	 			<if test="dictLabel != null and dictLabel != ''">dict_label,</if>
+	 			<if test="dictValue != null and dictValue != ''">dict_value,</if>
+	 			<if test="dictType != null and dictType != ''">dict_type,</if>
+	 			<if test="cssClass != null and cssClass != ''">css_class,</if>
+	 			<if test="listClass != null and listClass != ''">list_class,</if>
+	 			<if test="isDefault != null and isDefault != ''">is_default,</if>
+	 			<if test="status != null">status,</if>
+	 			<if test="remark != null and remark != ''">remark,</if>
+	 			<if test="createBy != null and createBy != ''">create_by,</if>
+	 			create_time
+	 		)values(
+	 		    #{dictCode},
+	 		    <if test="dictSort != null">#{dictSort},</if>
+	 		    <if test="dictLabel != null and dictLabel != ''">#{dictLabel},</if>
+	 			<if test="dictValue != null and dictValue != ''">#{dictValue},</if>
+	 			<if test="dictType != null and dictType != ''">#{dictType},</if>
+	 			<if test="cssClass != null and cssClass != ''">#{cssClass},</if>
+	 			<if test="listClass != null and listClass != ''">#{listClass},</if>
+	 			<if test="isDefault != null and isDefault != ''">#{isDefault},</if>
+	 			<if test="status != null">#{status},</if>
+	 			<if test="remark != null and remark != ''">#{remark},</if>
+	 			<if test="createBy != null and createBy != ''">#{createBy},</if>
+	 			CURRENT_TIMESTAMP
+	 		)
 	</insert>
 	
 </mapper> 

+ 19 - 17
pipe-network-service/zksy-system/src/main/resources/mapper/system/SysDictTypeMapper.xml

@@ -33,10 +33,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND dict_type like concat('%', #{dictType}, '%')
 			</if>
 			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
+				and TO_CHAR(create_time, 'YYYYMMDD') &gt;= TO_CHAR(#{params.beginTime}::TIMESTAMP, 'YYYYMMDD')
 			</if>
 			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
+				and TO_CHAR(create_time, 'YYYYMMDD') &lt;= TO_CHAR(#{params.endTime}::TIMESTAMP, 'YYYYMMDD')
 			</if>
 	    </where>
 	</select>
@@ -79,27 +79,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null">status = #{status},</if>
  			<if test="remark != null">remark = #{remark},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = sysdate()
+ 			update_time = CURRENT_TIMESTAMP
  		</set>
  		where dict_id = #{dictId}
 	</update>
  	
  	<insert id="insertDictType" parameterType="SysDictType">
  		insert into public.sys_dict_type(
- 			<if test="dictName != null and dictName != ''">dict_name,</if>
- 			<if test="dictType != null and dictType != ''">dict_type,</if>
- 			<if test="status != null">status,</if>
- 			<if test="remark != null and remark != ''">remark,</if>
- 			<if test="createBy != null and createBy != ''">create_by,</if>
- 			create_time
- 		)values(
- 			<if test="dictName != null and dictName != ''">#{dictName},</if>
- 			<if test="dictType != null and dictType != ''">#{dictType},</if>
- 			<if test="status != null">#{status},</if>
- 			<if test="remark != null and remark != ''">#{remark},</if>
- 			<if test="createBy != null and createBy != ''">#{createBy},</if>
- 			sysdate()
- 		)
+	 			dict_id,
+	 			<if test="dictName != null and dictName != ''">dict_name,</if>
+	 			<if test="dictType != null and dictType != ''">dict_type,</if>
+	 			<if test="status != null">status,</if>
+	 			<if test="remark != null and remark != ''">remark,</if>
+	 			<if test="createBy != null and createBy != ''">create_by,</if>
+	 			create_time
+	 		)values(
+	 		    #{dictId},
+	 			<if test="dictName != null and dictName != ''">#{dictName},</if>
+	 			<if test="dictType != null and dictType != ''">#{dictType},</if>
+	 			<if test="status != null">#{status},</if>
+	 			<if test="remark != null and remark != ''">#{remark},</if>
+	 			<if test="createBy != null and createBy != ''">#{createBy},</if>
+	 			CURRENT_TIMESTAMP
+	 		)
 	</insert>
 	
 </mapper> 

+ 2 - 2
pipe-network-service/zksy-system/src/main/resources/mapper/system/SysLogininforMapper.xml

@@ -17,8 +17,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</resultMap>
 
 	<insert id="insertLogininfor" parameterType="SysLogininfor">
-		insert into public.sys_logininfor (user_name, status, ipaddr, login_location, browser, os, msg, login_time)
-		values (#{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, sysdate())
+		insert into public.sys_logininfor (info_id, user_name, status, ipaddr, login_location, browser, os, msg, login_time)
+			values (#{infoId}, #{userName}, #{status}, #{ipaddr}, #{loginLocation}, #{browser}, #{os}, #{msg}, CURRENT_TIMESTAMP)
 	</insert>
 	
 	<select id="selectLogininforList" parameterType="SysLogininfor" resultMap="SysLogininforResult">

+ 8 - 8
pipe-network-service/zksy-system/src/main/resources/mapper/system/SysMenuMapper.xml

@@ -29,7 +29,7 @@
 	</resultMap>
 
 	<sql id="selectMenuVo">
-        select menu_id, menu_name, parent_id, order_num, path, component, `query`, route_name, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time 
+        select menu_id, menu_name, parent_id, order_num, path, component, "query", route_name, is_frame, is_cache, menu_type, visible, status, COALESCE(perms,'') as perms, icon, create_time 
 		from public.sys_menu
     </sql>
     
@@ -50,13 +50,13 @@
 	</select>
 	
 	<select id="selectMenuTreeAll" resultMap="SysMenuResult">
-		select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
+		select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m."query", m.route_name, m.visible, m.status, COALESCE(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
 		from public.sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
 		order by m.parent_id, m.order_num
 	</select>
 	
 	<select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
-		select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
+		select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m."query", m.route_name, m.visible, m.status, COALESCE(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
 		from public.sys_menu m
 		left join public.sys_role_menu rm on m.menu_id = rm.menu_id
 		left join public.sys_user_role ur on rm.role_id = ur.role_id
@@ -75,7 +75,7 @@
 	</select>
     
     <select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
-		select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
+		select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m."query", m.route_name, m.visible, m.status, COALESCE(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
 		from public.sys_menu m
 			 left join public.sys_role_menu rm on m.menu_id = rm.menu_id
 			 left join public.sys_user_role ur on rm.role_id = ur.role_id
@@ -141,7 +141,7 @@
 			<if test="orderNum != null">order_num = #{orderNum},</if>
 			<if test="path != null and path != ''">path = #{path},</if>
 			<if test="component != null">component = #{component},</if>
-			<if test="query != null">`query` = #{query},</if>
+			<if test="query != null">"query" = #{query},</if>
 			<if test="routeName != null">route_name = #{routeName},</if>
 			<if test="isFrame != null and isFrame != ''">is_frame = #{isFrame},</if>
 			<if test="isCache != null and isCache != ''">is_cache = #{isCache},</if>
@@ -152,7 +152,7 @@
 			<if test="icon !=null and icon != ''">icon = #{icon},</if>
 			<if test="remark != null and remark != ''">remark = #{remark},</if>
 			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
-			update_time = sysdate()
+			update_time = CURRENT_TIMESTAMP
 		</set>
 		where menu_id = #{menuId}
 	</update>
@@ -165,7 +165,7 @@
 		<if test="orderNum != null">order_num,</if>
 		<if test="path != null and path != ''">path,</if>
 		<if test="component != null and component != ''">component,</if>
-		<if test="query != null and query != ''">`query`,</if>
+		<if test="query != null and query != ''">"query",</if>
 		<if test="routeName != null">route_name,</if>
 		<if test="isFrame != null and isFrame != ''">is_frame,</if>
 		<if test="isCache != null and isCache != ''">is_cache,</if>
@@ -195,7 +195,7 @@
 		<if test="icon != null and icon != ''">#{icon},</if>
 		<if test="remark != null and remark != ''">#{remark},</if>
 		<if test="createBy != null and createBy != ''">#{createBy},</if>
-		sysdate()
+		CURRENT_TIMESTAMP
 		)
 	</insert>
 	

+ 19 - 17
pipe-network-service/zksy-system/src/main/resources/mapper/system/SysNoticeMapper.xml

@@ -44,22 +44,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     
     <insert id="insertNotice" parameterType="SysNotice">
         insert into public.sys_notice (
-			<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
-			<if test="noticeType != null and noticeType != '' ">notice_type, </if>
-			<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
-			<if test="status != null and status != '' ">status, </if>
-			<if test="remark != null and remark != ''">remark,</if>
- 			<if test="createBy != null and createBy != ''">create_by,</if>
- 			create_time
- 		)values(
-			<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
-			<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
-			<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
-			<if test="status != null and status != ''">#{status}, </if>
-			<if test="remark != null and remark != ''">#{remark},</if>
- 			<if test="createBy != null and createBy != ''">#{createBy},</if>
- 			sysdate()
-		)
+			notice_id,
+				<if test="noticeTitle != null and noticeTitle != '' ">notice_title, </if>
+				<if test="noticeType != null and noticeType != '' ">notice_type, </if>
+				<if test="noticeContent != null and noticeContent != '' ">notice_content, </if>
+				<if test="status != null and status != '' ">status, </if>
+				<if test="remark != null and remark != ''">remark,</if>
+	 			<if test="createBy != null and createBy != ''">create_by,</if>
+	 			create_time
+	 		)values(
+	 			#{noticeId},
+				<if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle}, </if>
+				<if test="noticeType != null and noticeType != ''">#{noticeType}, </if>
+				<if test="noticeContent != null and noticeContent != ''">#{noticeContent}, </if>
+				<if test="status != null and status != ''">#{status}, </if>
+				<if test="remark != null and remark != ''">#{remark},</if>
+	 			<if test="createBy != null and createBy != ''">#{createBy},</if>
+	 			CURRENT_TIMESTAMP
+			)
     </insert>
 	 
     <update id="updateNotice" parameterType="SysNotice">
@@ -70,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="noticeContent != null">notice_content = #{noticeContent}, </if>
             <if test="status != null and status != ''">status = #{status}, </if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = sysdate()
+ 			update_time = CURRENT_TIMESTAMP
         </set>
         where notice_id = #{noticeId}
     </update>

+ 2 - 2
pipe-network-service/zksy-system/src/main/resources/mapper/system/SysOperLogMapper.xml

@@ -30,8 +30,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
     
 	<insert id="insertOperlog" parameterType="SysOperLog">
-		insert into public.sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, cost_time, oper_time)
-        values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
+		insert into public.sys_oper_log(oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, cost_time, oper_time)
+	        values (#{operId}, #{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, CURRENT_TIMESTAMP)
 	</insert>
 	
 	<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">

+ 3 - 3
pipe-network-service/zksy-system/src/main/resources/mapper/system/SysPostMapper.xml

@@ -81,12 +81,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null and status != ''">status = #{status},</if>
  			<if test="remark != null">remark = #{remark},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = sysdate()
+ 			update_time = CURRENT_TIMESTAMP
  		</set>
  		where post_id = #{postId}
 	</update>
  	
- 	<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
+ 	<insert id="insertPost" parameterType="SysPost">
  		insert into public.sys_post(
  			<if test="postId != null and postId != 0">post_id,</if>
  			<if test="postCode != null and postCode != ''">post_code,</if>
@@ -104,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null and status != ''">#{status},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
- 			sysdate()
+ 			CURRENT_TIMESTAMP
  		)
 	</insert>
 	

+ 5 - 5
pipe-network-service/zksy-system/src/main/resources/mapper/system/SysRoleMapper.xml

@@ -46,10 +46,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			AND r.role_key like concat('%', #{roleKey}, '%')
 		</if>
 		<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-			and date_format(r.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
+			and TO_CHAR(r.create_time, 'YYYYMMDD') &gt;= TO_CHAR(#{params.beginTime}::TIMESTAMP, 'YYYYMMDD')
 		</if>
 		<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-			and date_format(r.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
+			and TO_CHAR(r.create_time, 'YYYYMMDD') &lt;= TO_CHAR(#{params.endTime}::TIMESTAMP, 'YYYYMMDD')
 		</if>
 		<!-- 数据范围过滤 -->
 		${params.dataScope}
@@ -93,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		 where r.role_key=#{roleKey} and r.del_flag = '0' limit 1
 	</select>
 	
- 	<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
+ 	<insert id="insertRole" parameterType="SysRole">
  		insert into public.sys_role(
  			<if test="roleId != null and roleId != 0">role_id,</if>
  			<if test="roleName != null and roleName != ''">role_name,</if>
@@ -117,7 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null and status != ''">#{status},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
- 			sysdate()
+ 			CURRENT_TIMESTAMP
  		)
 	</insert>
 	
@@ -133,7 +133,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="status != null and status != ''">status = #{status},</if>
  			<if test="remark != null">remark = #{remark},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = sysdate()
+ 			update_time = CURRENT_TIMESTAMP
  		</set>
  		where role_id = #{roleId}
 	</update>

+ 7 - 7
pipe-network-service/zksy-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -74,13 +74,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			AND u.phonenumber like concat('%', #{phonenumber}, '%')
 		</if>
 		<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-			AND date_format(u.create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
+			AND TO_CHAR(u.create_time, 'YYYYMMDD') &gt;= TO_CHAR(#{params.beginTime}::TIMESTAMP, 'YYYYMMDD')
 		</if>
 		<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-			AND date_format(u.create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
+			AND TO_CHAR(u.create_time, 'YYYYMMDD') &lt;= TO_CHAR(#{params.endTime}::TIMESTAMP, 'YYYYMMDD')
 		</if>
 		<if test="deptId != null and deptId != 0">
-			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id from public.sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))
+			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id from public.sys_dept t WHERE POSITION(',' || #{deptId} || ',' IN ',' || ancestors || ',') > 0 ))
 		</if>
 		<!-- 数据范围过滤 -->
 		${params.dataScope}
@@ -143,7 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		select user_id, email from public.sys_user where email = #{email} and del_flag = '0' limit 1
 	</select>
 	
-	<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
+	<insert id="insertUser" parameterType="SysUser">
  		insert into public.sys_user(
  			<if test="userId != null and userId != 0">user_id,</if>
  			<if test="deptId != null and deptId != 0">dept_id,</if>
@@ -173,7 +173,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="pwdUpdateDate != null">#{pwdUpdateDate},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
- 			sysdate()
+ 			CURRENT_TIMESTAMP
  		)
 	</insert>
 	
@@ -192,7 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="loginDate != null">login_date = #{loginDate},</if>
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
  			<if test="remark != null">remark = #{remark},</if>
- 			update_time = sysdate()
+ 			update_time = CURRENT_TIMESTAMP
  		</set>
  		where user_id = #{userId}
 	</update>
@@ -206,7 +206,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</update>
 	
 	<update id="resetUserPwd" parameterType="SysUser">
- 		update public.sys_user set pwd_update_date = sysdate(), password = #{password} where user_id = #{userId}
+ 		update public.sys_user set pwd_update_date = CURRENT_TIMESTAMP, password = #{password} where user_id = #{userId}
 	</update>
 	
 	<delete id="deleteUserById" parameterType="Long">

+ 21 - 21
pipe-network-service/zksy-system/src/main/resources/mapper/warning/EarlyWarningMapper.xml

@@ -40,16 +40,16 @@
         COUNT(CASE WHEN status = 'HANDLED' THEN 1 END) AS handled_today,
         COUNT(CASE WHEN status = 'CLOSED' THEN 1 END) AS closed_today
         FROM early_warning
-        WHERE publish_time &gt;= DATE_FORMAT(NOW(), '%Y-%m-%d 00:00:00')
-        AND publish_time &lt; DATE_ADD(DATE_FORMAT(NOW(), '%Y-%m-%d'), INTERVAL 1 DAY)
+        WHERE publish_time &gt;= CURRENT_DATE
+        AND publish_time &lt; CURRENT_DATE + INTERVAL '1 day'
     </select>
 
     <!-- 查询今日预警列表 -->
     <select id="selectTodayWarningList" resultMap="BaseResultMap">
         SELECT <include refid="Base_Column_List"/>
         FROM early_warning
-        WHERE publish_time &gt;= DATE_FORMAT(NOW(), '%Y-%m-%d 00:00:00')
-        AND publish_time &lt; DATE_ADD(DATE_FORMAT(NOW(), '%Y-%m-%d'), INTERVAL 1 DAY)
+        WHERE publish_time &gt;= CURRENT_DATE
+        AND publish_time &lt; CURRENT_DATE + INTERVAL '1 day'
         <choose>
             <when test="status != null and status != ''">
                 AND status = #{status}
@@ -64,8 +64,8 @@
     <!-- 按日统计预警发展趋势 -->
     <select id="selectWarningTrendByDay" resultType="java.util.Map">
         SELECT
-        DATE_FORMAT(publish_time, '%Y-%m-%d') AS stat_date,
-        IFNULL(warning_special, '其他') AS warning_special,
+        TO_CHAR(publish_time, 'YYYY-MM-DD') AS stat_date,
+        COALESCE(warning_special, '其他') AS warning_special,
         COUNT(*) AS warning_count
         FROM early_warning
         WHERE status != 'DRAFT'
@@ -85,8 +85,8 @@
     <!-- 按月统计预警发展趋势 -->
     <select id="selectWarningTrendByMonth" resultType="java.util.Map">
         SELECT
-        DATE_FORMAT(publish_time, '%Y-%m') AS stat_month,
-        IFNULL(warning_special, '其他') AS warning_special,
+        TO_CHAR(publish_time, 'YYYY-MM') AS stat_month,
+        COALESCE(warning_special, '其他') AS warning_special,
         COUNT(*) AS warning_count
         FROM early_warning
         WHERE status != 'DRAFT'
@@ -132,7 +132,7 @@
         COUNT(*) AS total_count
         FROM (
         SELECT
-        TIMESTAMPDIFF(SECOND, w.publish_time, MAX(d.create_time)) / 3600 AS dispose_hours
+        EXTRACT(EPOCH FROM (MAX(d.create_time) - w.publish_time)) / 3600 AS dispose_hours
         FROM early_warning w
         LEFT JOIN warning_disposal d ON w.warning_id = d.warning_id
         WHERE w.status IN ('HANDLED', 'CLOSED')
@@ -162,7 +162,7 @@
         COUNT(*) AS warning_count
         FROM (
         SELECT
-        TIMESTAMPDIFF(SECOND, w.publish_time, MAX(d.create_time)) / 3600 AS dispose_hours
+        EXTRACT(EPOCH FROM (MAX(d.create_time) - w.publish_time)) / 3600 AS dispose_hours
         FROM early_warning w
         LEFT JOIN warning_disposal d ON w.warning_id = d.warning_id
         WHERE w.status IN ('HANDLED', 'CLOSED')
@@ -191,13 +191,13 @@
     <!-- 处置时效分析-按预警专项统计平均时效 -->
     <select id="selectDisposeEfficiencyBySpecial" resultType="java.util.Map">
         SELECT
-        IFNULL(warning_special, '其他') AS warning_special,
+        COALESCE(warning_special, '其他') AS warning_special,
         COUNT(*) AS warning_count,
         ROUND(AVG(dispose_hours), 2) AS avg_dispose_hours
         FROM (
         SELECT
         w.warning_special,
-        TIMESTAMPDIFF(SECOND, w.publish_time, MAX(d.create_time)) / 3600 AS dispose_hours
+        EXTRACT(EPOCH FROM (MAX(d.create_time) - w.publish_time)) / 3600 AS dispose_hours
         FROM early_warning w
         LEFT JOIN warning_disposal d ON w.warning_id = d.warning_id
         WHERE w.status IN ('HANDLED', 'CLOSED')
@@ -220,10 +220,10 @@
         w.warning_id,
         w.warning_no,
         w.warning_name,
-        IFNULL(w.warning_special, '其他') AS warning_special,
+        COALESCE(w.warning_special, '其他') AS warning_special,
         w.publish_time,
         MAX(d.create_time) AS dispose_time,
-        ROUND(TIMESTAMPDIFF(SECOND, w.publish_time, MAX(d.create_time)) / 3600, 2) AS dispose_hours,
+        ROUND(EXTRACT(EPOCH FROM (MAX(d.create_time) - w.publish_time)) / 3600, 2) AS dispose_hours,
         w.status
         FROM early_warning w
         LEFT JOIN warning_disposal d ON w.warning_id = d.warning_id
@@ -257,7 +257,7 @@
         COUNT(*) AS total_count
         FROM (
         SELECT
-        TIMESTAMPDIFF(SECOND, w.publish_time, MIN(d.create_time)) / 3600 AS receive_hours
+        EXTRACT(EPOCH FROM (MIN(d.create_time) - w.publish_time)) / 3600 AS receive_hours
         FROM early_warning w
         INNER JOIN warning_disposal d ON w.warning_id = d.warning_id
         WHERE w.status != 'DRAFT'
@@ -293,7 +293,7 @@
         COUNT(*) AS warning_count
         FROM (
         SELECT
-        TIMESTAMPDIFF(SECOND, w.publish_time, MIN(d.create_time)) / 3600 AS receive_hours
+        EXTRACT(EPOCH FROM (MIN(d.create_time) - w.publish_time)) / 3600 AS receive_hours
         FROM early_warning w
         INNER JOIN warning_disposal d ON w.warning_id = d.warning_id
         WHERE w.status != 'DRAFT'
@@ -328,13 +328,13 @@
     <!-- 接警效率分析-按预警类型统计平均时效 -->
     <select id="selectReceiveEfficiencyByType" resultType="java.util.Map">
         SELECT
-        IFNULL(warning_type, '其他') AS warning_type,
+        COALESCE(warning_type, '其他') AS warning_type,
         COUNT(*) AS warning_count,
         ROUND(AVG(receive_hours), 2) AS avg_receive_hours
         FROM (
         SELECT
         w.warning_type,
-        TIMESTAMPDIFF(SECOND, w.publish_time, MIN(d.create_time)) / 3600 AS receive_hours
+        EXTRACT(EPOCH FROM (MIN(d.create_time) - w.publish_time)) / 3600 AS receive_hours
         FROM early_warning w
         INNER JOIN warning_disposal d ON w.warning_id = d.warning_id
         WHERE w.status != 'DRAFT'
@@ -357,11 +357,11 @@
         w.warning_id,
         w.warning_no,
         w.warning_name,
-        IFNULL(w.warning_type, '其他') AS warning_type,
-        IFNULL(w.warning_special, '其他') AS warning_special,
+        COALESCE(w.warning_type, '其他') AS warning_type,
+        COALESCE(w.warning_special, '其他') AS warning_special,
         w.publish_time,
         MIN(d.create_time) AS receive_time,
-        ROUND(TIMESTAMPDIFF(SECOND, w.publish_time, MIN(d.create_time)) / 3600, 2) AS receive_hours,
+        ROUND(EXTRACT(EPOCH FROM (MIN(d.create_time) - w.publish_time)) / 3600, 2) AS receive_hours,
         w.status
         FROM early_warning w
         INNER JOIN warning_disposal d ON w.warning_id = d.warning_id