Browse Source

增加主键id Long类型序列化注解

loovi 1 year ago
parent
commit
54e6765696

+ 3 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterprise.java

@@ -7,6 +7,8 @@ import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -46,6 +48,7 @@ public class TbEnterprise extends Model<TbEnterprise> implements Serializable {
 	 *  
 	 */
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;	
 
 	/**

+ 3 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods/TbGoods.java

@@ -6,6 +6,8 @@ import java.util.Date;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -46,6 +48,7 @@ public class TbGoods extends Model<TbGoods> implements Serializable {
 	 * 主键 
 	 */
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;
 
 	/**

+ 3 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransit.java

@@ -6,6 +6,8 @@ import java.util.Date;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -46,6 +48,7 @@ public class TbGoodsTransit extends Model<TbGoodsTransit> implements Serializabl
 	 * 在销商品表主键 
 	 */
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;	
 
 	/**

+ 4 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsType.java

@@ -6,6 +6,8 @@ import java.util.Date;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -46,7 +48,8 @@ public class TbGoodsType extends Model<TbGoodsType> implements Serializable {
 	 * 主键 
 	 */
 	@TableId(type = IdType.AUTO)
-	private String id;	
+	@JsonSerialize(using = ToStringSerializer.class)
+	private Long id;
 
 	/**
 	 * 类别名称 

+ 3 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_goods_units/TbGoodsUnits.java

@@ -3,6 +3,8 @@ package com.pj.tb_goods_units;
 import java.io.Serializable;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -43,6 +45,7 @@ public class TbGoodsUnits extends Model<TbGoodsUnits> implements Serializable {
 	 * 商品主键 
 	 */
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;	
 
 	/**

+ 3 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroup.java

@@ -6,6 +6,8 @@ import java.util.Date;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -46,6 +48,7 @@ public class TbGroup extends Model<TbGroup> implements Serializable {
 	 *  
 	 */
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;
 
 	/**

+ 3 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrder.java

@@ -4,6 +4,8 @@ import java.io.Serializable;
 import java.util.*;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -44,6 +46,7 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	 * 主键 
 	 */
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;
 
 	/**

+ 3 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeople.java

@@ -6,6 +6,8 @@ import java.util.Date;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -46,6 +48,7 @@ public class TbPeople extends Model<TbPeople> implements Serializable {
 	 * 主键 
 	 */
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;
 
 	/**

+ 3 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShop.java

@@ -5,6 +5,8 @@ import java.util.*;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -45,6 +47,7 @@ public class TbShop extends Model<TbShop> implements Serializable {
 	 * 主键 
 	 */
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;
 
 	/**

+ 3 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeArea.java

@@ -5,6 +5,8 @@ import java.util.*;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -45,6 +47,7 @@ public class TbTradeArea extends Model<TbTradeArea> implements Serializable {
 	 * 主键 
 	 */
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;
 
 	/**

+ 3 - 0
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaser.java

@@ -5,6 +5,8 @@ import java.util.*;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.pj.common.core.annotation.Excel;
 import lombok.EqualsAndHashCode;
 
@@ -47,6 +49,7 @@ public class TbPurchaser extends Model<TbPurchaser> implements Serializable {
 	 */
 	@Excel(name = "id")
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;	
 
 	/**

+ 7 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriver.java

@@ -5,6 +5,9 @@ import java.util.*;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.pj.common.core.annotation.Excel;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -45,21 +48,25 @@ public class TbDriver extends Model<TbDriver> implements Serializable {
 	 * 主键 
 	 */
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;	
 
 	/**
 	 * 姓名 
 	 */
+	@Excel(name = "姓名")
 	private String name;	
 
 	/**
 	 * 年龄 
 	 */
+	@Excel(name = "年龄")
 	private Integer age;	
 
 	/**
 	 * 性别性别(1=男,2=女) 
 	 */
+	@Excel(name = "性别")
 	private Integer sex;
 
 	/**

+ 3 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_orders/TbOrders.java

@@ -3,6 +3,8 @@ package com.pj.project.tb_orders;
 import java.io.Serializable;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -43,6 +45,7 @@ public class TbOrders extends Model<TbOrders> implements Serializable {
 	 * 货运订单管理表主键 
 	 */
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;	
 
 	/**

+ 3 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/TbVehicle.java

@@ -5,6 +5,8 @@ import java.util.*;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -45,6 +47,7 @@ public class TbVehicle extends Model<TbVehicle> implements Serializable {
 	 * 主键 
 	 */
 	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
 	private Long id;	
 
 	/**