10 | * 功能动作 服务实现类 11 | *
12 | * 13 | * @author Kerbores 14 | * @since 2021-08-12 15 | */ 16 | @Service 17 | public class ActionService extends IdNameBaseService10 | * 用户角色关系 服务实现类 11 | *
12 | * 13 | * @author Kerbores 14 | * @since 2021-08-12 15 | */ 16 | @Service 17 | public class UserRoleService extends IdBaseService10 | * 码本分组 服务实现类 11 | *
12 | * 13 | * @author Kerbores 14 | * @since 2021-08-12 15 | */ 16 | @Service 17 | public class GroupService extends IdBaseService10 | * 用户权限关系 服务实现类 11 | *
12 | * 13 | * @author Kerbores 14 | * @since 2021-08-12 15 | */ 16 | @Service 17 | public class UserPermissionService extends IdBaseService10 | * 角色权限关系表 服务实现类 11 | *
12 | * 13 | * @author Kerbores 14 | * @since 2021-08-12 15 | */ 16 | @Service 17 | public class RolePermissionService extends IdBaseService
4 | 10 | * ${table.comment!} 服务实现类 11 | *
12 | * 13 | * @author ${author} 14 | * @since ${date} 15 | */ 16 | @Service 17 | <% if(kotlin){ %> 18 | open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} { 19 | 20 | } 21 | <% }else{ %> 22 | public class ${table.serviceImplName} extends IdBaseService<${entity}> { 23 | 24 | } 25 | <% } %> 26 | -------------------------------------------------------------------------------- /demo/src/frontend/src/layouts/RouteView.vue: -------------------------------------------------------------------------------- 1 | 2 |15 | * 功能模块 服务实现类 16 | *
17 | * 18 | * @author Kerbores 19 | * @since 2021-08-12 20 | */ 21 | @Service 22 | public class ModuleService extends IdNameBaseService13 | * 码本数据 服务实现类 14 | *
15 | * 16 | * @author Kerbores 17 | * @since 2021-08-12 18 | */ 19 | @Service 20 | public class CodebookService extends IdBaseService19 | * 用户角色关系 20 | *
21 | * 22 | * @author Kerbores 23 | * @since 2021-08-12 24 | */ 25 | @Data 26 | @EqualsAndHashCode(callSuper = true) 27 | @SuperBuilder 28 | @NoArgsConstructor 29 | @AllArgsConstructor 30 | @FieldNameConstants 31 | @Accessors(chain = true) 32 | @Table("t_user_role") 33 | @Comment("用户角色关系") 34 | @Schema(name = "UserRole", description = "用户角色关系") 35 | public class UserRole extends DemoEntity { 36 | 37 | private static final long serialVersionUID = 1L; 38 | 39 | @Schema(description = "角色 id", required = true) 40 | @Column("ur_role_id") 41 | @Comment("角色 id") 42 | private Long roleId; 43 | 44 | @Schema(description = "用户 id", required = true) 45 | @Column("ur_user_id") 46 | @Comment("用户 id") 47 | private Long userId; 48 | 49 | public static final String UR_ROLE_ID = "ur_role_id"; 50 | 51 | public static final String UR_USER_ID = "ur_user_id"; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /demo/src/frontend/src/components/SelectLang/SelectLang.vue: -------------------------------------------------------------------------------- 1 | 2 |20 | * 角色 21 | *
22 | * 23 | * @author Kerbores 24 | * @since 2021-08-12 25 | */ 26 | @Data 27 | @EqualsAndHashCode(callSuper = true) 28 | @SuperBuilder 29 | @NoArgsConstructor 30 | @AllArgsConstructor 31 | @FieldNameConstants 32 | @Accessors(chain = true) 33 | @Table("t_role") 34 | @Comment("角色") 35 | @Schema(name = "Role", description = "角色") 36 | public class Role extends DemoEntity { 37 | 38 | private static final long serialVersionUID = 1L; 39 | 40 | @Schema(description = "角色唯一键", required = true) 41 | @Column("r_key") 42 | @Comment("角色唯一键") 43 | @Name 44 | private String key; 45 | 46 | @Schema(description = "角色名称", required = true) 47 | @Column("r_name") 48 | @Comment("角色名称") 49 | private String name; 50 | 51 | @Schema(description = "角色描述") 52 | @Column("r_description") 53 | @Comment("角色描述") 54 | private String description; 55 | 56 | public static final String R_KEY = "r_key"; 57 | 58 | public static final String R_NAME = "r_name"; 59 | 60 | public static final String R_DESCR = "r_descr"; 61 | 62 | } 63 | -------------------------------------------------------------------------------- /demo/src/frontend/src/api/login/api.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-unused-vars */ 2 | /* eslint-disable @typescript-eslint/no-explicit-any */ 3 | 4 | declare namespace login { 5 | export class AuthUser { 6 | /** 扩展信息 */ 7 | extInfo: ObjectMap20 | * 功能模块 21 | *
22 | * 23 | * @author Kerbores 24 | * @since 2021-08-12 25 | */ 26 | @Data 27 | @EqualsAndHashCode(callSuper = true) 28 | @SuperBuilder 29 | @NoArgsConstructor 30 | @AllArgsConstructor 31 | @FieldNameConstants 32 | @Accessors(chain = true) 33 | @Table("t_module") 34 | @Comment("功能模块") 35 | @Schema(name = "Module", description = "功能模块") 36 | public class Module extends DemoEntity { 37 | 38 | private static final long serialVersionUID = 1L; 39 | 40 | @Schema(description = "模块key", required = true) 41 | @Column("m_key") 42 | @Comment("模块key") 43 | @Name 44 | private String key; 45 | 46 | @Schema(description = "模块描述") 47 | @Column("m_description") 48 | @Comment("模块描述") 49 | private String description; 50 | 51 | @Schema(description = "模块名称", required = true) 52 | @Column("m_name") 53 | @Comment("模块名称") 54 | private String name; 55 | 56 | public static final String M_KEY = "m_key"; 57 | 58 | public static final String M_DESCR = "m_descr"; 59 | 60 | public static final String M_NAME = "m_name"; 61 | 62 | } 63 | -------------------------------------------------------------------------------- /demo/src/frontend/src/global.less: -------------------------------------------------------------------------------- 1 | @import "./var.less"; 2 | 3 | html, 4 | body, 5 | #app, 6 | #root { 7 | height: 100%; 8 | } 9 | 10 | .colorWeak { 11 | filter: invert(80%); 12 | } 13 | 14 | .ant-layout.layout-basic { 15 | height: 100vh; 16 | min-height: 100vh; 17 | } 18 | 19 | canvas { 20 | display: block; 21 | } 22 | 23 | body { 24 | text-rendering: optimizeLegibility; 25 | -webkit-font-smoothing: antialiased; 26 | -moz-osx-font-smoothing: grayscale; 27 | } 28 | 29 | ul, 30 | ol { 31 | list-style: none; 32 | } 33 | 34 | // 数据列表 样式 35 | .table-alert { 36 | margin-bottom: 16px; 37 | } 38 | // 数据列表 操作 39 | .table-operator { 40 | margin-bottom: 18px; 41 | 42 | button { 43 | margin-right: 8px; 44 | } 45 | } 46 | // 数据列表 搜索条件 47 | .table-page-search-wrapper { 48 | .ant-form-inline { 49 | .ant-form-item { 50 | display: flex; 51 | margin-bottom: 24px; 52 | margin-right: 0; 53 | 54 | .ant-form-item-control-wrapper { 55 | flex: 1 1; 56 | display: inline-block; 57 | vertical-align: middle; 58 | } 59 | 60 | > .ant-form-item-label { 61 | line-height: 32px; 62 | padding-right: 8px; 63 | width: auto; 64 | } 65 | .ant-form-item-control { 66 | height: 32px; 67 | line-height: 32px; 68 | } 69 | } 70 | } 71 | 72 | .table-page-search-submitButtons { 73 | display: block; 74 | margin-bottom: 24px; 75 | white-space: nowrap; 76 | } 77 | } 78 | 79 | @media (max-width: @screen-xs) { 80 | .ant-table { 81 | width: 100%; 82 | overflow-x: auto; 83 | &-thead > tr, 84 | &-tbody > tr { 85 | > th, 86 | > td { 87 | white-space: pre; 88 | > span { 89 | display: block; 90 | } 91 | } 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /demo/src/frontend/src/store/modules/user.ts: -------------------------------------------------------------------------------- 1 | import { 2 | VuexModule, 3 | Module, 4 | Mutation, 5 | Action, 6 | getModule, 7 | } from "vuex-module-decorators"; 8 | import store from "@/store"; 9 | import * as types from "@/store/mutation-types"; 10 | import storage from "store"; 11 | 12 | export interface UserState { 13 | /** 14 | * 用户名 15 | */ 16 | name: string; 17 | /** 18 | * 姓名 19 | */ 20 | fullName?: string; 21 | /** 22 | * 头像 23 | */ 24 | avatarUrl?: string; 25 | /** 26 | * 邮箱 27 | */ 28 | email?: string; 29 | /** 30 | * 电话 31 | */ 32 | mobile?: string; 33 | /** 34 | * jwtToken 35 | */ 36 | token: string; 37 | /** 38 | * 角色 39 | */ 40 | roles: Array20 | * 码本分组 21 | *
22 | * 23 | * @author Kerbores 24 | * @since 2021-08-12 25 | */ 26 | @Data 27 | @EqualsAndHashCode(callSuper = true) 28 | @SuperBuilder 29 | @NoArgsConstructor 30 | @AllArgsConstructor 31 | @FieldNameConstants 32 | @Accessors(chain = true) 33 | @Table("t_group") 34 | @Comment("码本分组") 35 | @Schema(name = "Group", description = "码本分组") 36 | public class Group extends DemoEntity { 37 | 38 | private static final long serialVersionUID = 1L; 39 | 40 | @Schema(description = "分组唯一键", required = true) 41 | @Column("g_key") 42 | @Comment("分组唯一键") 43 | private String key; 44 | 45 | @Schema(description = "分组名称", required = true) 46 | @Column("g_name") 47 | @Comment("分组名称") 48 | private String name; 49 | 50 | @Schema(description = "分组描述") 51 | @Column("g_description") 52 | @Comment("分组描述") 53 | private String description; 54 | 55 | @Schema(description = "禁用标识", required = true) 56 | @Column("g_disabled") 57 | @Comment("禁用标识") 58 | @Default 59 | private Boolean disabled = false; 60 | 61 | public static final String G_KEY = "g_key"; 62 | 63 | public static final String G_NAME = "g_name"; 64 | 65 | public static final String G_DESCR = "g_descr"; 66 | 67 | public static final String G_DISABLED = "g_disabled"; 68 | 69 | } 70 | -------------------------------------------------------------------------------- /demo/src/frontend/src/locales/lang/zhCN/page.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | user: { 3 | name: "用户名", 4 | mobile: "手机号码", 5 | createTime: "创建时间", 6 | action: "操作", 7 | add: "添加用户", 8 | delete: "删除", 9 | grant: "授权", 10 | role: "设置角色", 11 | edit: "编辑", 12 | search: { 13 | placeholder: "请输入关键字", 14 | }, 15 | confirm: { 16 | title: "确认删除这个用户?", 17 | textYes: "确认", 18 | textNo: "取消", 19 | }, 20 | message: { 21 | deleteSuccess: "删除用户成功", 22 | }, 23 | }, 24 | role: { 25 | key: "角色Key", 26 | name: "角色名", 27 | createdAt: "创建时间", 28 | action: "操作", 29 | add: "添加角色", 30 | delete: "删除", 31 | edit: "编辑", 32 | grant: "授权", 33 | search: { 34 | placeholder: "请输入关键字", 35 | }, 36 | confirm: { 37 | title: "确认删除这个角色?", 38 | textYes: "确认", 39 | textNo: "取消", 40 | }, 41 | message: { 42 | deleteSuccess: "删除角色成功", 43 | }, 44 | }, 45 | module: { 46 | key: "模块Key", 47 | name: "模块名称", 48 | createTime: "创建时间", 49 | action: "操作", 50 | add: "添加模块", 51 | delete: "删除", 52 | edit: "编辑", 53 | search: { 54 | placeholder: "请输入关键字", 55 | }, 56 | confirm: { 57 | title: "确认删除这个模块?", 58 | textYes: "确认", 59 | textNo: "取消", 60 | }, 61 | message: { 62 | deleteSuccess: "删除模块成功", 63 | }, 64 | }, 65 | innerProject: { 66 | name: "项目名称", 67 | createTime: "创建时间", 68 | description: "项目简介", 69 | category: "项目所属分类", 70 | principal: "项目负责人", 71 | action: "操作", 72 | add: "添加模块", 73 | delete: "删除", 74 | edit: "编辑", 75 | status: "状态", 76 | num: "项目成员数", 77 | search: { 78 | placeholder: "请输入项目名称", 79 | }, 80 | }, 81 | port: { 82 | name: "接口名称", 83 | url: "接口地址", 84 | method: "接口请求方法", 85 | action: "操作", 86 | sync: "同步", 87 | confirm: { 88 | title: "请确认是否同步接口?", 89 | textYes: "确认", 90 | textNo: "取消", 91 | }, 92 | }, 93 | }; 94 | -------------------------------------------------------------------------------- /demo/src/frontend/src/api/acl/mods/action/index.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-explicit-any */ 2 | /** 3 | * @description 功能动作模块 4 | */ 5 | import add from './add'; 6 | import edit from './edit'; 7 | import get from './get'; 8 | import remove from './remove'; 9 | 10 | export class ActionApi { 11 | constructor( 12 | public add: ( 13 | action: acl.Action, 14 | 15 | success?: ({ 16 | data, 17 | ext, 18 | state, 19 | errors, 20 | }: { 21 | data: acl.Action; 22 | ext: ObjectMap; 23 | state: 'SUCCESS' | 'FAIL' | 'EXCEPTION'; 24 | errors?: Array19 | * 用户权限关系 20 | *
21 | * 22 | * @author Kerbores 23 | * @since 2021-08-12 24 | */ 25 | @Data 26 | @EqualsAndHashCode(callSuper = true) 27 | @SuperBuilder 28 | @NoArgsConstructor 29 | @AllArgsConstructor 30 | @FieldNameConstants 31 | @Accessors(chain = true) 32 | @Table("t_user_permission") 33 | @Comment("用户权限关系") 34 | @Schema(name = "UserPermission", description = "用户权限关系") 35 | public class UserPermission extends DemoEntity { 36 | 37 | private static final long serialVersionUID = 1L; 38 | 39 | @Schema(description = "动作key", required = true) 40 | @Column("up_action_key") 41 | @Comment("动作key") 42 | private String actionKey; 43 | 44 | @Schema(description = "模块id", required = true) 45 | @Column("up_module_id") 46 | @Comment("模块id") 47 | private Long moduleId; 48 | 49 | @Schema(description = "模块key", required = true) 50 | @Column("up_module_key") 51 | @Comment("模块key") 52 | private String moduleKey; 53 | 54 | @Schema(description = "用户id", required = true) 55 | @Column("up_user_id") 56 | @Comment("用户id") 57 | private Long userId; 58 | 59 | public static final String UP_ACTION_KEY = "up_action_key"; 60 | 61 | public static final String UP_MODULE_ID = "up_module_id"; 62 | 63 | public static final String UP_MODULE_KEY = "up_module_key"; 64 | 65 | public static final String UP_USER_ID = "up_user_id"; 66 | 67 | } 68 | -------------------------------------------------------------------------------- /demo/src/main/java/tech/riemann/demo/entity/acl/RolePermission.java: -------------------------------------------------------------------------------- 1 | package tech.riemann.demo.entity.acl; 2 | 3 | import org.nutz.dao.entity.annotation.Column; 4 | import org.nutz.dao.entity.annotation.Comment; 5 | import org.nutz.dao.entity.annotation.Table; 6 | 7 | import io.swagger.v3.oas.annotations.media.Schema; 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.EqualsAndHashCode; 11 | import lombok.NoArgsConstructor; 12 | import lombok.experimental.Accessors; 13 | import lombok.experimental.FieldNameConstants; 14 | import lombok.experimental.SuperBuilder; 15 | import tech.riemann.demo.entity.DemoEntity; 16 | 17 | /** 18 | *19 | * 角色权限关系表 20 | *
21 | * 22 | * @author Kerbores 23 | * @since 2021-08-12 24 | */ 25 | @Data 26 | @EqualsAndHashCode(callSuper = true) 27 | @SuperBuilder 28 | @NoArgsConstructor 29 | @AllArgsConstructor 30 | @FieldNameConstants 31 | @Accessors(chain = true) 32 | @Table("t_role_permission") 33 | @Comment("角色权限关系表") 34 | @Schema(name = "RolePermission", description = "角色权限关系表") 35 | public class RolePermission extends DemoEntity { 36 | 37 | private static final long serialVersionUID = 1L; 38 | 39 | @Schema(description = "动作key", required = true) 40 | @Column("rp_action_key") 41 | @Comment("动作key") 42 | private String actionKey; 43 | 44 | @Schema(description = "模块id", required = true) 45 | @Column("rp_module_id") 46 | @Comment("模块id") 47 | private Long moduleId; 48 | 49 | @Schema(description = "模块key", required = true) 50 | @Column("rp_module_key") 51 | @Comment("模块key") 52 | private String moduleKey; 53 | 54 | @Schema(description = "角色id", required = true) 55 | @Column("rp_role_id") 56 | @Comment("角色id") 57 | private Long roleId; 58 | 59 | public static final String RP_ACTION_KEY = "rp_action_key"; 60 | 61 | public static final String RP_MODULE_ID = "rp_module_id"; 62 | 63 | public static final String RP_MODULE_KEY = "rp_module_key"; 64 | 65 | public static final String RP_ROLE_ID = "rp_role_id"; 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/org/nutz/spring/boot/hanlder/JsonLocalDateLikeHandler.java: -------------------------------------------------------------------------------- 1 | package org.nutz.spring.boot.hanlder; 2 | 3 | import java.io.IOException; 4 | import java.time.LocalDate; 5 | import java.time.ZoneId; 6 | import java.time.format.DateTimeFormatter; 7 | import java.time.temporal.TemporalAccessor; 8 | import java.util.Locale; 9 | 10 | import org.nutz.castor.Castors; 11 | import org.nutz.json.JsonFormat; 12 | import org.nutz.json.JsonRender; 13 | import org.nutz.json.JsonTypeHandler; 14 | import org.nutz.lang.Mirror; 15 | 16 | /** 17 | * @author wkipy 18 | * 19 | */ 20 | public class JsonLocalDateLikeHandler extends JsonTypeHandler { 21 | 22 | /** 23 | * @param mirror 24 | * @param obj 25 | * @return 26 | * @see org.nutz.json.JsonTypeHandler#supportFromJson(org.nutz.lang.Mirror, 27 | * java.lang.Object) 28 | */ 29 | @Override 30 | public boolean supportFromJson(Mirror> mirror, Object obj) { 31 | return mirror.isLocalDateTimeLike(); 32 | } 33 | 34 | @Override 35 | public boolean supportToJson(Mirror> mirror, Object obj, JsonFormat jf) { 36 | return mirror.isLocalDateTimeLike(); 37 | } 38 | 39 | @Override 40 | public void toJson(Mirror> mirror, Object currentObj, JsonRender r, JsonFormat jf) throws IOException { 41 | String df = jf.getDateFormatRaw(); 42 | if (df == null) 43 | df = "yyyy-MM-dd HH:mm:ss.SSS"; 44 | if (mirror.getType().equals(LocalDate.class)) { 45 | df = "yyyy-MM-dd"; 46 | } 47 | Locale locale = null; 48 | String tmp = jf.getLocale(); 49 | if (tmp != null) 50 | locale = Locale.forLanguageTag(tmp); 51 | else 52 | locale = Locale.getDefault(); 53 | r.string2Json(DateTimeFormatter.ofPattern(df, locale).withZone(ZoneId.systemDefault()).format((TemporalAccessor) currentObj)); 54 | } 55 | 56 | @Override 57 | public Object fromJson(Object obj, Mirror> mirror) throws Exception { 58 | return Castors.me().castTo(obj, mirror.getType()); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /demo/src/main/java/tech/riemann/demo/entity/acl/Action.java: -------------------------------------------------------------------------------- 1 | package tech.riemann.demo.entity.acl; 2 | 3 | import org.nutz.dao.entity.annotation.Column; 4 | import org.nutz.dao.entity.annotation.Comment; 5 | import org.nutz.dao.entity.annotation.Name; 6 | import org.nutz.dao.entity.annotation.Table; 7 | 8 | import io.swagger.v3.oas.annotations.media.Schema; 9 | import lombok.AllArgsConstructor; 10 | import lombok.Builder.Default; 11 | import lombok.Data; 12 | import lombok.EqualsAndHashCode; 13 | import lombok.NoArgsConstructor; 14 | import lombok.experimental.Accessors; 15 | import lombok.experimental.FieldNameConstants; 16 | import lombok.experimental.SuperBuilder; 17 | import tech.riemann.demo.entity.DemoEntity; 18 | 19 | /** 20 | *21 | * 功能动作 22 | *
23 | * 24 | * @author Kerbores 25 | * @since 2021-08-12 26 | */ 27 | @Data 28 | @EqualsAndHashCode(callSuper = true) 29 | @SuperBuilder 30 | @NoArgsConstructor 31 | @AllArgsConstructor 32 | @FieldNameConstants 33 | @Accessors(chain = true) 34 | @Table("t_action") 35 | @Comment("功能动作") 36 | @Schema(name = "Action", description = "功能动作") 37 | public class Action extends DemoEntity { 38 | 39 | private static final long serialVersionUID = 1L; 40 | 41 | @Schema(description = "动作key", required = true) 42 | @Column("a_key") 43 | @Comment("动作key") 44 | @Name 45 | private String key; 46 | 47 | @Schema(description = "是否内置标识", required = true) 48 | @Column("a_installed") 49 | @Comment("是否内置标识") 50 | @Default 51 | private Boolean installed = false; 52 | 53 | @Schema(description = "归属的模块id", required = true) 54 | @Column("a_module_id") 55 | @Comment("归属的模块id") 56 | private Long moduleId; 57 | 58 | @Schema(description = "动作名称", required = true) 59 | @Column("a_name") 60 | @Comment("动作名称") 61 | private String name; 62 | 63 | public static final String A_KEY = "a_key"; 64 | 65 | public static final String A_INSTALLED = "a_installed"; 66 | 67 | public static final String A_MODULE_ID = "a_module_id"; 68 | 69 | public static final String A_NAME = "a_name"; 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/org/nutz/spring/boot/dao/sqlmanager/XmlSqlManager.java: -------------------------------------------------------------------------------- 1 | package org.nutz.spring.boot.dao.sqlmanager; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.util.List; 6 | 7 | import org.nutz.dao.impl.FileSqlManager; 8 | import org.nutz.lang.Xmls; 9 | import org.nutz.log.Log; 10 | import org.nutz.log.Logs; 11 | import org.nutz.resource.NutResource; 12 | import org.nutz.resource.Scans; 13 | import org.w3c.dom.Document; 14 | import org.w3c.dom.Element; 15 | import org.w3c.dom.Node; 16 | import org.w3c.dom.NodeList; 17 | 18 | /** 19 | * @author kerbores 20 | * 21 | */ 22 | public class XmlSqlManager extends FileSqlManager { 23 | 24 | private static final Log log = Logs.get(); 25 | 26 | public XmlSqlManager() {} 27 | 28 | public XmlSqlManager(String... paths) { 29 | super(paths); 30 | } 31 | 32 | @Override 33 | public void refresh() { 34 | if (paths != null) { 35 | for (String path : paths) { 36 | List21 | * 用户 22 | *
23 | * 24 | * @author Kerbores 25 | * @since 2021-08-12 26 | */ 27 | @Data 28 | @EqualsAndHashCode(callSuper = true) 29 | @SuperBuilder 30 | @NoArgsConstructor 31 | @AllArgsConstructor 32 | @FieldNameConstants 33 | @Accessors(chain = true) 34 | @Table("t_user") 35 | @Comment("用户") 36 | @Schema(name = "User", description = "用户") 37 | public class User extends DemoEntity { 38 | 39 | private static final long serialVersionUID = 1L; 40 | 41 | @Schema(description = "用户名", required = true) 42 | @Column("u_name") 43 | @Comment("用户名") 44 | @Name 45 | private String name; 46 | 47 | @Schema(description = "密码", required = true) 48 | @Column("u_password") 49 | @Comment("密码") 50 | private String password; 51 | 52 | @Schema(description = "手机号", required = true) 53 | @Column("u_mobile") 54 | @Comment("手机号") 55 | private String mobile; 56 | 57 | /** 58 | * @return 59 | */ 60 | public AuthUser toUser() { 61 | return AuthUser.builder() 62 | .userName(getName()) 63 | .password("nutz-demo") 64 | .build() 65 | .token() 66 | .addExt("user", this); 67 | } 68 | 69 | public static final String U_NAME = "u_name"; 70 | 71 | public static final String U_PWD = "u_pwd"; 72 | 73 | public static final String U_MOBILE = "u_mobile"; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/org/nutz/spring/boot/dao/sqltpl/impl/beetl/BeetlSqlTpl.java: -------------------------------------------------------------------------------- 1 | package org.nutz.spring.boot.dao.sqltpl.impl.beetl; 2 | 3 | import java.io.IOException; 4 | 5 | import org.beetl.core.Configuration; 6 | import org.beetl.core.GroupTemplate; 7 | import org.beetl.core.Template; 8 | import org.nutz.dao.sql.Sql; 9 | import org.nutz.lang.Lang; 10 | import org.nutz.spring.boot.dao.sqltpl.NutSqlTpl; 11 | import org.nutz.spring.boot.dao.sqltpl.VarSetMap; 12 | 13 | /** 14 | * @author kerbores 15 | * 16 | */ 17 | public class BeetlSqlTpl extends NutSqlTpl { 18 | 19 | private static final long serialVersionUID = 1L; 20 | 21 | public BeetlSqlTpl(String source) { 22 | super(source); 23 | } 24 | 25 | /** 26 | * 自定义GroupTemplate 27 | */ 28 | protected static GroupTemplate gt; 29 | 30 | /** 31 | * 渲染一个Sql对象 32 | * 33 | * @param sql 34 | * 需要渲染的Sql实例 35 | * @return 原对象,用于链式调用 36 | */ 37 | public static Sql c(Sql sql) { 38 | Object source = sql.getSourceSql(); 39 | Template t = gt().getTemplate(source); 40 | t.binding(VarSetMap.asCtx(sql)); 41 | String n = t.render(); 42 | sql.setSourceSql(n); 43 | return sql; 44 | } 45 | 46 | /** 47 | * 自定义设置GroupTemplate 48 | * 49 | * @param gt 50 | * 自定义的GroupTemplate 51 | */ 52 | public static void setGroupTemplate(GroupTemplate gt) { 53 | BeetlSqlTpl.gt = gt; 54 | } 55 | 56 | /** 57 | * 获取GroupTemplate 58 | * 59 | * @return GroupTemplate实例,如果没有自定义,就生成一个默认的 60 | */ 61 | public static GroupTemplate gt() { 62 | if (gt == null) { 63 | Configuration cfg; 64 | try (ClasspathStringResourceLoader resourceLoader = new ClasspathStringResourceLoader()) { 65 | cfg = Configuration.defaultConfiguration(); 66 | gt = new GroupTemplate(resourceLoader, cfg); 67 | } 68 | catch (IOException e) { 69 | throw Lang.wrapThrow(e); 70 | } 71 | } 72 | return gt; 73 | } 74 | 75 | @Override 76 | protected void render() { 77 | c(this); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /demo/src/frontend/src/api/wechat/api.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable @typescript-eslint/no-unused-vars */ 2 | /* eslint-disable @typescript-eslint/no-explicit-any */ 3 | 4 | declare namespace wechat { 5 | export class TieSocialLoginUserDataObject { 6 | /** 渠道 */ 7 | channel: 'MP' | 'MINIAPP' | 'WECHAT_SCAN' | 'WECHAT'; 8 | 9 | /** 验证码 */ 10 | code: string; 11 | 12 | /** 手机号 */ 13 | mobile: string; 14 | 15 | /** openid */ 16 | openid: string; 17 | } 18 | 19 | export class WxLogin { 20 | /** appid */ 21 | appid: string; 22 | 23 | /** href */ 24 | href?: string; 25 | 26 | /** id */ 27 | id: string; 28 | 29 | /** redirect_uri */ 30 | redirect_uri: string; 31 | 32 | /** scope */ 33 | scope: string; 34 | 35 | /** self_redirect */ 36 | self_redirect: boolean; 37 | 38 | /** state */ 39 | state: string; 40 | 41 | /** style */ 42 | style?: 'black' | 'white'; 43 | } 44 | 45 | export class Pagination