| | |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.utils.Jwt; |
| | | import com.yuanchu.mom.utils.ServletUtils; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | @Component |
| | | public class MyMetaObjectHandler implements MetaObjectHandler { |
| | |
| | | try { |
| | | userId = Integer.parseInt(JSONUtil.parseObj(jwt.readJWT(ServletUtils.getRequest().getHeader("token")).get("data")).get("id") + ""); |
| | | }catch (Exception ignored){} |
| | | // update的时候使用,更新的时候强制进行填充 |
| | | this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); // 起始版本 3.3.0(推荐) |
| | | this.strictUpdateFill(metaObject, "updateUser", Integer.class, userId); |
| | | } |