膳逸:【MIS】修改用户状态,查询用户打卡

膳逸:修改用户状态,查询用户打卡,接口文档

Base URLs:

Authentication

shanyi-mis-api

POST 修改用户状态

POST /user/changeStatusById

Body 请求参数

{
  "id": 5,
  "status": 0
}

请求参数

名称位置类型必选说明
Tokenheaderstringnone
bodybodyobjectnone
» idbodyintegernone
» statusbodyintegernone

返回示例

成功

{
  "msg": "success",
  "code": 200
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» msgstringtruenonenone
» codeintegertruenonenone

POST 查询用户打卡

POST /user/searchCheckInByPage

Body 请求参数

{
  "page": 1,
  "length": 10,
  "userId": 5,
  "nickName": "绊象",
  "name": "陈泽胜",
  "startTime": "2024-05-21",
  "endTime": "2024-05-22",
  "order": "desc"
}

请求参数

名称位置类型必选说明
Tokenheaderstringnone
bodybodyobjectnone
» pagebodyintegernone
» lengthbodyintegernone
» userIdbodyintegernone
» nickNamebodystringnone
» namebodystringnone
» startTimebodystringnone
» endTimebodystringnone
» orderbodystringnone

返回示例

成功

{
  "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
}

返回结果

状态码状态码含义说明数据模型
200OK成功Inline

返回数据结构

状态码 200

名称类型必选约束中文名说明
» msgstringtruenonenone
» resultobjecttruenonenone
»» totalCountintegertruenonenone
»» pageSizeintegertruenonenone
»» totalPageintegertruenonenone
»» pageIndexintegertruenonenone
»» list[object]truenonenone
»»» imagesstringfalsenonenone
»»» user_idintegerfalsenonenone
»»» nickNamestringfalsenonenone
»»» namestringfalsenonenone
»»» timestringfalsenonenone
»»» textstringfalsenonenone
»»» analysisstringfalsenonenone
» codeintegertruenonenone

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)

  • 25
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值