推荐系统

This commit is contained in:
2023-05-12 09:14:17 +08:00
parent 82f596f7eb
commit 2b5991ea75
17 changed files with 1013 additions and 3 deletions

View File

@@ -0,0 +1,289 @@
package com.wx.application.core.controller;
import org.springframework.web.bind.annotation.*;
import com.wx.application.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import com.wx.application.core.service.EntrysService;
import com.wx.application.core.entity.Entrys;
import com.wx.application.base.ResponseData;
import java.util.Map;
import java.io.Serializable;
/**
* @description : Entrys 默认控制器,仅供生成器使用
* ---------------------------------
* @since 2023-05-12
*/
/*@Slf4j*/
@RestController("coreEntrysController")
@RequestMapping("/entrys")
public class EntrysController extends BaseController {
@Autowired
private EntrysService entrysService;
/**
* 定义一些通用的错误信息,供其他 api引用
* @apiDefine DefaultException
* @apiError {String} code 错误码
* @apiError {String} msg 错误描述
* @apiError {String} requestId 请求id标识
*
* @apiErrorExample Error-Response:
* HTTP/1.1 200
* {
* "code": "UNAUTHORIZED",
* "msg": "未授权,请先登录",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
*/
/**
* 定义标准对象请求的结构体,供api引用
* @apiDefine EntrysReq
* @apiParam {String} fid
* @apiParam {Boolean} isHidden
* @apiParam {String} categories
* @apiParam {String} labels
* @apiParam {String} description
*/
/**
* 定义标准对象返回的结构体,供api引用
* @apiDefine EntrysResp
* @apiSuccess {String} fid
* @apiSuccess {Boolean} isHidden
* @apiSuccess {String} categories
* @apiSuccess {String} labels
* @apiSuccess {String} description
*/
/**
* 定义标准头部,供api引用
* @apiDefine EntrysHeader
* @apiHeader {String} Authorization 用户授权token
* @apiHeaderExample {json} Header-Example:
* {
* "Authorization": "Bearer 1eyJhbGciOiJIUzI1NiJ9....tzNK43MPVQWYYhDwihCAZa88zXzar7KLdgiBBDuUpBM",
* }
*/
/**
*
* @api {post} //entrys/query_unique 通过条件查询对象
* @apiName 通过条件查询对象
* @apiGroup Entrys
*
* @apiUse EntrysHeader
* @apiUse EntrysResp
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "data": {
"fid": null,
"isHidden": null,
"categories": null,
"labels": null,
"description": null,
* },
* "code": "SUCCESS",
* "msg": "请求成功",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
* @apiUse DefaultException
*
* @description : 通过条件查询对象
* 仅查询第一条
* ---------------------------------
* @author : zj
* @since : Create in 2023-05-12
*/
@PostMapping(value = "/query_unique")
public ResponseData queryUnique(@RequestBody Map entrysQ) {
return success(entrysService.queryUnique(entrysQ));
}
/**
*
* @api {post} //entrys/query_pages 通过条件分页查询列表
* @apiName 通过条件分页查询列表
* @apiGroup Entrys
*
* @apiUse EntrysHeader
* @apiUse EntrysResp
* @apiSuccess {Long} total 总数
* @apiSuccess {Long} size 分页大小
* @apiSuccess {Long} current 当前页
* @apiSuccess {Long} orders 排序
* @apiSuccess {Long} pages 总页数
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "data": {
* "records": [{
"fid": null,
"isHidden": null,
"categories": null,
"labels": null,
"description": null, * }],
* "total": 1,
* "size": 10,
* "current": 1,
* "orders": [],
* "searchCount": true,
* "pages": 1
* "code": "SUCCESS",
* "msg": "请求成功",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
* @apiUse DefaultException
*
* @description : 通过条件分页查询列表
* 默认第一页 分页长度为10
* ---------------------------------
* @author : zj
* @since : Create in 2023-05-12
*/
@PostMapping(value = "/query_pages")
public ResponseData queryPages(@RequestBody Map entrysQ) {
return success(entrysService.queryPage(entrysQ));
}
/**
*
* @api {post} //entrys/query_list 通过条件查询列表
* @apiName 通过条件查询列表
* @apiGroup Entrys
*
* @apiUse EntrysHeader
* @apiUse EntrysResp
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "data": [{
"fid": null,
"isHidden": null,
"categories": null,
"labels": null,
"description": null,
* }],
* "code": "SUCCESS",
* "msg": "请求成功",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
* @apiUse DefaultException
*
* @description : 通过条件查询列表
* 不分页直接返回list
* ---------------------------------
* @author : zj
* @since : Create in 2023-05-12
*/
@PostMapping(value = "/query_list")
public ResponseData queryList(@RequestBody Map entrysQ) {
return success(entrysService.queryList(entrysQ));
}
/**
*
* @api {post} //entrys/remove/:id 通过id删除单个记录
* @apiName 通过id删除单个记录
* @apiGroup Entrys
*
* @apiUse EntrysHeader
* @apiParam {PK} id 记录主键
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "data": true,
* "code": "SUCCESS",
* "msg": "请求成功",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
* @apiUse DefaultException
*
* @description : 通过id删除单个记录
* ---------------------------------
* @author : zj
* @since : Create in 2023-05-12
*/
@PostMapping(value = "/remove/{id}")
public ResponseData remove(@PathVariable("id") Serializable id) {
return success(entrysService.remove(id));
}
/**
*
* @api {post} //entrys/modify 通过id更新单个记录
* @apiName 通过id更新单个记录
* @apiGroup Entrys
*
* @apiUse EntrysHeader
* @apiParam {PK} id 记录主键
* @apiUse EntrysReq
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "data": true,
* "code": "SUCCESS",
* "msg": "请求成功",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
* @apiUse DefaultException
*
* @description : 通过id更新单个记录
* ---------------------------------
* @author : zj
* @since : Create in 2023-05-12
*/
@PostMapping(value = "/modify")
public ResponseData modify(@RequestBody Entrys entrys) {
return success(entrysService.modify(entrys));
}
/**
*
* @api {post} //entrys/create 新增
* @apiName 新增
* @apiGroup Entrys
*
* @apiUse EntrysHeader
* @apiUse EntrysReq
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "data": true,
* "code": "SUCCESS",
* "msg": "请求成功",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
* @apiUse DefaultException
*
* @description : 新增
* ---------------------------------
* @author : zj
* @since : Create in 2023-05-12
*/
@PostMapping(value = "/create")
public ResponseData create(@RequestBody Entrys entrys) {
return success(entrysService.create(entrys));
}
}

View File

@@ -0,0 +1,261 @@
package com.wx.application.core.controller;
import org.springframework.web.bind.annotation.*;
import com.wx.application.base.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import com.wx.application.core.service.FeedbackTypeService;
import com.wx.application.core.entity.FeedbackType;
import com.wx.application.base.ResponseData;
import java.util.Map;
import java.io.Serializable;
/**
* @description : FeedbackType 默认控制器,仅供生成器使用
* ---------------------------------
* @since 2023-05-12
*/
/*@Slf4j*/
@RestController("coreFeedbackTypeController")
@RequestMapping("//feedback-type")
public class FeedbackTypeController extends BaseController {
@Autowired
private FeedbackTypeService feedbackTypeService;
/**
* 定义一些通用的错误信息,供其他 api引用
* @apiDefine DefaultException
* @apiError {String} code 错误码
* @apiError {String} msg 错误描述
* @apiError {String} requestId 请求id标识
*
* @apiErrorExample Error-Response:
* HTTP/1.1 200
* {
* "code": "UNAUTHORIZED",
* "msg": "未授权,请先登录",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
*/
/**
* 定义标准对象请求的结构体,供api引用
* @apiDefine FeedbackTypeReq
* @apiParam {String} name
*/
/**
* 定义标准对象返回的结构体,供api引用
* @apiDefine FeedbackTypeResp
* @apiSuccess {String} name
*/
/**
* 定义标准头部,供api引用
* @apiDefine FeedbackTypeHeader
* @apiHeader {String} Authorization 用户授权token
* @apiHeaderExample {json} Header-Example:
* {
* "Authorization": "Bearer 1eyJhbGciOiJIUzI1NiJ9....tzNK43MPVQWYYhDwihCAZa88zXzar7KLdgiBBDuUpBM",
* }
*/
/**
*
* @api {post} //feedback-type/query_unique 通过条件查询对象
* @apiName 通过条件查询对象
* @apiGroup FeedbackType
*
* @apiUse FeedbackTypeHeader
* @apiUse FeedbackTypeResp
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "data": {
"name": null,
* },
* "code": "SUCCESS",
* "msg": "请求成功",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
* @apiUse DefaultException
*
* @description : 通过条件查询对象
* 仅查询第一条
* ---------------------------------
* @author : zj
* @since : Create in 2023-05-12
*/
@PostMapping(value = "/query_unique")
public ResponseData queryUnique(@RequestBody Map feedbackTypeQ) {
return success(feedbackTypeService.queryUnique(feedbackTypeQ));
}
/**
*
* @api {post} //feedback-type/query_pages 通过条件分页查询列表
* @apiName 通过条件分页查询列表
* @apiGroup FeedbackType
*
* @apiUse FeedbackTypeHeader
* @apiUse FeedbackTypeResp
* @apiSuccess {Long} total 总数
* @apiSuccess {Long} size 分页大小
* @apiSuccess {Long} current 当前页
* @apiSuccess {Long} orders 排序
* @apiSuccess {Long} pages 总页数
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "data": {
* "records": [{
"name": null, * }],
* "total": 1,
* "size": 10,
* "current": 1,
* "orders": [],
* "searchCount": true,
* "pages": 1
* "code": "SUCCESS",
* "msg": "请求成功",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
* @apiUse DefaultException
*
* @description : 通过条件分页查询列表
* 默认第一页 分页长度为10
* ---------------------------------
* @author : zj
* @since : Create in 2023-05-12
*/
@PostMapping(value = "/query_pages")
public ResponseData queryPages(@RequestBody Map feedbackTypeQ) {
return success(feedbackTypeService.queryPage(feedbackTypeQ));
}
/**
*
* @api {post} //feedback-type/query_list 通过条件查询列表
* @apiName 通过条件查询列表
* @apiGroup FeedbackType
*
* @apiUse FeedbackTypeHeader
* @apiUse FeedbackTypeResp
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "data": [{
"name": null,
* }],
* "code": "SUCCESS",
* "msg": "请求成功",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
* @apiUse DefaultException
*
* @description : 通过条件查询列表
* 不分页直接返回list
* ---------------------------------
* @author : zj
* @since : Create in 2023-05-12
*/
@PostMapping(value = "/query_list")
public ResponseData queryList(@RequestBody Map feedbackTypeQ) {
return success(feedbackTypeService.queryList(feedbackTypeQ));
}
/**
*
* @api {post} //feedback-type/remove/:id 通过id删除单个记录
* @apiName 通过id删除单个记录
* @apiGroup FeedbackType
*
* @apiUse FeedbackTypeHeader
* @apiParam {PK} id 记录主键
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "data": true,
* "code": "SUCCESS",
* "msg": "请求成功",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
* @apiUse DefaultException
*
* @description : 通过id删除单个记录
* ---------------------------------
* @author : zj
* @since : Create in 2023-05-12
*/
@PostMapping(value = "/remove/{id}")
public ResponseData remove(@PathVariable("id") Serializable id) {
return success(feedbackTypeService.remove(id));
}
/**
*
* @api {post} //feedback-type/modify 通过id更新单个记录
* @apiName 通过id更新单个记录
* @apiGroup FeedbackType
*
* @apiUse FeedbackTypeHeader
* @apiParam {PK} id 记录主键
* @apiUse FeedbackTypeReq
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "data": true,
* "code": "SUCCESS",
* "msg": "请求成功",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
* @apiUse DefaultException
*
* @description : 通过id更新单个记录
* ---------------------------------
* @author : zj
* @since : Create in 2023-05-12
*/
@PostMapping(value = "/modify")
public ResponseData modify(@RequestBody FeedbackType feedbackType) {
return success(feedbackTypeService.modify(feedbackType));
}
/**
*
* @api {post} //feedback-type/create 新增
* @apiName 新增
* @apiGroup FeedbackType
*
* @apiUse FeedbackTypeHeader
* @apiUse FeedbackTypeReq
* @apiSuccessExample Success-Response:
* HTTP/1.1 200 OK
* {
* "data": true,
* "code": "SUCCESS",
* "msg": "请求成功",
* "requestId": "163e2f67-5306-4b10-bcbe-a1579d589446"
* }
*
* @apiUse DefaultException
*
* @description : 新增
* ---------------------------------
* @author : zj
* @since : Create in 2023-05-12
*/
@PostMapping(value = "/create")
public ResponseData create(@RequestBody FeedbackType feedbackType) {
return success(feedbackTypeService.create(feedbackType));
}
}

View File

@@ -0,0 +1,31 @@
package com.wx.application.core.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.wx.application.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author zj
* @since 2023-05-12
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("re_entrys")
public class Entrys extends BaseEntity<Long> {
private String fid;
private Boolean isHidden;
private String categories;
private String labels;
private String description;
}

View File

@@ -0,0 +1,27 @@
package com.wx.application.core.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.wx.application.base.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author zj
* @since 2023-05-12
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("re_feedback_type")
public class FeedbackType extends BaseEntity<Long> {
private String name;
}

View File

@@ -0,0 +1,18 @@
package com.wx.application.core.mapper;
import com.wx.application.core.entity.Entrys;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper 接口
* </p>
*
* @author zj
* @since 2023-05-12
*/
@Repository
public interface EntrysMapper extends BaseMapper<Entrys> {
}

View File

@@ -0,0 +1,18 @@
package com.wx.application.core.mapper;
import com.wx.application.core.entity.FeedbackType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper 接口
* </p>
*
* @author zj
* @since 2023-05-12
*/
@Repository
public interface FeedbackTypeMapper extends BaseMapper<FeedbackType> {
}

View File

@@ -0,0 +1,28 @@
package com.wx.application.core.service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.wx.application.core.entity.Entrys;
import com.wx.application.base.BaseService;
import com.wx.application.core.mapper.EntrysMapper;
/**
* <p>
* 服务类
* </p>
*
* @author zj
* @since 2023-05-12
*/
/*@Slf4j*/
@Service("coreEntrysService")
@Transactional
public class EntrysService extends BaseService<Entrys, EntrysMapper> {
@Autowired
EntrysMapper baseMapper;
}

View File

@@ -0,0 +1,28 @@
package com.wx.application.core.service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.wx.application.core.entity.FeedbackType;
import com.wx.application.base.BaseService;
import com.wx.application.core.mapper.FeedbackTypeMapper;
/**
* <p>
* 服务类
* </p>
*
* @author zj
* @since 2023-05-12
*/
/*@Slf4j*/
@Service("coreFeedbackTypeService")
@Transactional
public class FeedbackTypeService extends BaseService<FeedbackType, FeedbackTypeMapper> {
@Autowired
FeedbackTypeMapper baseMapper;
}

View File

@@ -0,0 +1,58 @@
package com.wx.application.gorse4j;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Feedback {
private String feedbackType;
private String userId;
private String itemId;
private String timestamp;
public Feedback() {
}
public Feedback(String feedbackType, String userId, String itemId, String timestamp) {
this.feedbackType = feedbackType;
this.userId = userId;
this.itemId = itemId;
this.timestamp = timestamp;
}
@JsonProperty("FeedbackType")
public String getFeedbackType() {
return feedbackType;
}
@JsonProperty("UserId")
public String getUserId() {
return userId;
}
@JsonProperty("ItemId")
public String getItemId() {
return itemId;
}
@JsonProperty("Timestamp")
public String getTimestamp() {
return timestamp;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Feedback feedback = (Feedback) o;
return Objects.equals(feedbackType, feedback.feedbackType) && Objects.equals(userId, feedback.userId) && Objects.equals(itemId, feedback.itemId) && Objects.equals(timestamp, feedback.timestamp);
}
@Override
public int hashCode() {
return Objects.hash(feedbackType, userId, itemId, timestamp);
}
}

View File

@@ -0,0 +1,83 @@
package com.wx.application.gorse4j;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
public class Gorse {
private final String endpoint;
private final String apiKey;
public static void main(String[] args) throws IOException {
// Create a client.
Gorse client = new Gorse("http://43.139.83.67:8088/", "");
System.out.println(client.getRecommend("1265177464"));
}
public Gorse(String endpoint, String apiKey) {
this.endpoint = endpoint;
this.apiKey = apiKey;
}
public RowAffected insertUser(User user) throws IOException {
return this.request("POST", this.endpoint + "/api/user", user, RowAffected.class);
}
public User getUser(String userId) throws IOException {
return this.request("GET", this.endpoint + "/api/user/" + userId, null, User.class);
}
public RowAffected deleteUser(String userId) throws IOException {
return this.request("DELETE", this.endpoint + "/api/user/" + userId, null, RowAffected.class);
}
public RowAffected insertItem(Item item) throws IOException {
return this.request("POST", this.endpoint + "/api/item", item, RowAffected.class);
}
public Item getItem(String itemId) throws IOException {
return this.request("GET", this.endpoint + "/api/item/" + itemId, null, Item.class);
}
public RowAffected deleteItem(String itemId) throws IOException {
return this.request("DELETE", this.endpoint + "/api/item/" + itemId, null, RowAffected.class);
}
public RowAffected insertFeedback(List<Feedback> feedbacks) throws IOException {
return this.request("POST", this.endpoint + "/api/feedback", feedbacks, RowAffected.class);
}
public List<Feedback> listFeedback(String userId, String feedbackType) throws IOException {
return Arrays.asList(this.request("GET", this.endpoint + "/api/user/" + userId + "/feedback/" + feedbackType, null, Feedback[].class));
}
public List<String> getRecommend(String userId) throws IOException {
return Arrays.asList(this.request("GET", this.endpoint + "/api/recommend/" + userId, null, String[].class));
}
private <Request, Response> Response request(String method, String url, Request request, Class<Response> responseClass) throws IOException {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setRequestMethod(method);
connection.setRequestProperty("X-API-Key", this.apiKey);
connection.setRequestProperty("Content-Type", "application/json");
// Send request
ObjectMapper mapper = new ObjectMapper();
if (request != null) {
connection.setDoOutput(true);
String requestBody = mapper.writeValueAsString(request);
DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
outputStream.write(requestBody.getBytes());
outputStream.close();
}
// Get Response
InputStream inputStream = connection.getInputStream();
return mapper.readValue(inputStream, responseClass);
}
}

View File

@@ -0,0 +1,71 @@
package com.wx.application.gorse4j;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Objects;
public class Item {
private String itemId;
private Boolean isHidden;
private List<String> labels;
private List<String> categories;
private String timestamp;
private String comment;
public Item() {
}
public Item(String itemId, Boolean isHidden, List<String> labels, List<String> categories, String timestamp, String comment) {
this.itemId = itemId;
this.isHidden = isHidden;
this.labels = labels;
this.categories = categories;
this.timestamp = timestamp;
this.comment = comment;
}
@JsonProperty("ItemId")
public String getItemId() {
return itemId;
}
@JsonProperty("IsHidden")
public Boolean getIsHidden() {
return isHidden;
}
@JsonProperty("Labels")
public List<String> getLabels() {
return labels;
}
@JsonProperty("Categories")
public List<String> getCategories() {
return categories;
}
@JsonProperty("Timestamp")
public String getTimestamp() {
return timestamp;
}
@JsonProperty("Comment")
public String getComment() {
return comment;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Item item = (Item) o;
return Objects.equals(itemId, item.itemId) && Objects.equals(isHidden, item.isHidden) && Objects.equals(labels, item.labels) && Objects.equals(categories, item.categories) && Objects.equals(timestamp, item.timestamp) && Objects.equals(comment, item.comment);
}
@Override
public int hashCode() {
return Objects.hash(itemId, isHidden, labels, categories, timestamp, comment);
}
}

View File

@@ -0,0 +1,22 @@
package com.wx.application.gorse4j;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
public class RowAffected {
private int rowAffected;
public RowAffected() {
}
public RowAffected(int rowAffected) {
this.rowAffected = rowAffected;
}
@JsonProperty("RowAffected")
public int getRowAffected() {
return rowAffected;
}
}

View File

@@ -0,0 +1,19 @@
package com.wx.application.gorse4j;
import com.fasterxml.jackson.annotation.JsonProperty;
public class Score {
private String id;
private double score;
@JsonProperty("Id")
public String getId() {
return id;
}
@JsonProperty("Score")
public double getScore() {
return score;
}
}

View File

@@ -0,0 +1,45 @@
package com.wx.application.gorse4j;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Objects;
@JsonIgnoreProperties(ignoreUnknown = true)
public class User {
private String userId;
private List<String> labels;
public User() {
}
public User(String userId, List<String> labels) {
this.userId = userId;
this.labels = labels;
}
@JsonProperty("UserId")
public String getUserId() {
return userId;
}
@JsonProperty("Labels")
public List<String> getLabels() {
return labels;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return Objects.equals(userId, user.userId) && Objects.equals(labels, user.labels);
}
@Override
public int hashCode() {
return Objects.hash(userId, labels);
}
}

View File

@@ -54,11 +54,11 @@ public class DefaultGenerator {
// TODO 数据源配置 // TODO 数据源配置
DataSourceConfig dsc = new DataSourceConfig(); DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://118.25.104.98:3306/dn_nebula?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=CONVERT_TO_NULL"); dsc.setUrl("jdbc:mysql://43.139.83.67:13306/recom-gorse?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=CONVERT_TO_NULL");
// dsc.setSchemaName("public"); // dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.cj.jdbc.Driver"); dsc.setDriverName("com.mysql.cj.jdbc.Driver");
dsc.setUsername("root"); dsc.setUsername("root");
dsc.setPassword("Whb123321"); dsc.setPassword("AJuSP7F7VTRvm7rk");
mpg.setDataSource(dsc); mpg.setDataSource(dsc);
// 包配置 // 包配置
@@ -151,7 +151,7 @@ public class DefaultGenerator {
strategy.setControllerMappingHyphenStyle(true); strategy.setControllerMappingHyphenStyle(true);
//TODO 表名前缀 //TODO 表名前缀
strategy.setTablePrefix("dn" + "_"); strategy.setTablePrefix("re" + "_");
mpg.setStrategy(strategy); mpg.setStrategy(strategy);
mpg.setTemplateEngine(new VelocityTemplateEngine()); mpg.setTemplateEngine(new VelocityTemplateEngine());
mpg.execute(); mpg.execute();

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wx.application.core.mapper.EntrysMapper">
</mapper>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wx.application.core.mapper.FeedbackTypeMapper">
</mapper>