|
|
|
@ -49,17 +49,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
|
|
|
|
|
{
|
|
|
|
|
if (req.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
var isExist = db.Queryable<FlowTemplateTenant>().Where(x => x.Name == req.Name).First();
|
|
|
|
|
if (isExist != null)
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed("流程模板名称已存在!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = req.Adapt<FlowTemplateTenant>();
|
|
|
|
|
|
|
|
|
|
var entity = db.Insertable(data).ExecuteReturnEntity();
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("添加成功!", entity.Id);
|
|
|
|
|
return DataResult.Failed("非法请求!",MultiLanguageConst.IllegalRequest);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -68,7 +58,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
|
|
|
|
|
info = req.Adapt(info);
|
|
|
|
|
|
|
|
|
|
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|
|
|
|
return DataResult.Successed("更新成功!");
|
|
|
|
|
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -78,7 +68,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
|
|
|
|
|
.Where(a => a.Id == long.Parse(id))
|
|
|
|
|
.Select<FlowTemplateRes>()
|
|
|
|
|
.First();
|
|
|
|
|
return DataResult<FlowTemplateRes>.Success(data);
|
|
|
|
|
return DataResult<FlowTemplateRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DataResult ImportFlowTemplate(string id)
|
|
|
|
@ -86,20 +76,37 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
|
|
|
|
|
var info = db.Queryable<FlowTemplate>().Where(x => x.Id == long.Parse(id)).First();
|
|
|
|
|
if (info == null)
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed("流程模板不存在!");
|
|
|
|
|
return DataResult.Failed("流程模板不存在!",MultiLanguageConst.FlowTemplateImportNotExist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = info.Adapt<FlowTemplateTenant>();
|
|
|
|
|
db.Insertable(info).ExecuteCommand();
|
|
|
|
|
return DataResult.Successed("引入成功!");
|
|
|
|
|
return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DataResult DelFlowTemplate(string id)
|
|
|
|
|
{
|
|
|
|
|
var info = db.Queryable<FlowTemplateTenant>().Where(x => x.Id == long.Parse(id)).First();
|
|
|
|
|
if (info == null)
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed("流程模板不存在!",MultiLanguageConst.FlowTemplateNotExist);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (db.Queryable<FlowInstance>().Where(x=>x.TemplateId == long.Parse(id)).Any())
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed("工作流实例存在引用的流程模板不能删除!",MultiLanguageConst.FlowTemplateDelExistImport);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db.Deleteable(info).ExecuteCommand();
|
|
|
|
|
return DataResult.Successed("删除成功!",MultiLanguageConst.DataDelSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DataResult<List<FlowTemplateRes>> GetFlowTemplateList(PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
|
|
|
|
var data = db.Queryable<FlowTemplate>()
|
|
|
|
|
// .LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
|
|
|
|
|
var data = db.Queryable<FlowTemplate>().Where(a=>a.Status == StatusEnum.Enable)
|
|
|
|
|
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
|
|
|
|
|
.Select<FlowTemplateRes>()
|
|
|
|
|
.Where(whereList).ToQueryPage(request.PageCondition);
|
|
|
|
|
return data;
|
|
|
|
|