🎨 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; package com.rymcu.forest.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
/** /**
@ -8,7 +9,8 @@ import lombok.Data;
@Data @Data
public class TokenUser { public class TokenUser {
private Integer idUser; @JsonFormat(shape = JsonFormat.Shape.STRING)
private Long idUser;
private String account; private String account;

View File

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

View File

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

View File

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

View File

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

View File

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