From 37f8463032c06236bfd098133c31cda51217b00f Mon Sep 17 00:00:00 2001
From: yanzhaofeige <yanzhaofeige@qq.com>
Date: Wed, 09 Oct 2024 23:08:37 +0800
Subject: [PATCH] 数据中心编号处理

---
 cpzidc-framework/src/main/java/com/odcc/cpzidc/framework/config/JacksonConfig.java |   42 ++++++++++++++++++++++++++++++++++++++++++
 cpzidc-bis/src/main/resources/mapper/bis/IdcNoIndexMapper.xml                      |    4 ++--
 2 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/cpzidc-bis/src/main/resources/mapper/bis/IdcNoIndexMapper.xml b/cpzidc-bis/src/main/resources/mapper/bis/IdcNoIndexMapper.xml
index 33733b2..4be7b34 100644
--- a/cpzidc-bis/src/main/resources/mapper/bis/IdcNoIndexMapper.xml
+++ b/cpzidc-bis/src/main/resources/mapper/bis/IdcNoIndexMapper.xml
@@ -12,7 +12,7 @@
     </resultMap>
 
     <sql id="selectIdcNoIndexVo">
-        select id, tel_no, production_year, index from idc_no_index
+        select id, tel_no, production_year, 'index' from idc_no_index
     </sql>
 
     <select id="selectIdcNoIndexList" parameterType="IdcNoIndex" resultMap="IdcNoIndexResult">
@@ -20,7 +20,7 @@
         <where>  
             <if test="telNo != null  and telNo != ''"> and tel_no = #{telNo}</if>
             <if test="productionYear != null  and productionYear != ''"> and production_year = #{productionYear}</if>
-            <if test="index != null  and index != ''"> and index = #{index}</if>
+            <if test="index != null  and index != ''"> and 'index' = #{index}</if>
         </where>
     </select>
     
diff --git a/cpzidc-framework/src/main/java/com/odcc/cpzidc/framework/config/JacksonConfig.java b/cpzidc-framework/src/main/java/com/odcc/cpzidc/framework/config/JacksonConfig.java
new file mode 100644
index 0000000..8dfab20
--- /dev/null
+++ b/cpzidc-framework/src/main/java/com/odcc/cpzidc/framework/config/JacksonConfig.java
@@ -0,0 +1,42 @@
+package com.odcc.cpzidc.framework.config;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+
+import java.text.SimpleDateFormat;
+import java.util.TimeZone;
+
+/**
+ * Jackson配置
+ * 
+ * @author ruoyi
+ *
+ */
+@Configuration
+public class JacksonConfig
+{
+    @Bean
+    public MappingJackson2HttpMessageConverter jackson2HttpMessageConverter()
+    {
+        final Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
+        builder.serializationInclusion(JsonInclude.Include.NON_NULL);
+        final ObjectMapper objectMapper = builder.build();
+        SimpleModule simpleModule = new SimpleModule();
+        // Long 转为 String 防止 js 丢失精度
+        simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
+        objectMapper.registerModule(simpleModule);
+        // 忽略 transient 关键词属性
+        objectMapper.configure(MapperFeature.PROPAGATE_TRANSIENT_MARKER, true);
+        // 时区设置
+        objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8"));
+        objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
+        return new MappingJackson2HttpMessageConverter(objectMapper);
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3