parent
ef124e00c8
commit
e468b65add
@ -0,0 +1,50 @@
|
|||||||
|
package com.bsd.say.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.bsd.say.beans.AjaxRequest;
|
||||||
|
import com.bsd.say.beans.AjaxResult;
|
||||||
|
import com.bsd.say.entities.BaseEntity;
|
||||||
|
import com.bsd.say.service.BaseService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
|
||||||
|
public class BaseController<B extends BaseService, T extends BaseEntity> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private B baseService;
|
||||||
|
|
||||||
|
private Class<T> entityClass;
|
||||||
|
|
||||||
|
public B getBaseService() {
|
||||||
|
return this.baseService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseController() {
|
||||||
|
|
||||||
|
Type type = getClass().getGenericSuperclass();
|
||||||
|
ParameterizedType ptype = (ParameterizedType) type;
|
||||||
|
Type[] types = ptype.getActualTypeArguments();
|
||||||
|
entityClass = (Class<T>) types[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
public AjaxResult saveOrUpdate(AjaxRequest ajaxRequest) {
|
||||||
|
|
||||||
|
JSONObject data = ajaxRequest.getData();
|
||||||
|
T entityClass = data.toJavaObject(this.entityClass);
|
||||||
|
baseService.saveOrUpdate(entityClass, 12L);
|
||||||
|
return new AjaxResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public AjaxResult page(AjaxRequest ajaxRequest) {
|
||||||
|
|
||||||
|
AjaxResult ajaxResult = new AjaxResult();
|
||||||
|
JSONObject jsonObject = ajaxRequest.getData();
|
||||||
|
IPage<T> page = baseService.page(jsonObject);
|
||||||
|
ajaxResult.setData(page);
|
||||||
|
return ajaxResult;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.bsd.say.entities;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@TableName("award_list")
|
||||||
|
@Data
|
||||||
|
public class AwardList extends BaseEntity{
|
||||||
|
/**
|
||||||
|
* 中奖用户id
|
||||||
|
*/
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中奖类型(1-一等奖 2-二等奖)
|
||||||
|
*/
|
||||||
|
private int awardType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 奖品名
|
||||||
|
*/
|
||||||
|
private String awardName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 省
|
||||||
|
*/
|
||||||
|
private String province;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 市
|
||||||
|
*/
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区
|
||||||
|
*/
|
||||||
|
private String area;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详细地藏
|
||||||
|
*/
|
||||||
|
private String address;
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.bsd.say.entities;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@TableName("coupon")
|
||||||
|
@Data
|
||||||
|
public class Coupon extends BaseEntity{
|
||||||
|
/**
|
||||||
|
* 波司登返回的优惠券号
|
||||||
|
*/
|
||||||
|
private String couponNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券券面值
|
||||||
|
*/
|
||||||
|
private Double couponValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绑定的userId
|
||||||
|
*/
|
||||||
|
private Integer userId;
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.bsd.say.entities;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@TableName("love_letter")
|
||||||
|
@Data
|
||||||
|
public class LoveLetter extends BaseEntity{
|
||||||
|
/**
|
||||||
|
* 用户id(谁写的爱意情书)
|
||||||
|
*/
|
||||||
|
private String userId;
|
||||||
|
/**
|
||||||
|
* 情书内容(有字数限制)
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
/**
|
||||||
|
* 情书类型
|
||||||
|
*/
|
||||||
|
private Integer loveType;
|
||||||
|
/**
|
||||||
|
* 被送人手机号
|
||||||
|
*/
|
||||||
|
private String receivePhone;
|
||||||
|
/**
|
||||||
|
* 接收人姓名
|
||||||
|
*/
|
||||||
|
private String receiveName;
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.bsd.say.entities;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@TableName("love_type")
|
||||||
|
@Data
|
||||||
|
public class LoveType extends BaseEntity{
|
||||||
|
/**
|
||||||
|
* 绑定情书id
|
||||||
|
*/
|
||||||
|
private Integer letterId;
|
||||||
|
/**
|
||||||
|
* 爱意类型内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.bsd.say.entities;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@TableName("user")
|
||||||
|
@Data
|
||||||
|
public class User extends BaseEntity{
|
||||||
|
/**
|
||||||
|
* 用户手机号
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
/**
|
||||||
|
* 用户openId
|
||||||
|
*/
|
||||||
|
private String openId;
|
||||||
|
/**
|
||||||
|
* 0-白嫖客 1-寄信人 2-被送信人 3-既是寄信也是被送
|
||||||
|
*/
|
||||||
|
private int userType;
|
||||||
|
}
|
Loading…
Reference in New Issue