1 模型图
1.1 设计窗口截图
2 代码
CREATE TABLE `mydb`.`sp_role` ( `role_id` smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT, `role_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT ‘角色名称‘, `ps_ids` varchar(512) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ‘‘ COMMENT ‘权限ids,1,2,5‘, `ps_ca` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT ‘控制器-操作,控制器-操作,控制器-操作‘, `role_desc` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, PRIMARY KEY (`role_id`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
2.1 实体代码
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Text; namespace Xwy.Domain.Entities { public class AppRole { /// <summary> /// 编号,主键自增 /// </summary> public int Id { get; set; } /// <summary> /// 角色名称,必填,要设置唯一索引 /// </summary> [Required] [StringLength(128)] public string RoleName { get; set; } /// <summary> /// 权限ids,1,2,5 /// </summary> [Required] [StringLength(512)] public string PermissionIds { get; set; } /// <summary> /// 控制器-操作,控制器-操作,控制器-操作 /// </summary> public string PermissionActions { get; set; } /// <summary> /// 角色说明 /// </summary> public string RoleDesc { get; set; } } }