From f57b10802791e984afa9ab7de5a55b0823fcf54e Mon Sep 17 00:00:00 2001 From: zhaoyz <11@11.com> Date: Tue, 23 Apr 2024 18:32:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=B8=B8=E8=AE=A1=E5=88=92=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- daily-plan/pom.xml | 40 ++++++++++++++++ .../controller/DailyPlanController.java | 23 +++++++++ .../com/rax/dailyplan/dto/DailyPlanDTO.java | 31 ++++++++++++ .../com/rax/dailyplan/entity/DailyPlan.java | 47 +++++++++++++++++++ .../rax/dailyplan/mapper/DailyPlanMapper.java | 9 ++++ .../dailyplan/service/DailyPlanService.java | 16 +++++++ .../service/impl/DailyPlanServiceImpl.java | 26 ++++++++++ db/pig.sql | 15 ++++++ pom.xml | 3 +- 9 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 daily-plan/pom.xml create mode 100644 daily-plan/src/main/java/com/rax/dailyplan/controller/DailyPlanController.java create mode 100644 daily-plan/src/main/java/com/rax/dailyplan/dto/DailyPlanDTO.java create mode 100644 daily-plan/src/main/java/com/rax/dailyplan/entity/DailyPlan.java create mode 100644 daily-plan/src/main/java/com/rax/dailyplan/mapper/DailyPlanMapper.java create mode 100644 daily-plan/src/main/java/com/rax/dailyplan/service/DailyPlanService.java create mode 100644 daily-plan/src/main/java/com/rax/dailyplan/service/impl/DailyPlanServiceImpl.java diff --git a/daily-plan/pom.xml b/daily-plan/pom.xml new file mode 100644 index 0000000..2355718 --- /dev/null +++ b/daily-plan/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + com.rax + rax + 3.7.3 + + + daily-plan + jar + + + + com.rax + common-swagger + + + com.rax + common-mybatis + + + com.rax + common-security + + + com.rax + common-log + + + + + 17 + 17 + UTF-8 + + + \ No newline at end of file diff --git a/daily-plan/src/main/java/com/rax/dailyplan/controller/DailyPlanController.java b/daily-plan/src/main/java/com/rax/dailyplan/controller/DailyPlanController.java new file mode 100644 index 0000000..29d983e --- /dev/null +++ b/daily-plan/src/main/java/com/rax/dailyplan/controller/DailyPlanController.java @@ -0,0 +1,23 @@ +package com.rax.dailyplan.controller; + +import com.rax.common.core.util.R; +import com.rax.dailyplan.dto.DailyPlanDTO; +import com.rax.dailyplan.service.DailyPlanService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/dailyPlan") +public class DailyPlanController { + + @Autowired + private DailyPlanService dailyPlanService; + + @PostMapping("/addDailyPlan") + public R addDailyPlan(DailyPlanDTO dailyPlanDTO) { + return dailyPlanService.addDailyPlan(dailyPlanDTO); + } + +} diff --git a/daily-plan/src/main/java/com/rax/dailyplan/dto/DailyPlanDTO.java b/daily-plan/src/main/java/com/rax/dailyplan/dto/DailyPlanDTO.java new file mode 100644 index 0000000..30460c3 --- /dev/null +++ b/daily-plan/src/main/java/com/rax/dailyplan/dto/DailyPlanDTO.java @@ -0,0 +1,31 @@ +package com.rax.dailyplan.dto; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +@Schema(description = "日常计划") +public class DailyPlanDTO { + + @Schema(description = "标题") + private String title; + + @Schema(description = "计划类型") + private String type; + + @Schema(description = "计划状态,已处理:1,未处理:0") + private Boolean status; + + @Schema(description = "日期") + private String date; + + @Schema(description = "时间") + private String time; + + @Schema(description = "内容") + private String content; + + @Schema(description = "删除标记,1:已删除,0:正常") + private String delFlag; +} diff --git a/daily-plan/src/main/java/com/rax/dailyplan/entity/DailyPlan.java b/daily-plan/src/main/java/com/rax/dailyplan/entity/DailyPlan.java new file mode 100644 index 0000000..1970e59 --- /dev/null +++ b/daily-plan/src/main/java/com/rax/dailyplan/entity/DailyPlan.java @@ -0,0 +1,47 @@ +package com.rax.dailyplan.entity; + +import com.baomidou.mybatisplus.annotation.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +@Data +@Schema(description = "日常计划") +public class DailyPlan implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "id") + private Long id; + + @Schema(description = "标题") + private String title; + + @Schema(description = "计划类型") + private String type; + + @Schema(description = "计划状态,已处理:1,未处理:0") + private Boolean status; + + @Schema(description = "日期") + private String date; + + @Schema(description = "时间") + private String time; + + @Schema(description = "内容") + private String content; + + @Schema(description = "所属人id") + private String creator; + + /** + * 0-正常,1-删除 + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记,1:已删除,0:正常") + private String delFlag; + +} diff --git a/daily-plan/src/main/java/com/rax/dailyplan/mapper/DailyPlanMapper.java b/daily-plan/src/main/java/com/rax/dailyplan/mapper/DailyPlanMapper.java new file mode 100644 index 0000000..587fe6c --- /dev/null +++ b/daily-plan/src/main/java/com/rax/dailyplan/mapper/DailyPlanMapper.java @@ -0,0 +1,9 @@ +package com.rax.dailyplan.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.rax.dailyplan.entity.DailyPlan; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface DailyPlanMapper extends BaseMapper { +} diff --git a/daily-plan/src/main/java/com/rax/dailyplan/service/DailyPlanService.java b/daily-plan/src/main/java/com/rax/dailyplan/service/DailyPlanService.java new file mode 100644 index 0000000..6bde59a --- /dev/null +++ b/daily-plan/src/main/java/com/rax/dailyplan/service/DailyPlanService.java @@ -0,0 +1,16 @@ +package com.rax.dailyplan.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.rax.common.core.util.R; +import com.rax.dailyplan.dto.DailyPlanDTO; +import com.rax.dailyplan.entity.DailyPlan; + +public interface DailyPlanService extends IService { + + /** + * + * @param dailyPlanDTO + * @return + */ + R addDailyPlan(DailyPlanDTO dailyPlanDTO); +} diff --git a/daily-plan/src/main/java/com/rax/dailyplan/service/impl/DailyPlanServiceImpl.java b/daily-plan/src/main/java/com/rax/dailyplan/service/impl/DailyPlanServiceImpl.java new file mode 100644 index 0000000..0dc4b8a --- /dev/null +++ b/daily-plan/src/main/java/com/rax/dailyplan/service/impl/DailyPlanServiceImpl.java @@ -0,0 +1,26 @@ +package com.rax.dailyplan.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.rax.common.core.util.R; +import com.rax.dailyplan.dto.DailyPlanDTO; +import com.rax.dailyplan.entity.DailyPlan; +import com.rax.dailyplan.mapper.DailyPlanMapper; +import com.rax.dailyplan.service.DailyPlanService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class DailyPlanServiceImpl extends ServiceImpl implements DailyPlanService { + + @Autowired + private DailyPlanMapper dailyPlanMapper; + + @Override + public R addDailyPlan(DailyPlanDTO dailyPlanDTO) { + DailyPlan dailyPlan = new DailyPlan(); + BeanUtils.copyProperties(dailyPlanDTO, dailyPlan); + boolean status = save(dailyPlan); + return R.ok(status); + } +} diff --git a/db/pig.sql b/db/pig.sql index a06afc9..f4f0435 100644 --- a/db/pig.sql +++ b/db/pig.sql @@ -747,4 +747,19 @@ CREATE TABLE `sys_hospital` ( -- ---------------------------- INSERT INTO `sys_hospital` VALUES ('111', '111', '111', '111', '111', b'1', '111', '11', b'0', '111', '11', '111'); +---------------------------------------------- + +DROP TABLE IF EXISTS `sys_daily_plan`; +CREATE TABLE `sys_daily_plan` ( + `id` bigint NOT NULL COMMENT '主键', + `title` varchar(800) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '计划标题', + `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '日常计划类型', + `status` bit(1) NULL DEFAULT NULL COMMENT '计划处理状态', + `date` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '计划处理时间', + `time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '计划处理时间', + `content` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '计划内容', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT NULL COMMENT '删除标记,0未删除,1已删除', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin ROW_FORMAT = Dynamic; + SET FOREIGN_KEY_CHECKS = 1; diff --git a/pom.xml b/pom.xml index d591851..70c0aaa 100644 --- a/pom.xml +++ b/pom.xml @@ -100,7 +100,8 @@ common vital-signs - + daily-plan +