排序
This commit is contained in:
@@ -18,6 +18,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nutz.aop.interceptor.ioc.TransAop;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
@@ -32,7 +33,11 @@ import org.nutz.mvc.annotation.Ok;
|
||||
import org.nutz.mvc.annotation.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@IocBean
|
||||
@At("/flow/design")
|
||||
@@ -68,7 +73,7 @@ public class FlowDesignController {
|
||||
log.error("初始化AssignmentHandler失败: {}", aClass.getName());
|
||||
}
|
||||
}
|
||||
// 排序 按order
|
||||
// 排序按 order,保证设计器下拉项展示稳定。
|
||||
list.sort(Comparator.comparingInt(o -> o.getInt("order")));
|
||||
ASSIGMENT_HANDLER_LIST = Collections.unmodifiableList(list);
|
||||
}
|
||||
@@ -88,7 +93,7 @@ public class FlowDesignController {
|
||||
log.error("初始化CandidateHandler失败: {}", aClass.getName());
|
||||
}
|
||||
}
|
||||
// 排序 按order
|
||||
// 排序按 order,保证设计器下拉项展示稳定。
|
||||
list.sort(Comparator.comparingInt(o -> o.getInt("order")));
|
||||
CANDIDATE_HANDLER_LIST = Collections.unmodifiableList(list);
|
||||
}
|
||||
@@ -110,14 +115,40 @@ public class FlowDesignController {
|
||||
@ApiOperation("获取流程设计分页列表")
|
||||
@SaCheckPermission("flow.design")
|
||||
public Result pageData(PageForm pageForm, String displayName, String name, String category, Boolean deployed) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
pd.*
|
||||
FROM
|
||||
wf_process_design pd
|
||||
LEFT JOIN wf_process_category pc ON pc.id = pd.category
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
|
||||
cnd.and(Cnd.likeEX(ProcessDesign::getDisplayName, displayName));
|
||||
cnd.and(Cnd.likeEX(ProcessDesign::getName, name));
|
||||
cnd.andEX(ProcessDesign::getCategory, "=", category);
|
||||
cnd.andEX(ProcessDesign::getIsDeployed, "=", deployed);
|
||||
cnd.and(Cnd.likeEX("pd.displayName", displayName));
|
||||
cnd.and(Cnd.likeEX("pd.name", name));
|
||||
cnd.andEX("pd.category", "=", category);
|
||||
cnd.andEX("pd.isDeployed", "=", deployed);
|
||||
if ("sortNo".equals(pageForm.getPageOrderName())) {
|
||||
if ("descending".equals(pageForm.getPageOrderBy())) {
|
||||
cnd.desc("pd.sortNo");
|
||||
} else {
|
||||
cnd.asc("pd.sortNo");
|
||||
}
|
||||
} else if ("category".equals(pageForm.getPageOrderName())) {
|
||||
if ("descending".equals(pageForm.getPageOrderBy())) {
|
||||
cnd.desc("pc.name");
|
||||
} else {
|
||||
cnd.asc("pc.name");
|
||||
}
|
||||
} else {
|
||||
// 默认按排序编码升序,编码一致时再按主键兜底。
|
||||
cnd.asc("pd.sortNo");
|
||||
}
|
||||
cnd.asc("pd.id");
|
||||
|
||||
Pagination pagination = processDesignService.listPage(pageForm.getPageNumber(), pageForm.getPageSize(), cnd);
|
||||
sql.setCondition(cnd);
|
||||
Pagination pagination = processDesignService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
return Result.success(pagination);
|
||||
}
|
||||
|
||||
@@ -206,6 +237,17 @@ public class FlowDesignController {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@ApiOperation("修改流程设计排序编码")
|
||||
@SaCheckPermission("flow.design")
|
||||
public Result updateSortNo(@Param("id") Long id, @Param("sortNo") Integer sortNo) {
|
||||
if (id == null || sortNo == null || sortNo < 0) {
|
||||
return Result.error("排序编码必须是非负整数");
|
||||
}
|
||||
processDesignService.update(Chain.make("sortNo", sortNo), Cnd.where(ProcessDesign::getId, "=", id));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取流程设计任务参与者处理类")
|
||||
@@ -213,22 +255,20 @@ public class FlowDesignController {
|
||||
return Result.success(ASSIGMENT_HANDLER_LIST);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取流程设计任务参与者处理类")
|
||||
@ApiOperation("获取流程设计候选用户处理类")
|
||||
public Result candidateHandlerClass() {
|
||||
return Result.success(CANDIDATE_HANDLER_LIST);
|
||||
}
|
||||
|
||||
|
||||
@At
|
||||
@SaCheckLogin
|
||||
@ApiOperation("获取流程设计任务参与者分页数据")
|
||||
public Result assigneePage(Integer pageNumber, Integer pageSize, String searchKeyword, @Param("userIds") String[] userIds) {
|
||||
Sql sql = Sqls.create("select id,loginname,username,unitName from vw_user $condition");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if(StrUtil.isNotBlank(searchKeyword)) {
|
||||
if (StrUtil.isNotBlank(searchKeyword)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.orLike("username", searchKeyword);
|
||||
group.orLike("loginname", searchKeyword);
|
||||
|
||||
@@ -48,11 +48,11 @@ public class ProcessDesign extends BaseModel {
|
||||
@Column
|
||||
private String h5InstanceUrl;
|
||||
|
||||
@Comment("电脑端发起地址")
|
||||
@Comment("电脑端查看地址")
|
||||
@Column
|
||||
private String instanceViewUrl;
|
||||
|
||||
@Comment("手机端发起地址")
|
||||
@Comment("手机端查看地址")
|
||||
@Column
|
||||
private String h5InstanceViewUrl;
|
||||
|
||||
@@ -68,6 +68,11 @@ public class ProcessDesign extends BaseModel {
|
||||
@Column
|
||||
private Integer isDeployed;
|
||||
|
||||
@Comment("排序编码")
|
||||
@Column
|
||||
@Default("0")
|
||||
private Integer sortNo;
|
||||
|
||||
@Comment("备注")
|
||||
@Column
|
||||
private String remark;
|
||||
|
||||
@@ -411,6 +411,25 @@ public class SysMenuController {
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu.edit")
|
||||
public Object updateLocation(String id, Integer location) {
|
||||
try {
|
||||
if (StrUtil.isBlank(id) || location == null || location < 0) {
|
||||
return Result.error("排序编码必须是非负整数");
|
||||
}
|
||||
// 单独更新排序编码后同步清理缓存,保证菜单树立即按新顺序生效。
|
||||
sysMenuService.update(Chain.make("location", location), Cnd.where("id", "=", id));
|
||||
sysMenuService.clearCache();
|
||||
sysUserService.clearCache();
|
||||
sysRoleService.clearCache();
|
||||
return Result.success();
|
||||
} catch (Exception e) {
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
||||
@At
|
||||
@Ok("json")
|
||||
@SaCheckPermission("sys.manager.menu")
|
||||
|
||||
@@ -46,13 +46,14 @@ public class SysV4ServController {
|
||||
@ApiOperation("获取应用列表")
|
||||
public Result list(@Param("categoryId") String categoryId, @Param("letter") String letter, @Param("keyword") String keyword, HttpServletRequest req) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT t.*,(select picIcon from wf_process_design where name = t.name) as picIcon
|
||||
SELECT t.*, d.picIcon, d.sortNo
|
||||
FROM wf_process_define t
|
||||
INNER JOIN (
|
||||
SELECT name, MAX(id) AS max_id
|
||||
FROM wf_process_define
|
||||
GROUP BY name
|
||||
) sub ON t.name = sub.name AND t.id = sub.max_id
|
||||
LEFT JOIN wf_process_design d ON d.name = t.name
|
||||
$condition
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
@@ -61,10 +62,10 @@ public class SysV4ServController {
|
||||
}
|
||||
cnd.andEX("t.category", "=", categoryId);
|
||||
cnd.andEX("t.pinyinName", "=", letter);
|
||||
cnd.asc("d.sortNo");
|
||||
cnd.asc("t.id");
|
||||
sql.setCondition(cnd);
|
||||
List<NutMap> list = sysMenuService.listMap(sql);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user