Commit 49fcf848 by 谢海旭

[+]新增5个接口:查询旅程模板列表(SOP模板)、查询旅程模板详情、查询模板关联的门店列表、模板下发门店(模板与门店关联)、撤销模板下发门店(模板与门店撤销关联)

1 parent be30372a
Showing 27 changed files with 756 additions and 0 deletions
......@@ -5,6 +5,13 @@ import javax.persistence.*;
@Table(name = "sop_inst")
public class SopInst {
/**
* 启用状态:0,未启用;1,启用;-1,已删除/过期;
*/
public static final Byte INST_STATUS_UNUSED = 0;
public static final Byte INST_STATUS_DELETED = -1;
/**
* 实例id,一般sop只允许一个实例。特殊情况可以根据输入参数来区分不同实例。实例名可以用于在cdp保存状态
*/
......@@ -48,6 +55,13 @@ public class SopInst {
@Column(name = "inst_status")
private Byte instStatus;
/**
* 实例默认输入参数
*/
@Column(name = "inst_param")
private String instParam;
/**
* sop有效期,每个sop都设置一个有效期,到期自动停止。
*/
......@@ -196,6 +210,14 @@ public class SopInst {
this.instStatus = instStatus;
}
public String getInstParam() {
return instParam;
}
public void setInstParam(String instParam) {
this.instParam = instParam;
}
/**
* 获取sop有效期,每个sop都设置一个有效期,到期自动停止。
*
......
......@@ -4,6 +4,14 @@ import javax.persistence.*;
@Table(name = "sop_inst_node")
public class SopInstNode {
public static final byte NODE_SKIP_FALSE = 0;
public static final byte NODE_SKIP_TRUE = 1;
public static final int NODE_STATUS_DELETED = 0;
public static final int NODE_STATUS_NORMAL = 1;
/**
* 实例节点id
*/
......@@ -51,6 +59,18 @@ public class SopInstNode {
private String nodeShow;
/**
* 输入参数格式:Json,开始节点的输入参数全局共用
*/
@Column(name = "node_param")
private String nodeParam;
/**
* 节点源码,配合node_type使用,比如java源码,python脚本,sql脚本+数据源等
*/
@Column(name = "node_content")
private String nodeContent;
/**
* 节点可见状态
*/
@Column(name = "node_visible")
......@@ -220,6 +240,22 @@ public class SopInstNode {
this.nodeShow = nodeShow == null ? null : nodeShow.trim();
}
public String getNodeParam() {
return nodeParam;
}
public void setNodeParam(String nodeParam) {
this.nodeParam = nodeParam;
}
public String getNodeContent() {
return nodeContent;
}
public void setNodeContent(String nodeContent) {
this.nodeContent = nodeContent;
}
/**
* 获取节点可见状态
*
......
......@@ -37,6 +37,18 @@ public class SopTpl {
private Byte tplStatus;
/**
* JSON结构,sop默认输入参数定义,可以在分配门店时配置的参数,比如旅程阶段列表
*/
@Column(name = "tpl_param_def")
private String tplParamDef;
/**
* JSON结构,sop默认输入参数定义,可以在分配门店时配置的参数,比如旅程阶段列表
*/
@Column(name = "tpl_result_def")
private String tplResultDef;
/**
* 是否单实例模式:0,多实例;1,单实例;
*/
@Column(name = "tpl_singleton")
......@@ -49,6 +61,11 @@ public class SopTpl {
private Date updateTime;
/**
* 分发门店数
*/
private int grantCount;
/**
* 获取模板id,模板代码,建议使用模板名拼音首字母缩写,不要超过8位
*
* @return tpl_id - 模板id,模板代码,建议使用模板名拼音首字母缩写,不要超过8位
......@@ -129,6 +146,22 @@ public class SopTpl {
return tplStatus;
}
public String getTplParamDef() {
return tplParamDef;
}
public void setTplParamDef(String tplParamDef) {
this.tplParamDef = tplParamDef;
}
public String getTplResultDef() {
return tplResultDef;
}
public void setTplResultDef(String tplResultDef) {
this.tplResultDef = tplResultDef;
}
/**
* 设置启用状态:0,禁用;1,启用;
*
......@@ -183,4 +216,12 @@ public class SopTpl {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public int getGrantCount() {
return grantCount;
}
public void setGrantCount(int grantCount) {
this.grantCount = grantCount;
}
}
\ No newline at end of file
......@@ -5,6 +5,13 @@ import javax.persistence.*;
@Table(name = "sop_tpl_grant")
public class SopTplGrant {
/**
* 授权状态:0,未启用;1,启用;-1,删除;
*/
public static final Byte GRANT_STATUS_DELETED = -1;
public static final Byte GRANT_STATUS_NORMAL = 1;
/**
* 授权id
*/
......
......@@ -42,6 +42,18 @@ public class SopTplNode {
private String nodeShow;
/**
* 输入参数格式:Json,开始节点的输入参数全局共用
*/
@Column(name = "node_param_def")
private String nodeParamDef;
/**
* 节点源码,配合node_type使用,比如java源码,python脚本,sql脚本+数据源等
*/
@Column(name = "node_content_def")
private String nodeContentDef;
/**
* 节点的访问key,复制时不可变
*/
@Column(name = "node_key")
......@@ -179,6 +191,22 @@ public class SopTplNode {
this.nodeShow = nodeShow == null ? null : nodeShow.trim();
}
public String getNodeParamDef() {
return nodeParamDef;
}
public void setNodeParamDef(String nodeParamDef) {
this.nodeParamDef = nodeParamDef;
}
public String getNodeContentDef() {
return nodeContentDef;
}
public void setNodeContentDef(String nodeContentDef) {
this.nodeContentDef = nodeContentDef;
}
/**
* 获取节点的访问key,复制时不可变
*
......
......@@ -2,6 +2,8 @@ package cn.com.glsx.process.modules.mapper;
import cn.com.glsx.process.modules.entity.NodeTpl;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface NodeTplMapper extends CommonBaseMapper<NodeTpl> {
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package cn.com.glsx.process.modules.mapper;
import cn.com.glsx.process.modules.entity.SopInstBatch;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SopInstBatchMapper extends CommonBaseMapper<SopInstBatch> {
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package cn.com.glsx.process.modules.mapper;
import cn.com.glsx.process.modules.entity.SopInstLink;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SopInstLinkMapper extends CommonBaseMapper<SopInstLink> {
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package cn.com.glsx.process.modules.mapper;
import cn.com.glsx.process.modules.entity.SopInst;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SopInstMapper extends CommonBaseMapper<SopInst> {
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package cn.com.glsx.process.modules.mapper;
import cn.com.glsx.process.modules.entity.SopInstNodeBatch;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SopInstNodeBatchMapper extends CommonBaseMapper<SopInstNodeBatch> {
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package cn.com.glsx.process.modules.mapper;
import cn.com.glsx.process.modules.entity.SopInstNode;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SopInstNodeMapper extends CommonBaseMapper<SopInstNode> {
}
\ No newline at end of file
package cn.com.glsx.process.modules.mapper;
import cn.com.glsx.process.modules.entity.SopTplGrant;
import cn.com.glsx.process.modules.model.SopTplGrantSearch;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface SopTplGrantMapper extends CommonBaseMapper<SopTplGrant> {
int countByTplId(@Param("tplId") String tplId);
List<SopTplGrant> list(SopTplGrantSearch search);
void del(@Param("id") Integer id);
/**
* 统计所有状态的派发数量
*
* @param tplId
* @return
*/
int countAllByTplId(@Param("tplId") String tplId);
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package cn.com.glsx.process.modules.mapper;
import cn.com.glsx.process.modules.entity.SopTplLink;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SopTplLinkMapper extends CommonBaseMapper<SopTplLink> {
}
\ No newline at end of file
package cn.com.glsx.process.modules.mapper;
import cn.com.glsx.process.modules.entity.SopTpl;
import cn.com.glsx.process.modules.model.SopTplSearch;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface SopTplMapper extends CommonBaseMapper<SopTpl> {
List<SopTpl> page(SopTplSearch search);
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package cn.com.glsx.process.modules.mapper;
import cn.com.glsx.process.modules.entity.SopTplNode;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SopTplNodeMapper extends CommonBaseMapper<SopTplNode> {
}
\ No newline at end of file
package cn.com.glsx.process.modules.model;
import cn.com.glsx.process.modules.entity.SopTplLink;
import cn.com.glsx.process.modules.entity.SopTplNode;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class SopTplDTO {
/**
* 模板id,模板代码,建议使用模板名拼音首字母缩写,不要超过8位
*/
private String tplId;
/**
* 模板名
*/
private String tplName;
/**
* cron表达式,sop执行周期
*/
private String tplCron;
/**
* sop简介
*/
private String tplRemark;
/**
* 启用状态:0,禁用;1,启用;
*/
private Byte tplStatus;
/**
* JSON结构,sop默认输入参数定义,可以在分配门店时配置的参数,比如旅程阶段列表
*/
private String tplParamDef;
/**
* JSON结构,sop默认输入参数定义,可以在分配门店时配置的参数,比如旅程阶段列表
*/
private String tplResultDef;
/**
* 是否单实例模式:0,多实例;1,单实例;
*/
private Byte tplSingleton;
private Date createTime;
private Date updateTime;
/**
* 分发门店数
*/
private int grantCount;
/**
* sop任务节点
*/
private List<SopTplNode> nodes;
/**
* sop任务节点连接
*/
private List<SopTplLink> links;
public String getTplId() {
return tplId;
}
public void setTplId(String tplId) {
this.tplId = tplId;
}
public String getTplName() {
return tplName;
}
public void setTplName(String tplName) {
this.tplName = tplName;
}
public String getTplCron() {
return tplCron;
}
public void setTplCron(String tplCron) {
this.tplCron = tplCron;
}
public String getTplRemark() {
return tplRemark;
}
public void setTplRemark(String tplRemark) {
this.tplRemark = tplRemark;
}
public Byte getTplStatus() {
return tplStatus;
}
public void setTplStatus(Byte tplStatus) {
this.tplStatus = tplStatus;
}
public String getTplParamDef() {
return tplParamDef;
}
public void setTplParamDef(String tplParamDef) {
this.tplParamDef = tplParamDef;
}
public String getTplResultDef() {
return tplResultDef;
}
public void setTplResultDef(String tplResultDef) {
this.tplResultDef = tplResultDef;
}
public Byte getTplSingleton() {
return tplSingleton;
}
public void setTplSingleton(Byte tplSingleton) {
this.tplSingleton = tplSingleton;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public int getGrantCount() {
return grantCount;
}
public void setGrantCount(int grantCount) {
this.grantCount = grantCount;
}
public List<SopTplNode> getNodes() {
return nodes;
}
public void setNodes(List<SopTplNode> nodes) {
this.nodes = nodes;
}
public List<SopTplLink> getLinks() {
return links;
}
public void setLinks(List<SopTplLink> links) {
this.links = links;
}
}
package cn.com.glsx.process.modules.model;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.Date;
@Data
public class SopTplGrantSearch {
private Integer grantId;
/**
* 实例分组:当前场景下,分组id就是门店id
*/
private String groupId;
private String groupName;
/**
* 模板id
*/
@NotEmpty(message = "tplId参数不能为空!")
private String tplId;
private Date createTime;
private Date updateTime;
/**
* 授权状态:0,未启用;1,启用;-1,删除;
*/
private Byte grantStatus;
}
package cn.com.glsx.process.modules.model;
import cn.hutool.db.Page;
import lombok.Data;
@Data
public class SopTplSearch extends Page {
private String id;
private String name;
private Integer status;
}
package cn.com.glsx.process.modules.controller;
import cn.com.glsx.process.modules.BaseController;
import cn.com.glsx.process.modules.entity.SopTpl;
import cn.com.glsx.process.modules.model.SopTplDTO;
import cn.com.glsx.process.modules.model.SopTplSearch;
import cn.com.glsx.process.modules.service.SopTplService;
import com.github.pagehelper.PageInfo;
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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
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/sopTpls")
@ResponseResultBody
public class SopTplController extends BaseController {
@Resource
private SopTplService sopTplService;
@Operation(summary = "SOP模板列表", description = "SOP模板列表")
@GetMapping
public PageInfo<SopTpl> page(SopTplSearch search) {
PageInfo<SopTpl> list = sopTplService.page(search);
return list;
}
@Operation(summary = "SOP模板详情", description = "SOP模板详情")
@GetMapping("/{id}")
public SopTplDTO getById(@PathVariable("id") String id) {
return sopTplService.getById(id);
}
}
package cn.com.glsx.process.modules.controller;
import cn.com.glsx.process.modules.BaseController;
import cn.com.glsx.process.modules.entity.SopTplGrant;
import cn.com.glsx.process.modules.model.SopTplGrantSearch;
import cn.com.glsx.process.modules.service.SopTplGrantService;
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.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@Slf4j
@Tag(name = "SOP模板授权门店接口")
@RestController
@RequestMapping(value = "/sop/sopTplGrants")
@ResponseResultBody
public class SopTplGrantController extends BaseController {
@Resource
private SopTplGrantService sopTplGrantService;
@Operation(summary = "分配门店列表", description = "分配门店列表")
@GetMapping("/list")
public List<SopTplGrant> list(@Validated SopTplGrantSearch search) {
return sopTplGrantService.list(search);
}
@Operation(summary = "下发门店", description = "下发门店")
@PostMapping
public String add(@RequestBody @Validated List<SopTplGrant> sopTplGrants) {
sopTplGrantService.add(sopTplGrants);
return "success";
}
@Operation(summary = "撤销下发门店", description = "撤销下发门店")
@DeleteMapping("/{id}")
public String del(@PathVariable("id") Integer id) {
sopTplGrantService.del(id);
return "success";
}
}
package cn.com.glsx.process.modules.converter;
import cn.com.glsx.process.modules.entity.SopInst;
import cn.com.glsx.process.modules.entity.SopTpl;
import cn.com.glsx.process.modules.model.SopTplDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
@Mapper
public interface SopTplConverter {
SopTplConverter INSTANCE = Mappers.getMapper(SopTplConverter.class);
SopTplDTO do2dto(SopTpl sopTpl);
SopTpl dto2do(SopTplDTO sopTplDTO);
@Mappings({
@Mapping(source = "tplName", target = "instName"),
@Mapping(source = "tplCron", target = "instCron"),
@Mapping(source = "tplRemark", target = "instRemark"),
@Mapping(source = "tplParamDef", target = "instParam")})
SopInst do2inst(SopTpl sopTpl);
}
package cn.com.glsx.process.modules.converter;
import cn.com.glsx.process.modules.entity.SopInstLink;
import cn.com.glsx.process.modules.entity.SopTplLink;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
@Mapper
public interface SopTplLinKConverter {
SopTplLinKConverter INSTANCE = Mappers.getMapper(SopTplLinKConverter.class);
@Mappings({@Mapping(ignore = true, source = "linkId", target = "linkId")})
SopInstLink tpl2inst(SopTplLink link);
}
package cn.com.glsx.process.modules.converter;
import cn.com.glsx.process.modules.entity.SopInstNode;
import cn.com.glsx.process.modules.entity.SopTplNode;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
@Mapper
public interface SopTplNodeConverter {
SopTplNodeConverter INSTANCE = Mappers.getMapper(SopTplNodeConverter.class);
@Mappings({
@Mapping(source = "nodeParamDef", target = "nodeParam"),
@Mapping(source = "nodeContentDef", target = "nodeContent")})
SopInstNode tpl2inst(SopTplNode node);
}
package cn.com.glsx.process.modules.service;
import cn.com.glsx.process.modules.converter.SopTplConverter;
import cn.com.glsx.process.modules.converter.SopTplLinKConverter;
import cn.com.glsx.process.modules.converter.SopTplNodeConverter;
import cn.com.glsx.process.modules.entity.*;
import cn.com.glsx.process.modules.mapper.*;
import cn.com.glsx.process.modules.model.SopTplGrantSearch;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class SopTplGrantService {
@Resource
private SopTplGrantMapper sopTplGrantMapper;
@Resource
private SopInstMapper sopInstMapper;
@Resource
private SopInstLinkMapper sopInstLinkMapper;
@Resource
private SopInstNodeMapper sopInstNodeMapper;
@Resource
private SopTplMapper sopTplMapper;
@Resource
private SopTplNodeMapper sopTplNodeMapper;
@Resource
private SopTplLinkMapper sopTplLinkMapper;
public List<SopTplGrant> list(SopTplGrantSearch search) {
return sopTplGrantMapper.list(search);
}
@Transactional
public void del(Integer id) {
sopTplGrantMapper.del(id);
}
@Transactional
public void add(List<SopTplGrant> sopTplGrants) {
Date date = new Date();
//新增派发门店记录
sopTplGrants.forEach(sopTplGrant -> {
sopTplGrant.setGrantStatus(SopTplGrant.GRANT_STATUS_NORMAL);
sopTplGrant.setCreateTime(date);
sopTplGrant.setUpdateTime(date);
});
sopTplGrantMapper.insertList(sopTplGrants);
String tplId = sopTplGrants.get(0).getTplId();
SopTpl sopTpl = sopTplMapper.selectByPrimaryKey(tplId);
Assert.state(sopTpl != null, "模板不存在!");
SopTplNode nodeQuery = new SopTplNode();
nodeQuery.setTplId(tplId);
List<SopTplNode> nodes = sopTplNodeMapper.select(nodeQuery);
SopTplLink linkQuery = new SopTplLink();
linkQuery.setTplId(tplId);
List<SopTplLink> links = sopTplLinkMapper.select(linkQuery);
int count = sopTplGrantMapper.countAllByTplId(tplId);
SopTplConverter sopTplConverter = SopTplConverter.INSTANCE;
SopTplLinKConverter sopTplLinKConverter = SopTplLinKConverter.INSTANCE;
SopTplNodeConverter sopTplNodeConverter = SopTplNodeConverter.INSTANCE;
for (SopTplGrant sopTplGrant : sopTplGrants) {
Integer grantId = sopTplGrant.getGrantId();
//克隆模板内容
SopInst sopInst = sopTplConverter.do2inst(sopTpl);
sopInst.setInstId(tplId + grantId);
sopInst.setGrantId(grantId);
sopInst.setCreateTime(date);
sopInst.setUpdateTime(date);
sopInst.setInstStatus(SopInst.INST_STATUS_UNUSED);
sopInstMapper.insert(sopInst);
//克隆连接
String instId = sopInst.getInstId();
List<SopInstLink> sopInstLinks = new ArrayList<>();
links.forEach(sopTplLink -> {
SopInstLink sopInstLink = sopTplLinKConverter.tpl2inst(sopTplLink);
sopInstLink.setInstId(instId);
sopInstLinks.add(sopInstLink);
});
sopInstLinkMapper.insertList(sopInstLinks);
//克隆节点
List<SopInstNode> sopInstNodes = new ArrayList<>();
nodes.forEach(sopTplNode -> {
SopInstNode sopInstNode = sopTplNodeConverter.tpl2inst(sopTplNode);
sopInstNode.setInstId(instId);
sopInstNode.setNodeSkip(SopInstNode.NODE_SKIP_FALSE);
sopInstNode.setNodeStatus(SopInstNode.NODE_STATUS_NORMAL);
sopInstNodes.add(sopInstNode);
});
sopInstNodeMapper.insertList(sopInstNodes);
}
}
}
package cn.com.glsx.process.modules.service;
import cn.com.glsx.process.modules.converter.SopTplConverter;
import cn.com.glsx.process.modules.entity.SopTpl;
import cn.com.glsx.process.modules.entity.SopTplLink;
import cn.com.glsx.process.modules.entity.SopTplNode;
import cn.com.glsx.process.modules.mapper.SopTplLinkMapper;
import cn.com.glsx.process.modules.mapper.SopTplMapper;
import cn.com.glsx.process.modules.mapper.SopTplNodeMapper;
import cn.com.glsx.process.modules.model.SopTplDTO;
import cn.com.glsx.process.modules.model.SopTplSearch;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;
@Service
public class SopTplService {
@Resource
private SopTplMapper sopTplMapper;
@Resource
private SopTplNodeMapper sopTplNodeMapper;
@Resource
private SopTplLinkMapper sopTplLinkMapper;
public PageInfo<SopTpl> page(SopTplSearch search) {
PageHelper.startPage(search.getPageNumber(), search.getPageSize());
List<SopTpl> list = sopTplMapper.page(search);
return new PageInfo<>(list);
}
/**
* 查询sop模板详情
*
* @param id
* @return
*/
public SopTplDTO getById(String id) {
SopTpl sopTpl = sopTplMapper.selectByPrimaryKey(id);
if (Objects.isNull(sopTpl)) {
return null;
}
SopTplDTO sopTplDTO = SopTplConverter.INSTANCE.do2dto(sopTpl);
SopTplNode nodeQuery = new SopTplNode();
nodeQuery.setTplId(id);
List<SopTplNode> nodes = sopTplNodeMapper.select(nodeQuery);
sopTplDTO.setNodes(nodes);
SopTplLink linkQuery = new SopTplLink();
linkQuery.setTplId(id);
List<SopTplLink> links = sopTplLinkMapper.select(linkQuery);
sopTplDTO.setLinks(links);
return sopTplDTO;
}
}
......@@ -19,4 +19,22 @@
-->
grant_id, group_id, group_name, tpl_id, create_time, update_time, grant_status
</sql>
<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"/>
from sop_tpl_grant
where tpl_id = #{tplId} and grant_status != -1
</select>
<select id="countAllByTplId" resultType="java.lang.Integer">
SELECT COUNT(0) FROM sop_tpl_grant WHERE tpl_id = #{tplId}
</select>
<delete id="del">
update sop_tpl_grant set grant_status = -1 where grant_id = #{id}
</delete>
</mapper>
\ No newline at end of file
......@@ -27,4 +27,22 @@
-->
tpl_param_def, tpl_result_def
</sql>
<select id="page" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from sop_tpl
<where>
<if test="id != null and id !=''">
and tpl_id = #{id}
</if>
<if test="name != null and name !=''">
and tpl_name = #{name}
</if>
<if test="status != null">
and tpl_status = #{status}
</if>
</where>
</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!