Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-serivce
/
glsx-insurance-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 20b6c428
authored
Nov 26, 2020
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改搜索接口
1 parent
3aa394ac
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
139 additions
and
80 deletions
app/controller/biz/maintain.js
app/service/biz/collision.js
app/service/biz/devices.js
app/service/biz/fmrsdevice.js
app/service/biz/loss.js
app/service/biz/maintain.js
app/service/biz/merchant.js
app/service/biz/merchantlog.js
app/service/biz/shop.js
app/service/biz/tspdevice.js
app/controller/biz/maintain.js
View file @
20b6c42
/*
/*
* @Author: limin
* @Author: limin
* @Date: 2020-04-15 15:53:03
* @Date: 2020-04-15 15:53:03
* @Last Modified by:
limin
* @Last Modified by:
huyue
* @Last Modified time: 2020-
04-17 10:21:49
* @Last Modified time: 2020-
11-26 14:00:07
*/
*/
"use strict"
;
"use strict"
;
...
...
app/service/biz/collision.js
View file @
20b6c42
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: huyue
* @Author: huyue
* @Date: 2020-11-23 15:51:04
* @Date: 2020-11-23 15:51:04
* @Last Modified by: huyue
* @Last Modified by: huyue
* @Last Modified time: 2020-11-2
5 18:18:38
* @Last Modified time: 2020-11-2
6 15:34:21
*/
*/
const
Service
=
require
(
"egg"
).
Service
;
const
Service
=
require
(
"egg"
).
Service
;
...
@@ -34,6 +34,7 @@ class CollisionService extends Service {
...
@@ -34,6 +34,7 @@ class CollisionService extends Service {
async
findAll
({
pager
=
{},
searcher
=
{}
})
{
async
findAll
({
pager
=
{},
searcher
=
{}
})
{
const
{
current
=
1
,
size
=
10
}
=
pager
;
const
{
current
=
1
,
size
=
10
}
=
pager
;
const
{
const
{
searchKey
,
sn
,
sn
,
standNo
,
standNo
,
collisionTime
,
collisionTime
,
...
@@ -48,10 +49,16 @@ class CollisionService extends Service {
...
@@ -48,10 +49,16 @@ class CollisionService extends Service {
name
:
'standNo'
,
name
:
'standNo'
,
sqlName
:
'stand_no'
sqlName
:
'stand_no'
}]
}]
let
andD
ateArr
=
[{
let
d
ateArr
=
[{
name
:
'collisionTime'
,
name
:
'collisionTime'
,
sqlName
:
'collision_time'
sqlName
:
'collision_time'
}]
}]
if
(
searchKey
)
{
where
[
Op
.
or
]
=
[
{
sn
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
},
{
stand_no
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
}
]
}
likeArr
.
map
(
item
=>
{
likeArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
where
[
item
.
sqlName
]
=
{
...
@@ -59,13 +66,13 @@ class CollisionService extends Service {
...
@@ -59,13 +66,13 @@ class CollisionService extends Service {
}
}
}
}
})
})
andD
ateArr
.
map
(
item
=>
{
d
ateArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
where
[
item
.
sqlName
]
=
{
[
Op
.
and
]:
[{
[
Op
.
and
]:
[{
[
Op
.
gt
]:
searcher
[
item
.
name
]
[
Op
.
gt
]:
searcher
[
item
.
name
]
[
0
]
},
{
},
{
[
Op
.
lt
]:
new
Date
(
new
Date
(
searcher
[
item
.
name
]).
getTime
()
+
24
*
60
*
60
*
1000
).
toLocaleDateString
()
[
Op
.
lt
]:
searcher
[
item
.
name
][
1
]
}]
}]
}
}
}
}
...
...
app/service/biz/devices.js
View file @
20b6c42
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: chenwq
* @Author: chenwq
* @Date: 2020-06-16 10:02:39
* @Date: 2020-06-16 10:02:39
* @Last Modified by: huyue
* @Last Modified by: huyue
* @Last Modified time: 2020-11-2
5 16:01:28
* @Last Modified time: 2020-11-2
6 15:58:26
* 设备信息
* 设备信息
*/
*/
...
@@ -44,6 +44,7 @@ class DevicesService extends Service {
...
@@ -44,6 +44,7 @@ class DevicesService extends Service {
current
=
1
,
size
=
100
current
=
1
,
size
=
100
}
=
pager
}
=
pager
const
{
const
{
searchKey
,
deviceSn
,
deviceSn
,
simNo
,
simNo
,
deviceType
,
deviceType
,
...
@@ -60,15 +61,30 @@ class DevicesService extends Service {
...
@@ -60,15 +61,30 @@ class DevicesService extends Service {
let
likeArr
=
[{
let
likeArr
=
[{
name
:
'deviceSn'
,
name
:
'deviceSn'
,
sqlName
:
'device_sn'
sqlName
:
'device_sn'
},
{
name
:
'simNo'
,
sqlName
:
'sim_no'
}]
}]
let
andDateArr
=
[{
let
dateArr
=
[{
name
:
'activeTime'
,
sqlName
:
'active_time'
},
{
name
:
'effectDate'
,
sqlName
:
'effect_date'
},
{
name
:
'activeTime'
,
name
:
'activeTime'
,
sqlName
:
'active_time'
sqlName
:
'active_time'
}]
}]
let
equalArr
=
[{
let
equalArr
=
[{
name
:
'
deviceTyp
e'
,
name
:
'
endDat
e'
,
sqlName
:
'
device_typ
e'
sqlName
:
'
end_dat
e'
}]
}]
if
(
searchKey
)
{
where
[
Op
.
or
]
=
[
{
device_sn
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
},
{
sim_no
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
}
]
}
likeArr
.
map
(
item
=>
{
likeArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
where
[
item
.
sqlName
]
=
{
...
@@ -76,13 +92,13 @@ class DevicesService extends Service {
...
@@ -76,13 +92,13 @@ class DevicesService extends Service {
}
}
}
}
})
})
andD
ateArr
.
map
(
item
=>
{
d
ateArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
where
[
item
.
sqlName
]
=
{
[
Op
.
and
]:
[{
[
Op
.
and
]:
[{
[
Op
.
gt
]:
searcher
[
item
.
name
]
[
Op
.
gt
]:
searcher
[
item
.
name
]
[
0
]
//
}, {
},
{
// [Op.lt]: new Date(new Date(searcher[item.name]).getTime() + 24 * 60 * 60 * 1000).toLocaleDateString()
[
Op
.
lt
]:
searcher
[
item
.
name
][
1
]
}]
}]
}
}
}
}
...
@@ -92,15 +108,6 @@ class DevicesService extends Service {
...
@@ -92,15 +108,6 @@ class DevicesService extends Service {
where
[
item
.
sqlName
]
=
searcher
[
item
.
name
]
where
[
item
.
sqlName
]
=
searcher
[
item
.
name
]
}
}
})
})
if
(
effectDate
)
{
where
.
effect_date
=
{
[
Op
.
and
]:
[{
[
Op
.
gte
]:
searcher
.
effectDate
},
{
[
Op
.
lte
]:
searcher
.
endDate
}]
};
}
let
date
=
await
this
.
MDDI
.
findAndCountAll
({
let
date
=
await
this
.
MDDI
.
findAndCountAll
({
// attributes: {
// attributes: {
// include: [
// include: [
...
...
app/service/biz/fmrsdevice.js
View file @
20b6c42
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: huyue
* @Author: huyue
* @Date: 2020-11-23 16:45:21
* @Date: 2020-11-23 16:45:21
* @Last Modified by: huyue
* @Last Modified by: huyue
* @Last Modified time: 2020-11-2
5 19:16:55
* @Last Modified time: 2020-11-2
6 16:06:24
*/
*/
const
Service
=
require
(
"egg"
).
Service
;
const
Service
=
require
(
"egg"
).
Service
;
...
@@ -34,6 +34,7 @@ class FmrsdeviceService extends Service {
...
@@ -34,6 +34,7 @@ class FmrsdeviceService extends Service {
async
findAll
({
pager
=
{},
searcher
=
{}
})
{
async
findAll
({
pager
=
{},
searcher
=
{}
})
{
const
{
current
=
1
,
size
=
10
}
=
pager
;
const
{
current
=
1
,
size
=
10
}
=
pager
;
const
{
const
{
searchKey
,
sn
,
sn
,
iccid
,
iccid
,
deviceType
,
deviceType
,
...
@@ -49,16 +50,28 @@ class FmrsdeviceService extends Service {
...
@@ -49,16 +50,28 @@ class FmrsdeviceService extends Service {
sqlName
:
'sn'
sqlName
:
'sn'
},
{
},
{
name
:
'iccid'
,
name
:
'iccid'
,
sqlName
:
'
siccidimno
'
sqlName
:
'
iccid
'
}]
}]
let
andDateArr
=
[{
let
andDateArr
=
[{
name
:
'activeTime'
,
name
:
'activeTime'
,
sqlName
:
'active_time'
sqlName
:
'active_time'
},
{
name
:
'pkBeginTime'
,
sqlName
:
'pk_begin_time'
},
{
name
:
'pkEndTime'
,
sqlName
:
'pk_end_time'
}]
}]
let
equalArr
=
[{
let
equalArr
=
[{
name
:
'deviceType'
,
name
:
'deviceType'
,
sqlName
:
'device_type'
sqlName
:
'device_type'
}]
}]
if
(
searchKey
)
{
where
[
Op
.
or
]
=
[
{
sn
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
},
{
iccid
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
}
]
}
likeArr
.
map
(
item
=>
{
likeArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
where
[
item
.
sqlName
]
=
{
...
@@ -70,9 +83,9 @@ class FmrsdeviceService extends Service {
...
@@ -70,9 +83,9 @@ class FmrsdeviceService extends Service {
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
where
[
item
.
sqlName
]
=
{
[
Op
.
and
]:
[{
[
Op
.
and
]:
[{
[
Op
.
gt
]:
searcher
[
item
.
name
]
[
Op
.
gt
]:
searcher
[
item
.
name
]
[
0
]
//
}, {
},
{
// [Op.lt]: new Date(new Date(searcher[item.name]).getTime() + 24 * 60 * 60 * 1000).toLocaleDateString()
[
Op
.
lt
]:
searcher
[
item
.
name
][
1
]
}]
}]
}
}
}
}
...
@@ -82,15 +95,6 @@ class FmrsdeviceService extends Service {
...
@@ -82,15 +95,6 @@ class FmrsdeviceService extends Service {
where
[
item
.
sqlName
]
=
searcher
[
item
.
name
]
where
[
item
.
sqlName
]
=
searcher
[
item
.
name
]
}
}
})
})
if
(
pkBeginTime
)
{
where
.
pk_begin_time
=
{
[
Op
.
and
]:
[{
[
Op
.
gte
]:
searcher
.
pkBeginTime
},
{
[
Op
.
lte
]:
searcher
.
pkEndTime
}]
};
}
return
await
this
.
MFDI
.
findAndCountAll
({
return
await
this
.
MFDI
.
findAndCountAll
({
offset
,
offset
,
attributes
:
{
attributes
:
{
...
...
app/service/biz/loss.js
View file @
20b6c42
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: limin
* @Author: limin
* @Date: 2019-11-21 11:18:37
* @Date: 2019-11-21 11:18:37
* @Last Modified by: huyue
* @Last Modified by: huyue
* @Last Modified time: 2020-11-2
5 17:30:43
* @Last Modified time: 2020-11-2
6 16:14:40
*/
*/
const
Service
=
require
(
"egg"
).
Service
;
const
Service
=
require
(
"egg"
).
Service
;
...
@@ -35,6 +35,7 @@ class LossService extends Service {
...
@@ -35,6 +35,7 @@ class LossService extends Service {
async
findAll
({
pager
=
{},
searcher
=
{}
})
{
async
findAll
({
pager
=
{},
searcher
=
{}
})
{
const
{
current
=
1
,
size
=
10
}
=
pager
;
const
{
current
=
1
,
size
=
10
}
=
pager
;
const
{
const
{
searchKey
,
sn
,
sn
,
standNo
,
standNo
,
merchantName
,
merchantName
,
...
@@ -58,6 +59,12 @@ class LossService extends Service {
...
@@ -58,6 +59,12 @@ class LossService extends Service {
name
:
'merchantType'
,
name
:
'merchantType'
,
sqlName
:
'merchant_type'
sqlName
:
'merchant_type'
}]
}]
if
(
searchKey
)
{
where
[
Op
.
or
]
=
[
{
sn
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
},
{
stand_no
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
}
]
}
likeArr
.
map
(
item
=>
{
likeArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
where
[
item
.
sqlName
]
=
{
...
...
app/service/biz/maintain.js
View file @
20b6c42
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: limin
* @Author: limin
* @Date: 2019-11-21 11:18:37
* @Date: 2019-11-21 11:18:37
* @Last Modified by: huyue
* @Last Modified by: huyue
* @Last Modified time: 2020-11-2
5 17:30:22
* @Last Modified time: 2020-11-2
6 14:22:28
*/
*/
const
Service
=
require
(
"egg"
).
Service
;
const
Service
=
require
(
"egg"
).
Service
;
...
@@ -42,6 +42,7 @@ class MaintainService extends Service {
...
@@ -42,6 +42,7 @@ class MaintainService extends Service {
current
=
1
,
size
=
10
current
=
1
,
size
=
10
}
=
pager
;
}
=
pager
;
const
{
const
{
searchKey
,
sn
,
sn
,
standNo
,
standNo
,
remindType
,
remindType
,
...
@@ -69,19 +70,25 @@ class MaintainService extends Service {
...
@@ -69,19 +70,25 @@ class MaintainService extends Service {
},
{
},
{
name
:
'isNew'
,
name
:
'isNew'
,
sqlName
:
'is_new'
sqlName
:
'is_new'
}]
}]
likeArr
.
map
(
item
=>
{
if
(
searchKey
)
{
if
(
searcher
[
item
.
name
])
{
where
[
Op
.
or
]
=
[
where
[
item
.
sqlName
]
=
{
{
sn
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
},
[
Op
.
like
]:
`%
${
searcher
[
item
.
name
]}
%`
{
stand_no
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
}
]
}
likeArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
[
Op
.
like
]:
`%
${
searcher
[
item
.
name
]}
%`
}
}
}
}
})
})
equalArr
.
map
(
item
=>
{
equalArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
searcher
[
item
.
name
]
where
[
item
.
sqlName
]
=
searcher
[
item
.
name
]
}
}
})
})
return
await
this
.
MDCM
.
findAndCountAll
({
return
await
this
.
MDCM
.
findAndCountAll
({
offset
,
offset
,
limit
:
+
size
,
limit
:
+
size
,
...
...
app/service/biz/merchant.js
View file @
20b6c42
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: chenwq
* @Author: chenwq
* @Date: 2020-06-12 15:19:31
* @Date: 2020-06-12 15:19:31
* @Last Modified by: huyue
* @Last Modified by: huyue
* @Last Modified time: 2020-11-2
5 18:35:3
4
* @Last Modified time: 2020-11-2
6 16:18:4
4
*/
*/
const
Service
=
require
(
"egg"
).
Service
;
const
Service
=
require
(
"egg"
).
Service
;
...
@@ -40,6 +40,7 @@ class MerchantService extends Service {
...
@@ -40,6 +40,7 @@ class MerchantService extends Service {
current
=
1
,
size
=
10
current
=
1
,
size
=
10
}
=
pager
}
=
pager
const
{
const
{
searchKey
,
merchantId
,
merchantId
,
merchantName
,
merchantName
,
}
=
searcher
;
}
=
searcher
;
...
@@ -59,7 +60,14 @@ class MerchantService extends Service {
...
@@ -59,7 +60,14 @@ class MerchantService extends Service {
name
:
'merchantName'
,
name
:
'merchantName'
,
sqlName
:
'merchant_name'
,
sqlName
:
'merchant_name'
,
sqlOtherName
:
'short_name'
sqlOtherName
:
'short_name'
}]
}]
if
(
searchKey
)
{
where
[
Op
.
or
]
=
[
{
merchant_id
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
},
{
account_name
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
},
{
merchant_name
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
}
]
}
likeArr
.
map
(
item
=>
{
likeArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
||
item
.
sqlOtherName
]
=
{
[
Op
.
like
]:
`%
${
searcher
[
item
.
name
]}
%`
}
where
[
item
.
sqlName
||
item
.
sqlOtherName
]
=
{
[
Op
.
like
]:
`%
${
searcher
[
item
.
name
]}
%`
}
...
...
app/service/biz/merchantlog.js
View file @
20b6c42
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: huyue
* @Author: huyue
* @Date: 2020-11-23 16:29:59
* @Date: 2020-11-23 16:29:59
* @Last Modified by: huyue
* @Last Modified by: huyue
* @Last Modified time: 2020-11-2
5 18:44:01
* @Last Modified time: 2020-11-2
6 16:15:36
*/
*/
...
@@ -35,6 +35,7 @@ class MerchantlogService extends Service {
...
@@ -35,6 +35,7 @@ class MerchantlogService extends Service {
async
findAll
({
pager
=
{},
searcher
=
{}
})
{
async
findAll
({
pager
=
{},
searcher
=
{}
})
{
const
{
current
=
1
,
size
=
10
}
=
pager
;
const
{
current
=
1
,
size
=
10
}
=
pager
;
const
{
const
{
searchKey
,
merchantId
,
merchantId
,
accountName
,
accountName
,
merchantName
merchantName
...
@@ -51,7 +52,14 @@ class MerchantlogService extends Service {
...
@@ -51,7 +52,14 @@ class MerchantlogService extends Service {
},
{
},
{
name
:
'merchantName'
,
name
:
'merchantName'
,
sqlName
:
'merchant_name'
sqlName
:
'merchant_name'
}]
}]
if
(
searchKey
)
{
where
[
Op
.
or
]
=
[
{
merchant_id
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
},
{
login_name
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
},
{
merchant_name
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
}
]
}
likeArr
.
map
(
item
=>
{
likeArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
[
Op
.
like
]:
`%
${
searcher
[
item
.
name
]}
%`
}
where
[
item
.
sqlName
]
=
{
[
Op
.
like
]:
`%
${
searcher
[
item
.
name
]}
%`
}
...
...
app/service/biz/shop.js
View file @
20b6c42
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: limin
* @Author: limin
* @Date: 2019-11-21 11:18:37
* @Date: 2019-11-21 11:18:37
* @Last Modified by: huyue
* @Last Modified by: huyue
* @Last Modified time: 2020-11-2
5 18:18:31
* @Last Modified time: 2020-11-2
6 15:50:28
*/
*/
const
Service
=
require
(
"egg"
).
Service
;
const
Service
=
require
(
"egg"
).
Service
;
...
@@ -42,10 +42,11 @@ class ShopService extends Service {
...
@@ -42,10 +42,11 @@ class ShopService extends Service {
current
=
1
,
size
=
10
current
=
1
,
size
=
10
}
=
pager
;
}
=
pager
;
const
{
const
{
searchKey
,
sn
,
sn
,
standNo
,
standNo
,
merchantName
,
merchantName
,
enterTime
,
enterTime
}
=
searcher
;
}
=
searcher
;
const
offset
=
(
current
-
1
)
*
size
;
const
offset
=
(
current
-
1
)
*
size
;
const
{
const
{
...
@@ -63,10 +64,16 @@ class ShopService extends Service {
...
@@ -63,10 +64,16 @@ class ShopService extends Service {
name
:
'merchantName'
,
name
:
'merchantName'
,
sqlName
:
'merchant_name'
sqlName
:
'merchant_name'
}]
}]
let
andD
ateArr
=
[{
let
d
ateArr
=
[{
name
:
'enterTime'
,
name
:
'enterTime'
,
sqlName
:
'enter_time'
sqlName
:
'enter_time'
}]
}]
if
(
searchKey
)
{
where
[
Op
.
or
]
=
[
{
sn
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
},
{
stand_no
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
}
]
}
likeArr
.
map
(
item
=>
{
likeArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
where
[
item
.
sqlName
]
=
{
...
@@ -74,13 +81,13 @@ class ShopService extends Service {
...
@@ -74,13 +81,13 @@ class ShopService extends Service {
}
}
}
}
})
})
andD
ateArr
.
map
(
item
=>
{
d
ateArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
where
[
item
.
sqlName
]
=
{
[
Op
.
and
]:
[{
[
Op
.
and
]:
[{
[
Op
.
gt
]:
searcher
[
item
.
name
]
[
Op
.
gt
]:
searcher
[
item
.
name
]
[
0
]
},
{
},
{
[
Op
.
lt
]:
new
Date
(
new
Date
(
searcher
[
item
.
name
]).
getTime
()
+
24
*
60
*
60
*
1000
).
toLocaleDateString
()
[
Op
.
lt
]:
searcher
[
item
.
name
][
1
]
}]
}]
}
}
}
}
...
...
app/service/biz/tspdevice.js
View file @
20b6c42
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: huyue
* @Author: huyue
* @Date: 2020-11-23 16:43:15
* @Date: 2020-11-23 16:43:15
* @Last Modified by: huyue
* @Last Modified by: huyue
* @Last Modified time: 2020-11-2
5 19:16:26
* @Last Modified time: 2020-11-2
6 16:06:33
*/
*/
const
Service
=
require
(
"egg"
).
Service
;
const
Service
=
require
(
"egg"
).
Service
;
...
@@ -34,6 +34,7 @@ class TspdeviceService extends Service {
...
@@ -34,6 +34,7 @@ class TspdeviceService extends Service {
async
findAll
({
pager
=
{},
searcher
=
{}
})
{
async
findAll
({
pager
=
{},
searcher
=
{}
})
{
const
{
current
=
1
,
size
=
10
}
=
pager
;
const
{
current
=
1
,
size
=
10
}
=
pager
;
const
{
const
{
searchKey
,
sn
,
sn
,
simno
,
simno
,
deviceType
,
deviceType
,
...
@@ -51,14 +52,26 @@ class TspdeviceService extends Service {
...
@@ -51,14 +52,26 @@ class TspdeviceService extends Service {
name
:
'simno'
,
name
:
'simno'
,
sqlName
:
'simno'
sqlName
:
'simno'
}]
}]
let
andD
ateArr
=
[{
let
d
ateArr
=
[{
name
:
'activeTime'
,
name
:
'activeTime'
,
sqlName
:
'active_time'
sqlName
:
'active_time'
},
{
name
:
'pkBeginTime'
,
sqlName
:
'pk_begin_time'
},
{
name
:
'pkEndTime'
,
sqlName
:
'pk_end_time'
}]
}]
let
equalArr
=
[{
let
equalArr
=
[{
name
:
'deviceType'
,
name
:
'deviceType'
,
sqlName
:
'device_type'
sqlName
:
'device_type'
}]
}]
if
(
searchKey
)
{
where
[
Op
.
or
]
=
[
{
sn
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
},
{
simno
:
{[
Op
.
like
]:
`%
${
searchKey
}
%`
}
}
]
}
likeArr
.
map
(
item
=>
{
likeArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
where
[
item
.
sqlName
]
=
{
...
@@ -66,13 +79,13 @@ class TspdeviceService extends Service {
...
@@ -66,13 +79,13 @@ class TspdeviceService extends Service {
}
}
}
}
})
})
andD
ateArr
.
map
(
item
=>
{
d
ateArr
.
map
(
item
=>
{
if
(
searcher
[
item
.
name
])
{
if
(
searcher
[
item
.
name
])
{
where
[
item
.
sqlName
]
=
{
where
[
item
.
sqlName
]
=
{
[
Op
.
and
]:
[{
[
Op
.
and
]:
[{
[
Op
.
gt
]:
searcher
[
item
.
name
]
[
Op
.
gt
]:
searcher
[
item
.
name
]
[
0
]
//
}, {
},
{
// [Op.lt]: new Date(new Date(searcher[item.name]).getTime() + 24 * 60 * 60 * 1000).toLocaleDateString()
[
Op
.
lt
]:
searcher
[
item
.
name
][
1
]
}]
}]
}
}
}
}
...
@@ -82,15 +95,6 @@ class TspdeviceService extends Service {
...
@@ -82,15 +95,6 @@ class TspdeviceService extends Service {
where
[
item
.
sqlName
]
=
searcher
[
item
.
name
]
where
[
item
.
sqlName
]
=
searcher
[
item
.
name
]
}
}
})
})
if
(
pkBeginTime
)
{
where
.
pk_begin_time
=
{
[
Op
.
and
]:
[{
[
Op
.
gte
]:
searcher
.
pkBeginTime
},
{
[
Op
.
lte
]:
searcher
.
pkEndTime
}]
};
}
return
await
this
.
MTDI
.
findAndCountAll
({
return
await
this
.
MTDI
.
findAndCountAll
({
offset
,
offset
,
attributes
:
{
attributes
:
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment