|
|
|
|
@@ -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());
|
|
|
|
|
}
|
|
|
|
|
}
|