update:
新增常见问题汇总curd
This commit is contained in:
parent
fbdb10ace7
commit
17c0c1e973
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 问题解答表
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2022-08-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("t_question_answer")
|
||||
public class QuestionAnswer extends Model<QuestionAnswer> {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 问题解答表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2022-08-11
|
||||
*/
|
||||
public interface QuestionAnswerMapper extends BaseMapper<QuestionAnswer> {
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mt.wms.core.dal.mapper.QuestionAnswerMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.mt.wms.core.dal.entity.QuestionAnswer">
|
||||
<id column="id" property="id" />
|
||||
<result column="valid" property="valid" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="creator_id" property="creatorId" />
|
||||
<result column="updater_id" property="updaterId" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="version" property="version" />
|
||||
<result column="status" property="status" />
|
||||
<result column="inter_code" property="interCode" />
|
||||
<result column="code" property="code" />
|
||||
<result column="question" property="question" />
|
||||
<result column="answer" property="answer" />
|
||||
<result column="description" property="description" />
|
||||
<result column="note" property="note" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, valid, create_time, creator_id, updater_id, update_time, version, status, inter_code, code, question, answer, description, note
|
||||
</sql>
|
||||
|
||||
</mapper>
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 问题解答表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2022-08-11
|
||||
*/
|
||||
public interface QuestionAnswerServiceBiz extends IService<QuestionAnswer> {
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 问题解答表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author mt
|
||||
* @since 2022-08-11
|
||||
*/
|
||||
@Service
|
||||
public class QuestionAnswerServiceBizImpl extends ServiceImpl<QuestionAnswerMapper, QuestionAnswer> implements QuestionAnswerServiceBiz {
|
||||
|
||||
}
|
@ -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<QuestionAnswerVo> 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<QuestionAnswerVo>> list(@Validated({Default.class}) @RequestBody QuestionAnswerQueryparam questionAnswerQueryparam) {
|
||||
List<QuestionAnswer> questionAnswerList = questionAnswerServiceBiz.list(new QueryWrapper<QuestionAnswer>()
|
||||
.like(StringUtils.isNotBlank(questionAnswerQueryparam.getKey()), QuestionAnswer.QUESTION, questionAnswerQueryparam.getKey()));
|
||||
List<QuestionAnswerVo> questionAnswerVos = com.mt.wms.core.utils.BeanUtils.copyList(questionAnswerList, QuestionAnswerVo.class);
|
||||
return successful(questionAnswerVos);
|
||||
}
|
||||
|
||||
@PostMapping(value = "page")
|
||||
@ApiOperation(value = "获取分页报警基础信息")
|
||||
private R<PageVo<QuestionAnswerVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody QuestionAnswerQueryparam questionAnswerQueryparam) {
|
||||
QueryWrapper<QuestionAnswer> wrapper=new QueryWrapper<>();
|
||||
wrapper.like(StringUtils.isNotBlank(questionAnswerQueryparam.getKey()), QuestionAnswer.QUESTION, questionAnswerQueryparam.getKey());
|
||||
Page<QuestionAnswer> page = questionAnswerServiceBiz.page(new Page<>(questionAnswerQueryparam.getCurrent(), questionAnswerQueryparam.getSize()), wrapper);
|
||||
return successful(new PageVo<>(page,QuestionAnswerVo.class));
|
||||
}
|
||||
|
||||
@PostMapping(value = "add")
|
||||
@ApiOperation(value = "新增")
|
||||
private R<IdVo> 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<IdVo> 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<IdVo> delete(@Validated @RequestBody IdParam idParam) {
|
||||
questionAnswerServiceBiz.removeById(idParam.getId());
|
||||
return successful(IdVo.builder().id(idParam.getId()).build());
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user