ソースを参照

修改成SqlServer的语法

王苗苗 6 ヶ月 前
コミット
2638afee10

BIN
.DS_Store


+ 11 - 11
src/main/resources/application.yml

@@ -23,19 +23,19 @@ logging:
     org.springframework: warn
 
 
-#spring:
-#  datasource:
-#    url: jdbc:sqlserver://10.1.100.119:1433;DatabaseName=HS_WEB;encrypt=false;trustServerCertificate=true;
-#    username: sa
-#    password: Abc123456
-#    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
-
 spring:
   datasource:
-    url: jdbc:mysql://localhost:3306/big_model?useSSL=false&serverTimezone=UTC
-    username: root
-    password: 1234qwer
-    driver-class-name: com.mysql.cj.jdbc.Driver
+    url: jdbc:sqlserver://10.1.100.119:1433;DatabaseName=HS_WEB;encrypt=false;trustServerCertificate=true;
+    username: sa
+    password: Abc123456
+    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
+
+#spring:
+#  datasource:
+#    url: jdbc:mysql://localhost:3306/big_model?useSSL=false&serverTimezone=UTC
+#    username: root
+#    password: 1234qwer
+#    driver-class-name: com.mysql.cj.jdbc.Driver
 
 
 

+ 5 - 5
src/main/resources/mapper/TXinyiMedicineParamMapper.xml

@@ -89,11 +89,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="medicineAmount != null "> and medicine_amount = #{medicineAmount}</if>
             <if test="revision != null "> and revision = #{revision}</if>
             <!-- 下面是新增的SQL检索条件  SqlServer写法-->
-            <!--<if test="timeBegin != null  and timeBegin != ''"> and SUBSTRING (CONVERT ( VARCHAR, create_time, 120 ), 1, 10 ) &gt;= #{timeBegin}</if>
-            <if test="timeEnd != null  and timeEnd != ''"> and SUBSTRING (CONVERT ( VARCHAR, create_time, 120 ), 1, 10 ) &lt;= #{timeEnd}</if>-->
+            <if test="timeBegin != null  and timeBegin != ''"> and SUBSTRING (CONVERT ( VARCHAR, create_time, 120 ), 1, 10 ) &gt;= #{timeBegin}</if>
+            <if test="timeEnd != null  and timeEnd != ''"> and SUBSTRING (CONVERT ( VARCHAR, create_time, 120 ), 1, 10 ) &lt;= #{timeEnd}</if>
             <!-- 下面是新增的SQL检索条件  MySQL写法-->
-            <if test="timeBegin != null  and timeBegin != ''"> and DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= #{timeBegin}</if>
-            <if test="timeEnd != null  and timeEnd != ''"> DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{timeEnd}</if>
+            <!--<if test="timeBegin != null  and timeBegin != ''"> and DATE_FORMAT(create_time, '%Y-%m-%d') &gt;= #{timeBegin}</if>
+            <if test="timeEnd != null  and timeEnd != ''"> DATE_FORMAT(create_time, '%Y-%m-%d') &lt;= #{timeEnd}</if>-->
         </where>
         and del_flag = 0 order by id desc
     </select>
@@ -252,6 +252,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <!-- 下面是新增的SQL,不要覆盖 -->
     <select id="getLatestRecord" resultMap="TXinyiMedicineParamResult">
         <include refid="selectTXinyiMedicineParamVo"/>
-        where del_flag = 0 order by id desc limit 1
+        where del_flag = 0 order by id desc OFFSET 0 ROWS FETCH NEXT 1 ROW ONLY
     </select>
 </mapper>