Compare commits

...

4 Commits

Author SHA1 Message Date
wangliwen d5e66e60b5 创建索引前,先期删除索引 2022-06-27 15:51:04 +08:00
wangliwen f967285913 资源表使用全文索引替换like查询 2022-06-27 15:44:18 +08:00
wangliwen 6a784f705c 我的待办使用流程定义key过滤 2022-06-27 15:03:15 +08:00
wangliwen 038857a149 加索引 2022-06-27 15:02:44 +08:00
4 changed files with 78 additions and 45 deletions

View File

@ -23,6 +23,7 @@ import java.util.Map;
/**
* 任务管理
*
* @author Jone
*/
@RestController
@ -67,7 +68,8 @@ public class ActTaskController {
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
@ApiImplicitParam(name = "taskName", value = "任务名称", paramType = "query", dataType = "String")
@ApiImplicitParam(name = "taskName", value = "任务名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "processDefinitionKey", value = "流程定义KEY", paramType = "query", dataType = "String")
})
// @RequiresPermissions("sys:task:all")
public Result<PageData<TaskDTO>> myToDoTaskPage(@ApiIgnore @RequestParam Map<String, Object> params) {

View File

@ -112,7 +112,10 @@ public class ActTaskService extends BaseServiceImpl {
if (StringUtils.isNotEmpty((String) params.get("taskName"))) {
taskQuery.taskNameLike("%" + (String) params.get("taskName") + "%");
}
if (StringUtils.isNotEmpty((String) params.get("isRoleGroup")) && "1".equals(params.get("isRoleGroup"))) {
if (StringUtils.isNotEmpty((String) params.get("processDefinitionKey"))) { // 流程定义key
taskQuery.processDefinitionKey((String) params.get("taskName"));
}
if (StringUtils.isNotEmpty((String) params.get("isRoleGroup")) && "1" .equals(params.get("isRoleGroup"))) {
List<Long> listRoles = sysRoleUserService.getRoleIdList(SecurityUser.getUserId());
List<String> listStr = new ArrayList<>();
for (Long role : listRoles) {
@ -134,6 +137,10 @@ public class ActTaskService extends BaseServiceImpl {
ObjectMapper oMapper = new ObjectMapper();
Map<String, Object> processVariable = new LinkedHashMap<>();
if (dto.getBusinessKey().contains("{") || dto.getBusinessKey().contains("[")) { // 为json内容 (特殊处理批量)
continue;
}
TAbilityApplicationDTO abilityApplicationDTO =
tAbilityApplicationService.get(Long.valueOf(dto.getBusinessKey()));
if (abilityApplicationDTO != null) {
@ -344,10 +351,10 @@ public class ActTaskService extends BaseServiceImpl {
public void deleteTaskVariable(String taskId, String variableName, String scope) {
if (StringUtils.isNotEmpty(scope)) {
if ("global".equals(scope.toLowerCase())) {
if ("global" .equals(scope.toLowerCase())) {
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
runtimeService.removeVariable(task.getExecutionId(), variableName);
} else if ("local".equals(scope.toLowerCase())) {
} else if ("local" .equals(scope.toLowerCase())) {
taskService.removeVariable(taskId, variableName);
}
} else {
@ -452,19 +459,19 @@ public class ActTaskService extends BaseServiceImpl {
TransitionImpl transitionImpl = (TransitionImpl) pvmTransition;
ActivityImpl activityImpl = transitionImpl.getSource();
String type = (String) activityImpl.getProperty("type");
if ("parallelGateway".equals(type)) {
if ("parallelGateway" .equals(type)) {
// 并行路线
if (activityImpl.getOutgoingTransitions().size() > 1) {
throw new RenException(ErrorCode.BACK_PROCESS_HANDLEING_ERROR);
}
this.getCanBackUpActivitys(activityImpl, rtnList);
} else if ("startEvent".equals(type)) {
} else if ("startEvent" .equals(type)) {
return;
} else if ("userTask".equals(type)) {
} else if ("userTask" .equals(type)) {
rtnList.add(activityImpl);
} else if ("exclusiveGateway".equals(type)) {
} else if ("exclusiveGateway" .equals(type)) {
this.getCanBackUpActivitys(activityImpl, rtnList);
} else if ("inclusiveGateway".equals(type)) {
} else if ("inclusiveGateway" .equals(type)) {
if (activityImpl.getOutgoingTransitions().size() > 1) {
return;
}
@ -537,10 +544,10 @@ public class ActTaskService extends BaseServiceImpl {
if (StringUtils.isEmpty(activityId)) {
activityId = task.getTaskDefinitionKey();
}
if ("END".equals(activityId.toUpperCase())) {
if ("END" .equals(activityId.toUpperCase())) {
for (ActivityImpl activityImpl : processDefinition.getActivities()) {
String type = (String) activityImpl.getProperty("type");
if ("endEvent".equals(type)) {
if ("endEvent" .equals(type)) {
return activityImpl;
}
}

View File

@ -1,4 +1,20 @@
-- 删除索引
alter table `tb_resource_collection` drop index `resourceid`;
alter table `tb_resource_car` drop index `resourceid`;
alter table `tb_resource_score` drop index `resourceid`;
alter table `tb_resource_browse` drop index `resourceid`;
alter table `t_ability_application` drop index `resourceid`;
alter table `t_ability_application` drop index `userId`;
alter table `tb_data_resource` drop index `type`;
alter table `tb_data_attr` drop index `attr_value`;
alter table `tb_data_resource` drop index `name`;
-- 创建索引
alter table `tb_resource_collection` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '收藏的资源id';
alter table `tb_resource_car` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '加入申购车的id';
alter table`tb_resource_car` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '加入申购车的id';
alter table `tb_resource_score` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '评分的资源id';
ALTER TABLE `tb_resource_browse` ADD INDEX `resourceid`(`resource_id`) USING BTREE COMMENT '资源id索引';
alter table `tb_resource_browse` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '资源id索引';
alter table `t_ability_application` ADD INDEX `resourceid`(`resource_id`) USING BTREE comment '资源id';
alter table `t_ability_application` ADD INDEX `userId`(`user_id`) USING BTREE comment '用户';
alter table `tb_data_resource` ADD FULLTEXT INDEX `type`(`type`);
alter table `tb_data_attr` ADD FULLTEXT INDEX `attr_value`(`attr_value`);
alter table `tb_data_resource` ADD FULLTEXT INDEX `name`(`name`);

View File

@ -133,10 +133,12 @@
WHERE 1 = 1
AND tdr.del_flag = 0
<if test="dto.type != null and dto.type != ''">
AND tdr.type LIKE CONCAT('%',#{dto.type},'%')
AND MATCH (tdr.type) AGAINST ( #{dto.type} IN BOOLEAN MODE)
<!--AND tdr.type LIKE CONCAT('%',#{dto.type},'%') -->
</if>
<if test="dto.name != null and dto.name != ''">
AND tdr.name LIKE CONCAT('%',#{dto.name},'%')
<!-- AND tdr.name LIKE CONCAT('%',#{dto.name},'%') -->
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
</if>
<if test="dto.districtId != null and dto.districtId != ''">
AND tdr.district_id = #{dto.districtId}
@ -163,7 +165,8 @@
<foreach collection="dto.infoList" item="item" separator="union all">
SELECT data_resource_id FROM tb_data_attr
WHERE attr_type = #{item.attrType}
AND attr_value LIKE CONCAT('%', #{item.attrValue}, '%')
<!-- AND attr_value LIKE CONCAT('%', #{item.attrValue}, '%') -->
AND MATCH ( attr_value) AGAINST ( #{item.attrValue} IN BOOLEAN MODE)
AND del_flag = 0
</foreach>) tb
GROUP BY tb.data_resource_id
@ -207,10 +210,12 @@
1 = 1
AND tdr.del_flag = 0
<if test="type != null and type != ''">
AND tdr.type LIKE CONCAT('%',#{type},'%')
<!-- AND tdr.type LIKE CONCAT('%',#{type},'%') -->
AND MATCH (tdr.type) AGAINST ( #{type} IN BOOLEAN MODE)
</if>
<if test="name != null and name != ''">
AND tdr.name LIKE CONCAT('%',#{name},'%')
<!--AND tdr.name LIKE CONCAT('%',#{name},'%') -->
AND MATCH (tdr.name) AGAINST ( #{name} IN BOOLEAN MODE)
</if>
ORDER BY ${orderFiled} ${orderType}
LIMIT ${pageNum}, ${pageSize}
@ -313,7 +318,8 @@
WHERE 1 = 1
AND tdr.del_flag = 0
<if test="dto.name != null and dto.name != ''">
AND tdr.name LIKE CONCAT('%',#{dto.name},'%')
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
<!--AND tdr.name LIKE CONCAT('%',#{dto.name},'%') -->
</if>
<if test="dto.type != null and dto.type != ''">
AND tdr.type = #{dto.type}
@ -879,7 +885,8 @@
AND tdr.del_flag = 0
AND tda.del_flag = 0
AND tdr.id = tda.data_resource_id
AND attr_value LIKE CONCAT('%', #{type}, '%')
AND MATCH (attr_value) AGAINST ( #{type} IN BOOLEAN MODE)
<!-- AND attr_value LIKE CONCAT('%', #{type}, '%') -->
</select>
<select id="selectAppAreaCountList" resultType="java.util.Map">
@ -900,35 +907,36 @@
</select>
<select id="applicationAreaCapabilitySet" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS type ,
COUNT( tdav.data_resource_id ) AS total
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS type ,
COUNT( tdav.data_resource_id ) AS total
FROM
tb_data_attr tdav
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
';', '' ) ) + 1 )
tb_data_attr tdav
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
';', '' ) ) + 1 )
WHERE
1 = 1
AND tdav.attr_type = '应用领域'
AND tdav.del_flag = 0
AND SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) != ''
1 = 1
AND tdav.attr_type = '应用领域'
AND tdav.del_flag = 0
AND SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) != ''
GROUP BY
type
type
</select>
<select id="applicationAreaCapabilityList" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS type ,
COUNT( tdav.data_resource_id ) AS total
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS type ,
COUNT( tdav.data_resource_id ) AS total
FROM
(select a.* from tb_data_attr a inner join tb_data_resource c on a.data_resource_id = c.id where c.type = #{resourceType} AND c.dept_id = #{id} ) tdav
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
';', '' ) ) + 1 )
(select a.* from tb_data_attr a inner join tb_data_resource c on a.data_resource_id = c.id where c.type =
#{resourceType} AND c.dept_id = #{id} ) tdav
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
';', '' ) ) + 1 )
WHERE
1 = 1
AND tdav.attr_type = '应用领域'
AND tdav.del_flag = 0
AND SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) != ''
1 = 1
AND tdav.attr_type = '应用领域'
AND tdav.del_flag = 0
AND SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) != ''
GROUP BY
type
type
</select>
@ -973,9 +981,9 @@
<select id="selectResourceNumAsType" parameterType="java.util.Map" resultType="java.util.Map">
SELECT COUNT(b.id) AS resourceNum,
a.id AS deptId,
a.name AS deptName,
SUM(b.visits) AS visits
a.id AS deptId,
a.name AS deptName,
SUM(b.visits) AS visits
FROM
sys_dept a
INNER JOIN
@ -1058,7 +1066,7 @@
WHERE
a.del_flag = 0
<if test="id != null and id != ''">
and b.dept_id = #{id}
and b.dept_id = #{id}
</if>
<if test="resourceType != null and resourceType != ''">
AND b.type = #{resourceType}
@ -1067,7 +1075,7 @@
<select id="selectResourceShare" parameterType="java.util.Map" resultType="integer">
SELECT COUNT(id) AS nums
FROM
tb_data_resource
tb_data_resource
WHERE
del_flag = 0
<if test="id != null and id != ''">