11 changed files with 243 additions and 32 deletions
@ -0,0 +1,19 @@ |
|||||
|
package com.ccsens.carbasics.persist.dao; |
||||
|
|
||||
|
import com.ccsens.carbasics.persist.mapper.MenuPluginMapper; |
||||
|
import com.ccsens.common.bean.vo.CTaskVo; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.springframework.stereotype.Repository; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Repository |
||||
|
public interface MenuPluginDao extends MenuPluginMapper { |
||||
|
|
||||
|
/** |
||||
|
* 查询菜单关联的插件 |
||||
|
* @param menuId 菜单id |
||||
|
* @return 菜单关联的插件列表 |
||||
|
*/ |
||||
|
List<CTaskVo.TaskPluginInfo> queryPluginByMenuId(@Param("menuId") Long menuId); |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
package com.ccsens.carbasics.persist.dao; |
||||
|
|
||||
|
import com.ccsens.carbasics.persist.mapper.PositionPowerMapper; |
||||
|
import com.ccsens.common.bean.vo.CTaskVo; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.springframework.stereotype.Repository; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author AUSU |
||||
|
*/ |
||||
|
@Repository |
||||
|
public interface PositionPowerDao extends PositionPowerMapper { |
||||
|
|
||||
|
/** |
||||
|
*查询角色的菜单与插件 |
||||
|
* @param roleId 角色id |
||||
|
* @return 角色的菜单与插件 |
||||
|
*/ |
||||
|
List<CTaskVo.QueryTask> queryRoleMenu(@Param("roleId") Long roleId); |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
package com.ccsens.carbasics.service; |
||||
|
|
||||
|
import com.ccsens.common.bean.dto.CTaskDto; |
||||
|
import com.ccsens.common.bean.vo.CTaskVo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface IPositionPowerService { |
||||
|
|
||||
|
/** |
||||
|
* 查询职位的权限与绑定的插件 |
||||
|
* @param param 角色id |
||||
|
* @param userId 用户id |
||||
|
* @return 职位的权限与绑定的插件 |
||||
|
*/ |
||||
|
List<CTaskVo.QueryTask> queryPermanentGlobalTask(CTaskDto.QueryPermanentGlobalTask param, Long userId); |
||||
|
} |
||||
@ -0,0 +1,46 @@ |
|||||
|
package com.ccsens.carbasics.service; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollectionUtil; |
||||
|
import com.ccsens.carbasics.bean.po.MenuPlugin; |
||||
|
import com.ccsens.carbasics.bean.po.PositionPower; |
||||
|
import com.ccsens.carbasics.persist.dao.MenuPluginDao; |
||||
|
import com.ccsens.carbasics.persist.dao.PositionPowerDao; |
||||
|
import com.ccsens.carbasics.persist.mapper.PositionPowerMapper; |
||||
|
import com.ccsens.common.bean.dto.CTaskDto; |
||||
|
import com.ccsens.common.bean.vo.CTaskVo; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Propagation; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
|
||||
|
@Slf4j |
||||
|
@Service |
||||
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
||||
|
public class PositionPowerService implements IPositionPowerService { |
||||
|
@Resource |
||||
|
private PositionPowerDao positionPowerDao; |
||||
|
@Resource |
||||
|
private MenuPluginDao menuPluginDao; |
||||
|
|
||||
|
@Override |
||||
|
public List<CTaskVo.QueryTask> queryPermanentGlobalTask(CTaskDto.QueryPermanentGlobalTask param, Long userId) { |
||||
|
List<CTaskVo.QueryTask> taskList = positionPowerDao.queryRoleMenu(param.getRoleId()); |
||||
|
//为功能添加插件
|
||||
|
if (CollectionUtil.isNotEmpty(taskList)) { |
||||
|
|
||||
|
for (CTaskVo.QueryTask queryTask : taskList) { |
||||
|
List<List<CTaskVo.TaskPluginInfo>> listArrayList = new ArrayList<>(); |
||||
|
List<CTaskVo.TaskPluginInfo> pluginInfoList = menuPluginDao.queryPluginByMenuId(queryTask.getDetailId()); |
||||
|
listArrayList.add(pluginInfoList); |
||||
|
queryTask.setPlugins(listArrayList); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
return taskList; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.ccsens.carbasics.persist.dao.MenuPluginDao"> |
||||
|
|
||||
|
|
||||
|
<select id="queryPluginByMenuId" resultType="com.ccsens.common.bean.vo.CTaskVo$TaskPluginInfo"> |
||||
|
SELECT |
||||
|
mp.id AS pluginTaskId, |
||||
|
mpp.plugin_id, |
||||
|
mp.url AS param, |
||||
|
1 AS row, |
||||
|
1 AS col, |
||||
|
1 AS rowspan, |
||||
|
1 AS colspan |
||||
|
FROM |
||||
|
t_qcp_menu_power AS mp |
||||
|
LEFT JOIN t_qcp_menu_plugin AS mpp ON mp.id = mpp.power_id |
||||
|
WHERE mp.rec_status = 0 AND mpp.rec_status = 0 |
||||
|
AND mp.id = #{menuId} |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,51 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.ccsens.carbasics.persist.dao.PositionPowerDao"> |
||||
|
|
||||
|
<resultMap id="queryTask" type="com.ccsens.common.bean.vo.CTaskVo$QueryTask"> |
||||
|
<id column="id" property="id"/> |
||||
|
<result column="detailId" property="detailId"/> |
||||
|
<result column="name" property="name"/> |
||||
|
<result column="description" property="description"/> |
||||
|
<result column="planStart" property="planStart"/> |
||||
|
<result column="plan_duration" property="planDuration"/> |
||||
|
<result column="plan_end_time" property="planEnd"/> |
||||
|
<result column="realStart" property="realStart"/> |
||||
|
<result column="real_duration" property="realDuration"/> |
||||
|
<result column="real_end_time" property="realEnd"/> |
||||
|
<result column="process" property="process"/> |
||||
|
<result column="skip" property="skip"/> |
||||
|
<result column="skipTaskId" property="skipTaskId"/> |
||||
|
<collection property="panel" ofType="com.ccsens.common.bean.vo.CTaskVo$PanelInfo"> |
||||
|
<result column="backgroundColor" property="backgroundColor"/> |
||||
|
<result column="borderRadius" property="borderRadius"/> |
||||
|
<result column="border" property="border"/> |
||||
|
<result column="shadow" property="shadow"/> |
||||
|
<result column="width" property="width"/> |
||||
|
<result column="height" property="height"/> |
||||
|
<result column="row" property="row"/> |
||||
|
<result column="col" property="col"/> |
||||
|
</collection> |
||||
|
</resultMap> |
||||
|
|
||||
|
<select id="queryRoleMenu" resultMap="queryTask"> |
||||
|
SELECT |
||||
|
mp.id AS id, |
||||
|
mp.id AS detailId, |
||||
|
mp.`name` AS `name` |
||||
|
FROM |
||||
|
t_organization_position AS op |
||||
|
LEFT JOIN t_organization_position_type_relation AS ptr ON op.id = ptr.position_id |
||||
|
LEFT JOIN t_organization_position_type AS opt ON opt.id = ptr.position_type_id |
||||
|
LEFT JOIN t_qcp_position_power AS pp ON opt.id = pp.position_type_id |
||||
|
LEFT JOIN t_qcp_menu_power AS mp ON mp.id = pp.power_id |
||||
|
AND op.rec_status = 0 |
||||
|
AND ptr.rec_status = 0 |
||||
|
AND opt.rec_status = 0 |
||||
|
AND pp.rec_status = 0 |
||||
|
AND mp.rec_status = 0 |
||||
|
AND op.id = #{roleId} |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
</mapper> |
||||
Loading…
Reference in new issue