ソースを参照

新增MySQL的查询处理

王苗苗 6 ヶ月 前
コミット
c8331f6a0a

+ 10 - 0
src/main/java/com/xlht/xlhtproject/controller/TXinyiMedicineParamController.java

@@ -61,5 +61,15 @@ public class TXinyiMedicineParamController extends BaseController
     }
 
 
+    /**
+     * 获取智能投药参数设置详细信息最新的一条数据
+     */
+    @GetMapping(value = "/getLatestRecord")
+    public AjaxResult getLatestRecord()
+    {
+        return success(tXinyiMedicineParamService.getLatestRecord());
+    }
+
+
 
 }

+ 6 - 3
src/main/resources/mapper/TXinyiMedicineParamMapper.xml

@@ -88,9 +88,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="tdb != null "> and tdb = #{tdb}</if>
             <if test="medicineAmount != null "> and medicine_amount = #{medicineAmount}</if>
             <if test="revision != null "> and revision = #{revision}</if>
-            <!-- 下面是新增的SQL检索条件 -->
-            <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检索条件  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>-->
+            <!-- 下面是新增的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>
         </where>
         and del_flag = 0 order by id desc
     </select>