diff --git a/pom.xml b/pom.xml index a96b86a..9a8e3b7 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,67 @@ 2.0.27 + + + + org.apache.commons + commons-math3 + 3.6.1 + + + + + + com.squareup.okhttp3 + okhttp + 4.12.0 + + + + + + com.hankcs.hanlp.restful + hanlp-restful + 0.0.12 + + + + + + + + + + + + + + + org.ujmp + ujmp-core + 0.3.0 + + + + org.jfree + jfreechart + 1.5.0 + + + + + com.hankcs + hanlp + portable-1.8.0 + + + + com.opencsv + opencsv + 5.7.0 + + + com.itextpdf itextpdf diff --git a/src/main/java/com/sztzjy/marketing/config/Constant.java b/src/main/java/com/sztzjy/marketing/config/Constant.java index ffa0431..8d37cc9 100644 --- a/src/main/java/com/sztzjy/marketing/config/Constant.java +++ b/src/main/java/com/sztzjy/marketing/config/Constant.java @@ -38,6 +38,21 @@ public class Constant { + public static final String COMMENT_EXTRACTION = "评论观点抽取"; + public static final String EMOTIONAL_TENDENCIES = "情感倾向分析"; + public static final String WORD_FREQUENCY = "词频分析"; + public static final String WORD_CLOUD = "词云分析"; + + + + + public static final String YHSXB = "用户属性表"; + public static final String YHDLHYB = "用户登录活跃表"; + public static final String YHXFNLB = "用户消费能力表"; + public static final String YHXWB = "用户行为表"; + public static final String YHPLB = "用户评论表"; + + diff --git a/src/main/java/com/sztzjy/marketing/controller/BigDataController.java b/src/main/java/com/sztzjy/marketing/controller/BigDataController.java index 8ff3537..761aa43 100644 --- a/src/main/java/com/sztzjy/marketing/controller/BigDataController.java +++ b/src/main/java/com/sztzjy/marketing/controller/BigDataController.java @@ -28,7 +28,7 @@ import java.util.UUID; * @author tz * @date 2024/6/12 10:48 */ -@Api(tags = "大数据") +@Api(tags = "大数据、人工智能实训任务") @RequestMapping("api/bigData") @RestController public class BigDataController { diff --git a/src/main/java/com/sztzjy/marketing/controller/StuDigitalMarketingModelController.java b/src/main/java/com/sztzjy/marketing/controller/StuDigitalMarketingModelController.java new file mode 100644 index 0000000..02f305a --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/controller/StuDigitalMarketingModelController.java @@ -0,0 +1,181 @@ +package com.sztzjy.marketing.controller; + +import com.sztzjy.marketing.annotation.AnonymousAccess; +import com.sztzjy.marketing.config.exception.handler.DigitalEconomyxception; +import com.sztzjy.marketing.entity.StuTrainingOperateStepExample; +import com.sztzjy.marketing.entity.StuTrainingOperateStepWithBLOBs; +import com.sztzjy.marketing.entity.dto.AssociationRulesDTO; +import com.sztzjy.marketing.entity.dto.ClusterAnalysisDTO; +import com.sztzjy.marketing.entity.dto.StatisticsDTO; +import com.sztzjy.marketing.service.StuDigitalMarketingModelService; +import com.sztzjy.marketing.util.ResultEntity; +import com.sztzjy.marketing.util.algorithm.Apriori; +import com.sztzjy.marketing.util.algorithm.KMeans; +import com.sztzjy.marketing.util.algorithm.LinearRegression; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.checkerframework.checker.units.qual.A; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.*; + +import static com.sztzjy.marketing.util.algorithm.KMeans.readIrisData; + +/** + * @author tz + * @date 2024/6/13 10:43 + */ +@Api(tags = "数字营销模型") +@RequestMapping("api/model") +@RestController +public class StuDigitalMarketingModelController { + + @Value("${file.path}") + private String filePath; + + @Resource + StuDigitalMarketingModelService modelService; + + @ApiOperation("选择指标--下拉框") + @PostMapping("/dropdownBox") + @AnonymousAccess + public ResultEntity dropdownBox(String userId) { + List list=modelService.dropdownBox(userId); + return new ResultEntity(HttpStatus.OK,"成功",list); + } + + @ApiOperation("选择指标--查看指标") + @PostMapping("/viewMetrics") + @AnonymousAccess + public ResultEntity viewMetrics(@ApiParam("用户ID") String userId, + @ApiParam("表格名") String tableName) { + List list=modelService.viewMetrics(userId,tableName); + return new ResultEntity(HttpStatus.OK,"成功",list); + } + + + @ApiOperation("选择指标--分析数据展示") + @PostMapping("/viewAnalyzeData") + @AnonymousAccess + public ResultEntity viewAnalyzeData(@ApiParam("用户ID") String userId, + @ApiParam("表格名") String tableName, + @ApiParam("指标列表") @RequestParam List fieldList) { + + return modelService.viewAnalyzeData(userId,tableName,fieldList); + } + + + + @ApiOperation("描述性统计") + @PostMapping("/descriptiveStatistics") + @AnonymousAccess + public ResultEntity descriptiveStatistics(@ApiParam("数据集、需要计算的方式、用户ID")@RequestBody StatisticsDTO statisticsDTO) { + + Map> map = statisticsDTO.getMap(); + List statistic = statisticsDTO.getStatistic(); + String userId = statisticsDTO.getUserId(); + + return modelService.descriptiveStatistics(map,statistic,userId); + } + + + @ApiOperation("聚类分析") + @PostMapping("/clusterAnalysis") + @AnonymousAccess + public ResultEntity clusterAnalysis(@ApiParam("簇数") Integer k, + @ApiParam("最大迭代次数") Integer t, + @ApiParam("最大迭代次数") String userId, + @RequestParam(required = false) @RequestPart MultipartFile file) { + +// //验证文件类型 +// if (!file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xls") && !file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")).equals(".xlsx")) { +// return new ResultEntity(HttpStatus.ACCEPTED, "文件类型有误!请上传Excel文件"); +// } + + List irisData = readIrisData(file); + + //获取数据集 + KMeans kMeans = new KMeans(k, t, irisData); + List> clusters = kMeans.cluster(); + + + //封装成map + + //数据集 + Map> dataSetMap=new HashMap<>(); + for (int i = 0; i < clusters.size(); i++) { + dataSetMap.put(i,clusters.get(i)); + } + + //质心 + Map> centroidMap=new HashMap<>(); + List centroids = kMeans.getCentroids(); + for (int i = 0; i < centroids.size(); i++) { + centroidMap.put(i, Collections.singletonList(centroids.get(i))); + } + + ClusterAnalysisDTO clusterAnalysisDTO=new ClusterAnalysisDTO(); + + clusterAnalysisDTO.setDataSet(dataSetMap); + clusterAnalysisDTO.setCentroid(centroidMap); + + return new ResultEntity(HttpStatus.OK,clusterAnalysisDTO); + } + + + + @ApiOperation("关联规则挖掘") + @PostMapping("/apriori") + @AnonymousAccess + public ResultEntity apriori(@ApiParam("最小支持度阀值") double support, + @ApiParam("最小置信度") double confidence, + @ApiParam("用户ID") String userId, + @RequestParam(required = false) @RequestPart MultipartFile file) { + + + //初始化事务数据库、项目集、候选集再进行剪枝 + Apriori.init(file,support); + + //迭代求出最终的候选频繁集 + Apriori.iteration(Apriori.C,Apriori.L,support); + + //根据最终的关联集,根据公式计算出各个关联事件 + List connection = Apriori.connection(confidence); + + + return new ResultEntity(HttpStatus.OK,"成功",connection); + } + + + @ApiOperation("回归分析") + @PostMapping("/regressionAnalysis") + @AnonymousAccess + public ResultEntity regressionAnalysis(@ApiParam("自变量X") double[] x, + @ApiParam("因变量Y") double[] y, + @ApiParam("用户ID") String userId) { + // 创建线性回归模型 + LinearRegression regression=new LinearRegression(); + regression.fit(x,y); + + + return new ResultEntity(HttpStatus.OK,"成功",regression); + } + + + @ApiOperation("情感分析/文本挖掘") + @PostMapping("/emotionalAnalysis") + @AnonymousAccess + public ResultEntity emotionalAnalysis(@ApiParam("用户ID") String userId, + @ApiParam("模型类别") String modelType, + @ApiParam("输入内容") String content) throws IOException { + + return modelService.emotionalAnalysis(userId,modelType,content); + } +} diff --git a/src/main/java/com/sztzjy/marketing/controller/Test.java b/src/main/java/com/sztzjy/marketing/controller/Test.java new file mode 100644 index 0000000..d5d9432 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/controller/Test.java @@ -0,0 +1,81 @@ +package com.sztzjy.marketing.controller; + +import com.hankcs.hanlp.HanLP; +import com.hankcs.hanlp.restful.HanLPClient; +import com.hankcs.hanlp.seg.common.Term; +import com.sztzjy.marketing.util.algorithm.LogisticRegression; +import com.sztzjy.marketing.util.algorithm.TrainDataSet; +import okhttp3.*; +import java.io.IOException; +import java.util.*; + +/** + * @author tz + * @date 2024/6/17 17:38 + */ +public class Test { + +// static final String content="服务态度很好,环境也不错,就是点歌系统不太好用。"; +// +// static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build(); +// +// public static void main(String []args) throws IOException { +// MediaType mediaType = MediaType.parse("application/json"); +// RequestBody body = RequestBody.create(mediaType, "{\"text\":\""+content+"\"}"); +// Request request = new Request.Builder() +// .url("https://aip.baidubce.com/rpc/2.0/nlp/v2/comment_tag?access_token=24.88968c130db3ca9f266907b5004bec8f.2592000.1721270821.282335-83957582&charset=UTF-8") +// .method("POST", body) +// .addHeader("Content-Type", "application/json") +// .addHeader("Accept", "application/json") +// .build(); +// Response response = HTTP_CLIENT.newCall(request).execute(); +// System.out.println(response.body().string()); +// +// } + + +// public static void main(String[] args) throws IOException { +// +// +//// HanLPClient HanLP = new HanLPClient("https://www.hanlp.com/hanlp/v21/redirect", "66713f44eaf65b7b456a5dec","zh",20); // auth不填则匿名,zh中文,mul多语种 +// +// +// // 初始化文本 +// String text = "据DigiTimes报道,在上海疫情趋缓,防疫管控开始放松后,苹果供应商广达正在逐步恢复其中国工厂的MacBook产品生产。\n" + +// " 据供应链消息人士称,生产厂的订单拉动情况正在慢慢转强,这会提高MacBook Pro机型的供应量,并缩短苹果客户在过去几周所经历的延长交货时间。\n" + +// " 仍有许多苹果笔记本用户在等待3月和4月订购的MacBook Pro机型到货,由于苹果的供应问题,他们的发货时间被大大推迟了。\n" + +// " 据分析师郭明錤表示,广达是高端MacBook Pro的唯一供应商,自防疫封控依赖,MacBook Pro大部分型号交货时间增加了三到五周,\n" + +// " 一些高端定制型号的MacBook Pro配置要到6月底到7月初才能交货"; +// // 使用 HanLP 分词 +// List terms = HanLP.segment(text); +// // 创建词汇表 +// Map wordCount = new HashMap<>(); +// // 统计词频 +// +// // 创建计数器 +// int count = 0; +// for (Term term : terms) { +// String word = term.word.trim(); // 去除空格 +// if(!word.isEmpty()){ +// count++; +// if (wordCount.containsKey(word)) { +// wordCount.put(word, wordCount.get(word) + 1); +// } else { +// wordCount.put(word, 1); +// } +// } +// if (count >= 200) { // 达到200个关键词时结束统计 +// break; +// } +// } +// // 将词汇表转换为列表,便于排序 +// List> wordList = new ArrayList<>(wordCount.entrySet()); +// // 按词频排序 +// wordList.sort((o1, o2) -> o2.getValue().compareTo(o1.getValue())); +// // 输出结果 +// for (Map.Entry entry : wordList) { +// System.out.println(entry.getKey() + ": " + entry.getValue()); +// } +// } + +} diff --git a/src/main/java/com/sztzjy/marketing/entity/StuTableName.java b/src/main/java/com/sztzjy/marketing/entity/StuTableName.java new file mode 100644 index 0000000..b41b5d5 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/entity/StuTableName.java @@ -0,0 +1,66 @@ +package com.sztzjy.marketing.entity; + +import java.util.Date; + +import io.swagger.annotations.ApiModelProperty; +/** + * + * @author whb + * stu_table_name + */ +public class StuTableName { + @ApiModelProperty("ID") + private Integer id; + + @ApiModelProperty("用户ID") + private String userId; + + @ApiModelProperty("表格名") + private String tableName; + + @ApiModelProperty("创建时间") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId == null ? null : userId.trim(); + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName == null ? null : tableName.trim(); + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/marketing/entity/StuTableNameExample.java b/src/main/java/com/sztzjy/marketing/entity/StuTableNameExample.java new file mode 100644 index 0000000..84c9c31 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/entity/StuTableNameExample.java @@ -0,0 +1,520 @@ +package com.sztzjy.marketing.entity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class StuTableNameExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public StuTableNameExample() { + oredCriteria = new ArrayList<>(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(String value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(String value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(String value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(String value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(String value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(String value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLike(String value) { + addCriterion("user_id like", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotLike(String value) { + addCriterion("user_id not like", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(String value1, String value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(String value1, String value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andTableNameIsNull() { + addCriterion("table_name is null"); + return (Criteria) this; + } + + public Criteria andTableNameIsNotNull() { + addCriterion("table_name is not null"); + return (Criteria) this; + } + + public Criteria andTableNameEqualTo(String value) { + addCriterion("table_name =", value, "tableName"); + return (Criteria) this; + } + + public Criteria andTableNameNotEqualTo(String value) { + addCriterion("table_name <>", value, "tableName"); + return (Criteria) this; + } + + public Criteria andTableNameGreaterThan(String value) { + addCriterion("table_name >", value, "tableName"); + return (Criteria) this; + } + + public Criteria andTableNameGreaterThanOrEqualTo(String value) { + addCriterion("table_name >=", value, "tableName"); + return (Criteria) this; + } + + public Criteria andTableNameLessThan(String value) { + addCriterion("table_name <", value, "tableName"); + return (Criteria) this; + } + + public Criteria andTableNameLessThanOrEqualTo(String value) { + addCriterion("table_name <=", value, "tableName"); + return (Criteria) this; + } + + public Criteria andTableNameLike(String value) { + addCriterion("table_name like", value, "tableName"); + return (Criteria) this; + } + + public Criteria andTableNameNotLike(String value) { + addCriterion("table_name not like", value, "tableName"); + return (Criteria) this; + } + + public Criteria andTableNameIn(List values) { + addCriterion("table_name in", values, "tableName"); + return (Criteria) this; + } + + public Criteria andTableNameNotIn(List values) { + addCriterion("table_name not in", values, "tableName"); + return (Criteria) this; + } + + public Criteria andTableNameBetween(String value1, String value2) { + addCriterion("table_name between", value1, value2, "tableName"); + return (Criteria) this; + } + + public Criteria andTableNameNotBetween(String value1, String value2) { + addCriterion("table_name not between", value1, value2, "tableName"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/marketing/entity/StuUserBehavior.java b/src/main/java/com/sztzjy/marketing/entity/StuUserBehavior.java new file mode 100644 index 0000000..2c0c926 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/entity/StuUserBehavior.java @@ -0,0 +1,188 @@ +package com.sztzjy.marketing.entity; + +import java.util.Date; + +import io.swagger.annotations.ApiModelProperty; +/** + * 用户行为表 + * + * @author whb + * stu_user_behavior + */ +public class StuUserBehavior { + @ApiModelProperty("id") + private Integer id; + + @ApiModelProperty("用户ID") + private String userId; + + @ApiModelProperty("登录名") + private String loginName; + + @ApiModelProperty("用户名") + private String userName; + + @ApiModelProperty("学号") + private String studentId; + + @ApiModelProperty("班级") + private String stuClass; + + @ApiModelProperty("专业") + private String major; + + @ApiModelProperty("学校") + private String school; + + @ApiModelProperty("角色名称") + private String roleName; + + @ApiModelProperty("商品名字") + private String goodsName; + + @ApiModelProperty("商品类型") + private String goodsType; + + @ApiModelProperty("商品小类") + private String goodsSubcategories; + + @ApiModelProperty("用户行为类型") + private String userBehaviorType; + + @ApiModelProperty("行为日期") + private Date behaviorDate; + + @ApiModelProperty("创建时间(注册时间)") + private Date createTime; + + @ApiModelProperty("更新时间") + private Date updateTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId == null ? null : userId.trim(); + } + + public String getLoginName() { + return loginName; + } + + public void setLoginName(String loginName) { + this.loginName = loginName == null ? null : loginName.trim(); + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName == null ? null : userName.trim(); + } + + public String getStudentId() { + return studentId; + } + + public void setStudentId(String studentId) { + this.studentId = studentId == null ? null : studentId.trim(); + } + + public String getStuClass() { + return stuClass; + } + + public void setStuClass(String stuClass) { + this.stuClass = stuClass == null ? null : stuClass.trim(); + } + + public String getMajor() { + return major; + } + + public void setMajor(String major) { + this.major = major == null ? null : major.trim(); + } + + public String getSchool() { + return school; + } + + public void setSchool(String school) { + this.school = school == null ? null : school.trim(); + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName == null ? null : roleName.trim(); + } + + public String getGoodsName() { + return goodsName; + } + + public void setGoodsName(String goodsName) { + this.goodsName = goodsName == null ? null : goodsName.trim(); + } + + public String getGoodsType() { + return goodsType; + } + + public void setGoodsType(String goodsType) { + this.goodsType = goodsType == null ? null : goodsType.trim(); + } + + public String getGoodsSubcategories() { + return goodsSubcategories; + } + + public void setGoodsSubcategories(String goodsSubcategories) { + this.goodsSubcategories = goodsSubcategories == null ? null : goodsSubcategories.trim(); + } + + public String getUserBehaviorType() { + return userBehaviorType; + } + + public void setUserBehaviorType(String userBehaviorType) { + this.userBehaviorType = userBehaviorType == null ? null : userBehaviorType.trim(); + } + + public Date getBehaviorDate() { + return behaviorDate; + } + + public void setBehaviorDate(Date behaviorDate) { + this.behaviorDate = behaviorDate; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/marketing/entity/StuUserBehaviorExample.java b/src/main/java/com/sztzjy/marketing/entity/StuUserBehaviorExample.java new file mode 100644 index 0000000..19e167a --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/entity/StuUserBehaviorExample.java @@ -0,0 +1,1280 @@ +package com.sztzjy.marketing.entity; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class StuUserBehaviorExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public StuUserBehaviorExample() { + oredCriteria = new ArrayList<>(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Integer value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Integer value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Integer value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Integer value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Integer value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Integer value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Integer value1, Integer value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Integer value1, Integer value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andUserIdIsNull() { + addCriterion("user_id is null"); + return (Criteria) this; + } + + public Criteria andUserIdIsNotNull() { + addCriterion("user_id is not null"); + return (Criteria) this; + } + + public Criteria andUserIdEqualTo(String value) { + addCriterion("user_id =", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotEqualTo(String value) { + addCriterion("user_id <>", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThan(String value) { + addCriterion("user_id >", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdGreaterThanOrEqualTo(String value) { + addCriterion("user_id >=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThan(String value) { + addCriterion("user_id <", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLessThanOrEqualTo(String value) { + addCriterion("user_id <=", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdLike(String value) { + addCriterion("user_id like", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotLike(String value) { + addCriterion("user_id not like", value, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdIn(List values) { + addCriterion("user_id in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotIn(List values) { + addCriterion("user_id not in", values, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdBetween(String value1, String value2) { + addCriterion("user_id between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andUserIdNotBetween(String value1, String value2) { + addCriterion("user_id not between", value1, value2, "userId"); + return (Criteria) this; + } + + public Criteria andLoginNameIsNull() { + addCriterion("login_name is null"); + return (Criteria) this; + } + + public Criteria andLoginNameIsNotNull() { + addCriterion("login_name is not null"); + return (Criteria) this; + } + + public Criteria andLoginNameEqualTo(String value) { + addCriterion("login_name =", value, "loginName"); + return (Criteria) this; + } + + public Criteria andLoginNameNotEqualTo(String value) { + addCriterion("login_name <>", value, "loginName"); + return (Criteria) this; + } + + public Criteria andLoginNameGreaterThan(String value) { + addCriterion("login_name >", value, "loginName"); + return (Criteria) this; + } + + public Criteria andLoginNameGreaterThanOrEqualTo(String value) { + addCriterion("login_name >=", value, "loginName"); + return (Criteria) this; + } + + public Criteria andLoginNameLessThan(String value) { + addCriterion("login_name <", value, "loginName"); + return (Criteria) this; + } + + public Criteria andLoginNameLessThanOrEqualTo(String value) { + addCriterion("login_name <=", value, "loginName"); + return (Criteria) this; + } + + public Criteria andLoginNameLike(String value) { + addCriterion("login_name like", value, "loginName"); + return (Criteria) this; + } + + public Criteria andLoginNameNotLike(String value) { + addCriterion("login_name not like", value, "loginName"); + return (Criteria) this; + } + + public Criteria andLoginNameIn(List values) { + addCriterion("login_name in", values, "loginName"); + return (Criteria) this; + } + + public Criteria andLoginNameNotIn(List values) { + addCriterion("login_name not in", values, "loginName"); + return (Criteria) this; + } + + public Criteria andLoginNameBetween(String value1, String value2) { + addCriterion("login_name between", value1, value2, "loginName"); + return (Criteria) this; + } + + public Criteria andLoginNameNotBetween(String value1, String value2) { + addCriterion("login_name not between", value1, value2, "loginName"); + return (Criteria) this; + } + + public Criteria andUserNameIsNull() { + addCriterion("user_name is null"); + return (Criteria) this; + } + + public Criteria andUserNameIsNotNull() { + addCriterion("user_name is not null"); + return (Criteria) this; + } + + public Criteria andUserNameEqualTo(String value) { + addCriterion("user_name =", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameNotEqualTo(String value) { + addCriterion("user_name <>", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameGreaterThan(String value) { + addCriterion("user_name >", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameGreaterThanOrEqualTo(String value) { + addCriterion("user_name >=", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameLessThan(String value) { + addCriterion("user_name <", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameLessThanOrEqualTo(String value) { + addCriterion("user_name <=", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameLike(String value) { + addCriterion("user_name like", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameNotLike(String value) { + addCriterion("user_name not like", value, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameIn(List values) { + addCriterion("user_name in", values, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameNotIn(List values) { + addCriterion("user_name not in", values, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameBetween(String value1, String value2) { + addCriterion("user_name between", value1, value2, "userName"); + return (Criteria) this; + } + + public Criteria andUserNameNotBetween(String value1, String value2) { + addCriterion("user_name not between", value1, value2, "userName"); + return (Criteria) this; + } + + public Criteria andStudentIdIsNull() { + addCriterion("student_id is null"); + return (Criteria) this; + } + + public Criteria andStudentIdIsNotNull() { + addCriterion("student_id is not null"); + return (Criteria) this; + } + + public Criteria andStudentIdEqualTo(String value) { + addCriterion("student_id =", value, "studentId"); + return (Criteria) this; + } + + public Criteria andStudentIdNotEqualTo(String value) { + addCriterion("student_id <>", value, "studentId"); + return (Criteria) this; + } + + public Criteria andStudentIdGreaterThan(String value) { + addCriterion("student_id >", value, "studentId"); + return (Criteria) this; + } + + public Criteria andStudentIdGreaterThanOrEqualTo(String value) { + addCriterion("student_id >=", value, "studentId"); + return (Criteria) this; + } + + public Criteria andStudentIdLessThan(String value) { + addCriterion("student_id <", value, "studentId"); + return (Criteria) this; + } + + public Criteria andStudentIdLessThanOrEqualTo(String value) { + addCriterion("student_id <=", value, "studentId"); + return (Criteria) this; + } + + public Criteria andStudentIdLike(String value) { + addCriterion("student_id like", value, "studentId"); + return (Criteria) this; + } + + public Criteria andStudentIdNotLike(String value) { + addCriterion("student_id not like", value, "studentId"); + return (Criteria) this; + } + + public Criteria andStudentIdIn(List values) { + addCriterion("student_id in", values, "studentId"); + return (Criteria) this; + } + + public Criteria andStudentIdNotIn(List values) { + addCriterion("student_id not in", values, "studentId"); + return (Criteria) this; + } + + public Criteria andStudentIdBetween(String value1, String value2) { + addCriterion("student_id between", value1, value2, "studentId"); + return (Criteria) this; + } + + public Criteria andStudentIdNotBetween(String value1, String value2) { + addCriterion("student_id not between", value1, value2, "studentId"); + return (Criteria) this; + } + + public Criteria andStuClassIsNull() { + addCriterion("stu_class is null"); + return (Criteria) this; + } + + public Criteria andStuClassIsNotNull() { + addCriterion("stu_class is not null"); + return (Criteria) this; + } + + public Criteria andStuClassEqualTo(String value) { + addCriterion("stu_class =", value, "stuClass"); + return (Criteria) this; + } + + public Criteria andStuClassNotEqualTo(String value) { + addCriterion("stu_class <>", value, "stuClass"); + return (Criteria) this; + } + + public Criteria andStuClassGreaterThan(String value) { + addCriterion("stu_class >", value, "stuClass"); + return (Criteria) this; + } + + public Criteria andStuClassGreaterThanOrEqualTo(String value) { + addCriterion("stu_class >=", value, "stuClass"); + return (Criteria) this; + } + + public Criteria andStuClassLessThan(String value) { + addCriterion("stu_class <", value, "stuClass"); + return (Criteria) this; + } + + public Criteria andStuClassLessThanOrEqualTo(String value) { + addCriterion("stu_class <=", value, "stuClass"); + return (Criteria) this; + } + + public Criteria andStuClassLike(String value) { + addCriterion("stu_class like", value, "stuClass"); + return (Criteria) this; + } + + public Criteria andStuClassNotLike(String value) { + addCriterion("stu_class not like", value, "stuClass"); + return (Criteria) this; + } + + public Criteria andStuClassIn(List values) { + addCriterion("stu_class in", values, "stuClass"); + return (Criteria) this; + } + + public Criteria andStuClassNotIn(List values) { + addCriterion("stu_class not in", values, "stuClass"); + return (Criteria) this; + } + + public Criteria andStuClassBetween(String value1, String value2) { + addCriterion("stu_class between", value1, value2, "stuClass"); + return (Criteria) this; + } + + public Criteria andStuClassNotBetween(String value1, String value2) { + addCriterion("stu_class not between", value1, value2, "stuClass"); + return (Criteria) this; + } + + public Criteria andMajorIsNull() { + addCriterion("major is null"); + return (Criteria) this; + } + + public Criteria andMajorIsNotNull() { + addCriterion("major is not null"); + return (Criteria) this; + } + + public Criteria andMajorEqualTo(String value) { + addCriterion("major =", value, "major"); + return (Criteria) this; + } + + public Criteria andMajorNotEqualTo(String value) { + addCriterion("major <>", value, "major"); + return (Criteria) this; + } + + public Criteria andMajorGreaterThan(String value) { + addCriterion("major >", value, "major"); + return (Criteria) this; + } + + public Criteria andMajorGreaterThanOrEqualTo(String value) { + addCriterion("major >=", value, "major"); + return (Criteria) this; + } + + public Criteria andMajorLessThan(String value) { + addCriterion("major <", value, "major"); + return (Criteria) this; + } + + public Criteria andMajorLessThanOrEqualTo(String value) { + addCriterion("major <=", value, "major"); + return (Criteria) this; + } + + public Criteria andMajorLike(String value) { + addCriterion("major like", value, "major"); + return (Criteria) this; + } + + public Criteria andMajorNotLike(String value) { + addCriterion("major not like", value, "major"); + return (Criteria) this; + } + + public Criteria andMajorIn(List values) { + addCriterion("major in", values, "major"); + return (Criteria) this; + } + + public Criteria andMajorNotIn(List values) { + addCriterion("major not in", values, "major"); + return (Criteria) this; + } + + public Criteria andMajorBetween(String value1, String value2) { + addCriterion("major between", value1, value2, "major"); + return (Criteria) this; + } + + public Criteria andMajorNotBetween(String value1, String value2) { + addCriterion("major not between", value1, value2, "major"); + return (Criteria) this; + } + + public Criteria andSchoolIsNull() { + addCriterion("school is null"); + return (Criteria) this; + } + + public Criteria andSchoolIsNotNull() { + addCriterion("school is not null"); + return (Criteria) this; + } + + public Criteria andSchoolEqualTo(String value) { + addCriterion("school =", value, "school"); + return (Criteria) this; + } + + public Criteria andSchoolNotEqualTo(String value) { + addCriterion("school <>", value, "school"); + return (Criteria) this; + } + + public Criteria andSchoolGreaterThan(String value) { + addCriterion("school >", value, "school"); + return (Criteria) this; + } + + public Criteria andSchoolGreaterThanOrEqualTo(String value) { + addCriterion("school >=", value, "school"); + return (Criteria) this; + } + + public Criteria andSchoolLessThan(String value) { + addCriterion("school <", value, "school"); + return (Criteria) this; + } + + public Criteria andSchoolLessThanOrEqualTo(String value) { + addCriterion("school <=", value, "school"); + return (Criteria) this; + } + + public Criteria andSchoolLike(String value) { + addCriterion("school like", value, "school"); + return (Criteria) this; + } + + public Criteria andSchoolNotLike(String value) { + addCriterion("school not like", value, "school"); + return (Criteria) this; + } + + public Criteria andSchoolIn(List values) { + addCriterion("school in", values, "school"); + return (Criteria) this; + } + + public Criteria andSchoolNotIn(List values) { + addCriterion("school not in", values, "school"); + return (Criteria) this; + } + + public Criteria andSchoolBetween(String value1, String value2) { + addCriterion("school between", value1, value2, "school"); + return (Criteria) this; + } + + public Criteria andSchoolNotBetween(String value1, String value2) { + addCriterion("school not between", value1, value2, "school"); + return (Criteria) this; + } + + public Criteria andRoleNameIsNull() { + addCriterion("role_name is null"); + return (Criteria) this; + } + + public Criteria andRoleNameIsNotNull() { + addCriterion("role_name is not null"); + return (Criteria) this; + } + + public Criteria andRoleNameEqualTo(String value) { + addCriterion("role_name =", value, "roleName"); + return (Criteria) this; + } + + public Criteria andRoleNameNotEqualTo(String value) { + addCriterion("role_name <>", value, "roleName"); + return (Criteria) this; + } + + public Criteria andRoleNameGreaterThan(String value) { + addCriterion("role_name >", value, "roleName"); + return (Criteria) this; + } + + public Criteria andRoleNameGreaterThanOrEqualTo(String value) { + addCriterion("role_name >=", value, "roleName"); + return (Criteria) this; + } + + public Criteria andRoleNameLessThan(String value) { + addCriterion("role_name <", value, "roleName"); + return (Criteria) this; + } + + public Criteria andRoleNameLessThanOrEqualTo(String value) { + addCriterion("role_name <=", value, "roleName"); + return (Criteria) this; + } + + public Criteria andRoleNameLike(String value) { + addCriterion("role_name like", value, "roleName"); + return (Criteria) this; + } + + public Criteria andRoleNameNotLike(String value) { + addCriterion("role_name not like", value, "roleName"); + return (Criteria) this; + } + + public Criteria andRoleNameIn(List values) { + addCriterion("role_name in", values, "roleName"); + return (Criteria) this; + } + + public Criteria andRoleNameNotIn(List values) { + addCriterion("role_name not in", values, "roleName"); + return (Criteria) this; + } + + public Criteria andRoleNameBetween(String value1, String value2) { + addCriterion("role_name between", value1, value2, "roleName"); + return (Criteria) this; + } + + public Criteria andRoleNameNotBetween(String value1, String value2) { + addCriterion("role_name not between", value1, value2, "roleName"); + return (Criteria) this; + } + + public Criteria andGoodsNameIsNull() { + addCriterion("goods_name is null"); + return (Criteria) this; + } + + public Criteria andGoodsNameIsNotNull() { + addCriterion("goods_name is not null"); + return (Criteria) this; + } + + public Criteria andGoodsNameEqualTo(String value) { + addCriterion("goods_name =", value, "goodsName"); + return (Criteria) this; + } + + public Criteria andGoodsNameNotEqualTo(String value) { + addCriterion("goods_name <>", value, "goodsName"); + return (Criteria) this; + } + + public Criteria andGoodsNameGreaterThan(String value) { + addCriterion("goods_name >", value, "goodsName"); + return (Criteria) this; + } + + public Criteria andGoodsNameGreaterThanOrEqualTo(String value) { + addCriterion("goods_name >=", value, "goodsName"); + return (Criteria) this; + } + + public Criteria andGoodsNameLessThan(String value) { + addCriterion("goods_name <", value, "goodsName"); + return (Criteria) this; + } + + public Criteria andGoodsNameLessThanOrEqualTo(String value) { + addCriterion("goods_name <=", value, "goodsName"); + return (Criteria) this; + } + + public Criteria andGoodsNameLike(String value) { + addCriterion("goods_name like", value, "goodsName"); + return (Criteria) this; + } + + public Criteria andGoodsNameNotLike(String value) { + addCriterion("goods_name not like", value, "goodsName"); + return (Criteria) this; + } + + public Criteria andGoodsNameIn(List values) { + addCriterion("goods_name in", values, "goodsName"); + return (Criteria) this; + } + + public Criteria andGoodsNameNotIn(List values) { + addCriterion("goods_name not in", values, "goodsName"); + return (Criteria) this; + } + + public Criteria andGoodsNameBetween(String value1, String value2) { + addCriterion("goods_name between", value1, value2, "goodsName"); + return (Criteria) this; + } + + public Criteria andGoodsNameNotBetween(String value1, String value2) { + addCriterion("goods_name not between", value1, value2, "goodsName"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIsNull() { + addCriterion("goods_type is null"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIsNotNull() { + addCriterion("goods_type is not null"); + return (Criteria) this; + } + + public Criteria andGoodsTypeEqualTo(String value) { + addCriterion("goods_type =", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeNotEqualTo(String value) { + addCriterion("goods_type <>", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeGreaterThan(String value) { + addCriterion("goods_type >", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeGreaterThanOrEqualTo(String value) { + addCriterion("goods_type >=", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeLessThan(String value) { + addCriterion("goods_type <", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeLessThanOrEqualTo(String value) { + addCriterion("goods_type <=", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeLike(String value) { + addCriterion("goods_type like", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeNotLike(String value) { + addCriterion("goods_type not like", value, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeIn(List values) { + addCriterion("goods_type in", values, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeNotIn(List values) { + addCriterion("goods_type not in", values, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeBetween(String value1, String value2) { + addCriterion("goods_type between", value1, value2, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsTypeNotBetween(String value1, String value2) { + addCriterion("goods_type not between", value1, value2, "goodsType"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesIsNull() { + addCriterion("goods_subcategories is null"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesIsNotNull() { + addCriterion("goods_subcategories is not null"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesEqualTo(String value) { + addCriterion("goods_subcategories =", value, "goodsSubcategories"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesNotEqualTo(String value) { + addCriterion("goods_subcategories <>", value, "goodsSubcategories"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesGreaterThan(String value) { + addCriterion("goods_subcategories >", value, "goodsSubcategories"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesGreaterThanOrEqualTo(String value) { + addCriterion("goods_subcategories >=", value, "goodsSubcategories"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesLessThan(String value) { + addCriterion("goods_subcategories <", value, "goodsSubcategories"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesLessThanOrEqualTo(String value) { + addCriterion("goods_subcategories <=", value, "goodsSubcategories"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesLike(String value) { + addCriterion("goods_subcategories like", value, "goodsSubcategories"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesNotLike(String value) { + addCriterion("goods_subcategories not like", value, "goodsSubcategories"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesIn(List values) { + addCriterion("goods_subcategories in", values, "goodsSubcategories"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesNotIn(List values) { + addCriterion("goods_subcategories not in", values, "goodsSubcategories"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesBetween(String value1, String value2) { + addCriterion("goods_subcategories between", value1, value2, "goodsSubcategories"); + return (Criteria) this; + } + + public Criteria andGoodsSubcategoriesNotBetween(String value1, String value2) { + addCriterion("goods_subcategories not between", value1, value2, "goodsSubcategories"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeIsNull() { + addCriterion("user_behavior_type is null"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeIsNotNull() { + addCriterion("user_behavior_type is not null"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeEqualTo(String value) { + addCriterion("user_behavior_type =", value, "userBehaviorType"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeNotEqualTo(String value) { + addCriterion("user_behavior_type <>", value, "userBehaviorType"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeGreaterThan(String value) { + addCriterion("user_behavior_type >", value, "userBehaviorType"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeGreaterThanOrEqualTo(String value) { + addCriterion("user_behavior_type >=", value, "userBehaviorType"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeLessThan(String value) { + addCriterion("user_behavior_type <", value, "userBehaviorType"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeLessThanOrEqualTo(String value) { + addCriterion("user_behavior_type <=", value, "userBehaviorType"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeLike(String value) { + addCriterion("user_behavior_type like", value, "userBehaviorType"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeNotLike(String value) { + addCriterion("user_behavior_type not like", value, "userBehaviorType"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeIn(List values) { + addCriterion("user_behavior_type in", values, "userBehaviorType"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeNotIn(List values) { + addCriterion("user_behavior_type not in", values, "userBehaviorType"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeBetween(String value1, String value2) { + addCriterion("user_behavior_type between", value1, value2, "userBehaviorType"); + return (Criteria) this; + } + + public Criteria andUserBehaviorTypeNotBetween(String value1, String value2) { + addCriterion("user_behavior_type not between", value1, value2, "userBehaviorType"); + return (Criteria) this; + } + + public Criteria andBehaviorDateIsNull() { + addCriterion("behavior_date is null"); + return (Criteria) this; + } + + public Criteria andBehaviorDateIsNotNull() { + addCriterion("behavior_date is not null"); + return (Criteria) this; + } + + public Criteria andBehaviorDateEqualTo(Date value) { + addCriterion("behavior_date =", value, "behaviorDate"); + return (Criteria) this; + } + + public Criteria andBehaviorDateNotEqualTo(Date value) { + addCriterion("behavior_date <>", value, "behaviorDate"); + return (Criteria) this; + } + + public Criteria andBehaviorDateGreaterThan(Date value) { + addCriterion("behavior_date >", value, "behaviorDate"); + return (Criteria) this; + } + + public Criteria andBehaviorDateGreaterThanOrEqualTo(Date value) { + addCriterion("behavior_date >=", value, "behaviorDate"); + return (Criteria) this; + } + + public Criteria andBehaviorDateLessThan(Date value) { + addCriterion("behavior_date <", value, "behaviorDate"); + return (Criteria) this; + } + + public Criteria andBehaviorDateLessThanOrEqualTo(Date value) { + addCriterion("behavior_date <=", value, "behaviorDate"); + return (Criteria) this; + } + + public Criteria andBehaviorDateIn(List values) { + addCriterion("behavior_date in", values, "behaviorDate"); + return (Criteria) this; + } + + public Criteria andBehaviorDateNotIn(List values) { + addCriterion("behavior_date not in", values, "behaviorDate"); + return (Criteria) this; + } + + public Criteria andBehaviorDateBetween(Date value1, Date value2) { + addCriterion("behavior_date between", value1, value2, "behaviorDate"); + return (Criteria) this; + } + + public Criteria andBehaviorDateNotBetween(Date value1, Date value2) { + addCriterion("behavior_date not between", value1, value2, "behaviorDate"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/marketing/entity/dto/AssociationRulesDTO.java b/src/main/java/com/sztzjy/marketing/entity/dto/AssociationRulesDTO.java new file mode 100644 index 0000000..36f9dd6 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/entity/dto/AssociationRulesDTO.java @@ -0,0 +1,22 @@ +package com.sztzjy.marketing.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author tz + * @date 2024/6/20 8:51 + */ +@Data +public class AssociationRulesDTO { + @ApiModelProperty("关联") + private List correlation; + + @ApiModelProperty("被关联") + private List associated; + + @ApiModelProperty("置信度") + private double confidenceLevel; +} diff --git a/src/main/java/com/sztzjy/marketing/entity/dto/ClusterAnalysisDTO.java b/src/main/java/com/sztzjy/marketing/entity/dto/ClusterAnalysisDTO.java new file mode 100644 index 0000000..fb31a9f --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/entity/dto/ClusterAnalysisDTO.java @@ -0,0 +1,18 @@ +package com.sztzjy.marketing.entity.dto; + +import com.sztzjy.marketing.util.algorithm.KMeans; +import lombok.Data; + +import java.util.List; +import java.util.Map; + +/** + * @author tz + * @date 2024/6/14 10:12 + */ +@Data +public class ClusterAnalysisDTO { + private Map> dataSet; + + private Map> centroid; +} diff --git a/src/main/java/com/sztzjy/marketing/entity/dto/DescriptiveStatistics.java b/src/main/java/com/sztzjy/marketing/entity/dto/DescriptiveStatistics.java new file mode 100644 index 0000000..56342a3 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/entity/dto/DescriptiveStatistics.java @@ -0,0 +1,49 @@ +package com.sztzjy.marketing.entity.dto; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author tz + * @date 2024/6/21 9:51 + */ +@Data +public class DescriptiveStatistics { + @ApiModelProperty("平均数") + private double average; + + @ApiModelProperty("中位数") + private double median; + + @ApiModelProperty("众数") + private List mode; + + @ApiModelProperty("标准差") + private double standardDeviation; + + @ApiModelProperty("方差") + private double variance; + + @ApiModelProperty("标准误差") + private double standardError; + + @ApiModelProperty("峰度") + private double kurtosis; + + @ApiModelProperty("偏度") + private double skewness; + + @ApiModelProperty("最大值") + private double max; + + @ApiModelProperty("最小值") + private double min; + + @ApiModelProperty("求和") + private double summation; + + @ApiModelProperty("观测数") + private Integer observations; +} diff --git a/src/main/java/com/sztzjy/marketing/entity/dto/DescriptiveStatisticsDTO.java b/src/main/java/com/sztzjy/marketing/entity/dto/DescriptiveStatisticsDTO.java new file mode 100644 index 0000000..d51e802 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/entity/dto/DescriptiveStatisticsDTO.java @@ -0,0 +1,14 @@ +package com.sztzjy.marketing.entity.dto; + +import lombok.Data; + +/** + * @author tz + * @date 2024/6/21 10:00 + */ +@Data +public class DescriptiveStatisticsDTO { + private String field; + + private DescriptiveStatistics statistics; +} diff --git a/src/main/java/com/sztzjy/marketing/entity/dto/StatisticsDTO.java b/src/main/java/com/sztzjy/marketing/entity/dto/StatisticsDTO.java new file mode 100644 index 0000000..8b4136d --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/entity/dto/StatisticsDTO.java @@ -0,0 +1,17 @@ +package com.sztzjy.marketing.entity.dto; + +import lombok.Data; + +import java.util.List; +import java.util.Map; + +/** + * @author tz + * @date 2024/6/21 10:57 + */ +@Data +public class StatisticsDTO { + private Map> map; + private List statistic; + private String userId; +} diff --git a/src/main/java/com/sztzjy/marketing/entity/dto/WordFrequencyDTO.java b/src/main/java/com/sztzjy/marketing/entity/dto/WordFrequencyDTO.java new file mode 100644 index 0000000..2f06197 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/entity/dto/WordFrequencyDTO.java @@ -0,0 +1,14 @@ +package com.sztzjy.marketing.entity.dto; + +import lombok.Data; + +/** + * @author tz + * @date 2024/6/18 16:48 + */ +@Data +public class WordFrequencyDTO { + private String keyword; + + private Integer frequency; +} diff --git a/src/main/java/com/sztzjy/marketing/mapper/StuSelectIndicatorsMapper.java b/src/main/java/com/sztzjy/marketing/mapper/StuSelectIndicatorsMapper.java new file mode 100644 index 0000000..620d282 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/mapper/StuSelectIndicatorsMapper.java @@ -0,0 +1,31 @@ +package com.sztzjy.marketing.mapper; +import com.sztzjy.marketing.entity.StuUserAttribute; +import com.sztzjy.marketing.entity.StuUserBehavior; +import com.sztzjy.marketing.entity.StuUserConsumptionAbility; +import com.sztzjy.marketing.entity.StuUserLoginActive; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List;/** +* @author tz +* @date 2024/6/21 13:50 +*/ +@Mapper +public interface StuSelectIndicatorsMapper { + + + @Select("select COLUMN_NAME from information_schema.COLUMNS where table_name = 'stu_user_login_active'") + + List getYHDLHYB(); + + @Select("select COLUMN_NAME from information_schema.COLUMNS where table_name = 'stu_user_consumption_ability'") + List getYHXFNLB(); + + @Select("select COLUMN_NAME from information_schema.COLUMNS where table_name = 'stu_user_behavior'") + List getYHPLB(); + + @Select("select COLUMN_NAME from information_schema.COLUMNS where table_name = 'stu_user_attribute'") + List getYHSXB(); + +} diff --git a/src/main/java/com/sztzjy/marketing/mapper/StuTableNameMapper.java b/src/main/java/com/sztzjy/marketing/mapper/StuTableNameMapper.java new file mode 100644 index 0000000..6782456 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/mapper/StuTableNameMapper.java @@ -0,0 +1,37 @@ +package com.sztzjy.marketing.mapper; + +import com.sztzjy.marketing.entity.*; + +import java.util.List; +import java.util.Map; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +@Mapper +public interface StuTableNameMapper { + long countByExample(StuTableNameExample example); + + int deleteByExample(StuTableNameExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(StuTableName record); + + int insertSelective(StuTableName record); + + List selectByExample(StuTableNameExample example); + + StuTableName selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") StuTableName record, @Param("example") StuTableNameExample example); + + int updateByExample(@Param("record") StuTableName record, @Param("example") StuTableNameExample example); + + int updateByPrimaryKeySelective(StuTableName record); + + int updateByPrimaryKey(StuTableName record); + + List getTableName(String userId); + + List> selectByFields(List fieldList, String table); +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/marketing/mapper/StuUserBehaviorMapper.java b/src/main/java/com/sztzjy/marketing/mapper/StuUserBehaviorMapper.java new file mode 100644 index 0000000..f0dba2e --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/mapper/StuUserBehaviorMapper.java @@ -0,0 +1,32 @@ +package com.sztzjy.marketing.mapper; + +import com.sztzjy.marketing.entity.StuUserBehavior; +import com.sztzjy.marketing.entity.StuUserBehaviorExample; +import java.util.List; + +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +@Mapper +public interface StuUserBehaviorMapper { + long countByExample(StuUserBehaviorExample example); + + int deleteByExample(StuUserBehaviorExample example); + + int deleteByPrimaryKey(Integer id); + + int insert(StuUserBehavior record); + + int insertSelective(StuUserBehavior record); + + List selectByExample(StuUserBehaviorExample example); + + StuUserBehavior selectByPrimaryKey(Integer id); + + int updateByExampleSelective(@Param("record") StuUserBehavior record, @Param("example") StuUserBehaviorExample example); + + int updateByExample(@Param("record") StuUserBehavior record, @Param("example") StuUserBehaviorExample example); + + int updateByPrimaryKeySelective(StuUserBehavior record); + + int updateByPrimaryKey(StuUserBehavior record); +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/marketing/service/StuDigitalMarketingModelService.java b/src/main/java/com/sztzjy/marketing/service/StuDigitalMarketingModelService.java new file mode 100644 index 0000000..47a7fe9 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/service/StuDigitalMarketingModelService.java @@ -0,0 +1,25 @@ +package com.sztzjy.marketing.service; + +import com.sztzjy.marketing.util.ResultEntity; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * @author tz + * @date 2024/6/14 11:05 + */ +public interface StuDigitalMarketingModelService { + List dropdownBox(String userId); + + ResultEntity emotionalAnalysis(String userId, String modelType, String content) throws IOException; + + + ResultEntity descriptiveStatistics(Map> map, List statistic, String userId); + + List viewMetrics(String userId, String tableName); + + ResultEntity viewAnalyzeData(String userId, String tableName, List fieldList); +} diff --git a/src/main/java/com/sztzjy/marketing/service/impl/StuDigitalMarketingModelServiceImpl.java b/src/main/java/com/sztzjy/marketing/service/impl/StuDigitalMarketingModelServiceImpl.java new file mode 100644 index 0000000..675f7a2 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/service/impl/StuDigitalMarketingModelServiceImpl.java @@ -0,0 +1,288 @@ +package com.sztzjy.marketing.service.impl; + +import com.hankcs.hanlp.HanLP; +import com.hankcs.hanlp.seg.common.Term; +import com.sztzjy.marketing.config.Constant; +import com.sztzjy.marketing.entity.*; +import com.sztzjy.marketing.entity.dto.DescriptiveStatistics; +import com.sztzjy.marketing.entity.dto.DescriptiveStatisticsDTO; +import com.sztzjy.marketing.entity.dto.WordFrequencyDTO; +import com.sztzjy.marketing.mapper.StuSelectIndicatorsMapper; +import com.sztzjy.marketing.mapper.StuTableNameMapper; +import com.sztzjy.marketing.service.StuDigitalMarketingModelService; +import com.sztzjy.marketing.util.ResultEntity; +import com.sztzjy.marketing.util.algorithm.DescriptiveStatisticsUtil; +import okhttp3.*; +import org.checkerframework.checker.units.qual.C; +import org.geolatte.geom.M; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.*; + +/** + * @author tz + * @date 2024/6/14 11:05 + */ +@Service +public class StuDigitalMarketingModelServiceImpl implements StuDigitalMarketingModelService { + + private final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build(); + + + @Resource + StuTableNameMapper stuTableNameMapper; + + @Resource + StuSelectIndicatorsMapper indicatorsMapper; + + @Resource + StuTableNameMapper tableNameMapper; + @Override + public List dropdownBox(String userId) { + + List list=stuTableNameMapper.getTableName(userId); + + if(list.isEmpty()){ //设置默认值 + String[] arr={"用户属性表","用户登录活跃表","用户消费能力表","用户行为表","用户评论表"}; + + StuTableName stuTableName=new StuTableName(); + for (int i = 0; i < arr.length; i++) { + Integer uuid = UUID.randomUUID().toString().replaceAll("-", "").hashCode(); + uuid = uuid < 0 ? -uuid : uuid;//String.hashCode() 值会为空 + + stuTableName.setId(uuid); + stuTableName.setTableName(arr[i]); + stuTableName.setUserId(userId); + stuTableName.setCreateTime(new Date()); + + stuTableNameMapper.insert(stuTableName); + list.add(arr[i]); + } + } + return list; + } + + @Override + public ResultEntity emotionalAnalysis(String userId, String modelType, String content) throws IOException { + + String commentUrl = "https://aip.baidubce.com/rpc/2.0/nlp/v2/comment_tag?access_token=24.88968c130db3ca9f266907b5004bec8f.2592000.1721270821.282335-83957582&charset=UTF-8"; + String emoUrl="https://aip.baidubce.com/rpc/2.0/nlp/v1/sentiment_classify?access_token=24.88968c130db3ca9f266907b5004bec8f.2592000.1721270821.282335-83957582"; + + + MediaType mediaType = MediaType.parse("application/json"); + + if(modelType.equals(Constant.COMMENT_EXTRACTION)){ //评论观点抽取 + + RequestBody body = RequestBody.create(mediaType, "{\"text\":\""+content+"\",\"type\":8}"); + + Request request = new Request.Builder() + .url(commentUrl) + .method("POST", body) + .build(); + Response response = HTTP_CLIENT.newCall(request).execute(); + + if (response.body() != null) { + return new ResultEntity(HttpStatus.OK,"成功",response.body().string()); + } + + } + if(modelType.equals(Constant.EMOTIONAL_TENDENCIES)){ //情感倾向分析 + + RequestBody body = RequestBody.create(mediaType, "{\"text\":\""+content+"\"}"); + + Request request = new Request.Builder() + .url(emoUrl) + .method("POST", body) + .build(); + Response response = HTTP_CLIENT.newCall(request).execute(); + + if (response.body() != null) { + return new ResultEntity(HttpStatus.OK,"成功",response.body().string()); + } + + } + + + if(modelType.equals(Constant.WORD_FREQUENCY)){ //词频分析 + + // 使用 HanLP 分词 + List terms = HanLP.segment(content); + // 创建词汇表 + Map wordCount = new HashMap<>(); + // 统计词频 + + // 创建计数器 + int count = 0; + for (Term term : terms) { + String word = term.word.trim(); // 去除空格 + if(!word.isEmpty()){ + count++; + if (wordCount.containsKey(word)) { + wordCount.put(word, wordCount.get(word) + 1); + } else { + wordCount.put(word, 1); + } + } + if (count >= 200) { // 达到200个关键词时结束统计 + break; + } + } + // 将词汇表转换为列表,便于排序 + List> wordList = new ArrayList<>(wordCount.entrySet()); + // 按词频排序 + wordList.sort((o1, o2) -> o2.getValue().compareTo(o1.getValue())); + + List list=new ArrayList<>(); + + for (Map.Entry entry : wordList) { + WordFrequencyDTO frequencyDTO=new WordFrequencyDTO(); + frequencyDTO.setKeyword(entry.getKey()); + frequencyDTO.setFrequency(entry.getValue()); + list.add(frequencyDTO); + } + return new ResultEntity<>(HttpStatus.OK,"成功",list); + + } +// if(modelType.equals(Constant.WORD_CLOUD)){ //词云分析 +// +// } + return null; + } + + @Override + public ResultEntity descriptiveStatistics(Map> map, List statistic, String userId) { + + DescriptiveStatisticsUtil statisticsUtil=new DescriptiveStatisticsUtil(); + + List dtoList=new ArrayList<>(); + + for(String key: map.keySet()){ + DescriptiveStatisticsDTO statisticsDTO=new DescriptiveStatisticsDTO(); + statisticsDTO.setField(key); + + DescriptiveStatistics statistics=new DescriptiveStatistics(); + + for (int i = 0; i < statistic.size(); i++) { + if(statistic.get(i).equals("平均数")){ + double mean = statisticsUtil.getMean(map.get(key)); + statistics.setAverage(mean); + + } + if(statistic.get(i).equals("中位数")){ + double median = statisticsUtil.getMedian(map.get(key)); + statistics.setMedian(median); + + } + if(statistic.get(i).equals("众数")){ + List mode = statisticsUtil.getMode(map.get(key)); + statistics.setMode(mode); + + } + if(statistic.get(i).equals("标准差")){ + double standardDeviation = statisticsUtil.getStandardDeviation(map.get(key)); + statistics.setStandardDeviation(standardDeviation); + + } + if(statistic.get(i).equals("方差")){ + double variance = statisticsUtil.getVariance(map.get(key)); + statistics.setVariance(variance); + + } + if(statistic.get(i).equals("标准误差")){ + double standardError = statisticsUtil.getStandardError(map.get(key)); + statistics.setStandardError(standardError); + + } + if(statistic.get(i).equals("峰度")){ + double kurtosis = statisticsUtil.getKurtosis(map.get(key)); + statistics.setKurtosis(kurtosis); + + } + if(statistic.get(i).equals("偏度")){ + double skewness = statisticsUtil.getSkewness(map.get(key)); + statistics.setSkewness(skewness); + + } + if(statistic.get(i).equals("最大值")){ + double max = statisticsUtil.getMax(map.get(key)); + statistics.setMax(max); + + } + if(statistic.get(i).equals("最小值")){ + double min = statisticsUtil.getMin(map.get(key)); + statistics.setMin(min); + + } + if(statistic.get(i).equals("求和")){ + double sum = statisticsUtil.getSum(map.get(key)); + statistics.setSummation(sum); + + } + if(statistic.get(i).equals("观测数")){ + int count = statisticsUtil.getCount(map.get(key)); + statistics.setObservations(count); + } + + } + statisticsDTO.setStatistics(statistics); + + dtoList.add(statisticsDTO); + + } + return new ResultEntity(HttpStatus.OK,"成功",dtoList); + } + + @Override + public List viewMetrics(String userId, String tableName) { + List list=new ArrayList<>(); + + if(tableName.equals(Constant.YHSXB)){ + list=indicatorsMapper.getYHSXB(); + } + if(tableName.equals(Constant.YHDLHYB)){ + list=indicatorsMapper.getYHDLHYB(); + } + if(tableName.equals(Constant.YHXFNLB)){ + list=indicatorsMapper.getYHXFNLB(); + } + if(tableName.equals(Constant.YHPLB) || tableName.equals(Constant.YHXWB)){ + list=indicatorsMapper.getYHPLB(); + } + return list; + } + + @Override + public ResultEntity viewAnalyzeData(String userId, String tableName, List fieldList) { + + String table=null; + + + if(tableName.equals(Constant.YHSXB)){ //查询用户属性表 + table="stu_user_attribute"; + } + + if(tableName.equals(Constant.YHDLHYB)){ //查询用户登录活跃表 + table="stu_user_login_active"; + } + + if(tableName.equals(Constant.YHXFNLB)){ //查询用户消费能力表 + table="stu_user_consumption_ability"; + } + + if(tableName.equals(Constant.YHPLB) || tableName.equals(Constant.YHXWB)){ //查询用户评论或行为表 + table="stu_user_behavior"; + } + + List> attributes = tableNameMapper.selectByFields(fieldList,table); + + + +// List createTime = attributes.get("create_time"); + + return new ResultEntity(HttpStatus.OK,attributes); + } +} diff --git a/src/main/java/com/sztzjy/marketing/util/algorithm/Apriori.java b/src/main/java/com/sztzjy/marketing/util/algorithm/Apriori.java new file mode 100644 index 0000000..14ced86 --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/util/algorithm/Apriori.java @@ -0,0 +1,253 @@ +package com.sztzjy.marketing.util.algorithm; + +import com.sztzjy.marketing.entity.dto.AssociationRulesDTO; +import org.springframework.web.multipart.MultipartFile; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.util.*; + +public class Apriori { + +// private double min_support; //最小支持度 +// private double min_confident; //最小置信度 + //文件路径 +// static String filePath = "D:\\home\\marketing\\1.txt"; + static ArrayList> D = new ArrayList>();//事务数据库D + public static HashMap, Integer> C = new HashMap, Integer>();//项目集C + public static HashMap, Integer> L = new HashMap, Integer>();//候选集L + // 用于存取候选集每次计算结果(即存放所有的频繁项集L),最后计算关联规则,就不用再次遍历事务数据库。 + static HashMap, Integer> L_ALL = new HashMap, Integer>(); + //从文件中读取内容,返回事务集 + public static ArrayList> readTable(MultipartFile file){ + ArrayList> t = new ArrayList>(); + ArrayList t1 = null; + try { + InputStreamReader isr = new InputStreamReader(file.getInputStream()); + BufferedReader bf = new BufferedReader(isr); + String str = null; + while((str = bf.readLine()) != null) { + t1 = new ArrayList(); + String[] str1 = str.split(","); + for(int i = 1; i < str1.length ; i++) { + t1.add(str1[i]); + } + t.add(t1); + } + bf.close(); + isr.close(); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("文件读取失败!"); + } + System.out.println("\nD:"+t); + return t; + } + //剪枝步:从候选集C中删除小于最小支持度的,并放入频繁集L中 + public static void pruning(HashMap, Integer> C,HashMap, Integer> L,double min_support) { + L.clear(); + // 根据项目集生成候选集 + L.putAll(C); + // 删除少于最小支持度的元素 + ArrayList> delete_key = new ArrayList>(); + for (ArrayList key : L.keySet()) { + if (L.get(key) < min_support) { + delete_key.add(key); + } + } + for (int i = 0; i < delete_key.size(); i++) { + L.remove(delete_key.get(i)); + } + } + + /** + * 初始化事务数据库、项目集、候选集 + */ + public static void init(MultipartFile file,double min_support) { +// //将文件中的数据放入集合D中 + D = readTable(file); + // 扫描事务数据库。生成项目集,支持度=该元素在事务数据库出现的次数/事务数据库的事务数 + for (int i = 0; i < D.size(); i++) { + for (int j = 0; j < D.get(i).size(); j++) { + String[] e = { D.get(i).get(j) }; + //将数组e转化为List + ArrayList item = new ArrayList(Arrays.asList(e)); + //map中是否包含指定的键 + if (!C.containsKey(item)) { + C.put(item, 1); + //System.out.println(C.get(item)); + } else { + C.put(item, C.get(item) + 1); + //System.out.println(C.get(item)); + } + } + } + //System.out.println("D.size= "+D.size()); + pruning(C, L,min_support);// 剪枝 + //将频繁项集放入集合中 + L_ALL.clear(); + L_ALL.putAll(L); + } + + // 两个整数集求并集 + public static ArrayList arrayListUnion(ArrayList arraylist1, ArrayList arraylist2) { + ArrayList arraylist = new ArrayList(); + arraylist.addAll(arraylist1); + arraylist.addAll(arraylist2); + //将ArrayList转化为HashSet去掉重复元素,再将HashSet转换为ArrayList + arraylist = new ArrayList(new HashSet(arraylist)); + return arraylist; + } + + /** + * 迭代求出最终的候选频繁集 + * + * @param C + * 完成初始化的项目集 + * @param L + * 完成初始化的候选集 + * @return 最终的候选频繁集 + */ + public static HashMap, Integer> iteration(HashMap, Integer> C,HashMap, Integer> L,double min_support) { + HashMap, Integer> L_temp = new HashMap, Integer>();// 用于判断是否结束剪枝的临时变量 + String str = null; + int t = 1;// 迭代次数 + while (L.size() > 0) {// 一旦被剪枝后剪干净,剪枝之前则是最终要求的结果。 + t++; + L_temp.clear(); + L_temp.putAll(L); + // 一、连接步 + C.clear(); + // 1.将L中的项以一定的规则两两匹配 + ArrayList> L_key = new ArrayList>(L.keySet()); + for (int i = 0; i < L_key.size(); i++) { + for (int j = i + 1; j < L_key.size(); j++) { + ArrayList C_item = new ArrayList(); + C_item = new ArrayList(arrayListUnion(L_key.get(i), + L_key.get(j))); + if (C_item.size() == t) { + C.put(C_item, 0);// 频繁项集的所有非空子集都必须是频繁的 + } + } + } + // 2.通过扫描D,计算此项的支持度 + for (ArrayList key : C.keySet()) { + for (int i = 0; i < D.size(); i++) { + if (D.get(i).containsAll(key)) { + C.put(key, C.get(key) + 1 ); + } + } + } + str = C.toString(); + + System.out.println("候选"+t+"项集:C: \n"+C); + // 二、剪枝步 + pruning(C, L,min_support); + System.out.println("频繁"+t+"项集:L: \n"+L+"\n"); + str = L.toString(); + + //System.out.println("==="); + L_ALL.putAll(L); + } + return L_temp; + } + + // 求一个集合的所有子集 + public static ArrayList> getSubset(ArrayList L) { + if (L.size() > 0) { + ArrayList> result = new ArrayList>(); + for (int i = 0; i < Math.pow(2, L.size()); i++) {// 集合子集个数=2的该集合长度的乘方 + ArrayList subSet = new ArrayList(); + int index = i;// 索引从0一直到2的集合长度的乘方-1 + for (int j = 0; j < L.size(); j++) { + // 通过逐一位移,判断索引那一位是1,如果是,再添加此项 + if ((index & 1) == 1) {// 位与运算,判断最后一位是否为1 + subSet.add(L.get(j)); + } + index >>= 1;// 索引右移一位 + } + result.add(subSet); // 把子集存储起来 + } + return result; + } else { + return null; + } + } + + // 判断两个集合相交是否为空 + public static boolean intersectionIsNull(ArrayList l1, + ArrayList l2) { + Set s1 = new HashSet(l1); + Set s2 = new HashSet(l2); + + s1.retainAll(s2); + if (s1.size() > 0) { + return false; + } else { + return true; + } + } + + /** + * 根据最终的关联集,根据公式计算出各个关联事件 + */ + public static List connection(double min_confident) { + + List list=new ArrayList<>(); + + for (ArrayList key : L_ALL.keySet()) {// 对最终的关联集各个事件进行判断 + ArrayList> key_allSubset = getSubset(key); + //得到所有频繁集中每个集合的子集 + // System.out.println(key_allSubset); + for (int i = 0; i < key_allSubset.size(); i++) { + ArrayList item_pre = key_allSubset.get(i);//得到一个真子集 + if (0 < item_pre.size() && item_pre.size() < key.size()) {// 判断是否是非空真子集 + // 各个非空互补真子集之间形成关联事件 + double item_pre_support = L_ALL.get(item_pre);//得到真子集的支持度度 + //System.out.println("itempre="+item_pre_support); + for (int j = 0; j < key_allSubset.size(); j++) { + ArrayList item_post = key_allSubset.get(j); + if (0 < item_post.size() + && item_post.size() < key.size() + && arrayListUnion(item_pre, item_post).equals(key) + && intersectionIsNull(item_pre, item_post)) + //不相交的两个非空真子集,相并为频繁项集 + { + double d = L_ALL.get(arrayListUnion(item_pre, item_post)); + //double item_post_support = L_ALL.get(item_post);// 互补真子集的支持度比则是事件的置信度 + //System.out.println("item_post="+item_post_support); + double confident = d + / item_pre_support; // 事件的置信度 + if (confident > min_confident) {// 如果事件的置信度大于最小置信度 + //封装对象返回 + + AssociationRulesDTO associationRulesDTO=new AssociationRulesDTO(); + associationRulesDTO.setCorrelation(item_pre); + associationRulesDTO.setAssociated(item_post); + associationRulesDTO.setConfidenceLevel(confident); + + list.add(associationRulesDTO); + + System.out.print(item_pre + "==>" + item_post );// 则是一个关联事件 + System.out.println("==>" + confident); + } + } + + } + } + } + } + return list; + } + + public static void main(String[] args) { +// Apriori apriori = new Apriori(); +// apriori.init(D); +// System.out.println("候选1项集:C:\n"+apriori.C); +// System.out.println("频繁1项集:L:\n"+apriori.L+"\n"); +// apriori.L = apriori.iteration(apriori.C, apriori.L); +// System.out.println("关联规则如下:"); +// apriori.connection(min_confident); + } +} + diff --git a/src/main/java/com/sztzjy/marketing/util/algorithm/DataDeal.java b/src/main/java/com/sztzjy/marketing/util/algorithm/DataDeal.java new file mode 100644 index 0000000..af0660a --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/util/algorithm/DataDeal.java @@ -0,0 +1,234 @@ +package com.sztzjy.marketing.util.algorithm; + +import java.util.*; +import java.io.*; +public class DataDeal { + static double min_support = 4; //最小支持度 + static double min_confident = 0.7; //最小置信度 + //文件路径,我的是在当前项目下,大家换成自己的文件路径就是了 + static String filePath = "D:\\home\\marketing\\1.txt"; + static ArrayList> D = new ArrayList>();//事务数据库D + static HashMap, Integer> C = new HashMap, Integer>();//项目集C + static HashMap, Integer> L = new HashMap, Integer>();//候选集L + // 用于存取候选集每次计算结果(即存放所有的频繁项集L),最后计算关联规则,就不用再次遍历事务数据库。 + static HashMap, Integer> L_ALL = new HashMap, Integer>(); + //从文件中读取内容,返回事务集 + public static ArrayList> readTable(String filePath){ + ArrayList> t = new ArrayList>(); + ArrayList t1 = null; + File file = new File(filePath); + try { + InputStreamReader isr = new InputStreamReader(new FileInputStream(file)); + BufferedReader bf = new BufferedReader(isr); + String str = null; + while((str = bf.readLine()) != null) { + t1 = new ArrayList(); + String[] str1 = str.split(","); + for(int i = 1; i < str1.length ; i++) { + t1.add(str1[i]); + } + t.add(t1); + } + bf.close(); + isr.close(); + } catch (Exception e) { + e.printStackTrace(); + System.out.println("文件不存在!"); + } + System.out.println("\nD:"+t); + return t; + } + //剪枝步:从候选集C中删除小于最小支持度的,并放入频繁集L中 + public static void pruning(HashMap, Integer> C,HashMap, Integer> L) { + L.clear(); + // 根据项目集生成候选集 + L.putAll(C); + // 删除少于最小支持度的元素 + ArrayList> delete_key = new ArrayList>(); + for (ArrayList key : L.keySet()) { + if (L.get(key) < min_support) { + delete_key.add(key); + } + } + for (int i = 0; i < delete_key.size(); i++) { + L.remove(delete_key.get(i)); + } + } + + /** + * 初始化事务数据库、项目集、候选集 + */ + public static void init() { + //将文件中的数据放入集合D中 + D = readTable(filePath); + // 扫描事务数据库。生成项目集,支持度=该元素在事务数据库出现的次数/事务数据库的事务数 + for (int i = 0; i < D.size(); i++) { + for (int j = 0; j < D.get(i).size(); j++) { + String[] e = { D.get(i).get(j) }; + //将数组e转化为List + ArrayList item = new ArrayList(Arrays.asList(e)); + //map中是否包含指定的键 + if (!C.containsKey(item)) { + C.put(item, 1); + //System.out.println(C.get(item)); + } else { + C.put(item, C.get(item) + 1); + //System.out.println(C.get(item)); + } + } + } + //System.out.println("D.size= "+D.size()); + pruning(C, L);// 剪枝 + //将频繁项集放入集合中 + L_ALL.putAll(L); + } + + // 两个整数集求并集 + public static ArrayList arrayListUnion(ArrayList arraylist1, ArrayList arraylist2) { + ArrayList arraylist = new ArrayList(); + arraylist.addAll(arraylist1); + arraylist.addAll(arraylist2); + //将ArrayList转化为HashSet去掉重复元素,再将HashSet转换为ArrayList + arraylist = new ArrayList(new HashSet(arraylist)); + return arraylist; + } + + /** + * 迭代求出最终的候选频繁集 + * + * @param C + * 完成初始化的项目集 + * @param L + * 完成初始化的候选集 + * @return 最终的候选频繁集 + */ + public static HashMap, Integer> iteration(HashMap, Integer> C,HashMap, Integer> L) { + HashMap, Integer> L_temp = new HashMap, Integer>();// 用于判断是否结束剪枝的临时变量 + String str = null; + int t = 1;// 迭代次数 + while (L.size() > 0) {// 一旦被剪枝后剪干净,剪枝之前则是最终要求的结果。 + t++; + L_temp.clear(); + L_temp.putAll(L); + // 一、连接步 + C.clear(); + // 1.将L中的项以一定的规则两两匹配 + ArrayList> L_key = new ArrayList>(L.keySet()); + for (int i = 0; i < L_key.size(); i++) { + for (int j = i + 1; j < L_key.size(); j++) { + ArrayList C_item = new ArrayList(); + C_item = new ArrayList(arrayListUnion(L_key.get(i), + L_key.get(j))); + if (C_item.size() == t) { + C.put(C_item, 0);// 频繁项集的所有非空子集都必须是频繁的 + } + } + } + // 2.通过扫描D,计算此项的支持度 + for (ArrayList key : C.keySet()) { + for (int i = 0; i < D.size(); i++) { + if (D.get(i).containsAll(key)) { + C.put(key, C.get(key) + 1 ); + } + } + } + str = C.toString(); + + System.out.println("候选"+t+"项集:C: \n"+C); + // 二、剪枝步 + pruning(C, L); + System.out.println("频繁"+t+"项集:L: \n"+L+"\n"); + str = L.toString(); + + //System.out.println("==="); + L_ALL.putAll(L); + } + return L_temp; + } + + // 求一个集合的所有子集 + public static ArrayList> getSubset(ArrayList L) { + if (L.size() > 0) { + ArrayList> result = new ArrayList>(); + for (int i = 0; i < Math.pow(2, L.size()); i++) {// 集合子集个数=2的该集合长度的乘方 + ArrayList subSet = new ArrayList(); + int index = i;// 索引从0一直到2的集合长度的乘方-1 + for (int j = 0; j < L.size(); j++) { + // 通过逐一位移,判断索引那一位是1,如果是,再添加此项 + if ((index & 1) == 1) {// 位与运算,判断最后一位是否为1 + subSet.add(L.get(j)); + } + index >>= 1;// 索引右移一位 + } + result.add(subSet); // 把子集存储起来 + } + return result; + } else { + return null; + } + } + + // 判断两个集合相交是否为空 + public static boolean intersectionIsNull(ArrayList l1, + ArrayList l2) { + Set s1 = new HashSet(l1); + Set s2 = new HashSet(l2); + + s1.retainAll(s2); + if (s1.size() > 0) { + return false; + } else { + return true; + } + } + + /** + * 根据最终的关联集,根据公式计算出各个关联事件 + */ + public static void connection() { + for (ArrayList key : L_ALL.keySet()) {// 对最终的关联集各个事件进行判断 + ArrayList> key_allSubset = getSubset(key); + //得到所有频繁集中每个集合的子集 + // System.out.println(key_allSubset); + for (int i = 0; i < key_allSubset.size(); i++) { + ArrayList item_pre = key_allSubset.get(i);//得到一个真子集 + if (0 < item_pre.size() && item_pre.size() < key.size()) {// 判断是否是非空真子集 + // 各个非空互补真子集之间形成关联事件 + double item_pre_support = L_ALL.get(item_pre);//得到真子集的支持度度 + //System.out.println("itempre="+item_pre_support); + for (int j = 0; j < key_allSubset.size(); j++) { + ArrayList item_post = key_allSubset.get(j); + if (0 < item_post.size() + && item_post.size() < key.size() + && arrayListUnion(item_pre, item_post).equals(key) + && intersectionIsNull(item_pre, item_post)) + //不相交的两个非空真子集,相并为频繁项集 + { + double d = L_ALL.get(arrayListUnion(item_pre, item_post)); + //double item_post_support = L_ALL.get(item_post);// 互补真子集的支持度比则是事件的置信度 + //System.out.println("item_post="+item_post_support); + double confident = d + / item_pre_support; // 事件的置信度 + if (confident > min_confident) {// 如果事件的置信度大于最小置信度 + System.out.print(item_pre + "==>" + item_post );// 则是一个关联事件 + System.out.println("==>" + confident); + } + } + + } + } + } + } + } + + public static void main(String[] args) { + DataDeal apriori = new DataDeal(); + apriori.init(); + System.out.println("候选1项集:C:\n"+apriori.C); + System.out.println("频繁1项集:L:\n"+apriori.L+"\n"); + apriori.L = apriori.iteration(apriori.C, apriori.L); + System.out.println("关联规则如下:"); + apriori.connection(); + } +} + diff --git a/src/main/java/com/sztzjy/marketing/util/algorithm/DescriptiveStatisticsUtil.java b/src/main/java/com/sztzjy/marketing/util/algorithm/DescriptiveStatisticsUtil.java new file mode 100644 index 0000000..e25e1eb --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/util/algorithm/DescriptiveStatisticsUtil.java @@ -0,0 +1,130 @@ +package com.sztzjy.marketing.util.algorithm; + + + +import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics; + +import java.util.*; + +public class DescriptiveStatisticsUtil { + + // 计算平均数 + public double getMean(List data) { + DescriptiveStatistics stats = new DescriptiveStatistics(); + for (double value : data) { + stats.addValue(value); + } + return stats.getMean(); + } + + + // 计算中位数 + public double getMedian(List data) { + Collections.sort(data); + int size = data.size(); + if (size % 2 == 0) { + return (data.get(size / 2 - 1) + data.get(size / 2)) / 2.0; + } else { + return data.get(size / 2); + } + } + + + // 计算众数 + + public List getMode(List data) { + HashMap map = new HashMap(); + double imode = 0; + for (int i = 0; i < data.size(); i++) { + double x = data.get(i); + if (map.containsKey(String.valueOf(x))) { + // 如果出现多次,取出以前的计数,然后加1 + int len = Integer.parseInt(map.get(String.valueOf(x)).toString()); + map.put(String.valueOf(x), String.valueOf(len + 1)); + imode = Math.max(imode, len + 1); + } else { + // 如果是第一次出现,计数为1 + map.put(String.valueOf(x), String.valueOf(1)); + imode = Math.max(imode, 1); + } + } + Iterator iter = map.keySet().iterator(); + ArrayList lst = new ArrayList(); + while (iter.hasNext()) { + Object key = iter.next(); + Object v = map.get(key); + if (Integer.parseInt(v.toString()) == imode) { + lst.add(key); + } + } + return lst; + } + + + // 计算标准差 + public double getStandardDeviation(List data) { + DescriptiveStatistics stats = new DescriptiveStatistics(); + for (double value : data) { + stats.addValue(value); + } + return stats.getStandardDeviation(); + } + + // 计算方差 + public double getVariance(List data) { + DescriptiveStatistics stats = new DescriptiveStatistics(); + for (double value : data) { + stats.addValue(value); + } + return stats.getVariance(); + } + + // 计算标准误差 + public double getStandardError(List data) { + double standardDeviation = getStandardDeviation(data); + int count = getCount(data); + return standardDeviation / Math.sqrt(count); + } + + // 计算峰度 + public double getKurtosis(List data) { + DescriptiveStatistics stats = new DescriptiveStatistics(); + for (double value : data) { + stats.addValue(value); + } + return stats.getKurtosis(); + } + + // 计算偏度 + public double getSkewness(List data) { + DescriptiveStatistics stats = new DescriptiveStatistics(); + for (double value : data) { + stats.addValue(value); + } + return stats.getSkewness(); + } + + // 获取最大值 + public double getMax(List data) { + return Collections.max(data); + } + + // 获取最小值 + public double getMin(List data) { + return Collections.min(data); + } + + // 计算总和 + public double getSum(List data) { + double sum = 0; + for (double value : data) { + sum += value; + } + return sum; + } + + // 获取观测数 + public int getCount(List data) { + return data.size(); + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/marketing/util/algorithm/KMeans.java b/src/main/java/com/sztzjy/marketing/util/algorithm/KMeans.java index 6c509fc..f9ea1d4 100644 --- a/src/main/java/com/sztzjy/marketing/util/algorithm/KMeans.java +++ b/src/main/java/com/sztzjy/marketing/util/algorithm/KMeans.java @@ -1,8 +1,11 @@ package com.sztzjy.marketing.util.algorithm; +import org.springframework.web.multipart.MultipartFile; + import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; +import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.Random; @@ -14,6 +17,7 @@ public class KMeans { private List centroids; // 质心 private List points; // 数据集 + public KMeans(int k, int maxIterations, List points) { this.k = k; this.maxIterations = maxIterations; @@ -21,6 +25,11 @@ public class KMeans { this.centroids = initializeCentroids(); } + public List getCentroids() { + return centroids; + } + + // 初始化质心 private List initializeCentroids() { List centroids = new ArrayList<>(); @@ -93,7 +102,7 @@ public class KMeans { } // 示例中的数据点类 - static class Point { + public static class Point { private double x; private double y; @@ -124,27 +133,37 @@ public class KMeans { } } - public static void main(String[] args) { - List irisData = readIrisData("D:\\project\\digital_marketing\\src\\main\\java\\com\\sztzjy\\marketing\\controller\\Iris.txt"); - int k = 3; // 假设聚为3类 - int maxIterations = 100; - KMeans kMeans = new KMeans(k, maxIterations, irisData); - List> clusters = kMeans.cluster(); - - // 打印每个簇的结果 - for (int i = 0; i < clusters.size(); i++) { - System.out.println("Cluster " + i + ": " + clusters.get(i)); - } - } - - private static List readIrisData(String filename) { +// public static void main(String[] args) { +// List irisData = readIrisData("D:\\home\\marketing\\Iris.txt"); +// int k = 3; // 假设聚为3类 +// int maxIterations = 100; +// KMeans kMeans = new KMeans(k, maxIterations, irisData); +// List> clusters = kMeans.cluster(); +// +// // 打印每个簇的结果 +// for (int i = 0; i < clusters.size(); i++) { +// System.out.println("Cluster " + i + ": " + clusters.get(i)); +// } +// +// // 获取每个簇的中心点坐标 +// List centroids = kMeans.getCentroids(); +// for (int i = 0; i < centroids.size(); i++) { +// System.out.println("Centroid for cluster " + i + ": " + centroids.get(i)); +// } +// } + + public static List readIrisData(MultipartFile file) { List points = new ArrayList<>(); - try (BufferedReader br = new BufferedReader(new FileReader(filename))) { + try (BufferedReader br = new BufferedReader(new InputStreamReader(file.getInputStream()))) { String line; + + // 跳过标题行 + br.readLine(); + while ((line = br.readLine()) != null) { String[] values = line.split(","); - double x = Double.parseDouble(values[0]); - double y = Double.parseDouble(values[1]); + double x = Double.parseDouble(values[0]); // 假设第一列是数值 + double y = Double.parseDouble(values[1]); // 假设第二列是数值 points.add(new KMeans.Point(x, y)); } } catch (IOException e) { diff --git a/src/main/java/com/sztzjy/marketing/util/algorithm/LinearRegression.java b/src/main/java/com/sztzjy/marketing/util/algorithm/LinearRegression.java new file mode 100644 index 0000000..01f683d --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/util/algorithm/LinearRegression.java @@ -0,0 +1,59 @@ +package com.sztzjy.marketing.util.algorithm; + +public class LinearRegression { + private double intercept; + private double slope; + + // 线性回归的训练方法 + public void fit(double[] x, double[] y) { + int n = x.length; + double sumX = 0.0, sumY = 0.0, sumXY = 0.0, sumX2 = 0.0; + + for (int i = 0; i < n; i++) { + sumX += x[i]; + sumY += y[i]; + sumXY += x[i] * y[i]; + sumX2 += x[i] * x[i]; + } + + double xMean = sumX / n; + double yMean = sumY / n; + + this.slope = (sumXY - n * xMean * yMean) / (sumX2 - n * xMean * xMean); + this.intercept = yMean - this.slope * xMean; + } + + // 预测方法 + public double predict(double x) { + return this.intercept + this.slope * x; + } + + // 获取截距 + public double getIntercept() { + return this.intercept; + } + + // 获取斜率 + public double getSlope() { + return this.slope; + } + + public static void main(String[] args) { + // 示例数据 + double[] x = {1, 2, 3, 4, 5}; + double[] y = {2, 3, 5, 6, 8}; + + // 创建线性回归模型 + LinearRegression lr = new LinearRegression(); + lr.fit(x, y); + + // 输出模型参数 + System.out.println("截距: " + lr.getIntercept()); + System.out.println("斜率: " + lr.getSlope()); + + // 预测新数据 + double newX = 6; + double predictedY = lr.predict(newX); + System.out.println("输入x: " + newX + "预测y=" + predictedY); + } +} \ No newline at end of file diff --git a/src/main/java/com/sztzjy/marketing/util/algorithm/LogisticRegression.java b/src/main/java/com/sztzjy/marketing/util/algorithm/LogisticRegression.java new file mode 100644 index 0000000..428a2ec --- /dev/null +++ b/src/main/java/com/sztzjy/marketing/util/algorithm/LogisticRegression.java @@ -0,0 +1,196 @@ +package com.sztzjy.marketing.util.algorithm; + + +import org.ujmp.core.DenseMatrix; +import org.ujmp.core.Matrix; + +/** +* 参考:https://blog.csdn.net/weixin_45040801/article/details/102542209 + * https://blog.csdn.net/ccblogger/article/details/81739200 +* */ +public class LogisticRegression { + + /** + * 训练逻辑回归模型 + * + * @param data 输入的特征数据 + * @param classValues 目标类别值 + * @return 训练得到的模型参数 + */ + public static double[] train(double[][] data, double[] classValues) { + + if (data != null && classValues != null && data.length == classValues.length) { +// 期望矩阵 +// Matrix matrWeights = DenseMatrix.Factory.zeros(data[0].length + 1, 1); + Matrix matrWeights = DenseMatrix.Factory.zeros(data[0].length, 1); + System.out.println("data[0].length + 1========"+data[0].length + 1); +// 数据矩阵 +// Matrix matrData = DenseMatrix.Factory.zeros(data.length, data[0].length + 1); + Matrix matrData = DenseMatrix.Factory.zeros(data.length, data[0].length); +// 标志矩阵 + Matrix matrLable = DenseMatrix.Factory.zeros(data.length, 1); +// 训练速率矩阵 +// Matrix matrRate = DenseMatrix.Factory.zeros(data[0].length + 1,data.length); +// 统计difference的总体失误的辅助矩阵 + Matrix matrDiffUtil = DenseMatrix.Factory.zeros(data[0].length,data.length); + for(int i=0;i features = new ArrayList<>(); + /** + * 标签集合 + **/ + public List labels = new ArrayList<>(); + /** + * 特征向量维度 + **/ + public int featureDim; + + public int size() { + return labels.size(); + } + + public double[] getFeature(int index) { + return features.get(index); + } + + public double getLabel(int index) { + return labels.get(index); + } + + public void addData(double[] feature, double label) { + if (features.isEmpty()) { + featureDim = feature.length; + } else { + if (featureDim != feature.length) { + throwDimensionMismatchException(feature.length); + } + } + features.add(feature); + labels.add(label); + } + + public void throwDimensionMismatchException(int errorLen) { + throw new RuntimeException("DimensionMismatchError: 你应该传入维度为 " + featureDim + " 的特征向量 , 但你传入了维度为 " + errorLen + " 的特征向量"); + } + + +} diff --git a/src/main/resources/mappers/StuTableNameMapper.xml b/src/main/resources/mappers/StuTableNameMapper.xml new file mode 100644 index 0000000..aeb9410 --- /dev/null +++ b/src/main/resources/mappers/StuTableNameMapper.xml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, user_id, table_name, create_time, update_time + + + + + delete from stu_table_name + where id = #{id,jdbcType=INTEGER} + + + delete from stu_table_name + + + + + + insert into stu_table_name (id, user_id, table_name, + create_time, update_time) + values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{tableName,jdbcType=VARCHAR}, + #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) + + + insert into stu_table_name + + + id, + + + user_id, + + + table_name, + + + create_time, + + + update_time, + + + + + #{id,jdbcType=INTEGER}, + + + #{userId,jdbcType=VARCHAR}, + + + #{tableName,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + + + + update stu_table_name + + + id = #{record.id,jdbcType=INTEGER}, + + + user_id = #{record.userId,jdbcType=VARCHAR}, + + + table_name = #{record.tableName,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + + + + + + update stu_table_name + set id = #{record.id,jdbcType=INTEGER}, + user_id = #{record.userId,jdbcType=VARCHAR}, + table_name = #{record.tableName,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + update stu_table_name + + + user_id = #{userId,jdbcType=VARCHAR}, + + + table_name = #{tableName,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=INTEGER} + + + update stu_table_name + set user_id = #{userId,jdbcType=VARCHAR}, + table_name = #{tableName,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=INTEGER} + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mappers/StuUserBehaviorMapper.xml b/src/main/resources/mappers/StuUserBehaviorMapper.xml new file mode 100644 index 0000000..70541be --- /dev/null +++ b/src/main/resources/mappers/StuUserBehaviorMapper.xml @@ -0,0 +1,386 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, user_id, login_name, user_name, student_id, stu_class, major, school, role_name, + goods_name, goods_type, goods_subcategories, user_behavior_type, behavior_date, create_time, + update_time + + + + + delete from stu_user_behavior + where id = #{id,jdbcType=INTEGER} + + + delete from stu_user_behavior + + + + + + insert into stu_user_behavior (id, user_id, login_name, + user_name, student_id, stu_class, + major, school, role_name, + goods_name, goods_type, goods_subcategories, + user_behavior_type, behavior_date, create_time, + update_time) + values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR}, #{loginName,jdbcType=VARCHAR}, + #{userName,jdbcType=VARCHAR}, #{studentId,jdbcType=VARCHAR}, #{stuClass,jdbcType=VARCHAR}, + #{major,jdbcType=VARCHAR}, #{school,jdbcType=VARCHAR}, #{roleName,jdbcType=VARCHAR}, + #{goodsName,jdbcType=VARCHAR}, #{goodsType,jdbcType=VARCHAR}, #{goodsSubcategories,jdbcType=VARCHAR}, + #{userBehaviorType,jdbcType=VARCHAR}, #{behaviorDate,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}) + + + insert into stu_user_behavior + + + id, + + + user_id, + + + login_name, + + + user_name, + + + student_id, + + + stu_class, + + + major, + + + school, + + + role_name, + + + goods_name, + + + goods_type, + + + goods_subcategories, + + + user_behavior_type, + + + behavior_date, + + + create_time, + + + update_time, + + + + + #{id,jdbcType=INTEGER}, + + + #{userId,jdbcType=VARCHAR}, + + + #{loginName,jdbcType=VARCHAR}, + + + #{userName,jdbcType=VARCHAR}, + + + #{studentId,jdbcType=VARCHAR}, + + + #{stuClass,jdbcType=VARCHAR}, + + + #{major,jdbcType=VARCHAR}, + + + #{school,jdbcType=VARCHAR}, + + + #{roleName,jdbcType=VARCHAR}, + + + #{goodsName,jdbcType=VARCHAR}, + + + #{goodsType,jdbcType=VARCHAR}, + + + #{goodsSubcategories,jdbcType=VARCHAR}, + + + #{userBehaviorType,jdbcType=VARCHAR}, + + + #{behaviorDate,jdbcType=TIMESTAMP}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + + + + update stu_user_behavior + + + id = #{record.id,jdbcType=INTEGER}, + + + user_id = #{record.userId,jdbcType=VARCHAR}, + + + login_name = #{record.loginName,jdbcType=VARCHAR}, + + + user_name = #{record.userName,jdbcType=VARCHAR}, + + + student_id = #{record.studentId,jdbcType=VARCHAR}, + + + stu_class = #{record.stuClass,jdbcType=VARCHAR}, + + + major = #{record.major,jdbcType=VARCHAR}, + + + school = #{record.school,jdbcType=VARCHAR}, + + + role_name = #{record.roleName,jdbcType=VARCHAR}, + + + goods_name = #{record.goodsName,jdbcType=VARCHAR}, + + + goods_type = #{record.goodsType,jdbcType=VARCHAR}, + + + goods_subcategories = #{record.goodsSubcategories,jdbcType=VARCHAR}, + + + user_behavior_type = #{record.userBehaviorType,jdbcType=VARCHAR}, + + + behavior_date = #{record.behaviorDate,jdbcType=TIMESTAMP}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + + + + + + update stu_user_behavior + set id = #{record.id,jdbcType=INTEGER}, + user_id = #{record.userId,jdbcType=VARCHAR}, + login_name = #{record.loginName,jdbcType=VARCHAR}, + user_name = #{record.userName,jdbcType=VARCHAR}, + student_id = #{record.studentId,jdbcType=VARCHAR}, + stu_class = #{record.stuClass,jdbcType=VARCHAR}, + major = #{record.major,jdbcType=VARCHAR}, + school = #{record.school,jdbcType=VARCHAR}, + role_name = #{record.roleName,jdbcType=VARCHAR}, + goods_name = #{record.goodsName,jdbcType=VARCHAR}, + goods_type = #{record.goodsType,jdbcType=VARCHAR}, + goods_subcategories = #{record.goodsSubcategories,jdbcType=VARCHAR}, + user_behavior_type = #{record.userBehaviorType,jdbcType=VARCHAR}, + behavior_date = #{record.behaviorDate,jdbcType=TIMESTAMP}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + update stu_user_behavior + + + user_id = #{userId,jdbcType=VARCHAR}, + + + login_name = #{loginName,jdbcType=VARCHAR}, + + + user_name = #{userName,jdbcType=VARCHAR}, + + + student_id = #{studentId,jdbcType=VARCHAR}, + + + stu_class = #{stuClass,jdbcType=VARCHAR}, + + + major = #{major,jdbcType=VARCHAR}, + + + school = #{school,jdbcType=VARCHAR}, + + + role_name = #{roleName,jdbcType=VARCHAR}, + + + goods_name = #{goodsName,jdbcType=VARCHAR}, + + + goods_type = #{goodsType,jdbcType=VARCHAR}, + + + goods_subcategories = #{goodsSubcategories,jdbcType=VARCHAR}, + + + user_behavior_type = #{userBehaviorType,jdbcType=VARCHAR}, + + + behavior_date = #{behaviorDate,jdbcType=TIMESTAMP}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=INTEGER} + + + update stu_user_behavior + set user_id = #{userId,jdbcType=VARCHAR}, + login_name = #{loginName,jdbcType=VARCHAR}, + user_name = #{userName,jdbcType=VARCHAR}, + student_id = #{studentId,jdbcType=VARCHAR}, + stu_class = #{stuClass,jdbcType=VARCHAR}, + major = #{major,jdbcType=VARCHAR}, + school = #{school,jdbcType=VARCHAR}, + role_name = #{roleName,jdbcType=VARCHAR}, + goods_name = #{goodsName,jdbcType=VARCHAR}, + goods_type = #{goodsType,jdbcType=VARCHAR}, + goods_subcategories = #{goodsSubcategories,jdbcType=VARCHAR}, + user_behavior_type = #{userBehaviorType,jdbcType=VARCHAR}, + behavior_date = #{behaviorDate,jdbcType=TIMESTAMP}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file