|
|
|
@ -17,9 +17,9 @@ func AddBaseRole(ms models.TBaseRole) (int64, error) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//检查一个角色编码是不是已存在
|
|
|
|
|
func ExistRoleCode(roleCode string) (bool, error) {
|
|
|
|
|
sql := `select count(1) as c from t_base_role where b_use=1 and role_code=?`
|
|
|
|
|
list, err := db.SQL(sql, roleCode).Query().List()
|
|
|
|
|
func ExistRoleCode(roleId string, roleCode string) (bool, error) {
|
|
|
|
|
sql := `select count(1) as c from t_base_role where b_use=1 and role_code=? and role_id<>?`
|
|
|
|
|
list, err := db.SQL(sql, roleCode, roleId).Query().List()
|
|
|
|
|
if err != nil {
|
|
|
|
|
return false, err
|
|
|
|
|
}
|
|
|
|
@ -81,7 +81,7 @@ func DeleteRoleAppRepleation(roleId string) {
|
|
|
|
|
//获取角色与系统的关联关系
|
|
|
|
|
func GetRoleAppRepleation(roleId string) ([]map[string]interface{}, error) {
|
|
|
|
|
var myBuilder = builder.Dialect(builder.MYSQL).Select("t1.*,t2.app_name").From("t_base_role_app as t1")
|
|
|
|
|
myBuilder.InnerJoin("t_app_base as t2","t1.app_id=t2.app_id")
|
|
|
|
|
myBuilder.InnerJoin("t_app_base as t2", "t1.app_id=t2.app_id")
|
|
|
|
|
myBuilder.And(builder.Eq{"t1.app_id": roleId})
|
|
|
|
|
myBuilder.And(builder.Eq{"t1.b_use": 1})
|
|
|
|
|
//获取拼接完成的SQL语句
|
|
|
|
|