Commit 3396e70d authored by hongguangwu's avatar hongguangwu

EKP1.7.1-hgw-权限

parent 81f631db
......@@ -196,8 +196,9 @@ public interface SysUserPermissionMapper extends BaseMapper<SysUserPermission> {
List<SysUserPermission> getUserPermissionByAutoCreateHT(@Param("fdId") String fdId);
List<SysUserPermission> getUserPermissionByAutoCreateXM(@Param("fdId") String fdId);
List<SysUserPermission> getUserPermissionByAutoCreateXMBG(@Param("fdId") String fdId);
String selectCodeByFdId(@Param("fdId") String fdId);
void deleteUserPermissionByIdAndType(@Param("domainId") String domainId, @Param("permissionType") String permissionType);
void deleteUserPermissionByIdAndType(@Param("code") String code, @Param("permissionType") String permissionType);
}
......@@ -435,35 +435,35 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
List<SysUserPermission> list;
// 1客户;2商机;3报价单;4合同;5项目;
String[] deleteType = {"0","1","2","3","4","5"};
log.error("EKP传过来的类型是啥0?" + type);
log.error("11111同步权限,EKP传过来的fdId=" + fdId + ",type="+ type);
String deleteType = CommonConstants.ONE_STRING;
switch (type) {
case "客户":
baseMapper.deleteUserPermissionByIdAndType(fdId, deleteType[1]);
deleteType = CommonConstants.dingleDigitStrArray[1];
list = baseMapper.getUserPermissionByAutoCreateKH(fdId); break;
case "商机":
baseMapper.deleteUserPermissionByIdAndType(fdId, deleteType[2]);
deleteType = CommonConstants.dingleDigitStrArray[2];
list = baseMapper.getUserPermissionByAutoCreateSJ(fdId); break;
case "报价单":
baseMapper.deleteUserPermissionByIdAndType(fdId, deleteType[3]);
deleteType = CommonConstants.dingleDigitStrArray[3];
list = baseMapper.getUserPermissionByAutoCreateBJD(fdId); break;
case "合同":
baseMapper.deleteUserPermissionByIdAndType(fdId, deleteType[4]);
deleteType = CommonConstants.dingleDigitStrArray[4];
list = baseMapper.getUserPermissionByAutoCreateHT(fdId); break;
case "项目":
baseMapper.deleteUserPermissionByIdAndType(fdId, deleteType[5]);
deleteType = CommonConstants.dingleDigitStrArray[5];
list = baseMapper.getUserPermissionByAutoCreateXM(fdId); break;
case "项目变更":
baseMapper.deleteUserPermissionByIdAndType(fdId, deleteType[5]);
deleteType = CommonConstants.dingleDigitStrArray[5];
list = baseMapper.getUserPermissionByAutoCreateXMBG(fdId); break;
default:
log.error("EKP传过来的类型是啥1?" + type);
// 后面改为这个:
// list = new ArrayList<>()
list = baseMapper.getUserPermissionByAutoCreateKH(fdId);
baseMapper.deleteUserPermissionByIdAndType(fdId, deleteType[1]);
list = new ArrayList<>();
}
if (list != null && !list.isEmpty()) {
if (Common.isNotNull(list.get(0).getCode())) {
baseMapper.deleteUserPermissionByIdAndType(list.get(0).getCode(), deleteType);
}
for (SysUserPermission sysUserPermission : list) {
SysUserPermission permission = this.getOne(Wrappers.<SysUserPermission>query().lambda()
.eq(SysUserPermission::getDeleteFlag, CommonConstants.ONE_STRING)
......@@ -474,6 +474,11 @@ public class SysUserPermissionServiceImpl extends ServiceImpl<SysUserPermissionM
this.save(sysUserPermission);
}
}
} else {
String code = baseMapper.selectCodeByFdId(fdId);
if (Common.isNotNull(code)) {
baseMapper.deleteUserPermissionByIdAndType(code, deleteType);
}
}
return R.ok();
}
......
......@@ -363,10 +363,25 @@
where d.fd_id = #{fdId} GROUP BY e.fd_id
</select>
<!-- 查找fdId对应的code -->
<select id="selectCodeByFdId" resultType="java.lang.String">
select d.fd_3a9d1d4d438bfc CODE from ekp_fa3e25a1b6c472683e96 d where d.fd_id = #{fdId}
union ALL
select d.fd_3b107f1084fd96 CODE from ekp_24385b8cc934eb8a9231 d where d.fd_id = #{fdId}
union ALL
select d.fd_3b04b9dc64a9f4 CODE from ekp_fd06fd1251d4bac8cc91 d where d.fd_id = #{fdId}
union ALL
select d.fd_3ade319226ed52 CODE from ekp_4834ce2ea964f1a8cfdb d where d.fd_id = #{fdId}
union ALL
select d.fd_3a829aea0b84a4 CODE from ekp_fb3b8d0c8f148639b8e2 d where d.fd_id = #{fdId}
union ALL
select d.fd_3b879793d37afe CODE from ekp_d701e3e72794ff390ca8 d where d.fd_id = #{fdId}
limit 1
</select>
<!-- 删除EKP新建的 -->
<delete id="deleteUserPermissionByIdAndType">
delete from sys_user_permission p
where SOURCE_TYPE = 0 and DOMAIN_ID = #{domainId} and PERMISSION_TYPE = #{permissionType}
where SOURCE_TYPE = 0 and CODE = #{code} and PERMISSION_TYPE = #{permissionType}
</delete>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment