常规功能和模块自定义系统 (cfcmms)—028开发日志(创建ManyToMany的column3)

028开发日志(创建ManyToMany的column3)


  三、给“模块字段”增加一个字段,用来存放ManyToMany字段的joinTable值,也就是中间表的表名。给“用户模块”增加一个字段tf_Roles,字段类型为Set<_Role>,关联关系为ManyToMany, 关联表名为_UserRole。字段的定义截图如下:


  四、加工处理自动生成grid数据的sql语句,把ManyToMany的字段加进去:
select
_t9035.tf_userId as tf_userId ,
_t9035.tf_userName as tf_userName ,
_t9035.tf_loginName as tf_loginName ,
_t9035.tf_allowLogin as tf_allowLogin ,
_t9035.tf_office as tf_office ,
_t9035.tf_telnumber as tf_telnumber ,
_t9035.tf_phonenumber as tf_phonenumber ,
_t9035.tf_eMail as tf_eMail ,
_t9035.tf_qq as tf_qq ,
_t9035.tf_isSendMessage as tf_isSendMessage ,
_t9035.tf_lastLoginDate as tf_lastLoginDate ,
_t9035.tf_loginTimes as tf_loginTimes ,
_t9035.tf_favoriteSet as tf_favoriteSet ,
_t9035.tf_remark as tf_remark ,
_t9011.tf_departmentId as P__t9011___tf_departmentId ,

// ManyToMany 字段的加入
(select
    GROUP_CONCAT( otherSide.tf_roleId,
    ',',
    otherSide.tf_roleName ,
            ',',
            joinTable.tf_userRoleId   SEPARATOR '|||')  
from
    _UserRole joinTable 
inner join
    _Role otherSide 
        on joinTable.tf_roleId = otherSide.tf_roleId 
where
    joinTable.tf_userId = _t9035.tf_userId ) as tf_Roles ,

_t9011.tf_departmentId as _t9011___tf_departmentId ,
_t9011.tf_name as _t9011___tf_name ,
_t9010.tf_scopeId as _t9010___tf_scopeId ,
_t9010.tf_scopeName as _t9010___tf_scopeName ,
_t9030.tf_positionId as _t9030___tf_positionId ,
_t9030.tf_positionName as _t9030___tf_positionName    
from
_User _t9035 
left outer join
_Department _t9011 
    on _t9011.tf_departmentId = _t9035.tf_departmentId  
left outer join
_DepartmentScope _t9010 
    on _t9010.tf_scopeId = _t9011.tf_scopeId  
left outer join
_Position _t9030 
    on _t9030.tf_positionId = _t9035.tf_positionId  
order by
_t9011.tf_departmentId ,
tf_loginName limit ?
  获取的用户数据中也加入了“权限列表”的字段值。


  在“用户”模块的grid加入了“权限列表”字段后,可以显示这个字符串。


  做到现在,可以在用户中显示ManyToMany的权限列表字段了。下面就要着手编前二节说的显示和操作的功能了。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值