Commit ea9ec968 by 谢海旭

查询模板列表(倒序返回)、"更新模板实例节点输入参数"接口

1 parent 050a939f
...@@ -17,5 +17,7 @@ public interface SopInstNodeMapper extends CommonBaseMapper<SopInstNode> { ...@@ -17,5 +17,7 @@ public interface SopInstNodeMapper extends CommonBaseMapper<SopInstNode> {
int resetInstNodeDailyCount(@Param("instId") String instId); int resetInstNodeDailyCount(@Param("instId") String instId);
PageInfo<SopTaskDTO> findPageListByInstId(@Param("instId")String instId); PageInfo<SopTaskDTO> findPageListByInstId(@Param("instId")String instId);
int updateNodeParamById(SopInstNode node);
} }
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.process.modules.controller;
import cn.com.glsx.process.modules.BaseController;
import cn.com.glsx.process.modules.entity.SopInstNode;
import cn.com.glsx.process.modules.service.SopInstNodeService;
import com.glsx.plat.core.annotation.ResponseResultBody;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
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.annotation.Resource;
@Slf4j
@Tag(name = "SOP门店模板实例节点开放接口")
@RestController
@RequestMapping(value = "/sop/api/sopInstNodes")
@ResponseResultBody
public class SopInstNodeController extends BaseController {
@Resource
private SopInstNodeService sopInstNodeService;
@Operation(summary = "更新SOP模板实例节点输入参数", description = "更新SOP模板实例节点输入参数")
@PostMapping("/updateParam")
public String updateNodeParam(@RequestBody SopInstNode node) {
log.info("更新节点输入参数 入参:instNodeId {} nodeParam {}", node.getInstNodeId(), node.getNodeParam());
sopInstNodeService.updateNodeParam(node);
return "success";
}
}
package cn.com.glsx.process.modules.service; package cn.com.glsx.process.modules.service;
import org.springframework.beans.factory.annotation.Autowired; import cn.com.glsx.process.common.sysenum.ResultEnum;
import org.springframework.stereotype.Service; import cn.com.glsx.process.exception.AdminException;
import cn.com.glsx.process.modules.entity.SopInstNode; import cn.com.glsx.process.modules.entity.SopInstNode;
import cn.com.glsx.process.modules.mapper.SopInstNodeMapper; import cn.com.glsx.process.modules.mapper.SopInstNodeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.Objects;
@Service @Service
public class SopInstNodeService { public class SopInstNodeService {
...@@ -14,6 +17,15 @@ public class SopInstNodeService { ...@@ -14,6 +17,15 @@ public class SopInstNodeService {
@Autowired @Autowired
private SopInstNodeMapper sopInstNodeMapper; private SopInstNodeMapper sopInstNodeMapper;
@Transactional
public void updateNodeParam(SopInstNode node) {
if (Objects.isNull(node.getInstNodeId())) {
throw new AdminException(ResultEnum.PARAM_ERROR.getCode(), "实例节点id必传!");
}
sopInstNodeMapper.updateNodeParamById(node);
}
/** /**
* 根据id查询 * 根据id查询
* *
......
...@@ -75,7 +75,7 @@ public class SopTplService { ...@@ -75,7 +75,7 @@ public class SopTplService {
* @return * @return
*/ */
public List<SopTpl> list() { public List<SopTpl> list() {
return sopTplMapper.selectAll(); return sopTplMapper.selectByExample(Example.builder(SopTpl.class).orderByDesc("updateTime").build());
} }
@Transactional @Transactional
......
...@@ -44,4 +44,8 @@ ...@@ -44,4 +44,8 @@
update sop_inst_node set daily_count=0 where inst_id=#{instId} update sop_inst_node set daily_count=0 where inst_id=#{instId}
</update> </update>
<update id="updateNodeParamById">
update sop_inst_node set node_param = CAST(#{nodeParam} AS JSON) where inst_node_id = #{instNodeId}
</update>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!