From 8a0a8adfbe53db564df7aaaf561a60be7d4d8dd0 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 26 九月 2024 17:52:24 +0800
Subject: [PATCH] 1. 新增监管系统中用户模糊搜索功能 2. 新增监测设备和用户的匹配关系搜索功能
---
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt | 34 ++++++
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ScenseMapper.kt | 2
src/main/resources/application-test.yml | 4
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/UserinfoMapper.kt | 5 +
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DeviceService.kt | 9 +
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt | 19 +++
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt | 10 +
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt | 2
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt | 12 ++
src/main/resources/mapper/ds1/UserinfoMapper.xml | 87 +++++++++++++++++
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt | 10 ++
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt | 45 ++++++--
src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt | 13 ++
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt | 4
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt | 14 ++
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DeviceServiceImpl.kt | 9 +
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt | 2
17 files changed, 263 insertions(+), 18 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
index 830d9ed..0e08474 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
@@ -7,7 +7,18 @@
ADMIN(0, "绠$悊鍛�"),
INSIDER(1, "鍐呴儴浜哄憳"),
GOV(2, "鏀垮簻閮ㄩ棬"),
- ENTERPRISE(3, "浼佷笟")
+ ENTERPRISE(3, "浼佷笟");
+
+ companion object {
+ fun fromValue(value: Int?) = when (value) {
+ -1 -> ALL_USER
+ 0 -> ADMIN
+ 1 -> INSIDER
+ 2 -> GOV
+ 3 -> ENTERPRISE
+ else -> ALL_USER
+ }
+ }
}
//瑙勮寖绫诲埆
enum class RuleType(val value: Byte, val text: String){
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ScenseMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ScenseMapper.kt
index a576989..45d7742 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ScenseMapper.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/ScenseMapper.kt
@@ -6,7 +6,7 @@
import org.apache.ibatis.annotations.Select
@Mapper
-interface ScenseMapper:MyMapper<Scense>, MutableList<Scense> {
+interface ScenseMapper : MyMapper<Scense> {
/**
* 鑾峰彇鏈垱寤虹敤鎴风殑鍦烘櫙
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/UserinfoMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/UserinfoMapper.kt
index 00bd0a8..3141df8 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/UserinfoMapper.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/UserinfoMapper.kt
@@ -2,9 +2,14 @@
import cn.flightfeather.supervision.domain.ds1.entity.Userinfo
import cn.flightfeather.supervision.domain.util.MyMapper
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
import org.apache.ibatis.annotations.Mapper
@Mapper
interface UserinfoMapper:MyMapper<Userinfo> {
+ /**
+ * 鐢ㄦ埛妯$硦鎼滅储
+ */
+ fun searchUser(areaVo: AreaVo, keyword: String, userTypeId: Int): List<Userinfo?>
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt
index 7db939a..56e16a5 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/SceneRep.kt
@@ -38,6 +38,10 @@
})
}
+ fun findSceneList(scene: Scense): List<Scense?> {
+ return scenseMapper.select(scene)
+ }
+
fun findSceneList(nameList: List<String?>): List<Scense?> {
return scenseMapper.selectByExample(Example(Scense::class.java).apply {
createCriteria().andIn("name", nameList)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt
index d3bc67d..a2fac40 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/UserInfoSVRep.kt
@@ -1,8 +1,10 @@
package cn.flightfeather.supervision.domain.ds1.repository
+import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.entity.Userinfo
import cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
import org.springframework.stereotype.Repository
import tk.mybatis.mapper.entity.Example
@@ -12,6 +14,7 @@
@Repository
class UserInfoSVRep(
private val userinfoMapper: UserinfoMapper,
+ private val sceneRep: SceneRep,
) {
/**
@@ -31,4 +34,35 @@
null
}
}
+
+ /**
+ * 妯$硦鎼滅储鐢ㄦ埛
+ * @param areaVo 鏌ヨ鍖哄煙鑼冨洿
+ * @param keyword 鎼滅储鍏抽敭瀛楋紝鍖归厤璐︽埛[Userinfo.acountname]鍜屾樀绉癧Userinfo.realname]
+ * @param userType 鐢ㄦ埛绫诲瀷锛岄粯璁や紒涓歔Constant.UserType.ENTERPRISE]
+ */
+ fun searchUser(
+ areaVo: AreaVo, keyword: String,
+ userType: Constant.UserType = Constant.UserType.ENTERPRISE,
+ ): List<Userinfo?> {
+ return userinfoMapper.searchUser(areaVo, keyword, userType.value)
+// val userList = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
+// createCriteria().orLike("realname", "%${keyword}%")
+// .orLike("acountname", "%${keyword}%")
+// })
+// val sceneList = sceneRep.findSceneList(Scense().apply {
+// provincecode = areaVo.provincecode
+// citycode = areaVo.citycode
+// districtcode = areaVo.districtcode
+// towncode = areaVo.towncode
+// typeid = areaVo.scensetypeid?.toByteOrNull()
+// extension1 = if (areaVo.online == true) "1" else "0"
+// })
+// return userList.filter { u ->
+// val scene = sceneList.find { s ->
+// return@find s?.guid == u.dGuid
+// }
+// return@filter scene != null
+// }
+ }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DeviceService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DeviceService.kt
index fceaf90..096e42a 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DeviceService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/DeviceService.kt
@@ -3,6 +3,11 @@
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.BaseDevice
import cn.flightfeather.supervision.domain.ds1.entity.DeviceStatus
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
+import cn.flightfeather.supervision.lightshare.vo.DataHead
+import cn.flightfeather.supervision.lightshare.vo.MonitorDeviceInfoVo
+import io.swagger.annotations.ApiParam
+import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.multipart.MultipartFile
interface DeviceService {
@@ -39,4 +44,8 @@
*鏇存柊璁惧鍙婂浘鐗�
*/
fun updateDeviceLocation(deviceLocation: String, deleteImg: List<String>, files: Array<MultipartFile>): Int
+
+ fun searchExternalDevice(
+ areaVo: AreaVo, keyword: String, page: Int?, perPage: Int?,
+ ): Pair<DataHead, MonitorDeviceInfoVo>
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt
index 41d0c3d..1d418bb 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserMapService.kt
@@ -20,5 +20,5 @@
fun autoCreateMap(userList: List<Userinfo?>)
- fun fetchDeviceMap(areaVo: AreaVo): List<DeviceMapVo?>
+ fun fetchDeviceMap(page: Int?, perPage: Int?, areaVo: AreaVo): List<DeviceMapVo?>
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt
index df41591..529580d 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt
@@ -3,6 +3,9 @@
import cn.flightfeather.supervision.domain.ds1.entity.Scense
import cn.flightfeather.supervision.domain.ds1.entity.Userinfo
import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
+import cn.flightfeather.supervision.lightshare.vo.DataHead
+import org.springframework.web.bind.annotation.RequestBody
interface UserinfoService {
fun findOne(id: String): Userinfo?
@@ -17,12 +20,21 @@
fun delete(id: String): Int
+ /**
+ * 鏍规嵁璐︽埛鍚嶇О妯$硦鎼滅储
+ */
+ fun search(areaVo: AreaVo, keyword: String, userType: Int?, page: Int?, perPage: Int?)
+ : Pair<DataHead, List<Userinfo?>>
+
fun findOneByName(userinfo: Userinfo): Userinfo?
fun createAccount(sceneId: String): Userinfo
fun findByScene(sceneId: String): Userinfo?
+ /**
+ * 鏍规嵁鍦烘櫙鍚嶇О锛岃幏鍙栧悎閫傜殑璐︽埛鍚�
+ */
fun getUName(sceneName: String): String
fun autoCreateAccount()
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DeviceServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DeviceServiceImpl.kt
index 619c65d..9dea773 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DeviceServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/DeviceServiceImpl.kt
@@ -8,6 +8,9 @@
import cn.flightfeather.supervision.domain.ds1.entity.*
import cn.flightfeather.supervision.domain.ds1.repository.DeviceRep
import cn.flightfeather.supervision.lightshare.service.DeviceService
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
+import cn.flightfeather.supervision.lightshare.vo.DataHead
+import cn.flightfeather.supervision.lightshare.vo.MonitorDeviceInfoVo
import com.google.gson.Gson
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
@@ -112,4 +115,10 @@
obj.dlPicUrl = oldImg.joinToString(";")
return deviceRep.updateStatus(obj)
}
+
+ override fun searchExternalDevice(
+ areaVo: AreaVo, keyword: String, page: Int?, perPage: Int?,
+ ): Pair<DataHead, MonitorDeviceInfoVo> {
+ TODO("Not yet implemented")
+ }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
index 348af4d..234838d 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
@@ -96,7 +96,7 @@
}
}
- override fun fetchDeviceMap(areaVo: AreaVo): List<DeviceMapVo?> {
+ override fun fetchDeviceMap(page: Int?, perPage: Int?, areaVo: AreaVo): List<DeviceMapVo?> {
// 1.閫氳繃鍖哄煙鏉′欢鑾峰彇涓讳綋鐢ㄦ埛
val userIdList = when (areaVo.sourceType) {
//浠ラ缇界幆澧冪郴缁熶腑鐨勭敤鎴蜂负涓讳綋
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt
index 9b20267..6de4b92 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt
@@ -14,6 +14,8 @@
import cn.flightfeather.supervision.domain.ds2.repository.UserInfoTZRep
import cn.flightfeather.supervision.lightshare.service.UserinfoService
import cn.flightfeather.supervision.lightshare.vo.AreaVo
+import cn.flightfeather.supervision.lightshare.vo.DataHead
+import com.github.pagehelper.PageHelper
import org.springframework.beans.BeanUtils
import org.springframework.stereotype.Service
import tk.mybatis.mapper.entity.Example
@@ -69,6 +71,14 @@
override fun delete(id: String): Int = userinfoMapper.deleteByPrimaryKey(id)
+ override fun search(areaVo: AreaVo, keyword: String, userType: Int?, page: Int?, perPage: Int?)
+ : Pair<DataHead, List<Userinfo?>> {
+ val p = PageHelper.startPage<Userinfo>(page ?: 1, perPage ?: 30)
+ val result = userInfoSVRep.searchUser(areaVo, keyword.trim(), Constant.UserType.fromValue(userType))
+ result.forEach { it?.password = null }
+ return DataHead(p.pageNum, p.pages, p.total) to result
+ }
+
override fun createAccount(sceneId: String): Userinfo {
findByScene(sceneId)?.let { return it }
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt
index 972d163..104ab39 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt
@@ -2,43 +2,66 @@
import com.fasterxml.jackson.annotation.JsonFormat
import com.fasterxml.jackson.annotation.JsonInclude
+import io.swagger.annotations.ApiModel
+import io.swagger.annotations.ApiModelProperty
import java.time.LocalDateTime
/**
* 鍖哄煙鏉′欢
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
-open class AreaVo{
- // 琛屾斂鍖哄垝
+@ApiModel("鍖哄煙鏉′欢")
+open class AreaVo {
+ @ApiModelProperty("鐪佷唤缂栫爜")
var provincecode: String? = null
+
+ @ApiModelProperty("鐪佷唤鍚嶇О")
var provincename: String? = null
+
+ @ApiModelProperty("鍩庡競缂栫爜")
var citycode: String? = null
+
+ @ApiModelProperty("鍩庡競鍚嶇О")
var cityname: String? = null
+
+ @ApiModelProperty("鍖哄幙缂栫爜")
var districtcode: String? = null
+
+ @ApiModelProperty("鍖哄幙鍚嶇О")
var districtname: String? = null
+
+ @ApiModelProperty("琛楅晣缂栫爜")
var towncode: String? = null
+
+ @ApiModelProperty("琛楅晣鍚嶇О")
var townname: String? = null
- // 鏃堕棿鑼冨洿,鏍煎紡yyyy-MM-dd HH:mm:ss
+ @ApiModelProperty("璧峰鏃堕棿锛屾牸寮� yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
var starttime: LocalDateTime? = null
+
+ @ApiModelProperty("缁撴潫鏃堕棿锛屾牸寮� yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
var endtime: LocalDateTime? = null
- // 鍦烘櫙id
+ @ApiModelProperty("鍦烘櫙涓婚敭id")
var sceneId: String? = null
- // 鍦烘櫙鍚嶇О
+
+ @ApiModelProperty("鍦烘櫙鍚嶇О")
var sceneName: String? = null
- // 鍦烘櫙绫诲瀷
+
+ @ApiModelProperty("鍦烘櫙绫诲瀷id")
var scensetypeid: String? = null
- // 鏄惁涓婄嚎
+ @ApiModelProperty("鏄惁涓婄嚎")
var online: Boolean? = null
- // 涓绘暟鎹簮锛�1锛氫互椋炵窘鐜绯荤粺涓殑鐢ㄦ埛涓轰富浣擄紱2锛氫互椋炵窘鐩戠绯荤粺涓殑鐢ㄦ埛涓轰富浣�
- var sourceType:Int = 1
+ @ApiModelProperty("涓绘暟鎹簮", allowableValues = "1锛氫互椋炵窘鐜绯荤粺涓殑鐢ㄦ埛涓轰富浣擄紱2锛氫互椋炵窘鐩戠绯荤粺涓殑鐢ㄦ埛涓轰富浣�")
+ var sourceType: Int = 1
- // 鏌ヨ鎺掑簭
- var sort:String? = "asc"
+ @ApiModelProperty("鏌ヨ鎺掑簭", allowableValues = "asc锛氭搴�, desc锛氬�掑簭")
+ var sort: String? = "asc"
+
+ @ApiModelProperty("鎺掑簭瀛楁", allowableValues = "pro: 鎸夌収闂鏁版帓搴忥紝changePer锛氭寜鐓ф暣鏀圭巼鎺掑簭")
var sortBy: String? = null
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt
index c20ade5..96e94e5 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/DeviceController.kt
@@ -3,6 +3,7 @@
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.domain.ds1.entity.MonitorDeviceInfo
import cn.flightfeather.supervision.lightshare.service.DeviceService
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
@@ -57,4 +58,17 @@
@ApiParam("鍒犻櫎鐨勮澶囧浘鐗囪矾寰�") @RequestParam("deleteImg") deleteImg: List<String>,
@ApiParam("璁惧鍥剧墖") @RequestPart("images") images: Array<MultipartFile>,
) = resPack { deviceService.updateDeviceLocation(status, deleteImg, images) }
+
+ @ApiOperation("鏌ヨ浠庡閮ㄨ幏鍙栫殑璁惧淇℃伅")
+ @PostMapping("/external/search")
+ fun searchExternalDevice(
+ @ApiParam("鍖哄煙鏉′欢淇℃伅") @RequestBody
+ areaVo: AreaVo,
+ @ApiParam("鎼滅储鍏抽敭瀛楋紝鍖归厤璁惧缂栧彿鍜岀偣浣嶅悕绉�") @RequestParam
+ keyword: String,
+ @ApiParam("鏌ヨ椤电爜", defaultValue = "1", required = false) @RequestParam("page", required = false)
+ page: Int?,
+ @ApiParam("鍗曢〉鏁版嵁閲�", defaultValue = "30", required = false) @RequestParam("per_page", required = false)
+ perPage: Int?,
+ ) = resPack { deviceService.searchExternalDevice(areaVo, keyword, page, perPage) }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt
index 3d31eaf..31e8f9d 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserMapController.kt
@@ -4,6 +4,7 @@
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
+import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
@Api(tags = ["UserMapController"], description = "鐢ㄦ埛id瀵瑰簲API鎺ュ彛")
@@ -21,5 +22,12 @@
@ApiOperation(value = "鑾峰彇鍖哄煙鐢ㄦ埛鐨勭洃娴嬭澶囧拰椋炵窘鐩戠绯荤粺銆侀缇界幆澧冪郴缁熺殑鍖归厤璁板綍")
@PostMapping("/device")
- fun fetchDeviceMap(@RequestBody areaVo: AreaVo) = resPack { userMapService.fetchDeviceMap(areaVo) }
+ fun fetchDeviceMap(
+ @ApiParam("鏌ヨ椤电爜", defaultValue = "1", required = false) @RequestParam("page", required = false)
+ page: Int?,
+ @ApiParam("鍗曢〉鏁版嵁閲�", defaultValue = "30", required = false) @RequestParam("per_page", required = false)
+ perPage: Int?,
+ @ApiParam("鍖哄煙鏉′欢淇℃伅") @RequestBody
+ areaVo: AreaVo
+ ) = resPack { userMapService.fetchDeviceMap(page, perPage, areaVo) }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt
index 4f7e412..c9ad232 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt
@@ -2,7 +2,10 @@
import cn.flightfeather.supervision.domain.ds1.entity.Userinfo
import cn.flightfeather.supervision.lightshare.service.UserinfoService
+import cn.flightfeather.supervision.lightshare.vo.AreaVo
import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
+import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
@Api(tags = ["UserinfoController"], description = "鐢ㄦ埛淇℃伅API鎺ュ彛")
@@ -28,6 +31,22 @@
@DeleteMapping("/{id}")
fun delete(@PathVariable id: String) = userinfoService.delete(id)
+ @ApiOperation(value = "妯$硦鎼滅储鐢ㄦ埛淇℃伅")
+ @PostMapping("/search")
+ fun search(
+ @ApiParam("鍖哄煙鏉′欢淇℃伅") @RequestBody
+ areaVo: AreaVo,
+ @ApiParam("鎼滅储鍏抽敭瀛楋紝鍖归厤鐢ㄦ埛璐︽埛鍚嶅拰鏄电О") @RequestParam
+ keyword: String,
+ @ApiParam("鐢ㄦ埛绫诲瀷", example = "0:绠$悊鍛�;1:鍐呴儴浜哄憳;2:鏀垮簻閮ㄩ棬;3:浼佷笟", defaultValue = "3", required = false)
+ @RequestParam(required = false)
+ userType: Int?,
+ @ApiParam("鏌ヨ椤电爜", defaultValue = "1", required = false) @RequestParam("page", required = false)
+ page: Int?,
+ @ApiParam("鍗曢〉鏁版嵁閲�", defaultValue = "30", required = false) @RequestParam("per_page", required = false)
+ perPage: Int?,
+ ) = resPack { userinfoService.search(areaVo, keyword, userType, page, perPage) }
+
@PostMapping("/login")
fun getByName(@RequestBody userinfo: Userinfo) = userinfoService.findOneByName(userinfo)
diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml
index 7541789..aa6b7d0 100644
--- a/src/main/resources/application-test.yml
+++ b/src/main/resources/application-test.yml
@@ -11,12 +11,12 @@
# username: root
# password: cn.FLIGHTFEATHER
- #-杩滅▼娴嬭瘯鏈嶅姟鍣�-
+ #-杩滅▼姝e紡鏈嶅姟鍣紙鏆傚仛娴嬭瘯锛�-
url: jdbc:mysql://47.100.191.150:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
username: remoteU1
password: eSoF8DnzfGTlhAjE
ds2:
- #-杩滅▼娴嬭瘯鏈嶅姟鍣�-
+ #-杩滅▼姝e紡鏈嶅姟鍣紙鏆傚仛娴嬭瘯锛�-
url: jdbc:mysql://47.100.191.150:3306/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
username: remoteU1
password: eSoF8DnzfGTlhAjE
diff --git a/src/main/resources/mapper/ds1/UserinfoMapper.xml b/src/main/resources/mapper/ds1/UserinfoMapper.xml
new file mode 100644
index 0000000..1344052
--- /dev/null
+++ b/src/main/resources/mapper/ds1/UserinfoMapper.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.flightfeather.supervision.domain.ds1.mapper.UserinfoMapper">
+ <resultMap id="BaseResultMap" type="cn.flightfeather.supervision.domain.ds1.entity.Userinfo">
+ <!--
+ WARNING - @mbg.generated
+ -->
+ <id column="UI_GUID" jdbcType="VARCHAR" property="guid" />
+ <result column="UI_AcountName" jdbcType="VARCHAR" property="acountname" />
+ <result column="UI_RealName" jdbcType="VARCHAR" property="realname" />
+ <result column="UI_Password" jdbcType="VARCHAR" property="password" />
+ <result column="UI_UserTypeID" jdbcType="TINYINT" property="usertypeid" />
+ <result column="UI_UserType" jdbcType="VARCHAR" property="usertype" />
+ <result column="D_GUID" jdbcType="VARCHAR" property="dGuid" />
+ <result column="UI_DepartmentName" jdbcType="VARCHAR" property="departmentname" />
+ <result column="UI_IsEnable" jdbcType="BIT" property="isenable" />
+ <result column="UI_WorkNo" jdbcType="VARCHAR" property="workno" />
+ <result column="UI_Telephone" jdbcType="VARCHAR" property="telephone" />
+ <result column="UI_WechatID" jdbcType="VARCHAR" property="wechatid" />
+ <result column="UI_Extension1" jdbcType="VARCHAR" property="extension1" />
+ <result column="UI_Extension2" jdbcType="VARCHAR" property="extension2" />
+ <result column="UI_Extension3" jdbcType="VARCHAR" property="extension3" />
+ <result column="UI_Remark" jdbcType="VARCHAR" property="remark" />
+ </resultMap>
+ <sql id="Base_Column_List">
+ <!--
+ WARNING - @mbg.generated
+ -->
+ UI_GUID, UI_AcountName, UI_RealName, UI_Password, UI_UserTypeID,
+ UI_UserType, D_GUID, UI_DepartmentName, UI_IsEnable,
+ UI_WorkNo, UI_Telephone, UI_WechatID, UI_Extension1,
+ UI_Extension2, UI_Extension3, UI_Remark
+ </sql>
+
+ <select id="searchUser" resultMap="BaseResultMap">
+ SELECT
+ a.*
+ FROM
+ sm_t_userinfo AS a
+ LEFT JOIN sm_t_scense AS b ON a.D_GUID = b.S_GUID
+ WHERE
+ (a.UI_WorkNo IS NULL OR a.UI_WorkNo != 'test')
+ <if test="areaVo.provincecode != null">
+ AND b.S_ProvinceCode = #{areaVo.provincecode}
+ </if>
+ <if test="areaVo.provincename != null">
+ AND b.S_ProvinceName = #{areaVo.provincename}
+ </if>
+ <if test="areaVo.citycode != null">
+ AND b.S_CityCode = #{areaVo.citycode}
+ </if>
+ <if test="areaVo.cityname != null">
+ AND b.S_CityName = #{areaVo.cityname}
+ </if>
+ <if test="areaVo.districtcode != null">
+ AND b.S_DistrictCode = #{areaVo.districtcode}
+ </if>
+ <if test="areaVo.districtname != null">
+ AND b.S_DistrictName = #{areaVo.districtname}
+ </if>
+ <if test="areaVo.towncode != null">
+ AND b.S_TownCode = #{areaVo.towncode}
+ </if>
+ <if test="areaVo.townname != null">
+ AND b.S_TownName = #{areaVo.townname}
+ </if>
+ <if test="areaVo.scensetypeid != null">
+ AND b.S_TypeID = #{areaVo.scensetypeid}
+ </if>
+ <if test="areaVo.online == true">
+ AND b.S_Extension1 = '1'
+ </if>
+ <if test="areaVo.online == false">
+ AND b.S_Extension1 = '0'
+ </if>
+ <if test="userTypeId != null">
+ AND a.UI_UserTypeID = #{userTypeId}
+ </if>
+ <if test="keyword != null and keyword != ''">
+ AND (
+ a.UI_AcountName LIKE CONCAT('%', #{keyword}, '%')
+ OR
+ a.UI_RealName LIKE CONCAT('%', #{keyword}, '%')
+ )
+ </if>
+ </select>
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3