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

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


  三、给“模块字段”增加一个字段,用来存放ManyToMany字段的joinTable值,也就是中间表的表名。给“用户模块”增加一个字段tf_Roles,字段类型为Set<_Role>,关联关系为ManyToMany, 关联表名为_UserRole。字段的定义截图如下:
[置顶] 常规功能和模块自定义系统 (cfcmms)—028开发日志(创建ManyToMany的column3)_第1张图片

  四、加工处理自动生成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 ?
  获取的用户数据中也加入了“权限列表”的字段值。
[置顶] 常规功能和模块自定义系统 (cfcmms)—028开发日志(创建ManyToMany的column3)_第2张图片

  在“用户”模块的grid加入了“权限列表”字段后,可以显示这个字符串。
[置顶] 常规功能和模块自定义系统 (cfcmms)—028开发日志(创建ManyToMany的column3)_第3张图片

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

你可能感兴趣的:(开发经验,ExtJs6,常规功能和模块自定义系统,cfcmms)