Commit 7d633235 by 谢海旭

更名变量、微调查询模板详情接口逻辑

1 parent 84f61814
......@@ -5,6 +5,7 @@ import cn.com.glsx.process.modules.model.SopTplDTO;
import cn.com.glsx.process.modules.model.SopTplSearch;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -12,4 +13,6 @@ import java.util.List;
public interface SopTplMapper extends CommonBaseMapper<SopTpl> {
List<SopTplDTO> page(SopTplSearch search);
SopTplDTO getById(@Param("tplId") String tplId);
}
\ No newline at end of file
......@@ -6,9 +6,9 @@ import lombok.Data;
@Data
public class SopTplSearch extends Page {
private String id;
private String tplId;
private String name;
private String tplName;
private Integer status;
private Integer tplStatus;
}
......@@ -36,8 +36,8 @@ public class SopTplController extends BaseController {
}
@Operation(summary = "SOP模板详情", description = "SOP模板详情")
@GetMapping("/{id}")
public SopTplDTO getById(@PathVariable("id") String id) {
return sopTplService.getById(id);
@GetMapping("/{tplId}")
public SopTplDTO getById(@PathVariable("tplId") String tplId) {
return sopTplService.getById(tplId);
}
}
......@@ -41,24 +41,22 @@ public class SopTplService {
/**
* 查询sop模板详情
*
* @param id
* @param tplId
* @return
*/
public SopTplDTO getById(String id) {
SopTpl sopTpl = sopTplMapper.selectByPrimaryKey(id);
if (Objects.isNull(sopTpl)) {
public SopTplDTO getById(String tplId) {
SopTplDTO sopTplDTO = sopTplMapper.getById(tplId);
if (Objects.isNull(sopTplDTO)) {
return null;
}
SopTplDTO sopTplDTO = SopTplConverter.INSTANCE.do2dto(sopTpl);
SopTplNode nodeQuery = new SopTplNode();
nodeQuery.setTplId(id);
nodeQuery.setTplId(tplId);
List<SopTplNode> nodes = sopTplNodeMapper.select(nodeQuery);
sopTplDTO.setNodes(nodes);
SopTplLink linkQuery = new SopTplLink();
linkQuery.setTplId(id);
linkQuery.setTplId(tplId);
List<SopTplLink> links = sopTplLinkMapper.select(linkQuery);
sopTplDTO.setLinks(links);
return sopTplDTO;
......
......@@ -23,6 +23,7 @@
<select id="countByTplId" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT group_id) FROM sop_tpl_grant WHERE tpl_id = #{tplId} AND grant_status != -1;
</select>
<select id="list" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
......
......@@ -32,17 +32,21 @@
<include refid="Base_Column_List" />
from sop_tpl
<where>
<if test="id != null and id !=''">
and tpl_id = #{id}
<if test="tplId != null and tplId !=''">
and tpl_id = #{tplId}
</if>
<if test="name != null and name !=''">
and tpl_name = #{name}
<if test="tplName != null and tplName !=''">
and tpl_name = #{tplName}
</if>
<if test="status != null">
and tpl_status = #{status}
<if test="tplStatus != null">
and tpl_status = #{tplStatus}
</if>
</where>
order by update_time desc
</select>
<select id="getById" resultMap="BaseResultDTOMap">
select <include refid="Base_Column_List" /> from sop_tpl where tpl_id = #{tplId}
</select>
</mapper>
\ 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!