账号管理,运营人员角色权限问题,找不到店铺。

dev_0531
kevin jiang 6 years ago
parent 2ba9891a02
commit 21239ba73b

@ -45,4 +45,23 @@ public interface PrivilageAccountDOMapper extends BaseMapper<PrivilageAccountDO>
int deleteByUserId(@Param("userId") long userId);
/**
* id
* @param searchContent
* @param roleId id
* @param companyId ID
* @return id
* @author dexiang.jiang
* @date 2020/05/18 19:55
*/
List<AccountBean> selectAccountIdByRoleAndSearchContentAndYY(@Param("searchContent") String searchContent, @Param("roleId") Long roleId, @Param("companyId") Long companyId);
/**
* ID
* @param userId
* @return id
* @author dexiang.jiang
* @date 2020/05/20 10:36
*/
List<AccountBean> selectCompanyNameAndCodeByRoleId(@Param("userId") Long userId);
}

@ -130,7 +130,25 @@ public class PrivilageAccountServiceImpl extends ServiceImpl<PrivilageAccountDOM
Long roleId, Long companyId, Long shopId) {
PageHelper.startPage(pageNum, pageSize);
//根据搜索内容和角色筛选查询
List<AccountBean> accountIds = privilageAccountDOMapper.selectAccountIdByRoleAndSearchContent(searchContent, roleId, companyId, shopId);
List<AccountBean> accountIds = new ArrayList<>();
// 运营人员角色
if(roleId.equals(3L)){
accountIds = privilageAccountDOMapper.selectAccountIdByRoleAndSearchContentAndYY(searchContent, roleId, companyId);
} else {
accountIds = privilageAccountDOMapper.selectAccountIdByRoleAndSearchContent(searchContent, roleId, companyId, shopId);
if(CollectionUtils.isNotEmpty(accountIds)){
for (int i = 0; i < accountIds.size(); i++) {
AccountBean item = accountIds.get(i);
if(item.getRoleId().equals(3L)){
List<AccountBean> itemList = privilageAccountDOMapper.selectCompanyNameAndCodeByRoleId(item.getUserId());
if(CollectionUtils.isNotEmpty(itemList)){
accountIds.get(i).setCompanyName(itemList.get(0).getCompanyName());
accountIds.get(i).setCompanyCode(itemList.get(0).getCompanyCode());
}
}
}
}
}
return new PageInfo<>(accountIds);
}

@ -12,7 +12,7 @@
</select>
<select id="selectAccountIdByRoleAndSearchContent" resultType="com.kiisoo.ic.system.bean.AccountBean">
select t1.id as accountId,t1.login as account,t2.id as userId,t5.staff_code as staffCode,t2.name as userName,t2.abbreviation,t4.name as roleName,t4.id as roleId,t1.password,t6.id as shopId,t9.name as companyName,t9.code as companyCode,t6.name as shopName,t6.code as shopCode,t4.code as roleCode,t9.id as orgId,t2.mobil
select t1.id as accountId,t1.login as account,t2.id as userId,t5.staff_code as staffCode,t2.name as userName,t2.abbreviation,t4.name as roleName,t4.id as roleId,t1.password,t6.id as shopId,t10.name as companyName,t10.code as companyCode,t6.name as shopName,t6.code as shopCode,t4.code as roleCode,t9.id as orgId,t2.mobil
from privilage_account t1
join privilage_user t2 on t1.user_id = t2.id and t1.type = 1
join privilage_user_role t3 on t2.id = t3.user_id
@ -22,6 +22,7 @@
left join privilage_domain_entity t7 on t7.entity_id = t6.id and t7.type = 3
left join privilage_organizational_domain t8 on t8.domain_id = t7.domain_id
left join privilage_organizational t9 on t9.id = t8.org_id and t9.`level` = 3
left join privilage_organizational t10 on t9.parent_id = t10.id and t10.`level` = 2
WHERE 1=1
<if test="roleId != 0">
@ -40,6 +41,27 @@
</if>
</select>
<select id="selectAccountIdByRoleAndSearchContentAndYY" resultType="com.kiisoo.ic.system.bean.AccountBean">
select t1.id as accountId,t1.login as account,t2.id as userId,t2.name as userName,t2.abbreviation,t4.name as roleName,t4.id as roleId,t1.password,t10.name as companyName,t10.code as companyCode,t4.code as roleCode,t10.id as orgId,t2.mobil
from privilage_account t1
join privilage_user t2 on t1.user_id = t2.id and t1.type = 1
join privilage_user_role t3 on t2.id = t3.user_id
join privilage_role t4 on t3.role_id = t4.id
join privilage_organizational_member pom on pom.user_id = t2.id
join privilage_organizational t10 on t10.id = pom.org_id and t10.`level` = 2
WHERE 1=1
<if test="roleId != 0">
and t3.role_id = #{roleId}
</if>
<if test="searchContent != null and searchContent != ''">
and
CONCAT(IFNULL(t1.login,''),IFNULL(t2.name,''))
LIKE CONCAT('%',#{searchContent},'%')
</if>
<if test="companyId != 0">
and t10.id = #{companyId}
</if>
</select>
<select id="selectAccountIdByShopId" resultType="java.lang.Long">
select t3.id from poi_store_staff t1, privilage_user t2, privilage_account t3
where t1.user_id = t2.id
@ -50,4 +72,14 @@
delete from privilage_account where user_id =#{userId}
</delete>
<select id="selectCompanyNameAndCodeByRoleId" resultType="com.kiisoo.ic.system.bean.AccountBean">
select t10.name as companyName,t10.code as companyCode
from privilage_account t1
join privilage_user t2 on t1.user_id = t2.id and t1.type = 1
join privilage_user_role t3 on t2.id = t3.user_id
join privilage_role t4 on t3.role_id = t4.id
join privilage_organizational_member pom on pom.user_id = t2.id
join privilage_organizational t10 on t10.id = pom.org_id and t10.`level` = 2
WHERE t2.id = #{userId}
</select>
</mapper>

Loading…
Cancel
Save