From 17c0c1e97391c99ebb89276758dd6041ba36044a Mon Sep 17 00:00:00 2001
From: LGH <1746689524@qq.com>
Date: Thu, 11 Aug 2022 16:40:48 +0800
Subject: [PATCH] =?UTF-8?q?update:=20=E6=96=B0=E5=A2=9E=E5=B8=B8=E8=A7=81?=
=?UTF-8?q?=E9=97=AE=E9=A2=98=E6=B1=87=E6=80=BBcurd?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../wms/core/dal/entity/QuestionAnswer.java | 149 ++++++++++++++++++
.../core/dal/mapper/QuestionAnswerMapper.java | 16 ++
.../core/dal/mapper/QuestionAnswerMapper.xml | 28 ++++
.../dal/service/QuestionAnswerServiceBiz.java | 16 ++
.../impl/QuestionAnswerServiceBizImpl.java | 20 +++
.../controller/QuestionAnswerController.java | 105 ++++++++++++
.../wms/empty/params/QuestionAnswerParam.java | 28 ++++
.../params/QuestionAnswerQueryparam.java | 23 +++
.../com/mt/wms/empty/vo/QuestionAnswerVo.java | 29 ++++
9 files changed, 414 insertions(+)
create mode 100644 6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/QuestionAnswer.java
create mode 100644 6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/QuestionAnswerMapper.java
create mode 100644 6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/QuestionAnswerMapper.xml
create mode 100644 6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/QuestionAnswerServiceBiz.java
create mode 100644 6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/QuestionAnswerServiceBizImpl.java
create mode 100644 6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/QuestionAnswerController.java
create mode 100644 6.program/wms-empty/src/main/java/com/mt/wms/empty/params/QuestionAnswerParam.java
create mode 100644 6.program/wms-empty/src/main/java/com/mt/wms/empty/params/QuestionAnswerQueryparam.java
create mode 100644 6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/QuestionAnswerVo.java
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/QuestionAnswer.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/QuestionAnswer.java
new file mode 100644
index 0000000..98c7b99
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/entity/QuestionAnswer.java
@@ -0,0 +1,149 @@
+package com.mt.wms.core.dal.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ *
+ * 问题解答表
+ *
+ *
+ * @author mt
+ * @since 2022-08-11
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("t_question_answer")
+public class QuestionAnswer extends Model {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 删除标志,是否有效:1 可用 0不可用
+ */
+ @TableField("valid")
+ @TableLogic
+ private Integer valid;
+
+ /**
+ * 添加时间
+ */
+ @TableField("create_time")
+ private LocalDateTime createTime;
+
+ /**
+ * 创建人id
+ */
+ @TableField("creator_id")
+ private Integer creatorId;
+
+ /**
+ * 更新人id
+ */
+ @TableField("updater_id")
+ private Integer updaterId;
+
+ /**
+ * 修改时间
+ */
+ @TableField("update_time")
+ private LocalDateTime updateTime;
+
+ /**
+ * 版本号 默认为 1
+ */
+ @TableField("version")
+ @Version
+ private String version;
+
+ /**
+ * 状态 0初始化
+ */
+ @TableField("status")
+ private Integer status;
+
+ /**
+ * 内部编码
+ */
+ @TableField("inter_code")
+ private String interCode;
+
+ /**
+ * 编码
+ */
+ @TableField("code")
+ private String code;
+
+ /**
+ * 问题
+ */
+ @TableField("question")
+ private String question;
+
+ /**
+ * 解答
+ */
+ @TableField("answer")
+ private String answer;
+
+ /**
+ * 描述信息
+ */
+ @TableField("description")
+ private String description;
+
+ /**
+ * 备注
+ */
+ @TableField("note")
+ private String note;
+
+
+ public static final String ID = "id";
+
+ public static final String VALID = "valid";
+
+ public static final String CREATE_TIME = "create_time";
+
+ public static final String CREATOR_ID = "creator_id";
+
+ public static final String UPDATER_ID = "updater_id";
+
+ public static final String UPDATE_TIME = "update_time";
+
+ public static final String VERSION = "version";
+
+ public static final String STATUS = "status";
+
+ public static final String INTER_CODE = "inter_code";
+
+ public static final String CODE = "code";
+
+ public static final String QUESTION = "question";
+
+ public static final String ANSWER = "answer";
+
+ public static final String DESCRIPTION = "description";
+
+ public static final String NOTE = "note";
+
+ @Override
+ protected Serializable pkVal() {
+ return this.id;
+ }
+
+}
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/QuestionAnswerMapper.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/QuestionAnswerMapper.java
new file mode 100644
index 0000000..6c963b8
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/QuestionAnswerMapper.java
@@ -0,0 +1,16 @@
+package com.mt.wms.core.dal.mapper;
+
+import com.mt.wms.core.dal.entity.QuestionAnswer;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * 问题解答表 Mapper 接口
+ *
+ *
+ * @author mt
+ * @since 2022-08-11
+ */
+public interface QuestionAnswerMapper extends BaseMapper {
+
+}
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/QuestionAnswerMapper.xml b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/QuestionAnswerMapper.xml
new file mode 100644
index 0000000..dab9278
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/mapper/QuestionAnswerMapper.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, code, question, answer, description, note
+
+
+
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/QuestionAnswerServiceBiz.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/QuestionAnswerServiceBiz.java
new file mode 100644
index 0000000..9018cee
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/QuestionAnswerServiceBiz.java
@@ -0,0 +1,16 @@
+package com.mt.wms.core.dal.service;
+
+import com.mt.wms.core.dal.entity.QuestionAnswer;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 问题解答表 服务类
+ *
+ *
+ * @author mt
+ * @since 2022-08-11
+ */
+public interface QuestionAnswerServiceBiz extends IService {
+
+}
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/QuestionAnswerServiceBizImpl.java b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/QuestionAnswerServiceBizImpl.java
new file mode 100644
index 0000000..b12ef41
--- /dev/null
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/dal/service/impl/QuestionAnswerServiceBizImpl.java
@@ -0,0 +1,20 @@
+package com.mt.wms.core.dal.service.impl;
+
+import com.mt.wms.core.dal.entity.QuestionAnswer;
+import com.mt.wms.core.dal.mapper.QuestionAnswerMapper;
+import com.mt.wms.core.dal.service.QuestionAnswerServiceBiz;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 问题解答表 服务实现类
+ *
+ *
+ * @author mt
+ * @since 2022-08-11
+ */
+@Service
+public class QuestionAnswerServiceBizImpl extends ServiceImpl implements QuestionAnswerServiceBiz {
+
+}
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/QuestionAnswerController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/QuestionAnswerController.java
new file mode 100644
index 0000000..2974b5c
--- /dev/null
+++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/QuestionAnswerController.java
@@ -0,0 +1,105 @@
+package com.mt.wms.empty.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.mt.wms.basic.params.AlarmBaseParam;
+import com.mt.wms.basic.params.AlarmBaseQueryParam;
+import com.mt.wms.basic.service.AlarmBaseService;
+import com.mt.wms.basic.vo.AlarmBaseVo;
+import com.mt.wms.core.base.BaseController;
+import com.mt.wms.core.constants.CommonConstant;
+import com.mt.wms.core.dal.entity.AlarmBase;
+import com.mt.wms.core.dal.entity.QuestionAnswer;
+import com.mt.wms.core.dal.service.QuestionAnswerServiceBiz;
+import com.mt.wms.core.params.IdParam;
+import com.mt.wms.core.validator.groups.AddGroup;
+import com.mt.wms.core.validator.groups.PageGroup;
+import com.mt.wms.core.validator.groups.UpdateGroup;
+import com.mt.wms.core.vo.IdVo;
+import com.mt.wms.core.vo.PageVo;
+import com.mt.wms.core.vo.R;
+import com.mt.wms.empty.params.QuestionAnswerParam;
+import com.mt.wms.empty.params.QuestionAnswerQueryparam;
+import com.mt.wms.empty.vo.QuestionAnswerVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.groups.Default;
+import java.util.List;
+
+/**
+ * @Author: LGH
+ * @Date: 2022/8/11
+ */
+@RestController
+@RequestMapping(CommonConstant.API_MODULE_BASE + "questionAnswer")
+@Slf4j
+@Api(value = "问题解答相关接口", tags = "问题解答相关接口", hidden = false)
+public class QuestionAnswerController extends BaseController {
+
+ @Autowired
+ private QuestionAnswerServiceBiz questionAnswerServiceBiz;
+
+ @PostMapping(value = "get")
+ @ApiOperation(value = "获取报警基础信息")
+ private R get(@Validated @RequestBody IdParam idParam) {
+ QuestionAnswer questionAnswer = questionAnswerServiceBiz.getById(idParam.getId());
+ QuestionAnswerVo questionAnswerVo= QuestionAnswerVo.builder().build();
+ BeanUtils.copyProperties(questionAnswer,QuestionAnswerVo.class);
+ return successful(questionAnswerVo);
+ }
+
+ @PostMapping(value = "list")
+ @ApiOperation(value = "获取报警基础信息列表")
+ private R> list(@Validated({Default.class}) @RequestBody QuestionAnswerQueryparam questionAnswerQueryparam) {
+ List questionAnswerList = questionAnswerServiceBiz.list(new QueryWrapper()
+ .like(StringUtils.isNotBlank(questionAnswerQueryparam.getKey()), QuestionAnswer.QUESTION, questionAnswerQueryparam.getKey()));
+ List questionAnswerVos = com.mt.wms.core.utils.BeanUtils.copyList(questionAnswerList, QuestionAnswerVo.class);
+ return successful(questionAnswerVos);
+ }
+
+ @PostMapping(value = "page")
+ @ApiOperation(value = "获取分页报警基础信息")
+ private R> page(@Validated({PageGroup.class, Default.class}) @RequestBody QuestionAnswerQueryparam questionAnswerQueryparam) {
+ QueryWrapper wrapper=new QueryWrapper<>();
+ wrapper.like(StringUtils.isNotBlank(questionAnswerQueryparam.getKey()), QuestionAnswer.QUESTION, questionAnswerQueryparam.getKey());
+ Page page = questionAnswerServiceBiz.page(new Page<>(questionAnswerQueryparam.getCurrent(), questionAnswerQueryparam.getSize()), wrapper);
+ return successful(new PageVo<>(page,QuestionAnswerVo.class));
+ }
+
+ @PostMapping(value = "add")
+ @ApiOperation(value = "新增")
+ private R add(@Validated({AddGroup.class, Default.class}) @RequestBody QuestionAnswerParam questionAnswerParam) {
+ QuestionAnswer questionAnswer=new QuestionAnswer();
+ BeanUtils.copyProperties(questionAnswerParam,questionAnswer);
+ setCommonField(questionAnswer);
+ questionAnswerServiceBiz.save(questionAnswer);
+ return successful(IdVo.builder().id(questionAnswer.getId()).build());
+ }
+
+ @PostMapping(value = "update")
+ @ApiOperation(value = "更新")
+ private R update(@Validated({UpdateGroup.class, Default.class}) @RequestBody QuestionAnswerParam questionAnswerParam) {
+ QuestionAnswer questionAnswer=new QuestionAnswer();
+ BeanUtils.copyProperties(questionAnswerParam,questionAnswer);
+ setCommonField(questionAnswer);
+ questionAnswerServiceBiz.save(questionAnswer);
+ return successful(IdVo.builder().id(questionAnswer.getId()).build());
+ }
+
+ @PostMapping(value = "delete")
+ @ApiOperation(value = "删除报警基础信息")
+ private R delete(@Validated @RequestBody IdParam idParam) {
+ questionAnswerServiceBiz.removeById(idParam.getId());
+ return successful(IdVo.builder().id(idParam.getId()).build());
+ }
+}
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/QuestionAnswerParam.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/QuestionAnswerParam.java
new file mode 100644
index 0000000..20dd55d
--- /dev/null
+++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/QuestionAnswerParam.java
@@ -0,0 +1,28 @@
+package com.mt.wms.empty.params;
+
+import com.mt.wms.core.base.BaseParam;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @Author: LGH
+ * @Date: 2022/8/11
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "问题解答参数对象", description = "问题解答参数对象")
+public class QuestionAnswerParam extends BaseParam {
+
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "问题", required = true)
+ private String question;
+
+ @ApiModelProperty(value = "解答", required = true)
+ private String answer;
+
+}
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/QuestionAnswerQueryparam.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/QuestionAnswerQueryparam.java
new file mode 100644
index 0000000..84e08b2
--- /dev/null
+++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/params/QuestionAnswerQueryparam.java
@@ -0,0 +1,23 @@
+package com.mt.wms.empty.params;
+
+import com.mt.wms.core.params.BasePageParam;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @Author: LGH
+ * @Date: 2022/8/11
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "问题解答查询对象", description = "问题解答查询对象")
+public class QuestionAnswerQueryparam extends BasePageParam {
+ private static final long serialVersionUID = 1L;
+
+ @ApiModelProperty(value = "问题", required = false)
+ private String key;
+}
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/QuestionAnswerVo.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/QuestionAnswerVo.java
new file mode 100644
index 0000000..5c83f9d
--- /dev/null
+++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/QuestionAnswerVo.java
@@ -0,0 +1,29 @@
+package com.mt.wms.empty.vo;
+
+import com.mt.wms.core.base.BaseVo;
+import com.mt.wms.core.vo.PageVo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @Author: LGH
+ * @Date: 2022/8/11
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@Builder
+@ApiModel(value = "问题解答视图对象", description = "问题解答视图对象")
+public class QuestionAnswerVo extends BaseVo implements PageVo.ConvertVo{
+
+
+ @ApiModelProperty(value = "问题", required = true)
+ private String question;
+
+ @ApiModelProperty(value = "解答", required = true)
+ private String answer;
+}