Quellcode durchsuchen

修改sql

Signed-off-by: tangsong <86121657@qq.com>
tangsong vor 1 Jahr
Ursprung
Commit
363cd35eb0

+ 1 - 1
base-server/src/main/resources/bootstrap-devmysql.yml

@@ -14,7 +14,7 @@ spring:
14 14
     restart:
15 15
       enabled: false
16 16
   datasource:
17
-#    type: com.alibaba.druid.pool.DruidDataSource
17
+    type: com.alibaba.druid.pool.DruidDataSource
18 18
     url: jdbc:mysql://172.16.0.46:3306/base?useUnicode=true&characterEncoding=UTF-8&useSSL=true&serverTimezone=GMT%2b8
19 19
 #    url: jdbc:mysql://101.36.160.140:10311/base?useUnicode=true&characterEncoding=UTF-8&useSSL=true&serverTimezone=GMT%2b8
20 20
     username: root

+ 24 - 23
base-server/src/main/resources/mybatis/mapper/TzSlqyMapper.xml

@@ -161,12 +161,12 @@
161 161
             (select first 1 pj.pjjg
162 162
                 from qyxypjdc pj
163 163
                 where pj.ztmc = tz.qymc
164
-                and to_date(pj.pjyxq
165
-                , 'yyyy-MM-dd') &gt;= to_date((select sysdate from dual)
166
-                , 'yyyy-MM-dd')
167
-                and to_date(pj.pjrq
168
-                , 'yyyy-MM-dd') &lt;= to_date((select sysdate from dual)
169
-                , 'yyyy-MM-dd')
164
+                and DATE_FORMAT(pj.pjyxq
165
+                , '%Y-%m-%d') &gt;= DATE_FORMAT(now()
166
+                , '%Y-%m-%d')
167
+                and DATE_FORMAT(pj.pjrq
168
+                , '%Y-%m-%d') &lt;= DATE_FORMAT(now()
169
+                , '%Y-%m-%d')
170 170
                 and zt = '已提交'
171 171
                 order by pj.pjnd desc) x) as pjjg
172 172
         from
@@ -289,10 +289,10 @@
289 289
 
290 290
     <!--	根据统一社会信用代码获取企业相关信息-->
291 291
     <select id="getqyxxBytyshxydm" parameterType="java.lang.String" resultMap="BaseResultMap">
292
-		SELECT qymc, fddbr, create_date,refresh_time,zcr,
293
-        (select distinct p.provin_name from usercenter.BAS_AREA p where p.provin_code= txprovince) ||
294
-	    (select distinct p.county_name from usercenter.BAS_AREA p where p.county_code= txcity) ||
295
-         (select distinct p.city_name from usercenter.BAS_AREA p where p.city_code= txcity) || qytxdz as qytxdz
292
+    SELECT qymc, fddbr, create_date,refresh_time,zcr,
293
+        concat((select distinct p.provin_name from usercenter.BAS_AREA p where p.provin_code= txprovince),
294
+	    (select distinct p.county_name from usercenter.BAS_AREA p where p.county_code= txcity) ,
295
+         (select distinct p.city_name from usercenter.BAS_AREA p where p.city_code= txcity) , qytxdz) as qytxdz
296 296
         FROM TZ_SLQY
297 297
 		WHERE tyshxydm = #{kddm}
298 298
 	</select>
@@ -1393,9 +1393,9 @@
1393 1393
     <select id="getCompanyBytyshxydm" parameterType="java.lang.String" resultMap="BaseResultMap">
1394 1394
         SELECT
1395 1395
         <include refid="Base_Column_List_common"></include>
1396
-        ,(select nvl(count(0),0) from base.d_kdxxsjy where tyshxydm=tz.tyshxydm and status=1) as kqsl
1397
-        ,(select nvl(count(distinct(gfcfdm)),0) from base.d_cfxxsjy where tyshxydm=tz.tyshxydm and status=1 and sfba=5) as cfsl
1398
-        ,(select nvl(count(0),0) from base.d_ygxxsjy where tyshxydm=tz.tyshxydm and status=1 and sfba=5 ) as ygsl
1396
+        ,(select ifnull(count(0),0) from base.d_kdxxsjy where tyshxydm=tz.tyshxydm and status=1) as kqsl
1397
+        ,(select ifnull(count(distinct(gfcfdm)),0) from base.d_cfxxsjy where tyshxydm=tz.tyshxydm and status=1 and sfba=5) as cfsl
1398
+        ,(select ifnull(count(0),0) from base.d_ygxxsjy where tyshxydm=tz.tyshxydm and status=1 and sfba=5 ) as ygsl
1399 1399
         from
1400 1400
         TZ_SLQY tz
1401 1401
         <where>
@@ -1405,7 +1405,8 @@
1405 1405
     </select>
1406 1406
 
1407 1407
     <select id="selectMaxId" resultType="java.lang.Integer">
1408
-  	    SELECT MAX(CAST(ID AS INT)) AS ID FROM TZ_SLQY
1408
+  	    SELECT MAX(ID) AS ID FROM TZ_SLQY
1409
+--   	    SELECT MAX(CAST(ID AS INT)) AS ID FROM TZ_SLQY
1409 1410
   </select>
1410 1411
 
1411 1412
     <select id="selectByEntity" resultMap="BaseResultMap">
@@ -1482,7 +1483,7 @@
1482 1483
   </select>
1483 1484
 
1484 1485
     <select id="selectQyjg" resultType="com.unis.base.common.vo.TzQyjgVO">
1485
-        SELECT * FROM TZ_QYJG  WHERE status=1
1486
+        SELECT * FROM TZ_QYJG  WHERE status =1
1486 1487
     </select>
1487 1488
 
1488 1489
     <select id="selectKdxx" resultType="com.unis.base.common.vo.DKdxxsjyVO">
@@ -1685,7 +1686,7 @@
1685 1686
             SELECT DISTINCT(tz.id)
1686 1687
             from TZ_SLQY tz
1687 1688
             left join TZ_QYLX q on tz.id = q.qyid
1688
-            WHERE tz.status = 1 AND decode(tz.qyjd, null, 0, 1)  =1 and decode(tz.qywd, null, 0, 1) = 1
1689
+            WHERE tz.status = 1 AND if(tz.qyjd = null, 0, 1)  =1 and if(tz.qywd =null, 0, 1) = 1
1689 1690
             <!-- 企业类型 -->
1690 1691
             <if test="qylxbh != null and qylxbh != ''">
1691 1692
                 and q.qylxbh LIKE concat(CONCAT('%',#{qylxbh,jdbcType=VARCHAR}) ,'%')
@@ -2063,7 +2064,7 @@
2063 2064
     <!--根据实体的唯一属性查询数量-->
2064 2065
     <select id='selectCountById' resultType='java.lang.Integer'>
2065 2066
         SELECT
2066
-        COUNT(*)
2067
+        COUNT(1)
2067 2068
         FROM TZ_SLQY
2068 2069
         <where>
2069 2070
             <if test='id !=null and id != ""'>
@@ -2077,9 +2078,9 @@
2077 2078
     <select id="getCompanyByqymc" resultType="com.unis.base.server.entity.TzSlqyDO">
2078 2079
         SELECT
2079 2080
         <include refid="Base_Column_List_common"></include>
2080
-        ,(select nvl(count(0),0) from base.d_kdxxsjy where tyshxydm=tz.tyshxydm and status=1) as kqsl
2081
-        ,(select nvl(count(distinct(gfcfdm)),0) from base.d_cfxxsjy where tyshxydm=tz.tyshxydm and status=1 and sfba=5) as cfsl
2082
-        ,(select nvl(count(0),0) from base.d_ygxxsjy where tyshxydm=tz.tyshxydm and status=1 and sfba=5 ) as ygsl
2081
+        ,(select ifnull(count(0),0) from base.d_kdxxsjy where tyshxydm=tz.tyshxydm and status=1) as kqsl
2082
+        ,(select ifnull(count(distinct(gfcfdm)),0) from base.d_cfxxsjy where tyshxydm=tz.tyshxydm and status=1 and sfba=5) as cfsl
2083
+        ,(select ifnull(count(0),0) from base.d_ygxxsjy where tyshxydm=tz.tyshxydm and status=1 and sfba=5 ) as ygsl
2083 2084
         from
2084 2085
         TZ_SLQY tz
2085 2086
         <where>
@@ -2531,7 +2532,7 @@
2531 2532
         update TZ_SLQY
2532 2533
         set
2533 2534
             <if test="sjcr != null">
2534
-                sjcr = (select nvl(sum(sjcr),0)
2535
+                sjcr = (select ifnull(sum(sjcr),0)
2535 2536
                         from (select a.sjcr,
2536 2537
                                 row_number() over(partition by a.gfcfdm order by a.refresh_time desc) as rn
2537 2538
                               from  base.D_CFXXSJY a
@@ -2539,7 +2540,7 @@
2539 2540
                               and a.sfba = '5'
2540 2541
                               and tyshxydm = #{tyshxydm,jdbcType=VARCHAR})
2541 2542
                         where rn=1),
2542
-                zcr = (select nvl(sum(dczlrj),0)
2543
+                zcr = (select ifnull(sum(dczlrj),0)
2543 2544
                         from (select a.dczlrj,
2544 2545
                                  row_number() over(partition by a.gfcfdm order by a.refresh_time desc) as rn
2545 2546
                               from  base.D_CFXXSJY a
@@ -2549,7 +2550,7 @@
2549 2550
                         where rn=1),
2550 2551
             </if>
2551 2552
             <if test="gr != null">
2552
-                gr = (select nvl(sum(sjgr),0)
2553
+                gr = (select ifnull(sum(sjgr),0)
2553 2554
                      from d_ygxxsjy
2554 2555
                      where sfba = '5'
2555 2556
                      and tyshxydm = #{tyshxydm,jdbcType=VARCHAR}),

+ 3 - 3
base-server/src/main/resources/mybatis/mapper/XzqhMapper.xml

@@ -202,7 +202,7 @@
202 202
   <!--根据实体的某些属性查询数量-->
203 203
   <select id='selectCountByEntity' resultType='java.lang.Integer'>
204 204
     SELECT 
205
-    COUNT(*) 
205
+    COUNT(1)
206 206
     FROM TY_XZQHB
207 207
     <where>
208 208
       <!--自定义配置的检索条件-->
@@ -234,7 +234,7 @@
234 234
   <!--根据实体的唯一属性查询数量-->
235 235
   <select id='selectCountById' resultType='java.lang.Integer'>
236 236
     SELECT 
237
-    COUNT(*) 
237
+    COUNT(1)
238 238
     FROM TY_XZQHB
239 239
     <where>
240 240
       <if test='qhid !=null and qhid != ""'>
@@ -246,7 +246,7 @@
246 246
   <!--根据实体的业务唯一属性(且非指定主键数据)判断是否存在-->
247 247
   <select id='selectExistsByEntity' resultType='java.lang.Integer'>
248 248
     SELECT
249
-    COUNT(*) 
249
+    COUNT(1)
250 250
     FROM TY_XZQHB
251 251
     <where>
252 252
       <if test='qhid !=null and qhid != ""'>