Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
07bc4878
authored
Aug 08, 2024
by
Calcium-Ion
Committed by
GitHub
Aug 08, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #415 from dalefengs/fix_group
fix: 渠道多分组,优化分组 like 查询
parents
5c1a127b
3dd248c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
model/channel.go
+9
-3
web/src/components/ChannelsTable.js
+2
-1
No files found.
model/channel.go
View file @
07bc4878
...
@@ -106,9 +106,15 @@ func SearchChannels(keyword string, group string, model string) ([]*Channel, err
...
@@ -106,9 +106,15 @@ func SearchChannels(keyword string, group string, model string) ([]*Channel, err
// 构造WHERE子句
// 构造WHERE子句
var
whereClause
string
var
whereClause
string
var
args
[]
interface
{}
var
args
[]
interface
{}
if
group
!=
""
{
if
group
!=
""
&&
group
!=
"null"
{
whereClause
=
"(id = ? OR name LIKE ? OR "
+
keyCol
+
" = ?) AND "
+
groupCol
+
" = ? AND "
+
modelsCol
+
" LIKE ?"
var
groupCondition
string
args
=
append
(
args
,
common
.
String2Int
(
keyword
),
"%"
+
keyword
+
"%"
,
keyword
,
group
,
"%"
+
model
+
"%"
)
if
common
.
UsingPostgreSQL
{
groupCondition
=
`(',' || `
+
groupCol
+
` || ',') LIKE ?`
}
else
{
groupCondition
=
`CONCAT(',', `
+
groupCol
+
`, ',') LIKE ?`
}
whereClause
=
"(id = ? OR name LIKE ? OR "
+
keyCol
+
" = ?) AND "
+
modelsCol
+
` LIKE ? AND `
+
groupCondition
args
=
append
(
args
,
common
.
String2Int
(
keyword
),
"%"
+
keyword
+
"%"
,
keyword
,
"%"
+
model
+
"%"
,
"%,"
+
group
+
",%"
)
}
else
{
}
else
{
whereClause
=
"(id = ? OR name LIKE ? OR "
+
keyCol
+
" = ?) AND "
+
modelsCol
+
" LIKE ?"
whereClause
=
"(id = ? OR name LIKE ? OR "
+
keyCol
+
" = ?) AND "
+
modelsCol
+
" LIKE ?"
args
=
append
(
args
,
common
.
String2Int
(
keyword
),
"%"
+
keyword
+
"%"
,
keyword
,
"%"
+
model
+
"%"
)
args
=
append
(
args
,
common
.
String2Int
(
keyword
),
"%"
+
keyword
+
"%"
,
keyword
,
"%"
+
model
+
"%"
)
...
...
web/src/components/ChannelsTable.js
View file @
07bc4878
...
@@ -745,7 +745,8 @@ const ChannelsTable = () => {
...
@@ -745,7 +745,8 @@ const ChannelsTable = () => {
<
Form
.
Select
<
Form
.
Select
field
=
'group'
field
=
'group'
label
=
'分组'
label
=
'分组'
optionList
=
{
groupOptions
}
optionList
=
{[{
label
:
'选择分组'
,
value
:
null
},
...
groupOptions
]}
initValue
=
{
null
}
onChange
=
{(
v
)
=>
{
onChange
=
{(
v
)
=>
{
setSearchGroup
(
v
);
setSearchGroup
(
v
);
searchChannels
(
searchKeyword
,
v
,
searchModel
);
searchChannels
(
searchKeyword
,
v
,
searchModel
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment