feiyu02
2022-01-12 1564af04dacafcc08a9682a4ef1e651120c8cc46
新增搜索用户接口
已修改5个文件
29 ■■■■■ 文件已修改
src/main/kotlin/cn/flightfeather/supervision/SupervisionApplication.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/UserinfoServiceImpl.kt 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/common/score/AutoScoreTest.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/SupervisionApplication.kt
@@ -21,7 +21,7 @@
    @Bean
    fun runner() = ApplicationRunner {
        webSocketServer.start()
//        taskController.run()
        taskController.run()
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/Impl/UserinfoServiceImpl.kt
@@ -206,4 +206,16 @@
        return UserBaseInfo(userId, userInfo.realname, baseInfo, companyInfo, specialInfo)
    }
    override fun search(district: String?, sceneType: Int?, userType: Int?, page: Int, perPage: Int): BaseResponse<List<Userinfo>> {
        val result = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply {
            createCriteria().apply {
                district?.let { andEqualTo("extension1", it) }
                sceneType?.let { andEqualTo("extension2", it) }
                userType?.let { andEqualTo("usertypeid", it) }
            }
        })
        return BaseResponse(true, data = result)
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/UserinfoService.kt
@@ -32,4 +32,6 @@
    fun getBaseInfo(userId: String): UserBaseInfo
    fun search(district: String?, sceneType: Int?, userType: Int?, page: Int, perPage: Int): BaseResponse<List<Userinfo>>
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/UserinfoController.kt
@@ -6,6 +6,7 @@
import cn.flightfeather.supervision.lightshare.vo.UserSearchCondition
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile
import javax.servlet.http.HttpServletResponse
@@ -71,4 +72,14 @@
    fun getBaseInfo(
            @RequestParam("userId") userId: String
    ) = userinfoService.getBaseInfo(userId)
    @ApiOperation(value = "根据给定条件,搜索用户")
    @GetMapping("/search")
    fun search(
        @ApiParam("区县", example = "徐汇区") @RequestParam("district", required = false) district: String,
        @ApiParam("场景类型", example = "1", allowableValues = "0,1,2,3,4,5,6,7") @RequestParam("sceneType", required = false) sceneType: Int,
        @ApiParam("用户类型", example = "0", allowableValues = "0,1,2,3") @RequestParam("userType", required = false) userType: Int,
        @RequestParam(value = "page") page: Int,
        @RequestParam(value = "per_page") perPage: Int,
    ) = userinfoService.search(district, sceneType, userType, page, perPage)
}
src/test/kotlin/cn/flightfeather/supervision/common/score/AutoScoreTest.kt
@@ -20,6 +20,6 @@
    @Test
    fun go() {
        autoScore.go(2021, 7)
        autoScore.go(2021, 10)
    }
}