From 914ec24fbf53989b75e69f7b7cab9c3c658446b2 Mon Sep 17 00:00:00 2001
From: datou <18319785677@163.com>
Date: Tue, 24 Nov 2020 16:36:39 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=8F=91=E5=B8=83=E6=A8=A1?=
=?UTF-8?q?=E5=9D=97=E7=9A=84=E5=AE=9E=E4=BD=93=E7=B1=BB=E3=80=81mapper?=
=?UTF-8?q?=E3=80=81=E4=BB=A5=E5=8F=8A=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
share_project/pom.xml | 7 ++
.../java/com/share/domain/DemandProject.java | 69 +++++++++++++++++++
.../java/com/share/domain/SkillProject.java | 64 +++++++++++++++++
.../com/share/domain/UserDemandProject.java | 36 ++++++++++
.../com/share/domain/UserSkillProject.java | 34 +++++++++
.../com/share/mapper/DemandProjectMapper.java | 22 ++++++
.../com/share/mapper/SkillProjectMapper.java | 20 ++++++
.../share/mapper/UserDemandProjectMapper.java | 28 ++++++++
.../share/mapper/UserSkillProjectMapper.java | 29 ++++++++
.../src/main/resources/application.yml | 6 +-
.../resources/mapper/DemandProjectMapper.xml | 17 +++++
.../resources/mapper/SkillProjectMapper.xml | 17 +++++
.../mapper/UserDemandProjectMapper.xml | 17 +++++
.../mapper/UserSkillProjectMapper.xml | 17 +++++
.../src/test/java/com/share/publishTest.java | 28 ++++++++
15 files changed, 408 insertions(+), 3 deletions(-)
create mode 100644 share_project/src/main/java/com/share/domain/DemandProject.java
create mode 100644 share_project/src/main/java/com/share/domain/SkillProject.java
create mode 100644 share_project/src/main/java/com/share/domain/UserDemandProject.java
create mode 100644 share_project/src/main/java/com/share/domain/UserSkillProject.java
create mode 100644 share_project/src/main/java/com/share/mapper/DemandProjectMapper.java
create mode 100644 share_project/src/main/java/com/share/mapper/SkillProjectMapper.java
create mode 100644 share_project/src/main/java/com/share/mapper/UserDemandProjectMapper.java
create mode 100644 share_project/src/main/java/com/share/mapper/UserSkillProjectMapper.java
create mode 100644 share_project/src/main/resources/mapper/DemandProjectMapper.xml
create mode 100644 share_project/src/main/resources/mapper/SkillProjectMapper.xml
create mode 100644 share_project/src/main/resources/mapper/UserDemandProjectMapper.xml
create mode 100644 share_project/src/main/resources/mapper/UserSkillProjectMapper.xml
create mode 100644 share_project/src/test/java/com/share/publishTest.java
diff --git a/share_project/pom.xml b/share_project/pom.xml
index 602cb017..732f81f2 100644
--- a/share_project/pom.xml
+++ b/share_project/pom.xml
@@ -72,6 +72,13 @@
druid-spring-boot-starter
1.1.20
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.12
+
diff --git a/share_project/src/main/java/com/share/domain/DemandProject.java b/share_project/src/main/java/com/share/domain/DemandProject.java
new file mode 100644
index 00000000..cde1c827
--- /dev/null
+++ b/share_project/src/main/java/com/share/domain/DemandProject.java
@@ -0,0 +1,69 @@
+package com.share.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author 谢佳豪
+ * @data 2020/11/23 - 22:45
+ * @description demand_project 需求项目实体类
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@ToString
+public class DemandProject implements Serializable {
+ /**
+ * 项目编号
+ */
+ private Integer id;
+ /**
+ * 项目名称
+ */
+ private String projectName;
+ /**
+ * 项目描述
+ */
+ private String projectDesc;
+ /**
+ * 公司补贴
+ */
+ private String subsidy;
+ /**
+ * 价钱
+ */
+ private Float price;
+ /**
+ * 地址
+ */
+ private String address;
+ /**
+ * 所需技能
+ */
+ private String skill;
+ /**
+ * 项目类型
+ */
+ private String type;
+ /**
+ * 发布方式
+ */
+ private String method;
+ /**
+ * 发布人(用户名)
+ */
+ private String publisher;
+ /**
+ * 发布时间
+ */
+ private Date startTime;
+ /**
+ * 截止时间
+ */
+ private Date endTime;
+}
diff --git a/share_project/src/main/java/com/share/domain/SkillProject.java b/share_project/src/main/java/com/share/domain/SkillProject.java
new file mode 100644
index 00000000..39d7fbbb
--- /dev/null
+++ b/share_project/src/main/java/com/share/domain/SkillProject.java
@@ -0,0 +1,64 @@
+package com.share.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.util.Date;
+
+/**
+ * @author 谢佳豪
+ * @data 2020/11/24 - 15:20
+ * @description skill_project 技能项目表实体类
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@ToString
+public class SkillProject {
+ /**
+ * 项目编号
+ */
+ private Integer id;
+ /**
+ * 项目名称
+ */
+ private String projectName;
+ /**
+ * 项目描述
+ */
+ private String projectDesc;
+ /**
+ * 地址
+ */
+ private String address;
+ /**
+ * 所需技能
+ */
+ private String skill;
+ /**
+ * 价钱
+ */
+ private Float price;
+ /**
+ * 项目类型
+ */
+ private String type;
+ /**
+ * 发布方式
+ */
+ private String method;
+ /**
+ * 发布人(用户名)
+ */
+ private String publisher;
+ /**
+ * 发布时间
+ */
+ private Date startTime;
+ /**
+ * 截止时间
+ */
+ private Date endTime;
+}
diff --git a/share_project/src/main/java/com/share/domain/UserDemandProject.java b/share_project/src/main/java/com/share/domain/UserDemandProject.java
new file mode 100644
index 00000000..06d15888
--- /dev/null
+++ b/share_project/src/main/java/com/share/domain/UserDemandProject.java
@@ -0,0 +1,36 @@
+package com.share.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+/**
+ * @author 谢佳豪
+ * @data 2020/11/24 - 15:08
+ * @description user_demand_project 用户需求项目关联表的实体类
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@ToString
+public class UserDemandProject implements Serializable {
+ /**
+ * 需求项目id
+ */
+ private Integer projectId;
+ /**
+ * 发布者用户名
+ */
+ private String username;
+ /**
+ * 发布者电话号码
+ */
+ private String telephone;
+ /**
+ * 项目状态 TODO(待发布状态--0;待审核状态--1)
+ */
+ private Integer status;
+}
diff --git a/share_project/src/main/java/com/share/domain/UserSkillProject.java b/share_project/src/main/java/com/share/domain/UserSkillProject.java
new file mode 100644
index 00000000..918ffd2e
--- /dev/null
+++ b/share_project/src/main/java/com/share/domain/UserSkillProject.java
@@ -0,0 +1,34 @@
+package com.share.domain;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ * @author 谢佳豪
+ * @data 2020/11/24 - 15:25
+ * @description user_skill_project 用户技能项目关联表的实体类
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@ToString
+public class UserSkillProject {
+ /**
+ * 需求项目id
+ */
+ private Integer projectId;
+ /**
+ * 发布者用户名
+ */
+ private String username;
+ /**
+ * 发布者电话号码
+ */
+ private String telephone;
+ /**
+ * 项目状态 TODO(待发布状态--0;待审核状态--1)
+ */
+ private Integer status;
+}
diff --git a/share_project/src/main/java/com/share/mapper/DemandProjectMapper.java b/share_project/src/main/java/com/share/mapper/DemandProjectMapper.java
new file mode 100644
index 00000000..020f3e35
--- /dev/null
+++ b/share_project/src/main/java/com/share/mapper/DemandProjectMapper.java
@@ -0,0 +1,22 @@
+package com.share.mapper;
+
+import com.share.domain.DemandProject;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author 谢佳豪
+ * @data 2020/11/23 - 22:24
+ * @description demand_project--需求项目表接口类
+ */
+@Repository
+public interface DemandProjectMapper {
+
+ /**
+ * 插入需求项目数据
+ * @param demandProject 需求项目表单数据 TODO 用户名如何填写到项目表单中!
+ * @return
+ */
+ int insertDemandProject(DemandProject demandProject);
+
+
+}
diff --git a/share_project/src/main/java/com/share/mapper/SkillProjectMapper.java b/share_project/src/main/java/com/share/mapper/SkillProjectMapper.java
new file mode 100644
index 00000000..d4b2bfc5
--- /dev/null
+++ b/share_project/src/main/java/com/share/mapper/SkillProjectMapper.java
@@ -0,0 +1,20 @@
+package com.share.mapper;
+
+import com.share.domain.SkillProject;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author 谢佳豪
+ * @data 2020/11/23 - 22:33
+ * @description skill_project--个人技能项目表接口类
+ */
+@Repository
+public interface SkillProjectMapper {
+
+ /**
+ * 插入技能项目数据
+ * @param skillProject 技能项目表单数据 TODO 用户名如何填写到项目表单中!
+ * @return
+ */
+ int insertSkillProject(SkillProject skillProject);
+}
diff --git a/share_project/src/main/java/com/share/mapper/UserDemandProjectMapper.java b/share_project/src/main/java/com/share/mapper/UserDemandProjectMapper.java
new file mode 100644
index 00000000..ac4089e8
--- /dev/null
+++ b/share_project/src/main/java/com/share/mapper/UserDemandProjectMapper.java
@@ -0,0 +1,28 @@
+package com.share.mapper;
+
+import com.share.domain.UserDemandProject;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author 谢佳豪
+ * @data 2020/11/24 - 15:18
+ * @description user_demand_project 用户需求项目关联表的接口类
+ */
+@Repository
+public interface UserDemandProjectMapper {
+
+ /**
+ * 添加关联 (项目-用户)
+ * @param userDemandProject 关联数据
+ * @return
+ */
+ int addAssociation(UserDemandProject userDemandProject);
+
+ /**
+ * 更新项目状态
+ * @param id 项目id
+ * @param status 状态
+ * @return
+ */
+ int updateStatus(Integer id ,Integer status);
+}
diff --git a/share_project/src/main/java/com/share/mapper/UserSkillProjectMapper.java b/share_project/src/main/java/com/share/mapper/UserSkillProjectMapper.java
new file mode 100644
index 00000000..048cd7a5
--- /dev/null
+++ b/share_project/src/main/java/com/share/mapper/UserSkillProjectMapper.java
@@ -0,0 +1,29 @@
+package com.share.mapper;
+
+import com.share.domain.UserDemandProject;
+import com.share.domain.UserSkillProject;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @author 谢佳豪
+ * @data 2020/11/24 - 15:18
+ * @description user_skill_project 用户技能项目关联表的接口类
+ */
+@Repository
+public interface UserSkillProjectMapper {
+
+ /**
+ * 添加关联 (项目-用户)
+ * @param userSkillProject 关联数据
+ * @return
+ */
+ int addAssociation(UserSkillProject userSkillProject);
+
+ /**
+ * 更新项目状态
+ * @param id 项目id
+ * @param status 状态
+ * @return
+ */
+ int updateStatus(Integer id ,Integer status);
+}
diff --git a/share_project/src/main/resources/application.yml b/share_project/src/main/resources/application.yml
index fb846456..c7c24558 100644
--- a/share_project/src/main/resources/application.yml
+++ b/share_project/src/main/resources/application.yml
@@ -13,9 +13,9 @@ spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://127.0.0.1:3306/share_database?serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&allowMultiQueries=true
- data-username: root
- data-password: '0803' # 玄学一定要用引号
+ url: jdbc:mysql://112.74.80.172:3306/share_database?serverTimezone=Asia/Shanghai&characterEncoding=UTF-8&allowMultiQueries=true
+ data-username: gduf
+ data-password: '1218' # 玄学一定要用引号
druid:
max-active: 20
initial-size: 5
diff --git a/share_project/src/main/resources/mapper/DemandProjectMapper.xml b/share_project/src/main/resources/mapper/DemandProjectMapper.xml
new file mode 100644
index 00000000..1d07d3e6
--- /dev/null
+++ b/share_project/src/main/resources/mapper/DemandProjectMapper.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+ insert into demand_project
+ (project_name, project_desc, subsidy, price,
+ address, skill, type,
+ method, publisher, start_time, end_time)
+ VALUE (#{projectName}, #{projectDesc}, #{subsidy}, #{price}, #{address}, #{skill},
+ #{type}, #{method}, #{publisher}, #{startTime}, #{endTime});
+
+
+
\ No newline at end of file
diff --git a/share_project/src/main/resources/mapper/SkillProjectMapper.xml b/share_project/src/main/resources/mapper/SkillProjectMapper.xml
new file mode 100644
index 00000000..7d2d7d84
--- /dev/null
+++ b/share_project/src/main/resources/mapper/SkillProjectMapper.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+ insert into skill_project
+ (project_name, project_desc,
+ address, skill, price, type,
+ method, publisher, start_time, end_time)
+ VALUE (#{projectName}, #{projectDesc}, #{address}, #{skill}, #{price},
+ #{type}, #{method}, #{publisher}, #{startTime}, #{endTime});
+
+
+
\ No newline at end of file
diff --git a/share_project/src/main/resources/mapper/UserDemandProjectMapper.xml b/share_project/src/main/resources/mapper/UserDemandProjectMapper.xml
new file mode 100644
index 00000000..a49efa25
--- /dev/null
+++ b/share_project/src/main/resources/mapper/UserDemandProjectMapper.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+ insert into user_demand_project(project_id, username, telephone, status)
+ VALUE(#{projectId}, #{username}, #{telephone}, #{status});
+
+
+
+
+ update user_demand_project set status = #{status} where project_id = #{id};
+
+
\ No newline at end of file
diff --git a/share_project/src/main/resources/mapper/UserSkillProjectMapper.xml b/share_project/src/main/resources/mapper/UserSkillProjectMapper.xml
new file mode 100644
index 00000000..1f942a34
--- /dev/null
+++ b/share_project/src/main/resources/mapper/UserSkillProjectMapper.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+ insert into user_skill_project(project_id, username, telephone, status)
+ VALUE(#{projectId}, #{username}, #{telephone}, #{status});
+
+
+
+
+ update user_skill_project set status = #{status} where project_id = #{id};
+
+
\ No newline at end of file
diff --git a/share_project/src/test/java/com/share/publishTest.java b/share_project/src/test/java/com/share/publishTest.java
new file mode 100644
index 00000000..bb394940
--- /dev/null
+++ b/share_project/src/test/java/com/share/publishTest.java
@@ -0,0 +1,28 @@
+package com.share;
+
+import com.share.domain.DemandProject;
+import com.share.mapper.DemandProjectMapper;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+/**
+ * @author 谢佳豪
+ * @data 2020/11/23 - 23:04
+ * @description
+ */
+@SpringBootTest
+public class publishTest {
+
+ @Autowired
+ private DemandProjectMapper demandProjectMapper;
+
+ @Test
+ void testDomain(){
+ DemandProject demandProject = new DemandProject();
+ demandProject.setId(1);
+ demandProject.setProjectName("招募前端");
+ System.out.println(demandProject);
+ }
+
+}
--
Gitee