🎨 style(entity,dto,service,...): 实体等pojo主键变为Long类型

This commit is contained in:
ronger 2022-07-13 22:21:33 +08:00
parent 0744e48eb9
commit 89aef7a87b
6 changed files with 17 additions and 11 deletions

View File

@ -1,5 +1,6 @@
package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
/**
@ -8,7 +9,8 @@ import lombok.Data;
@Data
public class TokenUser {
private Integer idUser;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser;
private String account;

View File

@ -1,6 +1,7 @@
package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.Column;
@ -22,7 +23,8 @@ public class LoginRecord implements Serializable,Cloneable {
@Id
@GeneratedValue(generator = "JDBC")
@Column(name = "id")
private Integer id;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
/** IP */
@Column(name = "login_ip")
private String loginIp;
@ -43,7 +45,8 @@ public class LoginRecord implements Serializable,Cloneable {
private String loginBrowser;
/** 用户 id */
@Column(name = "id_user")
private Integer idUser;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser;
/** 创建时间 */
@Column(name = "created_time")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")

View File

@ -1,6 +1,7 @@
package com.rymcu.forest.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.persistence.Column;
@ -22,7 +23,8 @@ public class Visit implements Serializable,Cloneable {
@Id
@GeneratedValue(generator = "JDBC")
@Column(name = "id")
private Integer id;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long id;
/** 浏览链接 */
@Column(name = "visit_url")
private String visitUrl;
@ -40,7 +42,8 @@ public class Visit implements Serializable,Cloneable {
private String visitDeviceId;
/** 浏览者 id */
@Column(name = "visit_user_id")
private Integer visitUserId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long visitUserId;
/** 上游链接 */
@Column(name = "visit_referer_url")
private String visitRefererUrl;

View File

@ -18,7 +18,7 @@ public interface LoginRecordService extends Service<LoginRecord> {
* @param idUser
* @return
*/
LoginRecord saveLoginRecord(Integer idUser);
LoginRecord saveLoginRecord(Long idUser);
/**
* 获取用户登录记录

View File

@ -33,7 +33,7 @@ public class LoginRecordServiceImpl extends AbstractService<LoginRecord> impleme
@Override
@Transactional(rollbackFor = Exception.class)
public LoginRecord saveLoginRecord(Integer idUser) {
public LoginRecord saveLoginRecord(Long idUser) {
HttpServletRequest request = ((ServletRequestAttributes) Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
String ip = Utils.getIpAddress(request);
String ua = request.getHeader("user-agent");

View File

@ -106,11 +106,9 @@ public class CommonApiController {
@GetMapping("/article/{id}")
@VisitLogger
public GlobalResult<Map<String, Object>> article(@PathVariable Long id) {
public GlobalResult<ArticleDTO> article(@PathVariable Long id) {
ArticleDTO articleDTO = articleService.findArticleDTOById(id, 1);
Map<String, Object> map = new HashMap<>(1);
map.put("article", articleDTO);
return GlobalResultGenerator.genSuccessResult(map);
return GlobalResultGenerator.genSuccessResult(articleDTO);
}
@PatchMapping("/forget-password")