Commit 265d7033 by 谢海旭

[+]新增1个接口:根据门店旅程实例id查询详情

1 parent 294ce56e
......@@ -2,6 +2,7 @@ package cn.com.glsx.process.modules.controller;
import cn.com.glsx.process.modules.BaseController;
import cn.com.glsx.process.modules.entity.SopInst;
import cn.com.glsx.process.modules.model.SopInstDTO;
import cn.com.glsx.process.modules.model.SopInstSearch;
import cn.com.glsx.process.modules.service.SopInstService;
import com.github.pagehelper.PageInfo;
......@@ -11,6 +12,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -32,4 +34,10 @@ public class SopInstController extends BaseController {
return sopInstService.selectByGroupId(search);
}
@Operation(summary = "根据id查询SOP门店模板实例详情", description = "根据id查询SOP门店模板实例详情")
@GetMapping("/{instId}")
public SopInstDTO findById(@PathVariable("instId") String instId) {
return sopInstService.findById(instId);
}
}
......@@ -37,8 +37,9 @@ public class SopInstService {
* @param instId
* @return
*/
private SopInst findById(Integer instId) {
return sopInstMapper.selectByPrimaryKey(instId);
public SopInstDTO findById(String instId) {
SopInst sopInst = sopInstMapper.selectByPrimaryKey(instId);
return getSopInstOtherInfo(sopInst);
}
/**
......@@ -104,8 +105,21 @@ public class SopInstService {
return null;
}
Assert.state(sopInsts.size() < 2, "根据查询条件找到多条记录,请检查参数是否有误!");
return getSopInstOtherInfo(sopInsts.get(0));
}
/**
* 补充门店旅程实例其它信息
*
* @param sopInst
* @return
*/
private SopInstDTO getSopInstOtherInfo(SopInst sopInst) {
if (sopInst == null) {
return null;
}
SopInstDTO sopInstDTO = SopInstConverter.INSTANCE.do2dto(sopInsts.get(0));
SopInstDTO sopInstDTO = SopInstConverter.INSTANCE.do2dto(sopInst);
String instId = sopInstDTO.getInstId();
SopInstNode nodeQuery = new SopInstNode();
nodeQuery.setInstId(instId);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!