소스 검색

修改sql

ZeroLiYi 1 년 전
부모
커밋
b36216c0a5

+ 1 - 1
transaction-server/src/main/resources/mybatis/mapper/GiveBackBailLetterMapper.xml

@@ -457,7 +457,7 @@
457 457
   <!--根据实体的某些属性查询数量-->
458 458
   <select id='selectCountByEntity' resultType='java.lang.Integer'>
459 459
     SELECT
460
-    COUNT(*)
460
+    COUNT(1)
461 461
     FROM TY_JYTKWTH
462 462
     <where>
463 463
       <!--if条件要注意,以免误删除或者更新全部-->

+ 1 - 1
transaction-server/src/main/resources/mybatis/mapper/RefundNoticeMapper.xml

@@ -110,7 +110,7 @@
110 110
                 and ht.fsdw like CONCAT('%', #{orgCode}, '%')
111 111
             </if>
112 112
             <if test="sgmc != null and sgmc != ''">
113
-                and (instr(decode(ht.jylx, 0, ht.cmmc, 1, ht.sgmc), #{sgmc}) > 0)
113
+               and (IF(ht.jylx = 0, ht.cmmc, ht.sgmc) LIKE CONCAT('%', #{sgmc}, '%'))
114 114
             </if>
115 115
             <if test="cjkssj != null">
116 116
                 and STR_TO_DATE(ht.cjrq,'%Y-%m-%d')&gt;= #{cjkssj}

+ 7 - 7
transaction-server/src/main/resources/mybatis/mapper/TradeMarkMapper.xml

@@ -123,7 +123,7 @@
123 123
         <include refid="traderuleColumns" />
124 124
         FROM ty_jybd bd <include refid="traderuleJoins" />
125 125
         <where>
126
-            and bd.bdh like '%' || #{value} || '%'
126
+            and bd.bdh like '%${value}%'
127 127
         </where>
128 128
     </select>
129 129
 
@@ -164,7 +164,7 @@
164 164
                 and instr(cc.wtfmc, #{wtfmc}) > 0
165 165
             </if>
166 166
             <if test="jyrq != null">
167
-                and cc.jyrq = to_date(#{jyrq}, 'yyyy-mm-dd')
167
+                and cc.jyrq = DATE_FORMAT(#{jyrq}, '%Y-%m-%d')
168 168
             </if>
169 169
             <if test="fbzt != null">
170 170
                 and wt.fbzt = #{fbzt}
@@ -221,7 +221,7 @@
221 221
         <where>
222 222
             and bd.apbm = ap.apbm
223 223
             <if test="dwmc != null and dwmc != ''">
224
-                and ap.dwmc like '%' || #{dwmc} || '%'
224
+                and ap.dwmc like '%${dwmc}%'
225 225
             </if>
226 226
             <if test="pzbm != null and pzbm != ''">
227 227
                 and ap.pzbm = #{pzbm}
@@ -613,7 +613,7 @@
613 613
         </if>
614 614
     </select>
615 615
     <select id="selectOrgCode" resultType="java.lang.String">
616
-        select qyjgdm from base:tz_slqy where zzjgdm =#{value}
616
+        select qyjgdm from base.tz_slqy where zzjgdm =#{value}
617 617
     </select>
618 618
     <select id="selectContractHtByDwbm" resultType="com.unis.transaction.common.vo.tradeplan.ContractVO">
619 619
         select * from ty_jyht
@@ -648,18 +648,18 @@
648 648
         </where>
649 649
     </select>
650 650
     <select id="selectGxgsList" resultType="java.lang.String">
651
-        select org_code FROM usercenter:sys_orgainze where state_code='1'
651
+        select org_code FROM usercenter.sys_orgainze where state_code='1'
652 652
          and org_code like '${value}%'
653 653
         order by org_code
654 654
     </select>
655 655
     <select id="getKqdmByQyjgdm" resultType="java.lang.String">
656 656
         select
657 657
             kd.kqdm
658
-        from base:d_kdxxsjy kd
658
+        from base.d_kdxxsjy kd
659 659
         where kd.tyshxydm=
660 660
             (select
661 661
                 qy.tyshxydm
662
-            from base:tz_slqy qy
662
+            from base.tz_slqy qy
663 663
             where qyjgdm=#{cckdm})
664 664
     </select>
665 665
 

+ 1 - 1
transaction-server/src/main/resources/mybatis/mapper/TransactionSignUpMapper.xml

@@ -428,7 +428,7 @@
428 428
         where cc.ccbm = #{ccbm}
429 429
     </select>
430 430
 	<select id="selectdwbmByTyshxydm" resultType="java.lang.String">
431
-		select qy.qyjgdm from base:tz_slqy qy where qy.tyshxydm=#{tyshxydm}
431
+		select qy.qyjgdm from base.tz_slqy qy where qy.tyshxydm=#{tyshxydm}
432 432
 	</select>
433 433
 
434 434
 </mapper>

+ 1 - 1
transaction-server/src/main/resources/mybatis/mapper/TurnoverDataMapper.xml

@@ -135,7 +135,7 @@ lysl,round((sum(cj.zcjsl)/sum(cj.trsl)*100),2) lyl
135 135
         <where>
136 136
 			and status = 1
137 137
         	<if test="cjdwmc != null and cjdwmc != ''">
138
-        		and cjdwmc like  '%'||#{cjdwmc}||'%' CONCAT('%',#{cjdwmc},'%')
138
+        		and cjdwmc like  CONCAT('%',#{cjdwmc},'%')
139 139
         	</if>
140 140
 			<if test="cjdwbm != null and cjdwbm != ''">
141 141
 				and cjdwbm =#{cjdwbm}

+ 2 - 2
transaction-server/src/main/resources/mybatis/mapper/TyHtlytxMapper.xml

@@ -31,10 +31,10 @@
31 31
                 and ccqyhf = #{ccqyhf}
32 32
             </if>
33 33
             <if test="jhwcsjks != null and jhwcsjks != ''">
34
-                and jhwcrq &gt;= to_date(#{jhwcsjks}, 'yyyy-mm-dd')
34
+                and jhwcrq &gt;= DATE_FORMAT(#{jhwcsjks}, '%Y-%m-%d')
35 35
             </if>
36 36
             <if test="jhwcsjjs != null and jhwcsjjs != ''">
37
-                and jhwcrq &lt;= to_date(#{jhwcsjjs}, 'yyyy-mm-dd')
37
+                and jhwcrq &lt;= DATE_FORMAT(#{jhwcsjjs}, '%Y-%m-%d')
38 38
             </if>
39 39
         </where>
40 40
     </select>

+ 10 - 4
transaction-server/src/main/resources/mybatis/mapper/TyJycckhxxMapper.xml

@@ -13,8 +13,12 @@
13 13
                 kh.khmc as hymc,
14 14
                 max(kh.jyqbzj) as jyqbzj,
15 15
                 wt.jyrq as jyrq,
16
-                (select wm_concat(ht.htbh) from ty_jyht ht where ht.apcc = cc.apcc
17
-                and ((ht.jylx = '0' and ht.cmmc = kh.khmc) or (ht.jylx = '1' and ht.sgmc = kh.khmc))) as hth,
16
+                (SELECT GROUP_CONCAT(ht.htbh SEPARATOR ',')
17
+        FROM ty_jyht ht
18
+        JOIN ty_jycc cc-- 需要补全cc表的全名
19
+        ON ht.apcc = cc.apcc
20
+        JOIN ty_jycc_khxx kh-- 需要补全kh表的全名
21
+        ON (ht.jylx = '0' AND ht.cmmc = kh.khmc) OR (ht.jylx = '1' AND ht.sgmc = kh.khmc)) as hth,
18 22
                 (select count(*) from ty_jyht ht where ht.apcc = cc.apcc
19 23
                 and ((ht.jylx = '0' and ht.cmmc = kh.khmc) or (ht.jylx = '1' and ht.sgmc = kh.khmc))) as cjqk
20 24
             from ty_jycc_khxx kh
@@ -65,8 +69,10 @@
65 69
                 kh.khmc as hymc,
66 70
                 max(kh.jyqbzj) as jyqbzj,
67 71
                 wt.jyrq as jyrq,
68
-                (select wm_concat(ht.htbh) from ty_jyht ht where ht.apcc = cc.apcc
69
-                and ((ht.jylx = '0' and ht.cmmc = kh.khmc) or (ht.jylx = '1' and ht.sgmc = kh.khmc))) as hth,
72
+                (SELECT GROUP_CONCAT(ht.htbh) AS concatenated_htbh
73
+        FROM ty_jyht ht
74
+        JOIN ty_jycc cc ON ht.apcc = cc.apcc
75
+        JOIN ty_jycc_khxx kh ON (ht.jylx = '0' AND ht.cmmc = kh.khmc) OR (ht.jylx = '1' AND ht.sgmc = kh.khmc)) as hth,
70 76
                 (select count(*) from ty_jyht ht where ht.apcc = cc.apcc
71 77
                 and ((ht.jylx = '0' and ht.cmmc = kh.khmc) or (ht.jylx = '1' and ht.sgmc = kh.khmc))) as cjqk
72 78
             from ty_jycc_khxx kh