瀏覽代碼

sql类型转换

chenendian 2 周之前
父節點
當前提交
950c338dd0

+ 3 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/cadastre/impl/SupplyServiceImpl.java

@@ -199,6 +199,9 @@ public class SupplyServiceImpl implements ISupplyService {
      */
     @Override
     public TrendStatisticsRes trendStatistics(String landType) {
+        if(StringUtils.isBlank(landType) || landType.matches("[0]+")){
+            landType = null;
+        }
         //这里合并两部分数据
         List<TdgyStatisticsRes> completeList = new ArrayList<>();
         List<TdgyStatisticsRes> completeBusinessStatusList = dgyMapper.getListByYear(null, landType, null, null);

+ 1 - 1
siwei-modules/siwei-apply/src/main/resources/mapper/TdgyMapper.xml

@@ -191,7 +191,7 @@
         LEFT JOIN public.land_type land ON land.NAME = gj_gd_data.tdyt
         WHERE 1=1
         <if test="year != null">
-            AND  LEFT(gj_gd_data.qdrq, 4) = #{year}
+            AND  LEFT(CAST(gj_gd_data.qdrq AS VARCHAR), 4) = #{year}
         </if>
         <if test="landTypeCode != null">
             AND LEFT(land.code,2)=#{landTypeCode}