Commit 7d633235 by 谢海旭

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

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