From a98509f3a589be1c20507bf50d805d2296e9d55f Mon Sep 17 00:00:00 2001 From: sunhonglei Date: Tue, 25 Feb 2025 15:24:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E8=AF=95=E5=AE=89=E6=8E=92=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ccic/safeliab/entity/ExamSchedule.java | 42 +++++++++++ .../ccic/safeliab/dao/ExamScheduleMapper.java | 13 ++++ .../safeliab/service/ExamScheduleService.java | 11 +++ .../service/ExamScheduleServiceImpl.java | 16 +++++ .../com/ccic/safeliab/vo/ExamScheduleVO.java | 7 ++ .../safeliab/web/ExamScheduleController.java | 71 +++++++++++++++++++ .../resources/mappers/ExamScheduleMapper.xml | 33 +++++++++ 7 files changed, 193 insertions(+) create mode 100644 ccic-entity/src/main/java/com/ccic/safeliab/entity/ExamSchedule.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/dao/ExamScheduleMapper.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/service/ExamScheduleService.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/service/ExamScheduleServiceImpl.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/vo/ExamScheduleVO.java create mode 100644 ccic-exam/src/main/java/com/ccic/safeliab/web/ExamScheduleController.java create mode 100644 ccic-exam/src/main/resources/mappers/ExamScheduleMapper.xml diff --git a/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExamSchedule.java b/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExamSchedule.java new file mode 100644 index 0000000..b2dd579 --- /dev/null +++ b/ccic-entity/src/main/java/com/ccic/safeliab/entity/ExamSchedule.java @@ -0,0 +1,42 @@ +package com.ccic.safeliab.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.sql.Timestamp; + +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("ex_exam_info") +public class ExamSchedule{ + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + @TableId(value = "exam_id", type = IdType.ID_WORKER) + @JsonFormat(shape = JsonFormat.Shape.STRING) + private Long examId; + private String examName; + private Integer paperId; + private String regulatedIndustry; + private String examRegion; + private String validFrom; + private String validTo; + private Integer publishStatus; + private String remark; + private Long createUser; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Timestamp createTime; + private Long updateUser; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Timestamp updateTime; + private Integer status; + private Integer isDeleted; +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/dao/ExamScheduleMapper.java b/ccic-exam/src/main/java/com/ccic/safeliab/dao/ExamScheduleMapper.java new file mode 100644 index 0000000..3554315 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/dao/ExamScheduleMapper.java @@ -0,0 +1,13 @@ +package com.ccic.safeliab.dao; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ccic.safeliab.entity.ExamSchedule; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +@Mapper +public interface ExamScheduleMapper extends BaseMapper { + List selectExamSchedule(Map param); +} \ No newline at end of file diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamScheduleService.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamScheduleService.java new file mode 100644 index 0000000..0212201 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamScheduleService.java @@ -0,0 +1,11 @@ +package com.ccic.safeliab.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ccic.safeliab.entity.ExamSchedule; + +import java.util.List; +import java.util.Map; + +public interface ExamScheduleService extends IService { + public List selectExamSchedule(Map param); +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamScheduleServiceImpl.java b/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamScheduleServiceImpl.java new file mode 100644 index 0000000..f4d05bc --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/service/ExamScheduleServiceImpl.java @@ -0,0 +1,16 @@ +package com.ccic.safeliab.service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ccic.safeliab.dao.ExamScheduleMapper; +import com.ccic.safeliab.entity.ExamSchedule; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +@Service +public class ExamScheduleServiceImpl extends ServiceImpl implements ExamScheduleService { + public List selectExamSchedule(Map param){ + return baseMapper.selectExamSchedule(param); + } +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/vo/ExamScheduleVO.java b/ccic-exam/src/main/java/com/ccic/safeliab/vo/ExamScheduleVO.java new file mode 100644 index 0000000..ce0aa5e --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/vo/ExamScheduleVO.java @@ -0,0 +1,7 @@ +package com.ccic.safeliab.vo; + +import com.ccic.safeliab.entity.ExamSchedule; +import com.ccic.safeliab.entity.InsDemo; + +public class ExamScheduleVO extends ExamSchedule { +} diff --git a/ccic-exam/src/main/java/com/ccic/safeliab/web/ExamScheduleController.java b/ccic-exam/src/main/java/com/ccic/safeliab/web/ExamScheduleController.java new file mode 100644 index 0000000..5b44275 --- /dev/null +++ b/ccic-exam/src/main/java/com/ccic/safeliab/web/ExamScheduleController.java @@ -0,0 +1,71 @@ +package com.ccic.safeliab.web; + +import com.ccic.safeliab.entity.ExamSchedule; +import com.ccic.safeliab.service.ExamScheduleService; +import com.ccic.safeliab.support.Condition; +import com.ccic.safeliab.util.R; +import com.ccic.safeliab.vo.ExamScheduleVO; +import com.ccic.safeliab.vo.InsDemoVO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/exam-schedule") +public class ExamScheduleController { + @Autowired + private ExamScheduleService service; + @GetMapping("/select") + public R select( @RequestParam(required = false) String examName, + @RequestParam(required = false) String paperName, + @RequestParam(required = false) String regulatedIndustry, + @RequestParam(required = false) String validDate, + @RequestParam(defaultValue = "1") int page, + @RequestParam(defaultValue = "10") int pageSize) { + // 模拟数据库查询 + List examList = new ArrayList<>(); + ExamScheduleVO insDemoVO = new ExamScheduleVO(); + // 这里可以添加实际的数据库查询逻辑 + + Map param = new HashMap<>(); + param.put("examName", examName); + param.put("paperName", paperName); + param.put("regulatedIndustry", regulatedIndustry); + param.put("date", validDate); + examList = service.selectExamSchedule(param); + Map result = new HashMap<>(); + result.put("data", examList); + result.put("total", examList.size()); + return R.ok().data(result); + } + @GetMapping("/cancel") + public R cancel() { + ExamScheduleVO insDemoVO = new ExamScheduleVO(); + return R.ok().data(service.list(Condition.getQueryWrapper(insDemoVO))); + } + @GetMapping("/publish") + public R publish() { + ExamScheduleVO insDemoVO = new ExamScheduleVO(); + return R.ok().data(service.list(Condition.getQueryWrapper(insDemoVO))); + } + @PostMapping("/update") + public R update(@RequestBody ExamScheduleVO examSchedule) { + boolean result = service.saveOrUpdate(examSchedule); + return R.ok().data("success."); + } + + @PostMapping("/insert") + public R insert(@RequestBody ExamScheduleVO examSchedule) { + boolean result = service.save(examSchedule); + return R.ok().data("success."); + } + + @GetMapping("/show") + public R show() { + return R.ok().data("success."); + } +} diff --git a/ccic-exam/src/main/resources/mappers/ExamScheduleMapper.xml b/ccic-exam/src/main/resources/mappers/ExamScheduleMapper.xml new file mode 100644 index 0000000..446d018 --- /dev/null +++ b/ccic-exam/src/main/resources/mappers/ExamScheduleMapper.xml @@ -0,0 +1,33 @@ + + + + + \ No newline at end of file