Complete core functions #9
@@ -79,7 +79,7 @@ class SecurityConfig(
|
|||||||
"/forget",
|
"/forget",
|
||||||
"/retrieve"
|
"/retrieve"
|
||||||
).anonymous()
|
).anonymous()
|
||||||
.requestMatchers("/tool/detail/**").permitAll()
|
.requestMatchers("/tool/detail/**", "/tool/store").permitAll()
|
||||||
// Authentication required
|
// Authentication required
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ class EditServiceImpl(
|
|||||||
if (tool.review == Tool.ReviewType.PROCESSING) {
|
if (tool.review == Tool.ReviewType.PROCESSING) {
|
||||||
throw ToolUnderReviewException()
|
throw ToolUnderReviewException()
|
||||||
}
|
}
|
||||||
if (tool.review == Tool.ReviewType.PASS || tool.publish != 0L) {
|
if (tool.review == Tool.ReviewType.PASS && tool.publish != 0L) {
|
||||||
throw ToolHasBeenPublishedException()
|
throw ToolHasBeenPublishedException()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ class EditServiceImpl(
|
|||||||
|
|
||||||
override fun cancel(id: Long): Boolean {
|
override fun cancel(id: Long): Boolean {
|
||||||
val tool = getById(id)
|
val tool = getById(id)
|
||||||
if (tool.review == Tool.ReviewType.PASS || tool.publish != 0L) {
|
if (tool.review == Tool.ReviewType.PASS && tool.publish != 0L) {
|
||||||
throw ToolHasBeenPublishedException()
|
throw ToolHasBeenPublishedException()
|
||||||
}
|
}
|
||||||
if (tool.review != Tool.ReviewType.PROCESSING) {
|
if (tool.review != Tool.ReviewType.PROCESSING) {
|
||||||
|
|||||||
@@ -111,7 +111,6 @@ class ManagementServiceImpl(
|
|||||||
KtUpdateWrapper(Tool())
|
KtUpdateWrapper(Tool())
|
||||||
.eq(Tool::id, id)
|
.eq(Tool::id, id)
|
||||||
.set(Tool::review, Tool.ReviewType.REJECT)
|
.set(Tool::review, Tool.ReviewType.REJECT)
|
||||||
.set(Tool::publish, 0)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return this.getOne(id)
|
return this.getOne(id)
|
||||||
|
|||||||
@@ -2,31 +2,40 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="top.fatweb.oxygen.api.mapper.tool.StoreMapper">
|
<mapper namespace="top.fatweb.oxygen.api.mapper.tool.StoreMapper">
|
||||||
<select id="selectPage" resultType="long">
|
<select id="selectPage" resultType="long">
|
||||||
select distinct t_b_tool_main.id
|
select distinct tb.id from
|
||||||
from t_b_tool_main
|
(
|
||||||
left join json_table(t_b_tool_main.keywords, '$[*]' columns (keyword varchar(50) path '$')) as tk on true
|
select tbtm.id
|
||||||
|
from (select temp.*
|
||||||
|
from (select *,
|
||||||
|
row_number() over (partition by t_b_tool_main.tool_id, t_b_tool_main.author_id order by t_b_tool_main.id desc)
|
||||||
|
as rn
|
||||||
|
from t_b_tool_main where deleted = 0) temp
|
||||||
|
where temp.rn = 1) as tbtm
|
||||||
|
left join json_table(json_extract(tbtm.keywords, '$[*]'), '$[*]' columns (keyword varchar(50) path '$')) as tk
|
||||||
|
on true
|
||||||
<where>
|
<where>
|
||||||
and t_b_tool_main.deleted = 0 and t_b_tool_main.publish != 0
|
and tbtm.publish != 0 and tbtm.review = 'PASS'
|
||||||
<if test="searchValue != null">
|
<if test="searchValue != null">
|
||||||
and (
|
and (
|
||||||
t_b_tool_main.name like concat('%', #{searchValue}, '%')
|
tbtm.name like concat('%', #{searchValue}, '%')
|
||||||
or tk.keyword like concat('%', #{searchValue}, '%')
|
or tk.keyword like concat('%', #{searchValue}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
<choose>
|
<choose>
|
||||||
<when test="searchValue != null">
|
<when test="searchValue != null">
|
||||||
order by instr(t_b_tool_main.name, #{searchValue}) = 0,
|
order by instr(tbtm.name, #{searchValue}) = 0,
|
||||||
char_length(t_b_tool_main.name),
|
char_length(tbtm.name),
|
||||||
instr(t_b_tool_main.name, #{searchValue}),
|
instr(tbtm.name, #{searchValue}),
|
||||||
instr(tk.keyword, #{searchValue}) = 0,
|
instr(tk.keyword, #{searchValue}) = 0,
|
||||||
char_length(tk.keyword),
|
char_length(tk.keyword),
|
||||||
instr(tk.keyword, #{searchValue})
|
instr(tk.keyword, #{searchValue})
|
||||||
</when>
|
</when>
|
||||||
<otherwise>
|
<otherwise>
|
||||||
order by t_b_tool_main.publish desc
|
order by tbtm.publish desc
|
||||||
</otherwise>
|
</otherwise>
|
||||||
</choose>
|
</choose>
|
||||||
|
) as tb
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectListByIds" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolWithAuthor">
|
<select id="selectListByIds" resultMap="top.fatweb.oxygen.api.mapper.tool.ManagementMapper.toolWithAuthor">
|
||||||
|
|||||||
Reference in New Issue
Block a user