Merge branch 'sharding' into test

# Conflicts:
#	src/main/java/com/sqx/SqxApplication.java
#	src/main/java/com/sqx/modules/common/controller/app/AppCommonController.java
#	src/main/resources/mapper/course/CourseDao.xml
This commit is contained in:
2024-12-30 16:30:04 +08:00
41 changed files with 669 additions and 1115 deletions

View File

@@ -0,0 +1,61 @@
# 数据源的一些配置
driver-class-name: com.mysql.cj.jdbc.Driver
# 最小空闲连接默认值10小于0或大于maximum-pool-size都会重置为maximum-pool-size
minimum-idle: 5
# 最大连接数小于等于0会被重置为默认值10大于零小于1会被重置为minimum-idle的值
maximum-pool-size: 15
# 空闲连接超时时间默认值60000010分钟大于等于max-lifetime且max-lifetime>0会被重置为0不等于0且小于10秒会被重置为10秒。
idle-timeout: 30000
# 连接最大存活时间.不等于0且小于30秒会被重置为默认值30分钟.设置应该比mysql设置的超时时间短
max-lifetime: 30000
# 连接超时时间:毫秒小于250毫秒否则被重置为默认值30秒
connection-timeout: 30000
spring:
# sharding-jdbc 配置
shardingsphere:
center-tables-data-node: duanju.%s
# 显示sharding-jdbc改写的sql语句
show-sql: false
# 数据源名称
datasource:
# 数据源配置begin
master-0:
# slave-0:
driver-class-name: ${driver-class-name}
jdbc-url: jdbc:mysql://rm-gc712o11yndj78x6a6o.mysql.cn-chengdu.rds.aliyuncs.com/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
username: video_user
password: VideoUser@1
minimum-idle: ${minimum-idle}
maximum-pool-size: ${maximum-pool-size}
idle-timeout: ${idle-timeout}
max-lifetime: ${max-lifetime}
connection-timeout: ${connection-timeout}
slave-0:
# master-0:
driver-class-name: ${driver-class-name}
jdbc-url: jdbc:mysql://47.122.26.160:3306/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
username: root
password: 0fd6497c308ccfa8
minimum-idle: ${minimum-idle}
maximum-pool-size: ${maximum-pool-size}
idle-timeout: ${idle-timeout}
max-lifetime: ${max-lifetime}
connection-timeout: ${connection-timeout}
# 数据源配置end
# 读写分离配置begin
master-slave-rules:
#数据源
duanju:
master-data-source-name: master-0
slave-data-source-names: slave-0
# - master-0
# - slave-0
swagger:
enabled: true
pay:
h5BaseUrl: https://video-h5.hnsiyao.cn/me/detail/detail?allId=
orderNotifyUrl: https://video.hnsiyao.cn/czg/app/wuyou/notify
extractNotifyUrl: https://video.hnsiyao.cn/czg/app/wuyou/extractNotify

View File

@@ -0,0 +1 @@
center-tables=activity,app,banner,cash_out,comment_good,common_info,complet_award,coupon,coupon_user,course,course_classification,course_collect,course_comment,course_details,course_user,disc_spinning,disc_spinning_amount,disc_spinning_record,help_classify,help_word,invite,invite_award,invite_money,message_info,msg,orders,pay_classify,pay_details,qrtz_blob_triggers,qrtz_calendars,qrtz_cron_triggers,qrtz_fired_triggers,qrtz_job_details,qrtz_locks,qrtz_paused_trigger_grps,qrtz_scheduler_state,qrtz_simple_triggers,qrtz_simprop_triggers,qrtz_triggers,schedule_job,schedule_job_log,sdk_info,sdk_type,search,sys_captcha,sys_config,sys_dict,sys_log,sys_menu,sys_oss,sys_role,sys_role_menu,sys_user,sys_user_role,sys_user_token,task_center,task_center_record,task_center_reward,tb_user,uni_ad_callback_record,url_address,user_integral,user_integral_details,user_money,user_money_details,user_prize_exchange,user_sign_record,user_vip,vip_details,invite_achievement

View File

@@ -20,7 +20,7 @@ spring:
allow-bean-definition-overriding: true
# 环境 dev|test|prod
profiles:
active: dev
active: local
# jackson时间格式化
jackson:
time-zone: GMT+8
@@ -45,10 +45,14 @@ spring:
min-idle: 5 # 连接池中的最小空闲连接
mvc:
throw-exception-if-no-handler-found: true
pathmatch:
matching-strategy: ant_path_matcher
# pathmatch:
# matching-strategy: ant_path_matcher
management:
health:
db:
enabled: false #关闭数据库健康检查isV
#mybatis
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml

View File

@@ -168,9 +168,7 @@
(select sum(o.pay_money) from orders o where o.course_id=c.course_id and o.status=1) as payMoney,
(select sum(good_num) from course_details d where d.course_id=c.course_id ) as goodNum,
(select count(*) from course_details d where d.course_id=c.course_id ) as courseDetailsCount,
(select count(*) from course_collect d where d.course_id=c.course_id
and date_format(create_time,'%Y-%m-%d')>=date_format(#{startTime},'%Y-%m-%d') and
date_format(create_time,'%Y-%m-%d')<=date_format(#{endTime},'%Y-%m-%d') ) as weekGoodNum,
0 as weekGoodNum,
(select count(*) from course_details cd where c.course_id=cd.course_id and cd.good=1 ) as isRecommend
FROM
course AS c
@@ -200,7 +198,7 @@
<if test='null!= bannerId and bannerId!=0'>
and c.banner_id = #{bannerId}
</if>
<if test="classifyId==0">
<if test="classifyId!=null and classifyId==0">
and c.is_recommend=1
</if>
<if test="over!=null and over==1">