1 设计模型
2 设计效果图
3 代码
CREATE TABLE `mydb`.`sp_permission` ( `ps_id` smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT, `ps_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT ‘权限名称‘, `ps_pid` smallint(6) UNSIGNED NOT NULL COMMENT ‘父id‘, `ps_c` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ‘‘ COMMENT ‘控制器‘, `ps_a` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ‘‘ COMMENT ‘操作方法‘, `ps_level` enum(‘0‘,‘2‘,‘1‘) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ‘0‘ COMMENT ‘权限等级‘, PRIMARY KEY (`ps_id`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = ‘权限表‘ ROW_FORMAT = Dynamic;
using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Text; namespace Xwy.Domain.Entities { public class AppRermission { /// <summary> /// 编号,主键自增 /// </summary> public int Id { get; set; } /// <summary> /// 权限名称,必填,要设置唯一索引 /// </summary> [Required] [StringLength(128)] public string Name { get; set; } /// <summary> /// 父Id,应设置默认为0 /// </summary> public int PId { get; set; } /// <summary> /// 控制器 /// </summary> [StringLength(32)] public string Controller { get; set; } /// <summary> /// 操作方法 /// </summary> [StringLength(32)] public string Action { get; set; } /// <summary> /// 权限等级,‘0‘,‘2‘,‘1‘,应设置默认为0 /// </summary> public byte? Level { get; set; } } }