优化过滤划水贴 sql 语句

优化 sql 语句
This commit is contained in:
ronger 2020-09-25 11:41:59 +08:00 committed by GitHub
commit acaca62070
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 96 additions and 4 deletions

View File

@ -87,8 +87,7 @@
select art.*,su.nickname,su.avatar_url from vertical_article art join vertical_user su on art.article_author_id = su.id select art.*,su.nickname,su.avatar_url from vertical_article art join vertical_user su on art.article_author_id = su.id
where article_status = '0' where article_status = '0'
<if test="topicUri != 'news'"> <if test="topicUri != 'news'">
and not exists (select * from vertical_tag_article vta where vta.id_article = art.id and FIND_IN_SET("划水",art.article_tags) = 0
and exists (select * from vertical_tag vt where vta.id_tag = vt.id and vt.tag_title = '划水'))
</if> </if>
order by updated_time desc order by updated_time desc
</select> </select>
@ -118,7 +117,7 @@
select vta.id, vta.id_tag, vta.id_article, vt.tag_title, vt.tag_icon_path, vt.tag_uri, vt.tag_description from vertical_tag vt join vertical_tag_article vta on vt.id = vta.id_tag where vta.id_article = #{idArticle} select vta.id, vta.id_tag, vta.id_article, vt.tag_title, vt.tag_icon_path, vt.tag_uri, vt.tag_description from vertical_tag vt join vertical_tag_article vta on vt.id = vta.id_tag where vta.id_article = #{idArticle}
</select> </select>
<select id="selectDrafts" resultMap="DTOResultMap"> <select id="selectDrafts" resultMap="DTOResultMap">
select art.*,su.nickname,su.avatar_url from vertical_article art join vertical_user su on art.article_author_id = su.id where article_status = '1' and art.article_author_id = #{idUser} order by updated_time desc select art.*,su.nickname,su.avatar_url from vertical_article asdfasd art join vertical_user su on art.article_author_id = su.id where article_status = '1' and art.article_author_id = #{idUser} order by updated_time desc
</select> </select>
<select id="selectArticlesByIdPortfolio" resultMap="DTOResultMap"> <select id="selectArticlesByIdPortfolio" resultMap="DTOResultMap">
select art.*,su.nickname,su.avatar_url,vpa.sort_no from vertical_article art join vertical_portfolio_article vpa on vpa.id_vertical_article = art.id and vpa.id_vertical_portfolio = #{idPortfolio} select art.*,su.nickname,su.avatar_url,vpa.sort_no from vertical_article art join vertical_portfolio_article vpa on vpa.id_vertical_article = art.id and vpa.id_vertical_portfolio = #{idPortfolio}

View File

@ -0,0 +1,93 @@
publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKRz2GbHzAzGJYAqsHFWwmYaROlXuNZAQdsXMdIaAXPg45bKSVMUwvZyaoTJQY5EOUcrmcmIJkRxODmwtv+cSPkCAwEAAQ==
spring:
thymeleaf:
prefix: classpath:/templates/
suffix: .html
mode: LEGACYHTML5
encoding: UTF-8
servlet:
content-type: text/html
cache: false
redis:
host: 127.0.0.1
port: 6379
password: #
database: 1
timeout: 3000
jedis:
pool:
max-active: 8
max-wait: 1
max-idle: 500
min-idle: 0
datasource:
druid:
url: jdbc:mysql://120.26.175.127:3306/vertical?characterEncoding=UTF-8&autoReconnect=true&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: CPIStU9MEt7EGOdjSZzxbHk1iZvN1xQA+AlIjOx0H0dQj84f0SILF7RolIxXB/FRFtYhDLO4nO3TjA/SY29hcg==
driver-class-name: com.mysql.cj.jdbc.Driver
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
time-between-eviction-runs-millis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
min-evictable-idle-time-millis: 30000
validation-query: SELECT 1 FROM DUAL
test-while-idle: true
test-on-borrow: false
test-on-return: false
log-slow-sql: true
connection-properties: config.decrypt=true;config.decrypt.key=${publickey}
filters: config,stat,wall
max-pool-prepared-statement-per-connection-size: 100
stat-view-servlet:
enabled: true
allow:
login-username: admin
login-password: rymcu.Test1
resources:
add-mappings: true
mail:
host: smtp.163.com
port: 465
username: 123123@163.com
password: 123123
wx:
open:
componentAppId: #
componentSecret: #
componentToken: #
componentAesKey: #
mp:
configs:
- appId: #
secret: #
token: #
aesKey: #
- appId: #
secret: #
token: #
aesKey:
miniapp:
configs:
- appid: #
secret: #
token: #微信小程序消息服务器配置的token
aesKey: #微信小程序消息服务器配置的EncodingAESKey
msgDataFormat: JSON
env: dev
logging:
file:
path: /logs/vertical
server:
port: 8092
servlet:
context-path: /vertical
max-http-header-size: 1048576
version: 1.0
resource:
domain: http://baudi.com
file-path: http://baidu.com/vertical
baidu:
data:
site: https://baidu.com
token: #
reserved-words: \u7cfb\u7edf\u516c\u544a\u002c\u516c\u544a