Просмотр исходного кода

剔除并调整sql中不符合mysql8的语法

codingliang 8 месяцев назад
Родитель
Сommit
43ba9c2708

+ 161 - 0
src/main/resources/application-mysql8.yml

@@ -0,0 +1,161 @@
+spring:
+    datasource:
+        type: com.alibaba.druid.pool.DruidDataSource
+        druid:
+            driver-class-name: com.mysql.cj.jdbc.Driver
+            url: jdbc:mysql://172.22.45.21:3306/tcwm2.5?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&serverTimezone=CTT&useAffectedRows=true
+            username: root
+            password: Chuanghai2024.
+            initial-size: 10
+            max-active: 100
+            min-idle: 10
+            max-wait: 60000
+            pool-prepared-statements: true
+            max-pool-prepared-statement-per-connection-size: 20
+            time-between-eviction-runs-millis: 60000
+            min-evictable-idle-time-millis: 300000
+            #Oracle需要打开注释
+            #validation-query: SELECT 1 FROM DUAL
+            test-while-idle: true
+            test-on-borrow: false
+            test-on-return: false
+            stat-view-servlet:
+                enabled: true
+                url-pattern: /druid/*
+                #login-username: admin
+                #login-password: admin
+            filter:
+                stat:
+                    log-slow-sql: true
+                    slow-sql-millis: 1000
+                    merge-sql: false
+                wall:
+                    config:
+                        multi-statement-allow: true
+    redis:
+        host: 172.16.20.103
+        port: 6379
+        password: ch_wm_redis_2025@.
+        database: 3
+        timeout: 5000
+        jedis:
+            pool:
+                enabled: true
+                max-active: 20
+                min-idle: 0
+                max-idle: 10
+                max-wait: -1
+# 接口数据加密
+secure-api:
+    # 开启SecureApi功能,如果为false则其余配置项均不生效
+    enabled: true
+    # 开启加解密日志打印,会打印出接口名、加密模式、算法、明文和密文等信息
+    show-log: false
+    url-safe: true
+    # 加密模式,common和session_key可选,session_key是会话密钥模式,用于每次请求都使用不同的密钥,需要前端配合
+    mode: common
+    # 加密算法
+    cipher-algorithm: aes_cbc_pkcs5
+    # 对称算法用于加解密的密钥,Base64格式,cipher-algorithm选择对称加密算法时配置,也可为空,组件会随机生成一个
+    key: oURKtBcNU6axnNoebKkuPqkCn6ivhE9qbg9FpeNnfpo=
+    # 对称算法用于加解密的偏移量,Base64格式,cipher-algorithm选择对称加密算法时配置,也可为空,组件会随机生成一个
+    iv: eW1xeThJSkprcEZUTGh1Ng==
+    # 需要加密的接口路径匹配,遵循spring boot拦截器的正则规则,留空或者不配置代表不使用url匹配,只对注解的接口进行解密
+    encrypt-url:
+        # 配置了此项,接口有无注解都将进行返回值加密
+        include-urls: /**
+        # 即使配置了排除,注解的优先级也高于此项
+        exclude-urls:
+            - /captcha.jpg
+            - /app/wxPay/notifyMp
+            - /app/wxPay/notify
+            - /app/wxPay/notifyJsApi
+            - /app/wxPay/notifyShop
+            - /app/wxPay/notifyJsApiShop
+            - /app/wxPay/notifyMpShop
+            - /pay/open/notify
+            - /app/new-pay/wechat-pay/notify
+            - /chatSocket/**
+            - /websocket/**
+            - /alioss/**
+            - /swagger-ui.html
+            - /v2/api-docs
+            - /swagger-resources/**
+            - /webjars/**
+            - /back/open
+    # 需要解密的接口路径匹配,遵循spring boot拦截器的正则规则,留空或者不配置代表不使用url匹配,只对注解的接口、参数、字段进行解密
+    decrypt-url:
+        # 配置了此项,接口、参数、字段有无注解都将进行解密
+        include-urls: /**
+        # 即使配置了排除,注解的优先级也高于此项
+        exclude-urls:
+            - /captcha.jpg
+            - /app/wxPay/notifyMp
+            - /app/wxPay/notify
+            - /app/wxPay/notifyJsApi
+            - /app/wxPay/notifyShop
+            - /app/wxPay/notifyJsApiShop
+            - /app/wxPay/notifyMpShop
+            - /pay/open/notify
+            - /app/new-pay/wechat-pay/notify
+            - /chatSocket/**
+            - /websocket/**
+            - /alioss/**
+            - /swagger-ui.html
+            - /v2/api-docs
+            - /swagger-resources/**
+            - /webjars/**
+            - /back/open
+    # Date类型日期格式化
+    date-format: yyyy-MM-dd HH:mm:ss
+    # LocalDateTime类型日期格式化
+    local-date-time-format: yyyy-MM-dd HH:mm:ss
+
+mp:
+    temp: false
+sftp:
+    username: export
+    password: Waimai2024#
+    host: 172.16.20.105
+    port: 22
+#查询备用数据库
+dynamic:
+    driver-class-name: com.mysql.cj.jdbc.Driver
+    url: jdbc:mysql://172.16.20.104:3306/tcwm2.5?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&serverTimezone=CTT
+    #    url: jdbc:mysql://172.16.20.108:3306/tcwm2.5?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&serverTimezone=CTT
+    username: root
+    password: ch@2025.wm
+    #    password: chuanghai@2024
+    initial-size: 15
+    max-active: 100
+    min-idle: 10
+    max-wait: 60000
+    pool-prepared-statements: true
+    max-pool-prepared-statement-per-connection-size: 20
+    time-between-eviction-runs-millis: 60000
+    min-evictable-idle-time-millis: 300000
+    #Oracle需要打开注释
+    #validation-query: SELECT 1 FROM DUAL
+    test-while-idle: true
+    test-on-borrow: false
+    test-on-return: false
+    stat-view-servlet:
+        enabled: true
+        url-pattern: /druid/*
+        #login-username: admin
+        #login-password: admin
+    filter:
+        stat:
+            log-slow-sql: true
+            slow-sql-millis: 1000
+            merge-sql: false
+        wall:
+            config:
+                multi-statement-allow: true
+
+# minio配置
+minio:
+    endpoint: http://172.16.20.105:9000
+    accessKey: YTDm6Wtjf1q0LbGi2SKK
+    secretKey: MU1KozgxyknGDPwcKuvCEuhZwL37wbryHOFRW5Xt
+    bucket: wmfile

+ 0 - 59
src/main/resources/mapper/baseDate/RegionDao.xml

@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.sqx.modules.baseDate.dao.RegionDao">
-    <select id="selectRegion" resultType="Map">
-     select region_id,parent_id,region_name,status,ischildren,idtree from tb_region where isdelete=0
-        <if test ='0 != parentId'>
-            and parent_id=#{parentId}
-        </if>
-        <if test ='0 == parentId'>
-            and parent_id=0
-        </if>
-    </select>
-
-    <!--<insert id="insertRegion" useGeneratedKeys="true" keyColumn="regionId" keyProperty="regionId" parameterType="com.sqx.modules.app.order.entity.Order">
-        insert into tb_region
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test ='null != regionName'>
-                region_name,
-            </if>
-            <if test ='null != status'>
-                status,
-            </if>
-            <if test ='null != ischildren'>
-                ischildren
-            </if>
-        </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test ='null != regionName'>
-                #{regionName},
-            </if>
-            <if test ='null != status'>
-                #{status},
-            </if>
-            <if test ='null != ischildren'>
-                #{ischildren}
-            </if>
-        </trim>
-    </insert>-->
-
-    <update id="updateIschildren">
-        update tb_region set ischildren=1 where 1=1
-    <if test ='null != id'>
-        and region_id=#{id}
-    </if>
-    </update>
-
-    <update id="updateStatus">
-        update tb_region set
-            status= #{status}
-            where 1=1
-        <if test ='null != id'>
-            and idtree like #{id}
-        </if>
-    </update>
-
-    <update id="deleteRegion">
-        update tb_region set isdelete =1 where idtree like #{id}
-    </update>
-</mapper>

+ 167 - 131
src/main/resources/mapper/dataCentre/dataCenterMapper.xml

@@ -80,7 +80,7 @@
         select count(*)
         select count(*)
         from tb_indent
         from tb_indent
         where rider_user_id = #{userId}
         where rider_user_id = #{userId}
-          and indent_state in (2, 3, 4, 6, 11)
+          and indent_state in ('2', '3', '4', '6', '11')
           and date_format(create_time, '%Y-%m') = date_format(#{date}, '%Y-%m')
           and date_format(create_time, '%Y-%m') = date_format(#{date}, '%Y-%m')
     </select>
     </select>
 
 
@@ -88,7 +88,7 @@
         select ifnull(sum(rider_money), 0)
         select ifnull(sum(rider_money), 0)
         from tb_indent
         from tb_indent
         where rider_user_id = #{userId}
         where rider_user_id = #{userId}
-          and indent_state = 6
+          and indent_state = '6'
     </select>
     </select>
 
 
     <select id="sumCashMoney" resultType="java.math.BigDecimal">
     <select id="sumCashMoney" resultType="java.math.BigDecimal">
@@ -158,67 +158,84 @@
 
 
     <select id="rankingList" resultType="com.sqx.modules.errand.entity.TbIndent">
     <select id="rankingList" resultType="com.sqx.modules.errand.entity.TbIndent">
         SELECT
         SELECT
-        *,
-        @rank_num := @rank_num + 1 AS rankNum
-        FROM
-        ( SELECT @rank_num := 0 ) r,
-        ( SELECT ifnull( sum( rider_money ), 0 ) AS moneyOrder, i.rider_user_id, u.nick_name as nickName, u.avatar as
-        avatar,
-        i.user_province as userProvince, i.user_city as userCity, i.user_district as userDistrict,rs.station_name as stationName,
-        u.user_name as riderNickName,u.balance as riderBalance,u.phone as riderPhone
-        FROM tb_indent i left join tb_user u on i.rider_user_id = u.user_id
-        left join rider_station rs on u.rider_station_id=rs.id
-        WHERE i.rider_user_id IS NOT NULL and i.indent_state = 6
-        <if test="address!=null and address!=''">
-                and (i.user_province like concat('%',#{address},'%') or i.user_city like concat('%',#{address},'%') or
-                i.user_district like concat('%',#{address},'%'))
-        </if>
-        <if test="dateType=='day'">
-            and date_format(i.create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
-        </if>
-        <if test="dateType=='month'">
-            and date_format(i.create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
-        </if>
-        <if test="dateType=='year'">
-            and date_format(i.create_time,'%Y')=date_format(#{date},'%Y')
-        </if>
-        <if test="riderStationId != null and riderStationId != ''">
-            and u.rider_station_id=#{riderStationId}
-        </if>
-        GROUP BY i.rider_user_id ) a
+            a.*,
+            ROW_NUMBER() OVER (ORDER BY a.moneyOrder DESC) AS rankNum
+        FROM (
+            SELECT
+                ifnull(sum(rider_money), 0) AS moneyOrder,
+                i.rider_user_id,
+                u.nick_name as nickName,
+                u.avatar as avatar,
+                i.user_province as userProvince,
+                i.user_city as userCity,
+                i.user_district as userDistrict,
+                rs.station_name as stationName,
+                u.user_name as riderNickName,
+                u.balance as riderBalance,
+                u.phone as riderPhone
+            FROM tb_indent i
+                LEFT JOIN tb_user u ON i.rider_user_id = u.user_id
+                LEFT JOIN rider_station rs ON u.rider_station_id=rs.id
+            WHERE i.rider_user_id IS NOT NULL and i.indent_state = '6'
+            <if test="address!=null and address!=''">
+                    and (i.user_province like concat('%',#{address},'%') or i.user_city like concat('%',#{address},'%') or
+                    i.user_district like concat('%',#{address},'%'))
+            </if>
+            <if test="dateType=='day'">
+                and date_format(i.create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
+            </if>
+            <if test="dateType=='month'">
+                and date_format(i.create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
+            </if>
+            <if test="dateType=='year'">
+                and date_format(i.create_time,'%Y')=date_format(#{date},'%Y')
+            </if>
+            <if test="riderStationId != null and riderStationId != ''">
+                and u.rider_station_id=#{riderStationId}
+            </if>
+            GROUP BY i.rider_user_id
+        ) a
         ORDER BY moneyOrder DESC
         ORDER BY moneyOrder DESC
     </select>
     </select>
 
 
     <select id="excelRankList" resultType="com.sqx.modules.errand.entity.TbIndent">
     <select id="excelRankList" resultType="com.sqx.modules.errand.entity.TbIndent">
         SELECT
         SELECT
-        *,
-        @rank_num := @rank_num + 1 AS rankNum
-        FROM
-        ( SELECT @rank_num := 0 ) r,
-        ( SELECT ifnull( sum( rider_money ), 0 ) AS moneyOrder, i.rider_user_id, u.nick_name as nickName, u.avatar as
-        avatar,
-        i.user_province as userProvince, i.user_city as userCity, i.user_district as userDistrict,rs.station_name as stationName,
-        u.user_name as riderNickName,u.balance as riderBalance
-        FROM tb_indent i left join tb_user u on i.rider_user_id = u.user_id
-        left join rider_station rs on u.rider_station_id=rs.id
-        WHERE i.rider_user_id IS NOT NULL
-        <if test="query.address!=null and query.address!=''">
-            and (i.user_province like concat('%',#{query.address},'%') or i.user_city like concat('%',#{query.address},'%') or
-            i.user_district like concat('%',#{query.address},'%'))
-        </if>
-        <if test="query.dateType=='day'">
-            and date_format(i.create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
-        </if>
-        <if test="query.dateType=='month'">
-            and date_format(i.create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
-        </if>
-        <if test="query.dateType=='year'">
-            and date_format(i.create_time,'%Y')=date_format(#{query.date},'%Y')
-        </if>
-        <if test="query.riderStationId != null and query.riderStationId !=''">
-            and u.rider_station_id=#{query.riderStationId}
-        </if>
-        GROUP BY i.rider_user_id ) a
+            a.*,
+            ROW_NUMBER() OVER (ORDER BY a.moneyOrder DESC) AS rankNum
+        FROM (
+            SELECT
+                ifnull(sum(rider_money), 0) AS moneyOrder,
+                i.rider_user_id,
+                u.nick_name as nickName,
+                u.avatar as avatar,
+                i.user_province as userProvince,
+                i.user_city as userCity,
+                i.user_district as userDistrict,
+                rs.station_name as stationName,
+                u.user_name as riderNickName,
+                u.balance as riderBalance
+            FROM tb_indent i
+                LEFT JOIN tb_user u ON i.rider_user_id = u.user_id
+                LEFT JOIN rider_station rs ON u.rider_station_id=rs.id
+            WHERE i.rider_user_id IS NOT NULL
+            <if test="query.address!=null and query.address!=''">
+                and (i.user_province like concat('%',#{query.address},'%') or i.user_city like concat('%',#{query.address},'%') or
+                i.user_district like concat('%',#{query.address},'%'))
+            </if>
+            <if test="query.dateType=='day'">
+                and date_format(i.create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
+            </if>
+            <if test="query.dateType=='month'">
+                and date_format(i.create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
+            </if>
+            <if test="query.dateType=='year'">
+                and date_format(i.create_time,'%Y')=date_format(#{query.date},'%Y')
+            </if>
+            <if test="query.riderStationId != null and query.riderStationId !=''">
+                and u.rider_station_id=#{query.riderStationId}
+            </if>
+            GROUP BY i.rider_user_id
+        ) a
         ORDER BY moneyOrder DESC
         ORDER BY moneyOrder DESC
     </select>
     </select>
 
 
@@ -243,74 +260,89 @@
 
 
     <select id="selectRankingList" resultType="com.sqx.modules.order.entity.TbOrder">
     <select id="selectRankingList" resultType="com.sqx.modules.order.entity.TbOrder">
         SELECT
         SELECT
-        *,
-        @rank_num := @rank_num + 1 AS rankNum
-        FROM
-        ( SELECT @rank_num := 0 ) r,
-        ( SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney,ifnull( sum( shop_income_money ), 0 ) AS shopIncomeMoney, tor.shop_id , u.shop_name,gp.id as
-        shopType,gp.shop_type_name as shopTypeName
-        FROM tb_order tor force index(tb_order_pay_time_IDX) left join goods_shop u on tor.shop_id = u.shop_id
-        left join shop_type gp on gp.id=u.shop_type_id
-        WHERE tor.shop_id IS NOT NULL and tor.status = 4
-        <if test="query.startTime != null and query.startTime !=''">
-            and tor.pay_time >= #{query.startTime}
-        </if>
-        <if test="query.endTime != null and query.endTime != ''">
-            and tor.pay_time <![CDATA[<=]]> #{query.endTime}
-        </if>
-        <if test="query.shopType != null and query.shopType != '' ">
-            and gp.id = #{query.shopType}
-        </if>
-        GROUP BY tor.shop_id ) a
+            a.*,
+            ROW_NUMBER() OVER (ORDER BY a.shopMoney DESC) AS rankNum
+        FROM (
+            SELECT
+                ifnull(sum(pay_money), 0) AS shopMoney,
+                ifnull(sum(shop_income_money), 0) AS shopIncomeMoney,
+                tor.shop_id,
+                u.shop_name,
+                gp.id as shopType,
+                gp.shop_type_name as shopTypeName
+            FROM tb_order tor
+                LEFT JOIN goods_shop u ON tor.shop_id = u.shop_id
+                LEFT JOIN shop_type gp ON gp.id=u.shop_type_id
+            WHERE tor.shop_id IS NOT NULL and tor.status = 4
+            <if test="query.startTime != null and query.startTime !=''">
+                and tor.pay_time >= #{query.startTime}
+            </if>
+            <if test="query.endTime != null and query.endTime != ''">
+                and tor.pay_time <![CDATA[<=]]> #{query.endTime}
+            </if>
+            <if test="query.shopType != null and query.shopType != '' ">
+                and gp.id = #{query.shopType}
+            </if>
+            GROUP BY tor.shop_id
+        ) a
         ORDER BY shopMoney DESC
         ORDER BY shopMoney DESC
     </select>
     </select>
 
 
     <select id="selectRankingListAmount" resultType="com.sqx.modules.order.entity.TbOrder">
     <select id="selectRankingListAmount" resultType="com.sqx.modules.order.entity.TbOrder">
-        SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney,ifnull( sum( shop_income_money ), 0 ) AS shopIncomeMoney
-        FROM tb_order tor force index(tb_order_pay_time_IDX) left join goods_shop u on tor.shop_id = u.shop_id
-        left join shop_type gp on gp.id=u.shop_type_id
+        SELECT
+            ifnull( sum( pay_money ), 0 ) AS shopMoney,
+            ifnull( sum( shop_income_money ), 0 ) AS shopIncomeMoney
+        FROM tb_order tor
+            left join goods_shop u on tor.shop_id = u.shop_id
+            left join shop_type gp on gp.id=u.shop_type_id
         WHERE tor.shop_id IS NOT NULL and tor.status = 4
         WHERE tor.shop_id IS NOT NULL and tor.status = 4
-        <if test="query.startTime != null and query.startTime !=''">
-            and tor.pay_time >= #{query.startTime}
-        </if>
-        <if test="query.endTime != null and query.endTime != ''">
-            and tor.pay_time <![CDATA[<=]]> #{query.endTime}
-        </if>
-        <if test="query.shopType != null and query.shopType != '' ">
-            and gp.id = #{query.shopType}
-        </if>
+            <if test="query.startTime != null and query.startTime !=''">
+                and tor.pay_time >= #{query.startTime}
+            </if>
+            <if test="query.endTime != null and query.endTime != ''">
+                and tor.pay_time <![CDATA[<=]]> #{query.endTime}
+            </if>
+            <if test="query.shopType != null and query.shopType != '' ">
+                and gp.id = #{query.shopType}
+            </if>
     </select>
     </select>
 
 
     <select id="excelShopCenter" resultType="com.sqx.modules.order.entity.TbOrder">
     <select id="excelShopCenter" resultType="com.sqx.modules.order.entity.TbOrder">
         SELECT
         SELECT
-        *,
-        @rank_num := @rank_num + 1 AS Rank
-        FROM
-        ( SELECT @rank_num := 0 ) r,
-        ( SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney,ifnull( sum( shop_income_money ), 0 ) AS shopIncomeMoney, tor.shop_id , u.shop_name,gp.id as
-        shopType,gp.shop_type_name as shopTypeName
-        FROM tb_order tor left join goods_shop u on tor.shop_id = u.shop_id
-        left join shop_type gp on gp.id=u.shop_type_id
-        WHERE tor.shop_id IS NOT NULL and tor.status = 4
-        <if test="query.startTime != null and query.startTime !=''">
-            and tor.pay_time >= #{query.startTime}
-        </if>
-        <if test="query.endTime != null and query.endTime != ''">
-            and tor.pay_time <![CDATA[<=]]> #{query.endTime}
-        </if>
-        <if test="query.shopType != null and query.shopType != '' ">
-            and gp.id = #{query.shopType}
-        </if>
-        <if test="query.dateType=='day'">
-            and date_format(tor.pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
-        </if>
-        <if test="query.dateType=='month'">
-            and date_format(tor.pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
-        </if>
-        <if test="query.dateType=='year'">
-            and date_format(tor.pay_time,'%Y')=date_format(#{query.date},'%Y')
-        </if>
-        GROUP BY tor.shop_id ) a
+            a.*,
+            ROW_NUMBER() OVER (ORDER BY a.shopMoney DESC) AS `Rank`
+        FROM (
+            SELECT
+                ifnull(sum(pay_money), 0) AS shopMoney,
+                ifnull(sum(shop_income_money), 0) AS shopIncomeMoney,
+                tor.shop_id,
+                u.shop_name,
+                gp.id as shopType,
+                gp.shop_type_name as shopTypeName
+            FROM tb_order tor
+                LEFT JOIN goods_shop u ON tor.shop_id = u.shop_id
+                LEFT JOIN shop_type gp ON gp.id=u.shop_type_id
+            WHERE tor.shop_id IS NOT NULL and tor.status = 4
+                <if test="query.startTime != null and query.startTime !=''">
+                    and tor.pay_time >= #{query.startTime}
+                </if>
+                <if test="query.endTime != null and query.endTime != ''">
+                    and tor.pay_time <![CDATA[<=]]> #{query.endTime}
+                </if>
+                <if test="query.shopType != null and query.shopType != '' ">
+                    and gp.id = #{query.shopType}
+                </if>
+                <if test="query.dateType=='day'">
+                    and date_format(tor.pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
+                </if>
+                <if test="query.dateType=='month'">
+                    and date_format(tor.pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
+                </if>
+                <if test="query.dateType=='year'">
+                    and date_format(tor.pay_time,'%Y')=date_format(#{query.date},'%Y')
+                </if>
+            GROUP BY tor.shop_id
+        ) a
         ORDER BY shopMoney DESC
         ORDER BY shopMoney DESC
     </select>
     </select>
 
 
@@ -368,7 +400,7 @@
                  left join tb_indent ti on ti.order_id = i.order_id
                  left join tb_indent ti on ti.order_id = i.order_id
                  left join tb_user tu on ti.rider_user_id = tu.user_id
                  left join tb_user tu on ti.rider_user_id = tu.user_id
         where i.user_id = #{userId}
         where i.user_id = #{userId}
-          and i.indent_state in (2, 3, 4, 5, 6, 8, 9, 10)
+          and i.indent_state in ('2', '3', '4', '5', '6', '8', '9', '10')
         order by i.create_time desc
         order by i.create_time desc
     </select>
     </select>
 
 
@@ -376,25 +408,29 @@
         select *
         select *
         from tb_indent
         from tb_indent
         where rider_user_id = #{userId}
         where rider_user_id = #{userId}
-          and indent_state in (3, 4, 5, 6)
+          and indent_state in ('3', '4', '5', '6')
         order by create_time desc
         order by create_time desc
     </select>
     </select>
 
 
     <select id="findTopUpMoney" resultType="com.sqx.modules.pay.entity.PayDetails">
     <select id="findTopUpMoney" resultType="com.sqx.modules.pay.entity.PayDetails">
-        select pd.*, tu.nick_name as nickName from pay_details pd left join tb_user tu on pd.user_id = tu.user_id where
-        1 = 1
-        <if test="userId!=null">
-            and pd.user_id = #{userId}
-        </if>
-        <if test="startTime!=null and startTime!=''and endTime!=null and endTime!='' ">
-            and str_to_date(pd.create_time, '%Y-%m-%d') between str_to_date(#{startTime}, '%Y-%m-%d') AND
-            str_to_date(#{endTime}, '%Y-%m-%d')
-        </if>
+        select
+            pd.*,
+            tu.nick_name as nickName
+        from pay_details pd
+            left join tb_user tu on pd.user_id = tu.user_id
+        <where>
+            <if test="userId!=null">
+                and pd.user_id = #{userId}
+            </if>
+            <if test="startTime!=null and startTime!=''and endTime!=null and endTime!='' ">
+                and pd.create_time between #{startTime} AND #{endTime}
+            </if>
+        </where>
         order by pd.create_time desc
         order by pd.create_time desc
     </select>
     </select>
 
 
     <select id="billMoney" resultType="java.math.BigDecimal">
     <select id="billMoney" resultType="java.math.BigDecimal">
-        select ifnull(sum(indent_money),0) from tb_indent where indent_state in (2, 3, 4, 6)
+        select ifnull(sum(indent_money),0) from tb_indent where indent_state in ('2', '3', '4', '6')
         <if test="dateType=='day'">
         <if test="dateType=='day'">
             and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
             and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
         </if>
         </if>
@@ -407,7 +443,7 @@
     </select>
     </select>
 
 
     <select id="riderMoney" resultType="java.math.BigDecimal">
     <select id="riderMoney" resultType="java.math.BigDecimal">
-        select ifnull(sum(rider_money),0) from tb_indent where indent_state = "6"
+        select ifnull(sum(rider_money),0) from tb_indent where indent_state = '6'
         <if test="dateType=='day'">
         <if test="dateType=='day'">
             and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
             and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
         </if>
         </if>
@@ -420,7 +456,7 @@
     </select>
     </select>
 
 
     <select id="platformMoney" resultType="java.math.BigDecimal">
     <select id="platformMoney" resultType="java.math.BigDecimal">
-        select ifnull(sum(platform_money),0) from tb_indent where indent_state = "6"
+        select ifnull(sum(platform_money),0) from tb_indent where indent_state = '6'
         <if test="dateType=='day'">
         <if test="dateType=='day'">
             and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
             and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
         </if>
         </if>

+ 1 - 1
src/main/resources/mapper/errand/TbIndentMapper.xml

@@ -424,7 +424,7 @@
 
 
     <select id="findAllIndent" resultType="com.sqx.modules.errand.entity.TbIndent">
     <select id="findAllIndent" resultType="com.sqx.modules.errand.entity.TbIndent">
         select i.*, t.nick_name as nickName, t.avatar as avatar , r.red_packet_amount as redPacketAmount,
         select i.*, t.nick_name as nickName, t.avatar as avatar , r.red_packet_amount as redPacketAmount,
-        ru.nick_name as riderNickName, ru.phone as riderPhone,
+        ru.nick_name as riderNickName, ru.phone as riderPhone
         from tb_indent i
         from tb_indent i
         LEFT JOIN tb_user t on i.user_id = t.user_id
         LEFT JOIN tb_user t on i.user_id = t.user_id
         LEFT JOIN tb_user ru on i.rider_user_id = ru.user_id
         LEFT JOIN tb_user ru on i.rider_user_id = ru.user_id

+ 1 - 0
src/main/resources/mapper/errand/UserInfoMapper.xml

@@ -96,6 +96,7 @@
         update tb_user set on_line_flag = #{onLineFlag} where user_id = #{userId}
         update tb_user set on_line_flag = #{onLineFlag} where user_id = #{userId}
     </update>
     </update>
 
 
+    <!-- 废弃 -->
     <select id="rankingList" resultType="com.sqx.modules.errand.entity.TbIndent">
     <select id="rankingList" resultType="com.sqx.modules.errand.entity.TbIndent">
         SELECT
         SELECT
         *,
         *,

+ 19 - 20
src/main/resources/mapper/goods/GoodsMapper.xml

@@ -121,26 +121,25 @@
 
 
 
 
     <select id="selectGoodsBySalesAndGoodsNameAndShopIds" resultType="com.sqx.modules.goods.entity.Goods">
     <select id="selectGoodsBySalesAndGoodsNameAndShopIds" resultType="com.sqx.modules.goods.entity.Goods">
-        SELECT x.*
-        FROM (SELECT g.*,
-        CASE
-        WHEN @shopId != g.shop_id THEN @rownum := 1
-        ELSE @rownum := @rownum + 1
-        END AS rank,
-        @shopId := g.shop_id AS shopId
-        FROM goods g
-        JOIN (SELECT @rownum := NULL, @shopId := '') r
-        where g.status=0
-        <if test="goodsName!=null and goodsName!=''">
-            and g.goods_name like concat('%',#{goodsName},'%')
-        </if>
-        <if test="shopIdList.size()>0">
-            and g.shop_id in
-            <foreach collection="shopIdList" item="id" index="index" open="(" close=")" separator=",">
-                #{id}
-            </foreach>
-        </if>
-        ORDER BY g.shop_id,g.sort asc,g.sales_volume desc) x
+        SELECT
+            x.*
+        FROM (
+            SELECT
+                g.*,
+                ROW_NUMBER() OVER (PARTITION BY g.shop_id ORDER BY g.sort asc, g.sales_volume desc) AS rank
+            FROM
+                goods g
+            WHERE g.status=0
+                <if test="goodsName!=null and goodsName!=''">
+                    and g.goods_name like concat('%',#{goodsName},'%')
+                </if>
+                <if test="shopIdList.size()>0">
+                    and g.shop_id in
+                    <foreach collection="shopIdList" item="id" index="index" open="(" close=")" separator=",">
+                        #{id}
+                    </foreach>
+                </if>
+        ) x
         WHERE x.rank &lt;= 3
         WHERE x.rank &lt;= 3
     </select>
     </select>
 
 

+ 0 - 14
src/main/resources/mapper/job/ScheduleJobDao.xml

@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.sqx.modules.job.dao.ScheduleJobDao">
-
-	<!-- 批量更新状态 -->
-	<update id="updateBatch">
-		update schedule_job set status = #{status} where job_id in
-		<foreach item="jobId" collection="list"  open="(" separator="," close=")">
-			#{jobId}
-		</foreach>
-	</update>
-
-</mapper>

+ 0 - 6
src/main/resources/mapper/job/ScheduleJobLogDao.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.sqx.modules.job.dao.ScheduleJobLogDao">
-
-</mapper>