膳逸【MIS】修改用户状态,查询用户打卡
文章目录
Base URLs:
Authentication
shanyi-mis-api
POST 修改用户状态
POST /user/changeStatusById
Body 请求参数
{
"id": 5,
"status": 0
}
请求参数
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
Token | header | string | 否 | none |
body | body | object | 否 | none |
» id | body | integer | 是 | none |
» status | body | integer | 是 | none |
返回示例
成功
{
"msg": "success",
"code": 200
}
返回结果
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
返回数据结构
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» msg | string | true | none | none | |
» code | integer | true | none | none |
POST 查询用户打卡
POST /user/searchCheckInByPage
Body 请求参数
{
"page": 1,
"length": 10,
"userId": 5,
"nickName": "绊象",
"name": "陈泽胜",
"startTime": "2024-05-21",
"endTime": "2024-05-22",
"order": "desc"
}
请求参数
名称 | 位置 | 类型 | 必选 | 说明 |
---|---|---|---|---|
Token | header | string | 否 | none |
body | body | object | 否 | none |
» page | body | integer | 是 | none |
» length | body | integer | 是 | none |
» userId | body | integer | 否 | none |
» nickName | body | string | 否 | none |
» name | body | string | 否 | none |
» startTime | body | string | 否 | none |
» endTime | body | string | 否 | none |
» order | body | string | 是 | none |
返回示例
成功
{
"msg": "success",
"result": {
"totalCount": 1,
"pageSize": 10,
"totalPage": 1,
"pageIndex": 1,
"list": [
{
"images": "https://thirdwx.qlogo.cn/mmopen/vi_32/6ibtnStKibXDUTibnu052w40ps0DKqcUZBYaAiberiasgSsTGXwCLAicmXng2gE48ZnibYrmnPIiaVlNWjpCYiby85ibgM8Q/132",
"user_id": 5,
"nickName": "绊象",
"name": "陈**",
"time": "2024-05-21T17:34:25",
"text": "今天打卡",
"analysis": "暂无"
}
]
},
"code": 200
}
返回结果
状态码 | 状态码含义 | 说明 | 数据模型 |
---|---|---|---|
200 | OK | 成功 | Inline |
返回数据结构
状态码 200
名称 | 类型 | 必选 | 约束 | 中文名 | 说明 |
---|---|---|---|---|---|
» msg | string | true | none | none | |
» result | object | true | none | none | |
»» totalCount | integer | true | none | none | |
»» pageSize | integer | true | none | none | |
»» totalPage | integer | true | none | none | |
»» pageIndex | integer | true | none | none | |
»» list | [object] | true | none | none | |
»»» images | string | false | none | none | |
»»» user_id | integer | false | none | none | |
»»» nickName | string | false | none | none | |
»»» name | string | false | none | none | |
»»» time | string | false | none | none | |
»»» text | string | false | none | none | |
»»» analysis | string | false | none | none | |
» code | integer | true | none | none |
bug1
关键问题:org.springframework.dao.InvalidDataAccessApiUsageException: Error attempting to get column ‘time’ from result set.
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@369d16ec] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@420159c4] will not be managed by Spring
==> Preparing: SELECT u.nick_name AS nickName, ui.name, ci.user_id, ci.time, ci.text, ci.images, ci.analysis FROM check_in ci JOIN user u ON ci.user_id = u.id JOIN user_info ui ON u.id = ui.user_id WHERE 1 = 1 AND u.nick_name LIKE CONCAT('%', ?, '%') AND ui.name LIKE CONCAT('%', ?, '%') AND ci.time >= ? AND ci.time <= ? ORDER BY ci.time desc LIMIT ? OFFSET ?
==> Parameters: 绊象(String), 陈**(String), 1987-12-13T21:52:28(LocalDateTime), 2024-12-13T21:52:28(LocalDateTime), 10(Integer), 0(Integer)
<== Columns: nickName, name, user_id, time, text, images, analysis
<== Row: 绊象, 陈**, 5, 2024-07-11 18:40:02, 今天打卡, https://thirdwx.qlogo.cn/mmopen/vi_32/6ibtnStKibXDUTibnu052w40ps0DKqcUZBYaAiberiasgSsTGXwCLAicmXng2gE48ZnibYrmnPIiaVlNWjpCYiby85ibgM8Q/132, 暂无
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@369d16ec]
2024/05/21 19:54:33 ERROR 执行异常
org.springframework.dao.InvalidDataAccessApiUsageException: Error attempting to get column 'time' from result set. Cause: java.sql.SQLFeatureNotSupportedException
; null; nested exception is java.sql.SQLFeatureNotSupportedException
at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:96)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:79)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at jdk.proxy2/jdk.proxy2.$Proxy86.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224)
at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86)
at jdk.proxy2/jdk.proxy2.$Proxy95.searchCheckInByPage(Unknown Source)
at com.sdu.shanyimisapi.service.impl.UserServiceImpl.searchCheckInByPage(UserServiceImpl.java:72)
at com.sdu.shanyimisapi.controller.UserController.searchCheckInByPage(UserController.java:64)
at com.sdu.shanyimisapi.controller.UserController$$FastClassBySpringCGLIB$$c8586bf7.invoke(<generated>)
mp 官方给出建议
3.1.0之前版本没问题,针对3.1.1以及后续版本出现上述问题
现象: 集成druid数据源,使用3.1.0之前版本没问题,升级mp到3.1.1+后,运行时报错:java.sql.SQLFeatureNotSupportedException
原因: mp3.1.1+使用了新版jdbc,LocalDateTime等新日期类型处理方式升级,但druid在1.1.21版本之前不支持,参考issue
解决方案:
> 1. 升级druid到1.1.21解决这个问题;
> 2.保持mp版本3.1.0;
> 3.紧跟mp版本,换掉druid数据源
bug2
数据库与mybatis时区设置不同,相差八小时:
数据库数据:
查询参数:
17点与10点相差7小时,小于八小时,因为我们是东八区
不能查到信息:
如果查询参数大于等八小时:
才能查到信息:
修改配置文件:application.yml
参考:[JDBC连接数据库 mysql serverTimezone 时差问题_jdbc 链接时差-CSDN博客](https://blog.csdn.net/qq_44752641/article/details/109223983?ops_request_misc={“request_id”%3A"171637096216800186516093"%2C"scm"%3A"20140713.130102334.pc_all."}&request_id=171637096216800186516093&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-6-109223983-null-null.142v100pc_search_result_base8&utm_term=url%3A jdbc%3Amysql%3A%2F%2F152.136.173.53%3A3306%2FshanyiuseUnicode%3Dtrue%26characterEncoding%3DUTF-8%26serverTimezone%3DUTC怎么调成上海时区&spm=1018.2226.3001.4187)