diff --git a/db/6pigxx_config.sql b/db/6pigxx_config.sql index 6102ed469..5d11a3513 100644 --- a/db/6pigxx_config.sql +++ b/db/6pigxx_config.sql @@ -45,7 +45,7 @@ INSERT INTO `config_info` VALUES (11, 'pigx-mp-platform-dev.yml', 'DEFAULT_GROUP INSERT INTO `config_info` VALUES (12, 'pigx-xxl-job-admin-dev.yml', 'DEFAULT_GROUP', '# xxl\nxxl:\n job:\n i18n: zh_CN\n logretentiondays: 30\n triggerpool:\n fast.max: 200\n slow.max: 200\n\n# mybatis\nmybatis:\n mapper-locations: classpath:/mybatis-mapper/*Mapper.xml\n\n# spring\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n mvc:\n static-path-pattern: /static/**\n freemarker:\n suffix: .ftl\n request-context-attribute: request\n settings:\n number_format: 0.##########\n mail:\n host: smtp.mxhichina.com\n port: 465\n from: xxxx@gitee.wang\n username: xxxx@gitee.wang\n password: xxxx\n properties:\n mail:\n smtp:\n auth: true\n ssl.enable: true\n starttls.enable: false\n required: false\n\nmanagement:\n health:\n mail:\n enabled: false\n endpoints:\n web:\n exposure:\n include: \'*\'\n endpoint:\n health:\n show-details: ALWAYS', '6d70dce1f3ee48f261dce29bcfa99cbb', '2022-12-16 10:44:25', '2023-01-04 18:22:48', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', ''); INSERT INTO `config_info` VALUES (13, 'pigx-report-platform-dev.yml', 'DEFAULT_GROUP', 'spring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_report}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n jpa:\n database-platform: org.hibernate.dialect.MySQL8Dialect\n\nsecurity:\n oauth2:\n client:\n ignore-urls:\n - /\n - /api/project/getData\n - /static/**\n - /api/project/get-file/*\n\n# 文件上传路径\ngv:\n img-path: /Users/lengleng/Downloads/img/\n', 'ce3fde4b4592cdd61feb2e443b2ddfe5', '2022-12-16 10:44:25', '2023-04-07 12:56:57', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', ''); INSERT INTO `config_info` VALUES (14, 'pigx-jimu-platform-dev.yml', 'DEFAULT_GROUP', 'spring:\n #配置静态资源\n mvc:\n static-path-pattern: /**\n resource:\n static-locations: classpath:/static/\n #配置数据库\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_bi}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n \n#JimuReport[minidao配置]\nminidao :\n base-package: org.jeecg.modules.jmreport.desreport.dao*\n db-type: mysql\n#JimuReport[上传配置]\njeecg :\n jmreport:\n customPrePath: /api/jimu\n # 自动保存\n autoSave: true\n # 单位毫秒 默认5*60*1000 \n interval: 10000\n # local|minio|alioss\n uploadType: local\n # local\n path :\n #文件路径A\n upload: ~/jimu/data\n # alioss\n oss:\n endpoint: oss-cn-beijing.aliyuncs.com\n accessKey: ??\n secretKey: ??\n staticDomain: ??\n bucketName: ??\n # minio\n minio:\n minio_url: http://minio.jeecg.com\n minio_name: ??\n minio_pass: ??\n bucketName: ??\n#输出sql日志\nlogging:\n level:\n org.jeecg.modules.jmreport : debug', '66319da04963c4c7217f807bf1bd5f2d', '2022-12-16 10:44:25', '2023-04-07 13:12:32', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', ''); -INSERT INTO `config_info` VALUES (15, 'pigx-app-server-biz-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n autoconfigure:\n exclude: org.springframework.cloud.gateway.config.GatewayAutoConfiguration,org.springframework.cloud.gateway.config.GatewayClassPathWarningAutoConfiguration\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_app}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n\n# 本地文件系统\nfile:\n local:\n enable: true\n basePath: /data/file\n\n# Logger Config\nlogging:\n level:\n com.pig4cloud.pigx.admin.mapper: debug\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - app_user\n - app_role\n - app_menu', 'a56f0bf0c86e2cc389ae320271944849', '2022-12-19 10:30:07', '2023-04-07 14:10:41', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', ''); +INSERT INTO `config_info` VALUES (15, 'pigx-app-server-biz-dev.yml', 'DEFAULT_GROUP', '# 数据源\nspring:\n datasource:\n type: com.alibaba.druid.pool.DruidDataSource\n druid:\n driver-class-name: com.mysql.cj.jdbc.Driver\n username: ${MYSQL_USER:root}\n password: ${MYSQL_PWD:root}\n url: jdbc:mysql://${MYSQL_HOST:pigx-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:pigxx_app}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true\n\n# 租户表维护\npigx:\n tenant:\n column: tenant_id\n tables:\n - app_user\n - app_role\n - app_article\n - app_article_category\n - app_article_collect\n - app_page\n - app_tabbar', '2513bb14ce549a2a4ea1cdfd83bba1f3', '2022-12-19 10:30:07', '2023-06-20 18:15:07', 'nacos', '127.0.0.1', '', '', '', '', '', 'yaml', '', ''); -- ---------------------------- -- Table structure for config_info_aggr diff --git a/db/999pigxx_app.sql b/db/999pigxx_app.sql index b84163b47..78f03c371 100644 --- a/db/999pigxx_app.sql +++ b/db/999pigxx_app.sql @@ -1,162 +1,242 @@ - USE pigxx_app; SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- --- Table structure for app_menu +-- Table structure for app_article -- ---------------------------- -DROP TABLE IF EXISTS `app_menu`; -CREATE TABLE `app_menu` ( - `menu_id` bigint(0) NOT NULL COMMENT '菜单ID', - `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `permission` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `path` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `parent_id` bigint(0) NULL DEFAULT NULL COMMENT '父菜单ID', - `visible` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '1' COMMENT '是否显示', - `sort_order` int(0) NULL DEFAULT 1 COMMENT '排序值', - `menu_type` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', - `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', - `update_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0', - `tenant_id` bigint(0) UNSIGNED NULL DEFAULT NULL COMMENT '租户ID', - PRIMARY KEY (`menu_id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '菜单权限表' ROW_FORMAT = Dynamic; +DROP TABLE IF EXISTS `app_article`; +CREATE TABLE `app_article` ( + `id` bigint NOT NULL COMMENT '主键', + `cid` bigint NOT NULL COMMENT '分类', + `title` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '标题', + `intro` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '简介', + `summary` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '摘要', + `image` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '封面', + `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '内容', + `author` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '作者', + `visit` int unsigned NOT NULL DEFAULT '0' COMMENT '浏览', + `sort` int unsigned NOT NULL DEFAULT '50' COMMENT '排序', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `create_by` varchar(32) COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `update_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '删除时间', + `tenant_id` bigint(20) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE, + KEY `cid_idx` (`cid`) USING BTREE COMMENT '分类索引' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='文章资讯表'; -- ---------------------------- --- Records of app_menu +-- Records of app_article -- ---------------------------- -INSERT INTO `app_menu` VALUES (1000, '主页', NULL, 'pages/sys/home/index', -1, '1', 999, '0', ' ', '2022-12-08 05:07:35', ' ', NULL, '0', 1); -INSERT INTO `app_menu` VALUES (1001, '待办任务', 'pages_oa_todos', 'pages/oa/todos', 1000, '1', 999, '0', '', '2022-12-08 05:07:55', '', '2022-12-09 07:34:40', '0', 1); -INSERT INTO `app_menu` VALUES (1002, '发起任务', 'pages_oa_form', 'pages/oa/form', 1000, '1', 999, '0', '', '2022-12-08 05:08:12', '', '2022-12-09 07:34:57', '0', 1); -INSERT INTO `app_menu` VALUES (1003, '请假列表', 'pages_oa_history', 'pages/oa/history', 1000, '1', 999, '0', '', '2022-12-08 05:08:34', '', '2022-12-09 07:35:10', '0', 1); -INSERT INTO `app_menu` VALUES (1004, '用户管理', 'pages_sys_pigxUser', 'pages/sys/pigxUser/index', 1000, '1', 999, '0', '', '2022-12-08 05:09:55', '', '2022-12-09 07:35:38', '0', 1); -INSERT INTO `app_menu` VALUES (1005, '令牌管理', 'pages_sys_token', 'pages/sys/token/index', 1000, '1', 999, '0', '', '2022-12-08 05:09:55', '', '2022-12-09 07:36:19', '0', 1); -INSERT INTO `app_menu` VALUES (1006, '角色管理', 'pages_sys_pigxRole', 'pages/sys/pigxRole/index', 1000, '1', 999, '0', ' ', '2022-12-08 05:09:55', ' ', NULL, '0', 1); -INSERT INTO `app_menu` VALUES (1007, '岗位管理', 'pages_sys_pigxPost', 'pages/sys/pigxPost/index', 1000, '1', 999, '0', ' ', '2022-12-08 05:09:55', ' ', NULL, '0', 1); -INSERT INTO `app_menu` VALUES (1008, '租户管理', 'pages_sys_pigxTenant', 'pages/sys/pigxTenant/index', 1000, '1', 999, '0', ' ', '2022-12-08 05:09:55', ' ', NULL, '0', 1); -INSERT INTO `app_menu` VALUES (1009, '参数管理', 'pages_sys_pigxParam', 'pages/sys/pigxParam/index', 1000, '1', 999, '0', ' ', '2022-12-08 05:09:55', ' ', NULL, '0', 1); +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for app_article_category +-- ---------------------------- +DROP TABLE IF EXISTS `app_article_category`; +CREATE TABLE `app_article_category` ( + `id` bigint unsigned NOT NULL COMMENT '主键', + `name` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '名称', + `sort` smallint unsigned NOT NULL DEFAULT '50' COMMENT '排序', + `is_show` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '是否显示: 0=否, 1=是', + `del_flag` char(1) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '是否删除: 0=否, 1=是', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `create_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '创建人', + `update_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人', + `tenant_id` bigint(20) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='文章分类表'; + +-- ---------------------------- +-- Records of app_article_category +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for app_article_collect +-- ---------------------------- +DROP TABLE IF EXISTS `app_article_collect`; +CREATE TABLE `app_article_collect` ( + `id` bigint unsigned NOT NULL COMMENT '主键', + `user_id` bigint unsigned NOT NULL DEFAULT '0' COMMENT '用户ID', + `article_id` bigint unsigned NOT NULL DEFAULT '0' COMMENT '文章ID', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_time` datetime NOT NULL COMMENT '更新时间', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '是否删除', + `create_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人', + `tenant_id` bigint(20) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='文章收藏表'; + +-- ---------------------------- +-- Records of app_article_collect +-- ---------------------------- +BEGIN; +COMMIT; + +-- ---------------------------- +-- Table structure for app_page +-- ---------------------------- +DROP TABLE IF EXISTS `app_page`; +CREATE TABLE `app_page` ( + `id` bigint unsigned NOT NULL COMMENT '主键', + `page_type` tinyint unsigned NOT NULL DEFAULT '10' COMMENT '页面类型', + `page_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '页面名称', + `page_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '页面数据', + `create_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '修改人', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '修改时间', + `del_flag` char(1) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '删除标记', + `tenant_id` bigint(20) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='页面装修表'; + +-- ---------------------------- +-- Records of app_page +-- ---------------------------- +BEGIN; +INSERT INTO `app_page` VALUES (1, 1, '商城首页', '[{\"title\":\"搜索\",\"name\":\"search\",\"disabled\":1,\"content\":{},\"styles\":{}},{\"title\":\"首页轮播图\",\"name\":\"banner\",\"content\":{\"enabled\":1,\"data\":[{\"image\":\"/api/static/banner01.png\",\"name\":\"\",\"link\":{\"path\":\"/pages/index/index\",\"name\":\"商城首页\",\"type\":\"shop\"}}]},\"styles\":{}},{\"title\":\"导航菜单\",\"name\":\"nav\",\"content\":{\"enabled\":1,\"data\":[{\"image\":\"https://minio.pigx.top/oss/app/nav01.png\",\"name\":\"资讯中心\",\"link\":{\"path\":\"/pages/news/news\",\"name\":\"文章资讯\",\"type\":\"shop\"}},{\"image\":\"https://minio.pigx.top/oss/app/nav02.png\",\"name\":\"我的收藏\",\"link\":{\"path\":\"/pages/collection/collection\",\"name\":\"我的收藏\",\"type\":\"shop\"}},{\"image\":\"https://minio.pigx.top/oss/app/nav03.png\",\"name\":\"个人设置\",\"link\":{\"path\":\"/pages/user_set/user_set\",\"name\":\"个人设置\",\"type\":\"shop\"}},{\"image\":\"https://minio.pigx.top/oss/app/nav04.png\",\"name\":\"联系客服\",\"link\":{\"path\":\"/pages/customer_service/customer_service\",\"name\":\"联系客服\",\"type\":\"shop\"}},{\"image\":\"https://minio.pigx.top/oss/app/nav05.png\",\"name\":\"关于我们\",\"link\":{\"path\":\"/pages/as_us/as_us\",\"name\":\"关于我们\",\"type\":\"shop\"}}]},\"styles\":{}},{\"id\":\"l84almsk2uhyf\",\"title\":\"资讯\",\"name\":\"news\",\"disabled\":1,\"content\":{},\"styles\":{}}]', NULL, 'admin', NULL, '2023-06-15 09:18:02', '0',1); +INSERT INTO `app_page` VALUES (2, 2, '个人中心', '[{\"title\":\"用户信息\",\"name\":\"user-info\",\"disabled\":1,\"content\":{},\"styles\":{}},{\"title\":\"我的服务\",\"name\":\"my-service\",\"content\":{\"style\":2,\"title\":\"服务中心\",\"data\":[{\"image\":\"https://minio.pigx.top/oss/app/user_collect.png\",\"name\":\"我的收藏\",\"link\":{\"path\":\"/pages/collection/collection\",\"name\":\"我的收藏\",\"type\":\"shop\"}},{\"image\":\"https://minio.pigx.top/oss/app/user_setting.png\",\"name\":\"个人设置\",\"link\":{\"path\":\"/pages/user_set/user_set\",\"name\":\"个人设置\",\"type\":\"shop\"}},{\"image\":\"https://minio.pigx.top/oss/app/user_kefu.png\",\"name\":\"联系客服\",\"link\":{\"path\":\"/pages/customer_service/customer_service\",\"name\":\"联系客服\",\"type\":\"shop\"}}]},\"styles\":{}},{\"title\":\"个人中心广告图\",\"name\":\"user-banner\",\"content\":{\"enabled\":1,\"data\":[{\"image\":\"\",\"name\":\"sdds\",\"link\":{\"path\":\"/pages/user/user\",\"name\":\"个人中心\",\"type\":\"shop\"}}]},\"styles\":{}}]', NULL, 'admin', NULL, '2023-06-18 17:00:05', '0',1); +INSERT INTO `app_page` VALUES (3, 3, '客服设置', '[{\"title\":\"客服设置\",\"name\":\"customer-service\",\"content\":{\"title\":\"添加客服二维码\",\"time\":\"早上 9:00 - 22:00\",\"mobile\":\"13800138000\",\"qrcode\":\"/admin/sys-file/local/adc5061f99e9440abcd9b22572909c88.jpg\"},\"styles\":{}}]', NULL, 'admin', NULL, '2023-06-14 13:12:19', '0',1); +COMMIT; + +-- ---------------------------- +-- Table structure for app_tabbar +-- ---------------------------- +DROP TABLE IF EXISTS `app_tabbar`; +CREATE TABLE `app_tabbar` ( + `id` bigint unsigned NOT NULL COMMENT '主键', + `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '导航名称', + `selected` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '未选图标', + `unselected` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '已选图标', + `link` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '链接地址', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `create_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人', + `update_by` varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人', + `del_flag` char(1) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '删除标记', + `tenant_id` bigint(20) DEFAULT NULL, + PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='底部装修表'; + +-- ---------------------------- +-- Records of app_tabbar +-- ---------------------------- +BEGIN; +INSERT INTO `app_tabbar` VALUES (1, '首页', 'https://minio.pigx.top/oss/app/tabbar0.png', 'https://minio.pigx.top/oss/app/tabbar0_0.png', '{\"path\":\"/pages/index/index\",\"name\":\"商城首页\",\"type\":\"shop\"}', NULL, '2023-06-15 09:16:25', NULL, 'admin', '0',1); +INSERT INTO `app_tabbar` VALUES (2, '资讯', 'https://minio.pigx.top/oss/app/tabbar1.png', 'https://minio.pigx.top/oss/app/tabbar1_1.png', '{\"path\":\"/pages/news/news\",\"name\":\"文章资讯\",\"type\":\"shop\"}', NULL, '2023-06-15 09:16:25', NULL, 'admin', '0',1); +INSERT INTO `app_tabbar` VALUES (3, '我的', 'https://minio.pigx.top/oss/app/tabbar3.png', 'https://minio.pigx.top/oss/app/tabbar3_3.png', '{\"path\":\"/pages/user/user\",\"name\":\"个人中心\",\"type\":\"shop\"}', NULL, '2023-06-15 09:16:25', NULL, 'admin', '0',1); +COMMIT; -- ---------------------------- -- Table structure for app_role -- ---------------------------- DROP TABLE IF EXISTS `app_role`; -CREATE TABLE `app_role` ( - `role_id` bigint(0) NOT NULL, - `role_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `role_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `role_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, +CREATE TABLE `app_role` ( + `role_id` bigint(20) NOT NULL, + `role_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `role_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `role_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', - `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0), - `update_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0), - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0', - `tenant_id` bigint(0) NULL DEFAULT NULL, + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP, + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0', + `tenant_id` bigint(20) DEFAULT NULL, PRIMARY KEY (`role_id`) USING BTREE, - INDEX `role_idx1_role_code`(`role_code`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'app角色表' ROW_FORMAT = Dynamic; + KEY `role_idx1_role_code` (`role_code`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='app角色表'; -- ---------------------------- -- Records of app_role -- ---------------------------- -INSERT INTO `app_role` VALUES (1, 'app用户', 'APP_USER', 'app用户角色', ' ', ' ', '2022-12-07 06:34:18', NULL, '0', 1); - --- ---------------------------- --- Table structure for app_role_menu --- ---------------------------- -DROP TABLE IF EXISTS `app_role_menu`; -CREATE TABLE `app_role_menu` ( - `role_id` bigint(0) NOT NULL COMMENT '角色ID', - `menu_id` bigint(0) NOT NULL COMMENT '菜单ID', - PRIMARY KEY (`role_id`, `menu_id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '角色菜单表' ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of app_role_menu --- ---------------------------- -INSERT INTO `app_role_menu` VALUES (1, 1000); -INSERT INTO `app_role_menu` VALUES (1, 1001); -INSERT INTO `app_role_menu` VALUES (1, 1002); -INSERT INTO `app_role_menu` VALUES (1, 1003); -INSERT INTO `app_role_menu` VALUES (1, 1004); -INSERT INTO `app_role_menu` VALUES (1, 1005); -INSERT INTO `app_role_menu` VALUES (1, 1006); -INSERT INTO `app_role_menu` VALUES (1, 1007); -INSERT INTO `app_role_menu` VALUES (1, 1008); -INSERT INTO `app_role_menu` VALUES (1, 1009); +BEGIN; +INSERT INTO `app_role` VALUES (1, 'app用户', 'APP_USER', 'app用户角色', '', '', '2022-12-07 06:34:18', '2023-03-09 06:34:42', '0', 1); +COMMIT; -- ---------------------------- -- Table structure for app_social_details -- ---------------------------- DROP TABLE IF EXISTS `app_social_details`; -CREATE TABLE `app_social_details` ( - `id` bigint(0) NOT NULL COMMENT '主鍵', - `type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `remark` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `app_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `app_secret` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `redirect_url` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `ext` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拓展字段', - `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', - `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', - `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', - `update_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0', - `tenant_id` bigint(0) NOT NULL DEFAULT 0 COMMENT '所属租户', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统社交登录账号表' ROW_FORMAT = Dynamic; +CREATE TABLE `app_social_details` ( + `id` bigint(20) NOT NULL COMMENT '主键', -- 主键 + `type` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '社交类型', -- 社交类型 + `remark` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注', -- 备注 + `app_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '应用ID', -- 应用ID + `app_secret` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '应用密钥', -- 应用密钥 + `redirect_url` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '重定向URL', -- 重定向URL + `ext` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段', -- 拓展字段 + `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', -- 创建人 + `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', -- 修改人 + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', -- 创建时间 + `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', -- 更新时间 + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标志', -- 删除标志 +PRIMARY KEY (`id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC +COMMENT='系统社交登录账号表'; -- 系统社交登录账号表 -- ---------------------------- -- Records of app_social_details -- ---------------------------- -INSERT INTO `app_social_details` VALUES (1, 'MINI', '小程序登录', 'wx6832be859d0e1cf5', '', NULL, NULL, '', 'admin', '2022-12-09 01:44:42', '2022-12-09 11:12:29', '0', 1); +BEGIN; +INSERT INTO `app_social_details` VALUES (1, 'MINI', '小程序登录', 'app_id', 'app_secret', 'http://www.baidu.com123', NULL, '', 'admin', '2022-12-09 01:44:42', '2023-04-03 06:12:30', '0'); +COMMIT; -- ---------------------------- -- Table structure for app_user -- ---------------------------- DROP TABLE IF EXISTS `app_user`; -CREATE TABLE `app_user` ( - `user_id` bigint(0) NOT NULL, - `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `salt` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `nickname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拓展字段:昵称', - `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拓展字段:姓名', - `email` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '拓展字段:邮箱', +CREATE TABLE `app_user` ( + `user_id` bigint(20) NOT NULL COMMENT '用户id', + `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户名', + `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '密码', + `salt` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '盐值', + `phone` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '手机号码', + `avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '头像图片链接', + `nickname` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段:昵称', + `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段:姓名', + `email` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '拓展字段:邮箱', `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT ' ' COMMENT '创建人', `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT ' ' COMMENT '修改人', - `create_time` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', - `update_time` datetime(0) NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '修改时间', - `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0', - `tenant_id` bigint(0) NOT NULL DEFAULT 0 COMMENT '所属租户', - `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后一次密码修改时间', - `lock_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '锁定状态', - `wx_openid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '微信登录openId', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', + `del_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '删除标志', + `tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '所属租户id', + `last_modified_time` datetime DEFAULT NULL COMMENT '最后一次密码修改时间', + `lock_flag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '0' COMMENT '锁定状态', + `wx_openid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '微信登录openId', PRIMARY KEY (`user_id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'app用户表' ROW_FORMAT = Dynamic; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='app用户表'; -- ---------------------------- -- Records of app_user -- ---------------------------- -INSERT INTO `app_user` VALUES (1, 'appuser', '$2a$10$d5mw9aUzBhxDqknpxIWxdOJ2xdhkaPNConNu4cU8JNhTrruyjPYL2', NULL, '13054729089', NULL, 'aeizzz', '刘洪磊', 'aeizzz@foxmail.com', '', 'aeizzz', '2022-12-07 02:59:38', '2022-12-09 10:55:23', '0', 1, NULL, '0', 'oBxPy5EnbDiN-gGEaovCpp_IkrkQ'); +BEGIN; +INSERT INTO `app_user` VALUES (1, 'appuser', '$2a$10$XQu3TmORLqDWayFspQN.U.LigJ5TWPTdXPIn/6SxGHKED3PVpuMH6', NULL, '13054729089', NULL, 'aeizzz', '刘洪磊', 'aeizzz@foxmail.com', '', 'appuser', '2022-12-07 02:59:38', '2023-03-09 15:14:44', '0', 1, NULL, '0', 'oBxPy5EnbDiN-gGEaovCpp_IkrkQ'); +COMMIT; -- ---------------------------- -- Table structure for app_user_role -- ---------------------------- DROP TABLE IF EXISTS `app_user_role`; -CREATE TABLE `app_user_role` ( - `user_id` bigint(0) NOT NULL COMMENT '用户ID', - `role_id` bigint(0) NOT NULL COMMENT '角色ID', - PRIMARY KEY (`user_id`, `role_id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户角色表' ROW_FORMAT = Dynamic; +CREATE TABLE `app_user_role` ( + `user_id` bigint(20) NOT NULL COMMENT '用户ID', + `role_id` bigint(20) NOT NULL COMMENT '角色ID', + PRIMARY KEY (`user_id`,`role_id`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='用户角色表'; -- ---------------------------- -- Records of app_user_role -- ---------------------------- +BEGIN; INSERT INTO `app_user_role` VALUES (1, 1); +COMMIT; SET FOREIGN_KEY_CHECKS = 1; diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/dto/AppUserDTO.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/dto/AppUserDTO.java index c03cc5ba7..ef2366638 100644 --- a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/dto/AppUserDTO.java +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/dto/AppUserDTO.java @@ -12,16 +12,19 @@ import java.util.List; @EqualsAndHashCode(callSuper = true) public class AppUserDTO extends AppUser { - /** - * 角色ID - */ - @Schema(description = "角色id集合") - private List role; + /** + * 角色ID + */ + @Schema(description = "角色id集合") + private List role; - /** - * 新密码 - */ - @Schema(description = "新密码") - private String newpassword1; + /** + * 新密码 + */ + @Schema(description = "新密码") + private String newpassword1; + + @Schema(description = "验证码") + private String mobileCode; } diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppArticleCategoryEntity.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppArticleCategoryEntity.java new file mode 100644 index 000000000..d07072b30 --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppArticleCategoryEntity.java @@ -0,0 +1,84 @@ +package com.pig4cloud.pigx.app.api.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * 文章分类表 + * + * @author pig + * @date 2023-06-07 16:28:03 + */ +@Data +@TableName("app_article_category") +@EqualsAndHashCode(callSuper = true) +@Schema(description = "文章分类表") +public class AppArticleCategoryEntity extends Model { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "主键") + private Long id; + + /** + * 名称 + */ + @Schema(description = "名称") + private String name; + + /** + * 排序 + */ + @Schema(description = "排序") + private Integer sort; + + /** + * 是否显示: 0=否, 1=是 + */ + @Schema(description = "是否显示: 0=否, 1=是") + private Integer isShow; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 更新人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description = "更新人") + private String updateBy; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description = "更新时间") + private LocalDateTime updateTime; + + /** + * 是否删除: 0=否, 1=是 + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "是否删除: 0=否, 1=是") + private String delFlag; + +} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppArticleCollectEntity.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppArticleCollectEntity.java new file mode 100644 index 000000000..295d27933 --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppArticleCollectEntity.java @@ -0,0 +1,84 @@ +package com.pig4cloud.pigx.app.api.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * 文章收藏表 + * + * @author pig + * @date 2023-06-16 14:33:41 + */ +@Data +@TableName("app_article_collect") +@EqualsAndHashCode(callSuper = true) +@Schema(description = "文章收藏表") +public class AppArticleCollectEntity extends Model { + + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "主键") + private Long id; + + /** + * 用户ID + */ + @Schema(description = "用户ID") + private Long userId; + + /** + * 文章ID + */ + @Schema(description = "文章ID") + private Long articleId; + + /** + * 文章标题 + */ + @TableField(exist = false) + private String title; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 更新人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description = "更新人") + private String updateBy; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description = "更新时间") + private LocalDateTime updateTime; + + /** + * 是否删除 + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "是否删除") + private String delFlag; +} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppArticleEntity.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppArticleEntity.java new file mode 100644 index 000000000..a40a662cb --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppArticleEntity.java @@ -0,0 +1,125 @@ +package com.pig4cloud.pigx.app.api.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * 文章资讯 + * + * @author pig + * @date 2023-06-07 16:32:35 + */ +@Data +@TableName("app_article") +@EqualsAndHashCode(callSuper = true) +@Schema(description = "文章资讯") +public class AppArticleEntity extends Model { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "主键") + private Long id; + + /** + * 分类 + */ + @Schema(description = "分类") + private Long cid; + + /** + * 标题 + */ + @Schema(description = "标题") + private String title; + + /** + * 简介 + */ + @Schema(description = "简介") + private String intro; + + /** + * 摘要 + */ + @Schema(description = "摘要") + private String summary; + + /** + * 封面 + */ + @Schema(description = "封面") + private String image; + + /** + * 内容 + */ + @Schema(description = "内容") + private String content; + + /** + * 作者 + */ + @Schema(description = "作者") + private String author; + + /** + * 浏览 + */ + @Schema(description = "浏览") + private Integer visit; + + /** + * 排序 + */ + @Schema(description = "排序") + private Integer sort; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 更新人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description = "更新人") + private String updateBy; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description = "更新时间") + private LocalDateTime updateTime; + + /** + * 删除时间 + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标志") + private String delFlag; + + /** + * 当前用户是否已收藏 + */ + @TableField(exist = false) + private boolean collect; +} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppMenu.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppMenu.java deleted file mode 100644 index 03f6201c6..000000000 --- a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppMenu.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.app.api.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.time.LocalDateTime; - -/** - * 菜单权限表 - * - * @author aeizzz - * @date 2022-12-07 09:52:03 - */ -@Data -@TableName("app_menu") -@EqualsAndHashCode(callSuper = true) -@Schema(description = "菜单权限表") -public class AppMenu extends Model { - - private static final long serialVersionUID = 1L; - - /** - * 菜单ID - */ - @TableId(type = IdType.ASSIGN_ID) - @Schema(description = "菜单ID") - private Long menuId; - - /** - * name - */ - @Schema(description = "name") - private String name; - - /** - * permission - */ - @Schema(description = "permission") - private String permission; - - /** - * path - */ - @Schema(description = "path") - private String path; - - /** - * 父菜单ID - */ - @Schema(description = "父菜单ID") - private Long parentId; - - /** - * 是否显示 - */ - @Schema(description = "是否显示") - private String visible; - - /** - * 排序值 - */ - @Schema(description = "排序值") - private Integer sortOrder; - - /** - * menuType - */ - @Schema(description = "menuType") - private String menuType; - - /** - * 创建人 - */ - @Schema(description = "创建人") - private String createBy; - - /** - * 创建时间 - */ - @Schema(description = "创建时间") - private LocalDateTime createTime; - - /** - * 修改人 - */ - @Schema(description = "修改人") - private String updateBy; - - /** - * 更新时间 - */ - @Schema(description = "更新时间") - private LocalDateTime updateTime; - - /** - * delFlag - */ - @Schema(description = "delFlag") - private String delFlag; - - /** - * 租户ID - */ - @Schema(description = "租户ID", hidden = true) - private Long tenantId; - -} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppPageEntity.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppPageEntity.java new file mode 100644 index 000000000..74ed0c885 --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppPageEntity.java @@ -0,0 +1,83 @@ +package com.pig4cloud.pigx.app.api.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.time.LocalDateTime; + +/** + * 页面 + * + * @author lengleng + * @date 2023-06-08 11:19:23 + */ +@Data +@TableName("app_page") +@EqualsAndHashCode(callSuper = true) +@Schema(description = "页面") +public class AppPageEntity extends Model { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "主键") + private Long id; + + /** + * 页面类型 + */ + @Schema(description = "页面类型") + private Integer pageType; + + /** + * 页面名称 + */ + @Schema(description = "页面名称") + private String pageName; + + /** + * 页面数据 + */ + @Schema(description = "页面数据") + private String pageData; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 修改人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description = "修改人") + private String updateBy; + + /** + * 修改时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description = "修改时间") + private LocalDateTime updateTime; + + /** + * 删除标记 + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记") + private String delFlag; + +} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppRoleMenu.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppRoleMenu.java deleted file mode 100644 index 208191037..000000000 --- a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppRoleMenu.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.app.api.entity; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.activerecord.Model; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 角色菜单表 - * - * @author aeizzz - * @date 2022-12-07 09:52:03 - */ -@Data -@TableName("app_role_menu") -@EqualsAndHashCode(callSuper = true) -@Schema(description = "角色菜单表") -public class AppRoleMenu extends Model { - - private static final long serialVersionUID = 1L; - - /** - * 角色ID - */ - @TableId(type = IdType.ASSIGN_ID) - @Schema(description = "角色ID") - private Long roleId; - - /** - * 菜单ID - */ - @Schema(description = "菜单ID") - private Long menuId; - -} diff --git a/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppTabbarEntity.java b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppTabbarEntity.java new file mode 100644 index 000000000..66dc8fc06 --- /dev/null +++ b/pigx-app-server/pigx-app-server-api/src/main/java/com/pig4cloud/pigx/app/api/entity/AppTabbarEntity.java @@ -0,0 +1,94 @@ +package com.pig4cloud.pigx.app.api.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonRawValue; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.time.LocalDateTime; + +/** + * 导航栏 + * + * @author lengleng + * @date 2023-06-08 11:18:46 + */ +@Data +@TableName("app_tabbar") +@EqualsAndHashCode(callSuper = true) +@Schema(description = "导航栏") +public class AppTabbarEntity extends Model { + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + @Schema(description = "主键") + private Long id; + + /** + * 导航名称 + */ + @Schema(description = "导航名称") + private String name; + + /** + * 未选图标 + */ + @Schema(description = "未选图标") + private String selected; + + /** + * 已选图标 + */ + @Schema(description = "已选图标") + private String unselected; + + /** + * 链接地址 + */ + @Schema(description = "链接地址") + @JsonRawValue + @JsonDeserialize() + private String link; + + /** + * 创建人 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + @Schema(description = "创建时间") + private LocalDateTime createTime; + + /** + * 更新人 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description = "更新人") + private String updateBy; + + /** + * 更新时间 + */ + @TableField(fill = FieldFill.INSERT_UPDATE) + @Schema(description = "更新时间") + private LocalDateTime updateTime; + + /** + * 删除标记 + */ + @TableLogic + @TableField(fill = FieldFill.INSERT) + @Schema(description = "删除标记") + private String delFlag; + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppArticleCategoryController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppArticleCategoryController.java new file mode 100644 index 000000000..76a1a51cc --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppArticleCategoryController.java @@ -0,0 +1,131 @@ +package com.pig4cloud.pigx.app.controller; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pigx.app.api.entity.AppArticleCategoryEntity; +import com.pig4cloud.pigx.app.service.AppArticleCategoryService; +import com.pig4cloud.pigx.common.core.util.R; +import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel; +import com.pig4cloud.pigx.common.log.annotation.SysLog; +import com.pig4cloud.pigx.common.security.annotation.Inner; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springdoc.api.annotations.ParameterObject; +import org.springframework.http.HttpHeaders; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 文章分类表 + * + * @author pig + * @date 2023-06-07 16:28:03 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/appArticleCategory") +@Tag(description = "appArticleCategory", name = "文章分类表管理") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class AppArticleCategoryController { + + private final AppArticleCategoryService appArticleCategoryService; + + /** + * 分页查询 + * @param page 分页对象 + * @param appArticleCategory 文章分类表 + * @return + */ + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + @PreAuthorize("@pms.hasPermission('app_appArticleCategory_view')") + public R getAppArticleCategoryPage(@ParameterObject Page page, + @ParameterObject AppArticleCategoryEntity appArticleCategory) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + wrapper.like(StrUtil.isNotBlank(appArticleCategory.getName()), AppArticleCategoryEntity::getName, + appArticleCategory.getName()); + return R.ok(appArticleCategoryService.page(page, wrapper)); + } + + /** + * 通过id查询文章分类表 + * @param id id + * @return R + */ + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/{id}") + @PreAuthorize("@pms.hasPermission('app_appArticleCategory_view')") + public R getById(@PathVariable("id") Long id) { + return R.ok(appArticleCategoryService.getById(id)); + } + + /** + * 通过查询文章分类 + * @return R + */ + @Operation(summary = "查询文章分类", description = "查询文章分类") + @Inner(value = false) + @GetMapping("/list") + public R list() { + return R.ok(appArticleCategoryService.list()); + } + + /** + * 新增文章分类表 + * @param appArticleCategory 文章分类表 + * @return R + */ + @Operation(summary = "新增文章分类表", description = "新增文章分类表") + @SysLog("新增文章分类表") + @PostMapping + @PreAuthorize("@pms.hasPermission('app_appArticleCategory_add')") + public R save(@RequestBody AppArticleCategoryEntity appArticleCategory) { + return R.ok(appArticleCategoryService.save(appArticleCategory)); + } + + /** + * 修改文章分类表 + * @param appArticleCategory 文章分类表 + * @return R + */ + @Operation(summary = "修改文章分类表", description = "修改文章分类表") + @SysLog("修改文章分类表") + @PutMapping + @PreAuthorize("@pms.hasPermission('app_appArticleCategory_edit')") + public R updateById(@RequestBody AppArticleCategoryEntity appArticleCategory) { + return R.ok(appArticleCategoryService.updateById(appArticleCategory)); + } + + /** + * 通过id删除文章分类表 + * @param ids id列表 + * @return R + */ + @Operation(summary = "通过id删除文章分类表", description = "通过id删除文章分类表") + @SysLog("通过id删除文章分类表") + @DeleteMapping + @PreAuthorize("@pms.hasPermission('app_appArticleCategory_del')") + public R removeById(@RequestBody Long[] ids) { + return R.ok(appArticleCategoryService.removeBatchByIds(CollUtil.toList(ids))); + } + + /** + * 导出excel 表格 + * @param appArticleCategory 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('app_appArticleCategory_export')") + public List export(AppArticleCategoryEntity appArticleCategory) { + return appArticleCategoryService.list(Wrappers.query(appArticleCategory)); + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppArticleCollectController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppArticleCollectController.java new file mode 100644 index 000000000..c5c184887 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppArticleCollectController.java @@ -0,0 +1,130 @@ +package com.pig4cloud.pigx.app.controller; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.pig4cloud.pigx.app.api.entity.AppArticleCollectEntity; +import com.pig4cloud.pigx.app.api.entity.AppArticleEntity; +import com.pig4cloud.pigx.app.service.AppArticleCollectService; +import com.pig4cloud.pigx.common.core.util.R; +import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel; +import com.pig4cloud.pigx.common.log.annotation.SysLog; +import com.pig4cloud.pigx.common.security.util.SecurityUtils; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springdoc.api.annotations.ParameterObject; +import org.springframework.http.HttpHeaders; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 文章收藏表 + * + * @author pig + * @date 2023-06-16 14:33:41 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/collect") +@Tag(description = "collect", name = "文章收藏表管理") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class AppArticleCollectController { + + private final AppArticleCollectService appArticleCollectService; + + /** + * 分页查询 + * + * @param page 分页对象 + * @param appArticleCollect 文章收藏表 + * @return + */ + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + public R getAppArticleCollectPage(@ParameterObject Page page) { + MPJLambdaWrapper wrapper = new MPJLambdaWrapper().selectAll(AppArticleCollectEntity.class).select(AppArticleEntity::getTitle).leftJoin(AppArticleEntity.class, AppArticleEntity::getId, AppArticleCollectEntity::getArticleId); + return R.ok(appArticleCollectService.selectJoinListPage(page, AppArticleCollectEntity.class, wrapper)); + } + + + /** + * 通过id查询文章收藏表 + * + * @param id id + * @return R + */ + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/{id}") + public R getById(@PathVariable("id") Long id) { + return R.ok(appArticleCollectService.getById(id)); + } + + /** + * 新增文章收藏表 + * + * @param appArticleCollect 文章收藏表 + * @return R + */ + @Operation(summary = "新增文章收藏表", description = "新增文章收藏表") + @SysLog("新增文章收藏表") + @PostMapping + public R save(@RequestBody AppArticleCollectEntity appArticleCollect) { + Long id = SecurityUtils.getUser().getId(); + appArticleCollect.setUserId(id); + return R.ok(appArticleCollectService.save(appArticleCollect)); + } + + /** + * 修改文章收藏表 + * + * @param appArticleCollect 文章收藏表 + * @return R + */ + @Operation(summary = "修改文章收藏表", description = "修改文章收藏表") + @SysLog("修改文章收藏表") + @PutMapping + public R updateById(@RequestBody AppArticleCollectEntity appArticleCollect) { + return R.ok(appArticleCollectService.updateById(appArticleCollect)); + } + + /** + * 通过id删除文章收藏表 + * + * @param ids id列表 + * @return R + */ + @Operation(summary = "通过id删除文章收藏表", description = "通过id删除文章收藏表") + @SysLog("通过id删除文章收藏表") + @DeleteMapping + public R removeById(@RequestBody Long[] ids) { + return R.ok(appArticleCollectService.removeBatchByIds(CollUtil.toList(ids))); + } + + + @Operation(summary = "通过文章id删除文章收藏表", description = "通过文章id删除文章收藏表") + @SysLog("通过文章id删除文章收藏表") + @DeleteMapping("/{articleId}") + public R removeByArticleId(@PathVariable String articleId) { + Long id = SecurityUtils.getUser().getId(); + return R.ok(appArticleCollectService.remove(Wrappers.lambdaQuery().eq(AppArticleCollectEntity::getUserId, id).eq(AppArticleCollectEntity::getArticleId, articleId))); + } + + + /** + * 导出excel 表格 + * + * @param appArticleCollect 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('app_collect_export')") + public List export(AppArticleCollectEntity appArticleCollect) { + return appArticleCollectService.list(Wrappers.query(appArticleCollect)); + } +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppArticleController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppArticleController.java new file mode 100644 index 000000000..628a88443 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppArticleController.java @@ -0,0 +1,128 @@ +package com.pig4cloud.pigx.app.controller; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.pig4cloud.pigx.app.api.entity.AppArticleEntity; +import com.pig4cloud.pigx.app.service.AppArticleService; +import com.pig4cloud.pigx.common.core.util.R; +import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel; +import com.pig4cloud.pigx.common.log.annotation.SysLog; +import com.pig4cloud.pigx.common.security.annotation.Inner; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springdoc.api.annotations.ParameterObject; +import org.springframework.http.HttpHeaders; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Objects; + +/** + * 文章资讯 + * + * @author pig + * @date 2023-06-07 16:32:35 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/appArticle") +@Tag(description = "appArticle", name = "文章资讯管理") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class AppArticleController { + + private final AppArticleService appArticleService; + + /** + * 分页查询 + * + * @param page 分页对象 + * @param appArticle 文章资讯 + * @return + */ + @Operation(summary = "分页查询", description = "分页查询") + @Inner(value = false) + @GetMapping("/page") + public R getAppArticlePage(@ParameterObject Page page, @ParameterObject AppArticleEntity appArticle) { + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery(); + wrapper.like(StrUtil.isNotBlank(appArticle.getAuthor()), AppArticleEntity::getAuthor, appArticle.getAuthor()); + wrapper.like(StrUtil.isNotBlank(appArticle.getTitle()), AppArticleEntity::getTitle, appArticle.getTitle()); + wrapper.eq(Objects.nonNull(appArticle.getCid()), AppArticleEntity::getCid, appArticle.getCid()); + return R.ok(appArticleService.page(page, wrapper)); + } + + /** + * 通过id查询文章资讯 + * + * @param id id + * @return R + */ + @Inner(value = false) + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/details/{id}/{userId}") + public R getById(@PathVariable("id") Long id, @PathVariable(required = false) Long userId) { + return R.ok(appArticleService.getArticleAndIncrById(id, userId)); + } + + /** + * 新增文章资讯 + * + * @param appArticle 文章资讯 + * @return R + */ + @Operation(summary = "新增文章资讯", description = "新增文章资讯") + @SysLog("新增文章资讯") + @PostMapping + @PreAuthorize("@pms.hasPermission('app_appArticle_add')") + public R save(@RequestBody AppArticleEntity appArticle) { + return R.ok(appArticleService.save(appArticle)); + } + + /** + * 修改文章资讯 + * + * @param appArticle 文章资讯 + * @return R + */ + @Operation(summary = "修改文章资讯", description = "修改文章资讯") + @SysLog("修改文章资讯") + @PutMapping + @PreAuthorize("@pms.hasPermission('app_appArticle_edit')") + public R updateById(@RequestBody AppArticleEntity appArticle) { + return R.ok(appArticleService.updateById(appArticle)); + } + + /** + * 通过id删除文章资讯 + * + * @param ids id列表 + * @return R + */ + @Operation(summary = "通过id删除文章资讯", description = "通过id删除文章资讯") + @SysLog("通过id删除文章资讯") + @DeleteMapping + @PreAuthorize("@pms.hasPermission('app_appArticle_del')") + public R removeById(@RequestBody Long[] ids) { + return R.ok(appArticleService.removeBatchByIds(CollUtil.toList(ids))); + } + + + /** + * 导出excel 表格 + * + * @param appArticle 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('app_appArticle_export')") + public List export(AppArticleEntity appArticle) { + return appArticleService.list(Wrappers.query(appArticle)); + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppIndexController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppIndexController.java new file mode 100644 index 000000000..cf79f0b87 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppIndexController.java @@ -0,0 +1,59 @@ +package com.pig4cloud.pigx.app.controller; + +import com.pig4cloud.pigx.app.api.entity.AppPageEntity; +import com.pig4cloud.pigx.app.service.AppIndexService; +import com.pig4cloud.pigx.common.core.util.R; +import com.pig4cloud.pigx.common.security.annotation.Inner; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Map; + +/** + * app 首页控制 + * + * @author lengleng + * @date 2023/6/8 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/index") +@Tag(description = "App 页面控制", name = "app index") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class AppIndexController { + + private final AppIndexService indexService; + + /** + * 首页 + * @return Object + */ + @Inner(value = false) + @GetMapping("/index") + public R index() { + Map detail = indexService.index(); + return R.ok(detail); + } + + @Inner(value = false) + @GetMapping("/config") + public R config() { + Map map = indexService.config(); + return R.ok(map); + } + + @Inner(value = false) + @GetMapping("/decorate") + public R decorate(@Validated @RequestParam("id") Integer id) { + AppPageEntity detail = indexService.decorate(id); + return R.ok(detail); + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppMenuController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppMenuController.java deleted file mode 100644 index c90ab1d37..000000000 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppMenuController.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.app.controller; - -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.pig4cloud.pigx.app.api.entity.AppMenu; -import com.pig4cloud.pigx.app.service.AppMenuService; -import com.pig4cloud.pigx.common.core.util.R; -import com.pig4cloud.pigx.common.log.annotation.SysLog; -import com.pig4cloud.pigx.common.security.util.SecurityUtils; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpHeaders; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.validation.Valid; -import java.util.HashSet; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * 菜单权限表 - * - * @author aeizzz - * @date 2022-12-07 09:52:03 - */ -@RestController -@RequiredArgsConstructor -@RequestMapping("/appmenu") -@Tag(description = "appmenu", name = "菜单权限表管理") -@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) -public class AppMenuController { - - private final AppMenuService appMenuService; - - /** - * 返回当前用户的树形菜单集合 - * @param type 类型 - * @param parentId 父节点ID - * @return 当前用户的树形菜单 - */ - @GetMapping - public R getUserMenu(String type, Long parentId) { - - // 获取符合条件的菜单 - Set all = new HashSet<>(); - SecurityUtils.getRoles().forEach(roleId -> all.addAll(appMenuService.findMenuByRoleId(roleId))); - return R.ok(appMenuService.filterMenu(all, type, parentId)); - } - - /** - * 返回全部树形菜单集合 - * @param parentId 父节点ID - * @param menuName 菜单名称 - * @return 树形菜单 - */ - @GetMapping(value = "/tree") - public R getTree(Long parentId, String menuName) { - return R.ok(appMenuService.treeMenu(parentId, menuName)); - } - - /** - * 返回角色的菜单集合授权 - * @param roleId 角色ID - * @return 属性集合 - */ - @GetMapping("/tree/{roleId}") - public R getRoleTree(@PathVariable Long roleId) { - return R.ok( - appMenuService.findMenuByRoleId(roleId).stream().map(AppMenu::getMenuId).collect(Collectors.toList())); - } - - /** - * 通过ID查询菜单的详细信息 - * @param id 菜单ID - * @return 菜单详细信息 - */ - @GetMapping("/{id}") - public R getById(@PathVariable Long id) { - return R.ok(appMenuService.getById(id)); - } - - /** - * 通过permission查询app菜单表 - * @param permission permission - * @return R - */ - @Operation(summary = "通过permission查询", description = "通过permission查询") - @GetMapping("/details/{permission}") - public R getByMenuName(@PathVariable("permission") String permission) { - return R.ok(appMenuService.getOne(Wrappers.lambdaQuery().eq(AppMenu::getPermission, permission))); - } - - /** - * 通过name查询app菜单表 - * @param name name - * @return R - */ - @Operation(summary = "通过name查询", description = "通过name查询") - @GetMapping("/detailsByName/{name}") - public R getByMenuByName(@PathVariable("name") String name) { - return R.ok(appMenuService.getOne(Wrappers.lambdaQuery().eq(AppMenu::getName, name))); - } - - /** - * 新增菜单 - * @param appMenu 菜单信息 - * @return success/false - */ - @SysLog("新增菜单") - @PostMapping - @PreAuthorize("@pms.hasPermission('app_appmenu_add')") - public R save(@Valid @RequestBody AppMenu appMenu) { - appMenuService.save(appMenu); - return R.ok(appMenu); - } - - /** - * 删除菜单 - * @param ids 菜单ID - * @return success/false - */ - @SysLog("删除菜单") - @DeleteMapping - @PreAuthorize("@pms.hasPermission('app_appmenu_del')") - public R removeById(@RequestBody Long[] ids) { - appMenuService.removeBatchByIds(CollUtil.toList(ids)); - return R.ok(); - } - - /** - * 更新菜单 - * @param appMenu - * @return - */ - @SysLog("更新菜单") - @PutMapping - @PreAuthorize("@pms.hasPermission('app_appmenu_edit')") - public R update(@Valid @RequestBody AppMenu appMenu) { - return R.ok(appMenuService.updateMenuById(appMenu)); - } - -} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppPageController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppPageController.java new file mode 100644 index 000000000..51d324937 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppPageController.java @@ -0,0 +1,48 @@ +package com.pig4cloud.pigx.app.controller; + +import com.pig4cloud.pigx.app.api.entity.AppPageEntity; +import com.pig4cloud.pigx.app.service.AppPageService; +import com.pig4cloud.pigx.common.core.util.R; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.web.bind.annotation.*; + +/** + * 页面管理 + * + * @author pig + * @date 2023-06-07 16:32:35 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/appPage") +@Tag(description = "appPage", name = "页面管理") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class AppPageController { + + private final AppPageService pageService; + + + /** + * 通过id查询文章资讯 + * + * @param id id + * @return R + */ + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/{id}") + public R getById(@PathVariable("id") Long id) { + return R.ok(pageService.getById(id)); + } + + + @Operation(summary = "更新页面", description = "更新页面") + @PutMapping + public R update(@RequestBody AppPageEntity page) { + return R.ok(pageService.updateById(page)); + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleController.java index 30819f2c4..6f103d3ad 100644 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleController.java +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleController.java @@ -22,7 +22,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pigx.app.api.entity.AppRole; import com.pig4cloud.pigx.app.api.vo.AppRoleExcelVO; -import com.pig4cloud.pigx.app.api.vo.AppRoleVO; import com.pig4cloud.pigx.app.service.AppRoleService; import com.pig4cloud.pigx.common.core.util.R; import com.pig4cloud.pigx.common.excel.annotation.RequestExcel; @@ -149,17 +148,6 @@ public class AppRoleController { return R.ok(appRoleService.deleteRoleByIds(ids)); } - /** - * 更新角色菜单 - * @param roleVo 角色对象 - * @return success、false - */ - @SysLog("更新角色菜单") - @PutMapping("/menu") - @PreAuthorize("@pms.hasPermission('app_approle_perm')") - public R saveRoleMenus(@RequestBody AppRoleVO roleVo) { - return R.ok(appRoleService.updateRoleMenus(roleVo)); - } /** * 导出excel 表格 diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleMenuController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleMenuController.java deleted file mode 100644 index 29f85a100..000000000 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppRoleMenuController.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.app.controller; - -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.pig4cloud.pigx.app.api.entity.AppRoleMenu; -import com.pig4cloud.pigx.app.service.AppRoleMenuService; -import com.pig4cloud.pigx.common.core.util.R; -import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel; -import com.pig4cloud.pigx.common.log.annotation.SysLog; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.security.SecurityRequirement; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpHeaders; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 角色菜单表 - * - * @author aeizzz - * @date 2022-12-07 09:52:03 - */ -@RestController -@RequiredArgsConstructor -@RequestMapping("/approlemenu") -@Tag(description = "approlemenu", name = "角色菜单表管理") -@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) -public class AppRoleMenuController { - - private final AppRoleMenuService appRoleMenuService; - - /** - * 分页查询 - * @param page 分页对象 - * @param appRoleMenu 角色菜单表 - * @return - */ - @Operation(summary = "分页查询", description = "分页查询") - @GetMapping("/page") - @PreAuthorize("@pms.hasPermission('app_approlemenu_view')") - public R getAppRoleMenuPage(Page page, AppRoleMenu appRoleMenu) { - return R.ok(appRoleMenuService.page(page, Wrappers.query(appRoleMenu))); - } - - /** - * 通过id查询角色菜单表 - * @param roleId id - * @return R - */ - @Operation(summary = "通过id查询", description = "通过id查询") - @GetMapping("/{roleId}") - @PreAuthorize("@pms.hasPermission('app_approlemenu_view')") - public R getById(@PathVariable("roleId") Long roleId) { - return R.ok(appRoleMenuService.getById(roleId)); - } - - /** - * 新增角色菜单表 - * @param appRoleMenu 角色菜单表 - * @return R - */ - @Operation(summary = "新增角色菜单表", description = "新增角色菜单表") - @SysLog("新增角色菜单表") - @PostMapping - @PreAuthorize("@pms.hasPermission('app_approlemenu_add')") - public R save(@RequestBody AppRoleMenu appRoleMenu) { - return R.ok(appRoleMenuService.save(appRoleMenu)); - } - - /** - * 修改角色菜单表 - * @param appRoleMenu 角色菜单表 - * @return R - */ - @Operation(summary = "修改角色菜单表", description = "修改角色菜单表") - @SysLog("修改角色菜单表") - @PutMapping - @PreAuthorize("@pms.hasPermission('app_approlemenu_edit')") - public R updateById(@RequestBody AppRoleMenu appRoleMenu) { - return R.ok(appRoleMenuService.updateById(appRoleMenu)); - } - - /** - * 通过id删除角色菜单表 - * @param roleId id - * @return R - */ - @Operation(summary = "通过id删除角色菜单表", description = "通过id删除角色菜单表") - @SysLog("通过id删除角色菜单表") - @DeleteMapping("/{roleId}") - @PreAuthorize("@pms.hasPermission('app_approlemenu_del')") - public R removeById(@PathVariable Long roleId) { - return R.ok(appRoleMenuService.removeById(roleId)); - } - - /** - * 导出excel 表格 - * @param appRoleMenu 查询条件 - * @return excel 文件流 - */ - @ResponseExcel - @GetMapping("/export") - @PreAuthorize("@pms.hasPermission('app_approlemenu_export')") - public List export(AppRoleMenu appRoleMenu) { - return appRoleMenuService.list(Wrappers.query(appRoleMenu)); - } - -} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppTabbarController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppTabbarController.java new file mode 100644 index 000000000..a4c100146 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppTabbarController.java @@ -0,0 +1,55 @@ +package com.pig4cloud.pigx.app.controller; + +import cn.hutool.core.collection.CollUtil; +import com.pig4cloud.pigx.app.api.entity.AppTabbarEntity; +import com.pig4cloud.pigx.app.service.AppTabbarService; +import com.pig4cloud.pigx.common.core.util.R; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.stream.Collectors; + +/** + * 底部导航 + * + * @author pig + * @date 2023-06-07 16:32:35 + */ +@RestController +@RequiredArgsConstructor +@RequestMapping("/appTabbar") +@Tag(description = "appTabbar", name = "底部导航") +@SecurityRequirement(name = HttpHeaders.AUTHORIZATION) +public class AppTabbarController { + + private final AppTabbarService tabbarService; + + + /** + * 查询导航列表 + * + * @return R + */ + @Operation(summary = "查询导航列表", description = "查询导航列表") + @GetMapping("/list") + public R list() { + return R.ok(tabbarService.list()); + } + + + @Operation(summary = "更新导航", description = "更新导航") + @PutMapping + public R update(@RequestBody List tabbarEntityList) { + // 删除不在新增范围的导航菜单 + List idList = tabbarService.list().stream().map(AppTabbarEntity::getId).collect(Collectors.toList()); + List newIdList = tabbarEntityList.stream().map(AppTabbarEntity::getId).collect(Collectors.toList()); + tabbarService.removeBatchByIds(CollUtil.subtractToList(idList, newIdList)); + return R.ok(tabbarService.saveOrUpdateBatch(tabbarEntityList)); + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppUserController.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppUserController.java index deb8a95c9..b179d5cd0 100644 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppUserController.java +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/controller/AppUserController.java @@ -24,6 +24,7 @@ import com.pig4cloud.pigx.app.api.entity.AppUser; import com.pig4cloud.pigx.app.api.vo.AppUserExcelVO; import com.pig4cloud.pigx.app.service.AppUserService; import com.pig4cloud.pigx.common.core.constant.CommonConstants; +import com.pig4cloud.pigx.common.core.constant.enums.UserTypeEnum; import com.pig4cloud.pigx.common.core.exception.ErrorCodes; import com.pig4cloud.pigx.common.core.util.MsgUtils; import com.pig4cloud.pigx.common.core.util.R; @@ -57,133 +58,154 @@ import java.util.List; @SecurityRequirement(name = HttpHeaders.AUTHORIZATION) public class AppUserController { - private final AppUserService appUserService; + private final AppUserService appUserService; - @Inner - @GetMapping("/info/{username}") - public R info(@PathVariable String username) { - AppUser user = appUserService.getOne(Wrappers.query().lambda().eq(AppUser::getUsername, username)); - if (user == null) { - return R.failed(MsgUtils.getMessage(ErrorCodes.APP_USER_USERINFO_EMPTY, username)); - } - return R.ok(appUserService.findUserInfo(user)); - } + @Inner + @GetMapping("/info/{username}") + public R info(@PathVariable String username) { + AppUser user = appUserService.getOne(Wrappers.query().lambda().eq(AppUser::getUsername, username).or().eq(AppUser::getPhone, username)); + if (user == null) { + return R.failed(MsgUtils.getMessage(ErrorCodes.APP_USER_USERINFO_EMPTY, username)); + } + return R.ok(appUserService.findUserInfo(user)); + } - /** - * 获取当前用户全部信息 - * @return 用户信息 - */ - @GetMapping(value = { "/info" }) - public R info() { - String username = SecurityUtils.getUser().getUsername(); - AppUser user = appUserService.getOne(Wrappers.query().lambda().eq(AppUser::getUsername, username)); - if (user == null) { - return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_QUERY_ERROR)); - } - return R.ok(appUserService.findUserInfo(user)); - } + /** + * 获取当前用户全部信息 + * + * @return 用户信息 + */ + @GetMapping(value = {"/info"}) + public R info() { + String username = SecurityUtils.getUser().getUsername(); + AppUser user = appUserService.getOne(Wrappers.query().lambda().eq(AppUser::getUsername, username)); + if (user == null) { + return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_USER_QUERY_ERROR)); + } + return R.ok(appUserService.findUserInfo(user)); + } - /** - * 分页查询 - * @param page 分页对象 - * @param appUserDTO app用户表 - * @return - */ - @Operation(summary = "分页查询", description = "分页查询") - @GetMapping("/page") - public R getAppUserPage(Page page, AppUserDTO appUserDTO) { - return R.ok(appUserService.getUsersWithRolePage(page, appUserDTO)); - } + /** + * 分页查询 + * + * @param page 分页对象 + * @param appUserDTO app用户表 + * @return + */ + @Operation(summary = "分页查询", description = "分页查询") + @GetMapping("/page") + public R getAppUserPage(Page page, AppUserDTO appUserDTO) { + return R.ok(appUserService.getUsersWithRolePage(page, appUserDTO)); + } - /** - * 通过id查询app用户表 - * @param userId id - * @return R - */ - @Operation(summary = "通过id查询", description = "通过id查询") - @GetMapping("/details/{userId}") - public R getById(@PathVariable("userId") Long userId) { - return R.ok(appUserService.selectUserVoById(userId)); - } + /** + * 通过id查询app用户表 + * + * @param userId id + * @return R + */ + @Operation(summary = "通过id查询", description = "通过id查询") + @GetMapping("/details/{userId}") + public R getById(@PathVariable("userId") Long userId) { + return R.ok(appUserService.selectUserVoById(userId)); + } - /** - * @return R - */ - @Operation(summary = "通过userName查询", description = "通过userName查询") - @GetMapping("/details") - public R getByUserName(AppUser user) { - AppUser one = appUserService.getOne(Wrappers.query(user), false); - return R.ok(one == null ? null : CommonConstants.SUCCESS); - } + /** + * @return R + */ + @Operation(summary = "通过userName查询", description = "通过userName查询") + @GetMapping("/details") + public R getByUserName(AppUser user) { + AppUser one = appUserService.getOne(Wrappers.query(user), false); + return R.ok(one == null ? null : CommonConstants.SUCCESS); + } - /** - * 新增app用户表 - * @param appUser app用户表 - * @return R - */ - @Operation(summary = "新增app用户表", description = "新增app用户表") - @SysLog("新增app用户表") - @PostMapping - @PreAuthorize("@pms.hasPermission('app_appuser_add')") - public R save(@RequestBody AppUserDTO appUser) { - appUserService.saveUser(appUser); - return R.ok(); - } + /** + * 新增app用户表 + * + * @param appUser app用户表 + * @return R + */ + @Operation(summary = "新增app用户表", description = "新增app用户表") + @SysLog("新增app用户表") + @PostMapping + @PreAuthorize("@pms.hasPermission('app_appuser_add')") + public R save(@RequestBody AppUserDTO appUser) { + appUserService.saveUser(appUser); + return R.ok(); + } - /** - * 修改app用户表 - * @param appUser app用户表 - * @return R - */ - @Operation(summary = "修改app用户表", description = "修改app用户表") - @SysLog("修改app用户表") - @PutMapping - @PreAuthorize("@pms.hasPermission('app_appuser_edit')") - public R updateById(@RequestBody AppUserDTO appUser) { - return R.ok(appUserService.updateUser(appUser)); - } + /** + * 修改app用户表 + * + * @param appUser app用户表 + * @return R + */ + @Operation(summary = "修改app用户表", description = "修改app用户表") + @SysLog("修改app用户表") + @PutMapping + @PreAuthorize("@pms.hasPermission('app_appuser_edit')") + public R updateById(@RequestBody AppUserDTO appUser) { + return R.ok(appUserService.updateUser(appUser)); + } - /** - * 通过id删除app用户表 - * @param ids userIds - * @return R - */ - @Operation(summary = "通过ids删除app用户表", description = "通过ids删除app用户表") - @SysLog("通过id删除app用户表") - @DeleteMapping - @PreAuthorize("@pms.hasPermission('app_appuser_del')") - public R removeById(@RequestBody Long[] ids) { - return R.ok(appUserService.deleteAppUserByIds(ids)); - } + /** + * 通过id删除app用户表 + * + * @param ids userIds + * @return R + */ + @Operation(summary = "通过ids删除app用户表", description = "通过ids删除app用户表") + @SysLog("通过id删除app用户表") + @DeleteMapping + @PreAuthorize("@pms.hasPermission('app_appuser_del')") + public R removeById(@RequestBody Long[] ids) { + return R.ok(appUserService.deleteAppUserByIds(ids)); + } - /** - * 导出excel 表格 - * @param appUser 查询条件 - * @return excel 文件流 - */ - @ResponseExcel - @GetMapping("/export") - @PreAuthorize("@pms.hasPermission('app_appuser_export')") - public List export(AppUserDTO appUser) { - return appUserService.listUser(appUser); - } + /** + * 导出excel 表格 + * + * @param appUser 查询条件 + * @return excel 文件流 + */ + @ResponseExcel + @GetMapping("/export") + @PreAuthorize("@pms.hasPermission('app_appuser_export')") + public List export(AppUserDTO appUser) { + return appUserService.listUser(appUser); + } - @SysLog("修改个人信息") - @PutMapping("/edit") - public R updateUserInfo(@Valid @RequestBody AppUserDTO userDto) { - return appUserService.updateUserInfo(userDto); - } + @SysLog("修改个人信息") + @PutMapping("/edit") + public R updateUserInfo(@Valid @RequestBody AppUserDTO userDto) { + if (UserTypeEnum.TOC.getStatus().equals(SecurityUtils.getUser().getUserType())) { + userDto.setUserId(SecurityUtils.getUser().getId()); + // TOC 以手机号为key + userDto.setUsername(SecurityUtils.getUser().getUsername()); + } + return appUserService.updateUserInfo(userDto); + } - /** - * 导入用户 - * @param excelVOList 用户列表 - * @param bindingResult 错误信息列表 - * @return R - */ - @PostMapping("/import") - @PreAuthorize("@pms.hasPermission('app_appuser_export')") - public R importUser(@RequestExcel List excelVOList, BindingResult bindingResult) { - return appUserService.importUser(excelVOList, bindingResult); - } + /** + * 导入用户 + * + * @param excelVOList 用户列表 + * @param bindingResult 错误信息列表 + * @return R + */ + @PostMapping("/import") + @PreAuthorize("@pms.hasPermission('app_appuser_export')") + public R importUser(@RequestExcel List excelVOList, BindingResult bindingResult) { + return appUserService.importUser(excelVOList, bindingResult); + } + + @Operation(summary = "注册app用户表", description = "注册app用户表") + @SysLog("注册app用户表") + @Inner(value = false) + @PostMapping("/register") + public R register(@RequestBody AppUserDTO appUser) { + return appUserService.registerAppUser(appUser); + } } diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/handler/MiniAppLoginHandler.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/handler/MiniAppLoginHandler.java index 149513326..e4a9d6330 100644 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/handler/MiniAppLoginHandler.java +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/handler/MiniAppLoginHandler.java @@ -100,9 +100,8 @@ public class MiniAppLoginHandler extends AbstractLoginHandler { private AppUserInfo createAndSaveAppUserInfo(String openId) { AppUser appUser = new AppUser(); - appUser.setUsername(openId); appUser.setWxOpenid(openId); - appUser.setPassword(openId); + appUser.setUsername(openId); appUserService.saveOrUpdate(appUser, Wrappers.lambdaQuery().eq(AppUser::getUsername, openId)); AppUserInfo appUserDTO = new AppUserInfo(); diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/handler/SmsLoginHandler.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/handler/SmsLoginHandler.java index 5d75a58e7..c0cf6362f 100644 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/handler/SmsLoginHandler.java +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/handler/SmsLoginHandler.java @@ -34,45 +34,65 @@ import org.springframework.stereotype.Component; @AllArgsConstructor public class SmsLoginHandler extends AbstractLoginHandler { - private final AppUserService appUserService; + private final AppUserService appUserService; - /** - * 验证码登录传入为手机号 不用不处理 - * @param mobile - * @return - */ - @Override - public String identify(String mobile) { - return mobile; - } + /** + * 验证码登录传入为手机号 不用不处理 + * + * @param mobile + * @return + */ + @Override + public String identify(String mobile) { + return mobile; + } - /** - * 通过mobile 获取用户信息 - * @param identify - * @return - */ - @Override - public AppUserInfo info(String identify) { - AppUser user = appUserService.getOne(Wrappers.query().lambda().eq(AppUser::getPhone, identify)); + /** + * 通过mobile 获取用户信息 + * + * @param identify + * @return + */ + @Override + public AppUserInfo info(String identify) { + AppUser user = appUserService.getOne(Wrappers.query().lambda().eq(AppUser::getPhone, identify)); - if (user == null) { - log.info("手机号未注册:{}", identify); - return null; - } - return appUserService.findUserInfo(user); - } + if (user == null) { + log.info("手机号未注册:{}", identify); + return createAndSaveAppUserInfo(identify); + } + return appUserService.findUserInfo(user); + } - /** - * 绑定逻辑 - * @param user 用户实体 - * @param identify 渠道返回唯一标识 - * @return - */ - @Override - public Boolean bind(AppUser user, String identify) { - user.setPhone(identify); - appUserService.updateById(user); - return true; - } + /** + * 创建并插入用户 + * + * @param identify + * @return + */ + private AppUserInfo createAndSaveAppUserInfo(String phone) { + AppUser appUser = new AppUser(); + appUser.setUsername(phone); + appUser.setPhone(phone); + appUserService.saveOrUpdate(appUser, Wrappers.lambdaQuery().eq(AppUser::getPhone, phone)); + + AppUserInfo appUserDTO = new AppUserInfo(); + appUserDTO.setAppUser(appUser); + return appUserDTO; + } + + /** + * 绑定逻辑 + * + * @param user 用户实体 + * @param identify 渠道返回唯一标识 + * @return + */ + @Override + public Boolean bind(AppUser user, String identify) { + user.setPhone(identify); + appUserService.updateById(user); + return true; + } } diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppArticleCategoryMapper.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppArticleCategoryMapper.java new file mode 100644 index 000000000..21b54b96a --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppArticleCategoryMapper.java @@ -0,0 +1,10 @@ +package com.pig4cloud.pigx.app.mapper; + +import com.pig4cloud.pigx.app.api.entity.AppArticleCategoryEntity; +import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface AppArticleCategoryMapper extends PigxBaseMapper { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppArticleCollectMapper.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppArticleCollectMapper.java new file mode 100644 index 000000000..38ac31ff4 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppArticleCollectMapper.java @@ -0,0 +1,10 @@ +package com.pig4cloud.pigx.app.mapper; + +import com.pig4cloud.pigx.app.api.entity.AppArticleCollectEntity; +import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface AppArticleCollectMapper extends PigxBaseMapper { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppArticleMapper.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppArticleMapper.java new file mode 100644 index 000000000..f8306c1f5 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppArticleMapper.java @@ -0,0 +1,10 @@ +package com.pig4cloud.pigx.app.mapper; + +import com.pig4cloud.pigx.app.api.entity.AppArticleEntity; +import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface AppArticleMapper extends PigxBaseMapper { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppMenuMapper.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppMenuMapper.java deleted file mode 100644 index c1bc2f342..000000000 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppMenuMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.app.mapper; - -import com.pig4cloud.pigx.app.api.entity.AppMenu; -import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -/** - * 菜单权限表 - * - * @author aeizzz - * @date 2022-12-07 09:52:03 - */ -@Mapper -public interface AppMenuMapper extends PigxBaseMapper { - - List listMenusByRoleId(Long roleId); - -} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppPageMapper.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppPageMapper.java new file mode 100644 index 000000000..cad423d1d --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppPageMapper.java @@ -0,0 +1,10 @@ +package com.pig4cloud.pigx.app.mapper; + +import com.pig4cloud.pigx.app.api.entity.AppPageEntity; +import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface AppPageMapper extends PigxBaseMapper { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppRoleMenuMapper.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppRoleMenuMapper.java deleted file mode 100644 index bf9c253e2..000000000 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppRoleMenuMapper.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.app.mapper; - -import com.pig4cloud.pigx.app.api.entity.AppRoleMenu; -import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** - * 角色菜单表 - * - * @author aeizzz - * @date 2022-12-07 09:52:03 - */ -@Mapper -public interface AppRoleMenuMapper extends PigxBaseMapper { - -} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppTabbarMapper.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppTabbarMapper.java new file mode 100644 index 000000000..774177178 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/mapper/AppTabbarMapper.java @@ -0,0 +1,10 @@ +package com.pig4cloud.pigx.app.mapper; + +import com.pig4cloud.pigx.app.api.entity.AppTabbarEntity; +import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface AppTabbarMapper extends PigxBaseMapper { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppArticleCategoryService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppArticleCategoryService.java new file mode 100644 index 000000000..73cfb8caa --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppArticleCategoryService.java @@ -0,0 +1,8 @@ +package com.pig4cloud.pigx.app.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pigx.app.api.entity.AppArticleCategoryEntity; + +public interface AppArticleCategoryService extends IService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppArticleCollectService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppArticleCollectService.java new file mode 100644 index 000000000..75a922521 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppArticleCollectService.java @@ -0,0 +1,8 @@ +package com.pig4cloud.pigx.app.service; + +import com.github.yulichang.base.MPJBaseService; +import com.pig4cloud.pigx.app.api.entity.AppArticleCollectEntity; + +public interface AppArticleCollectService extends MPJBaseService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppArticleService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppArticleService.java new file mode 100644 index 000000000..38665d9e8 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppArticleService.java @@ -0,0 +1,15 @@ +package com.pig4cloud.pigx.app.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pigx.app.api.entity.AppArticleEntity; + +public interface AppArticleService extends IService { + + /** + * 获取文章并使阅读数+1 + * + * @param id id + * @return + */ + AppArticleEntity getArticleAndIncrById(Long id, Long userId); +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppIndexService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppIndexService.java new file mode 100644 index 000000000..2cb203221 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppIndexService.java @@ -0,0 +1,33 @@ +package com.pig4cloud.pigx.app.service; + +import com.pig4cloud.pigx.app.api.entity.AppPageEntity; + +import java.util.Map; + +/** + * app 页面控制 + * + * @author lengleng + * @date 2023/6/8 + */ +public interface AppIndexService { + + /** + * 首页 + */ + Map index(); + + /** + * 配置 + * @return Map + */ + Map config(); + + /** + * 装修 + * @param id 装修ID + * @return Map + */ + AppPageEntity decorate(Integer id); + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppMenuService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppMenuService.java deleted file mode 100644 index 4745bffd0..000000000 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppMenuService.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.app.service; - -import cn.hutool.core.lang.tree.Tree; -import com.baomidou.mybatisplus.extension.service.IService; -import com.pig4cloud.pigx.app.api.entity.AppMenu; -import com.pig4cloud.pigx.common.core.util.R; - -import java.util.List; -import java.util.Set; - -/** - * 菜单权限表 - * - * @author aeizzz - * @date 2022-12-07 09:52:03 - */ -public interface AppMenuService extends IService { - - /** - * 通过角色编号查询URL 权限 - * @param roleId 角色ID - * @return 菜单列表 - */ - List findMenuByRoleId(Long roleId); - - /** - * 级联删除菜单 - * @param id 菜单ID - * @return 成功、失败 - */ - R removeMenuById(Long id); - - /** - * 更新菜单信息 - * @param appMenu 菜单信息 - * @return 成功、失败 - */ - Boolean updateMenuById(AppMenu appMenu); - - /** - * 构建树 - * @param parentId 父节点ID - * @param menuName 菜单名称 - * @return - */ - List> treeMenu(Long parentId, String menuName); - - /** - * 查询菜单 - * @param voSet - * @param parentId - * @return - */ - List> filterMenu(Set voSet, String type, Long parentId); - -} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppPageService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppPageService.java new file mode 100644 index 000000000..5d58d1d61 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppPageService.java @@ -0,0 +1,8 @@ +package com.pig4cloud.pigx.app.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pigx.app.api.entity.AppPageEntity; + +public interface AppPageService extends IService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleMenuService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleMenuService.java deleted file mode 100644 index f01bd2fa9..000000000 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleMenuService.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ - -package com.pig4cloud.pigx.app.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.pig4cloud.pigx.app.api.entity.AppRoleMenu; - -/** - * 角色菜单表 - * - * @author aeizzz - * @date 2022-12-07 09:52:03 - */ -public interface AppRoleMenuService extends IService { - - Boolean saveRoleMenus(Long roleId, String menuIds); - -} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleService.java index 823737536..f6b769415 100644 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleService.java +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppRoleService.java @@ -20,7 +20,6 @@ package com.pig4cloud.pigx.app.service; import com.baomidou.mybatisplus.extension.service.IService; import com.pig4cloud.pigx.app.api.entity.AppRole; import com.pig4cloud.pigx.app.api.vo.AppRoleExcelVO; -import com.pig4cloud.pigx.app.api.vo.AppRoleVO; import com.pig4cloud.pigx.common.core.util.R; import org.springframework.validation.BindingResult; @@ -34,7 +33,6 @@ import java.util.List; */ public interface AppRoleService extends IService { - Boolean updateRoleMenus(AppRoleVO roleVo); List findRolesByUserId(Long userId); diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppTabbarService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppTabbarService.java new file mode 100644 index 000000000..bdfbce6aa --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppTabbarService.java @@ -0,0 +1,8 @@ +package com.pig4cloud.pigx.app.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.pig4cloud.pigx.app.api.entity.AppTabbarEntity; + +public interface AppTabbarService extends IService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppUserService.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppUserService.java index f8353c27c..aadfcef26 100644 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppUserService.java +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/AppUserService.java @@ -56,4 +56,5 @@ public interface AppUserService extends IService { R importUser(List excelVOList, BindingResult bindingResult); + R registerAppUser(AppUserDTO appUser); } diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppArticleCategoryServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppArticleCategoryServiceImpl.java new file mode 100644 index 000000000..e0ffea62f --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppArticleCategoryServiceImpl.java @@ -0,0 +1,19 @@ +package com.pig4cloud.pigx.app.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pigx.app.api.entity.AppArticleCategoryEntity; +import com.pig4cloud.pigx.app.mapper.AppArticleCategoryMapper; +import com.pig4cloud.pigx.app.service.AppArticleCategoryService; +import org.springframework.stereotype.Service; + +/** + * 文章分类表 + * + * @author pig + * @date 2023-06-07 16:28:03 + */ +@Service +public class AppArticleCategoryServiceImpl extends ServiceImpl + implements AppArticleCategoryService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppArticleCollectServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppArticleCollectServiceImpl.java new file mode 100644 index 000000000..fe44289a7 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppArticleCollectServiceImpl.java @@ -0,0 +1,16 @@ +package com.pig4cloud.pigx.app.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pigx.app.api.entity.AppArticleCollectEntity; +import com.pig4cloud.pigx.app.mapper.AppArticleCollectMapper; +import com.pig4cloud.pigx.app.service.AppArticleCollectService; +import org.springframework.stereotype.Service; +/** + * 文章收藏表 + * + * @author pig + * @date 2023-06-16 14:33:41 + */ +@Service +public class AppArticleCollectServiceImpl extends ServiceImpl implements AppArticleCollectService { +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppArticleServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppArticleServiceImpl.java new file mode 100644 index 000000000..711a7dedf --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppArticleServiceImpl.java @@ -0,0 +1,52 @@ +package com.pig4cloud.pigx.app.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pigx.app.api.entity.AppArticleCollectEntity; +import com.pig4cloud.pigx.app.api.entity.AppArticleEntity; +import com.pig4cloud.pigx.app.mapper.AppArticleCollectMapper; +import com.pig4cloud.pigx.app.mapper.AppArticleMapper; +import com.pig4cloud.pigx.app.service.AppArticleService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.Objects; + +/** + * 文章资讯 + * + * @author pig + * @date 2023-06-07 16:32:35 + */ +@Service +@RequiredArgsConstructor +public class AppArticleServiceImpl extends ServiceImpl implements AppArticleService { + + private final AppArticleCollectMapper collectMapper; + + + /** + * 获取文章并使阅读数+1 + * + * @param id id + * @return + */ + @Override + public AppArticleEntity getArticleAndIncrById(Long id, Long userId) { + AppArticleEntity appArticleEntity = baseMapper.selectById(id); + // 查询是否收藏了 + if (Objects.nonNull(userId)) { + boolean exists = collectMapper.exists(Wrappers.lambdaQuery()// + .eq(AppArticleCollectEntity::getArticleId, appArticleEntity.getId())// + .eq(AppArticleCollectEntity::getUserId, userId)); + appArticleEntity.setCollect(exists); + } + + //TODO 更新条件需要根据其他指数限制 + Integer nowVisit = appArticleEntity.getVisit(); + appArticleEntity.setVisit(nowVisit + 1); + // 乐观锁 + baseMapper.update(appArticleEntity, Wrappers.lambdaQuery().eq(AppArticleEntity::getId, id).eq(AppArticleEntity::getVisit, nowVisit)); + return appArticleEntity; + } +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppIndexServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppIndexServiceImpl.java new file mode 100644 index 000000000..2b56aadc8 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppIndexServiceImpl.java @@ -0,0 +1,73 @@ +package com.pig4cloud.pigx.app.service.impl; + +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.pig4cloud.pigx.app.api.entity.AppArticleEntity; +import com.pig4cloud.pigx.app.api.entity.AppPageEntity; +import com.pig4cloud.pigx.app.api.entity.AppTabbarEntity; +import com.pig4cloud.pigx.app.mapper.AppArticleMapper; +import com.pig4cloud.pigx.app.mapper.AppPageMapper; +import com.pig4cloud.pigx.app.mapper.AppTabbarMapper; +import com.pig4cloud.pigx.app.service.AppIndexService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * app 页面控制 + * + * @author lengleng + * @date 2023/6/8 + */ + +@Service +@RequiredArgsConstructor +public class AppIndexServiceImpl implements AppIndexService { + + private final AppArticleMapper appArticleMapper; + + private final AppTabbarMapper appTabbarMapper; + + private final AppPageMapper appPageMapper; + + /** + * 商城首页 首页数据 + */ + @Override + public Map index() { + Map response = new LinkedHashMap<>(); + AppPageEntity appPageEntity = appPageMapper.selectById(1); + List articleList = appArticleMapper + .selectList(Wrappers.lambdaQuery().orderByDesc(AppArticleEntity::getSort)); + response.put("pages", appPageEntity); + response.put("article", articleList); + return response; + } + + /** + * 配置 + * @return Map + */ + @Override + public Map config() { + Map response = new LinkedHashMap<>(); + List tabbarEntityList = appTabbarMapper.selectList(Wrappers.emptyWrapper()); + response.put("tabbar", tabbarEntityList); + return response; + } + + /** + * 装修 + * + * @author fzr + * @param id 主键 + * @return Map + */ + @Override + public AppPageEntity decorate(Integer id) { + return appPageMapper.selectById(id); + } + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppMenuServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppMenuServiceImpl.java deleted file mode 100644 index 45f909ca2..000000000 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppMenuServiceImpl.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ -package com.pig4cloud.pigx.app.service.impl; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.lang.tree.Tree; -import cn.hutool.core.lang.tree.TreeNode; -import cn.hutool.core.lang.tree.TreeUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.pig4cloud.pigx.app.api.entity.AppMenu; -import com.pig4cloud.pigx.app.api.entity.AppRoleMenu; -import com.pig4cloud.pigx.app.mapper.AppMenuMapper; -import com.pig4cloud.pigx.app.mapper.AppRoleMenuMapper; -import com.pig4cloud.pigx.app.service.AppMenuService; -import com.pig4cloud.pigx.common.core.constant.CacheConstants; -import com.pig4cloud.pigx.common.core.constant.CommonConstants; -import com.pig4cloud.pigx.common.core.constant.enums.MenuTypeEnum; -import com.pig4cloud.pigx.common.core.exception.ErrorCodes; -import com.pig4cloud.pigx.common.core.util.MsgUtils; -import com.pig4cloud.pigx.common.core.util.R; -import lombok.AllArgsConstructor; -import org.springframework.beans.BeanUtils; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.validation.constraints.NotNull; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Function; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -/** - * 菜单权限表 - * - * @author aeizzz - * @date 2022-12-07 09:52:03 - */ -@Service -@AllArgsConstructor -public class AppMenuServiceImpl extends ServiceImpl implements AppMenuService { - - private final AppRoleMenuMapper appRoleMenuMapper; - - @Override - public List findMenuByRoleId(Long roleId) { - return baseMapper.listMenusByRoleId(roleId); - } - - @Override - @Transactional(rollbackFor = Exception.class) - @CacheEvict(value = CacheConstants.MENU_DETAILS, allEntries = true) - public R removeMenuById(Long id) { - // 查询父节点为当前节点的节点 - List menuList = this.list(Wrappers.query().lambda().eq(AppMenu::getParentId, id)); - if (CollUtil.isNotEmpty(menuList)) { - return R.failed(MsgUtils.getMessage(ErrorCodes.SYS_MENU_DELETE_EXISTING)); - } - - appRoleMenuMapper.delete(Wrappers.query().lambda().eq(AppRoleMenu::getMenuId, id)); - // 删除当前菜单及其子菜单 - return R.ok(this.removeById(id)); - } - - @Override - public Boolean updateMenuById(AppMenu appMenu) { - return this.updateById(appMenu); - } - - /** - * 构建树查询 1. 不是懒加载情况,查询全部 2. 是懒加载,根据parentId 查询 2.1 父节点为空,则查询ID -1 - * @param parentId 父节点ID - * @param menuName 菜单名称 - * @return - */ - @Override - public List> treeMenu(Long parentId, String menuName) { - Long parent = parentId == null ? CommonConstants.MENU_TREE_ROOT_ID : parentId; - - List> collect = baseMapper - .selectList( - Wrappers.lambdaQuery().like(StrUtil.isNotBlank(menuName), AppMenu::getName, menuName) - .orderByAsc(AppMenu::getSortOrder)) - .stream().map(getNodeFunction()).collect(Collectors.toList()); - - // 模糊查询 不组装树结构 直接返回 表格方便编辑 - if (StrUtil.isNotBlank(menuName)) { - return collect.stream().map(node -> { - Tree tree = new Tree<>(); - tree.putAll(node.getExtra()); - BeanUtils.copyProperties(node, tree); - return tree; - }).collect(Collectors.toList()); - } - - return TreeUtil.build(collect, parent); - } - - /** - * 查询菜单 - * @param all 全部菜单 - * @param type 类型 - * @param parentId 父节点ID - * @return - */ - @Override - public List> filterMenu(Set all, String type, Long parentId) { - List> collect = all.stream().filter(menuTypePredicate(type)).map(getNodeFunction()) - .collect(Collectors.toList()); - Long parent = parentId == null ? CommonConstants.MENU_TREE_ROOT_ID : parentId; - return TreeUtil.build(collect, parent); - } - - @NotNull - private Function> getNodeFunction() { - return menu -> { - TreeNode node = new TreeNode<>(); - node.setId(menu.getMenuId()); - node.setName(menu.getName()); - node.setParentId(menu.getParentId()); - node.setWeight(menu.getSortOrder()); - // 扩展属性 - Map extra = new HashMap<>(); - extra.put("path", menu.getPath()); - extra.put("menuType", menu.getMenuType()); - extra.put("permission", menu.getPermission()); - extra.put("label", menu.getName()); - extra.put("sortOrder", menu.getSortOrder()); - extra.put("visible", menu.getVisible()); - node.setExtra(extra); - return node; - }; - } - - /** - * menu 类型断言 - * @param type 类型 - * @return Predicate - */ - private Predicate menuTypePredicate(String type) { - return vo -> { - if (MenuTypeEnum.TOP_MENU.getDescription().equals(type)) { - return MenuTypeEnum.TOP_MENU.getType().equals(vo.getMenuType()); - } - // 其他查询 左侧 + 顶部 - return !MenuTypeEnum.BUTTON.getType().equals(vo.getMenuType()); - }; - } - -} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppMobileServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppMobileServiceImpl.java index 48c4128cf..8e441d179 100644 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppMobileServiceImpl.java +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppMobileServiceImpl.java @@ -17,12 +17,8 @@ package com.pig4cloud.pigx.app.service.impl; -import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.RandomUtil; import com.baomidou.mybatisplus.core.toolkit.StringPool; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.pig4cloud.pigx.app.api.entity.AppUser; -import com.pig4cloud.pigx.app.mapper.AppUserMapper; import com.pig4cloud.pigx.app.service.AppMobileService; import com.pig4cloud.pigx.common.core.constant.CacheConstants; import com.pig4cloud.pigx.common.core.constant.SecurityConstants; @@ -35,7 +31,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; -import java.util.List; import java.util.concurrent.TimeUnit; /** @@ -49,39 +44,28 @@ import java.util.concurrent.TimeUnit; @AllArgsConstructor public class AppMobileServiceImpl implements AppMobileService { - private final RedisTemplate redisTemplate; + private final RedisTemplate redisTemplate; - private final AppUserMapper userMapper; - /** - * 发送手机验证码 TODO: 调用短信网关发送验证码,测试返回前端 - * @param mobile mobile - * @return code - */ - @Override - public R sendSmsCode(String mobile) { - List userList = userMapper - .selectList(Wrappers.query().lambda().eq(AppUser::getPhone, mobile)); + /** + * 发送手机验证码 TODO: 调用短信网关发送验证码,测试返回前端 + * + * @param mobile mobile + * @return code + */ + @Override + public R sendSmsCode(String mobile) { + Object codeObj = redisTemplate.opsForValue().get(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile); - if (CollUtil.isEmpty(userList)) { - log.info("手机号未注册:{}", mobile); - return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_PHONE_UNREGISTERED, mobile)); - } + if (codeObj != null) { + log.info("手机号验证码未过期:{},{}", mobile, codeObj); + return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_SMS_OFTEN)); + } - Object codeObj = redisTemplate.opsForValue() - .get(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile); - - if (codeObj != null) { - log.info("手机号验证码未过期:{},{}", mobile, codeObj); - return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_SMS_OFTEN)); - } - - String code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE)); - log.debug("手机号生成验证码成功:{},{}", mobile, code); - redisTemplate.opsForValue().set( - CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile, code, - SecurityConstants.CODE_TIME, TimeUnit.SECONDS); - return R.ok(Boolean.TRUE, code); - } + String code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE)); + log.debug("手机号生成验证码成功:{},{}", mobile, code); + redisTemplate.opsForValue().set(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile, code, SecurityConstants.CODE_TIME, TimeUnit.SECONDS); + return R.ok(Boolean.TRUE, code); + } } diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppPageServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppPageServiceImpl.java new file mode 100644 index 000000000..00e44d480 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppPageServiceImpl.java @@ -0,0 +1,18 @@ +package com.pig4cloud.pigx.app.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pigx.app.api.entity.AppPageEntity; +import com.pig4cloud.pigx.app.mapper.AppPageMapper; +import com.pig4cloud.pigx.app.service.AppPageService; +import org.springframework.stereotype.Service; + +/** + * 页面 + * + * @author lengleng + * @date 2023-06-08 11:19:23 + */ +@Service +public class AppPageServiceImpl extends ServiceImpl implements AppPageService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleMenuServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleMenuServiceImpl.java deleted file mode 100644 index cd8365d13..000000000 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleMenuServiceImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2018-2025, lengleng All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * Neither the name of the pig4cloud.com developer nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * Author: lengleng (wangiegie@gmail.com) - */ -package com.pig4cloud.pigx.app.service.impl; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.pig4cloud.pigx.app.api.entity.AppRoleMenu; -import com.pig4cloud.pigx.app.mapper.AppRoleMenuMapper; -import com.pig4cloud.pigx.app.service.AppRoleMenuService; -import org.springframework.stereotype.Service; - -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -/** - * 角色菜单表 - * - * @author aeizzz - * @date 2022-12-07 09:52:03 - */ -@Service -public class AppRoleMenuServiceImpl extends ServiceImpl implements AppRoleMenuService { - - @Override - public Boolean saveRoleMenus(Long roleId, String menuIds) { - this.remove(Wrappers.query().lambda().eq(AppRoleMenu::getRoleId, roleId)); - - if (StrUtil.isBlank(menuIds)) { - return Boolean.TRUE; - } - List roleMenuList = Arrays.stream(menuIds.split(StrUtil.COMMA)).map(menuId -> { - AppRoleMenu roleMenu = new AppRoleMenu(); - roleMenu.setRoleId(roleId); - roleMenu.setMenuId(Long.valueOf(menuId)); - return roleMenu; - }).collect(Collectors.toList()); - this.saveBatch(roleMenuList); - return Boolean.TRUE; - } - -} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleServiceImpl.java index f188c170b..b4a8293a4 100644 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleServiceImpl.java +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppRoleServiceImpl.java @@ -17,14 +17,10 @@ package com.pig4cloud.pigx.app.service.impl; import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.pig4cloud.pigx.app.api.entity.AppRole; -import com.pig4cloud.pigx.app.api.entity.AppRoleMenu; import com.pig4cloud.pigx.app.api.vo.AppRoleExcelVO; -import com.pig4cloud.pigx.app.api.vo.AppRoleVO; import com.pig4cloud.pigx.app.mapper.AppRoleMapper; -import com.pig4cloud.pigx.app.service.AppRoleMenuService; import com.pig4cloud.pigx.app.service.AppRoleService; import com.pig4cloud.pigx.common.core.exception.ErrorCodes; import com.pig4cloud.pigx.common.core.util.MsgUtils; @@ -48,13 +44,6 @@ import java.util.Set; @AllArgsConstructor public class AppRoleServiceImpl extends ServiceImpl implements AppRoleService { - private final AppRoleMenuService appRoleMenuService; - - @Override - public Boolean updateRoleMenus(AppRoleVO roleVo) { - return appRoleMenuService.saveRoleMenus(roleVo.getRoleId(), roleVo.getMenuIds()); - } - @Override public List findRolesByUserId(Long userId) { return baseMapper.listRolesByUserId(userId); @@ -67,7 +56,6 @@ public class AppRoleServiceImpl extends ServiceImpl impl @Override public Boolean deleteRoleByIds(Long[] ids) { this.removeBatchByIds(CollUtil.toList(ids)); - appRoleMenuService.remove(Wrappers.lambdaQuery().in(AppRoleMenu::getRoleId, CollUtil.toList(ids))); return Boolean.TRUE; } @@ -79,7 +67,6 @@ public class AppRoleServiceImpl extends ServiceImpl impl */ @Override public R importRole(List excelVOList, BindingResult bindingResult) { - // // 通用校验获取失败的数据 List errorMessageList = (List) bindingResult.getTarget(); @@ -90,8 +77,9 @@ public class AppRoleServiceImpl extends ServiceImpl impl for (AppRoleExcelVO excel : excelVOList) { Set errorMsg = new HashSet<>(); // 检验角色名称或者角色编码是否存在 - boolean existRole = roleList.stream().anyMatch(appRole -> excel.getRoleName().equals(appRole.getRoleName()) - || excel.getRoleCode().equals(appRole.getRoleCode())); + boolean existRole = roleList.stream() + .anyMatch(appRole -> excel.getRoleName().equals(appRole.getRoleName()) + || excel.getRoleCode().equals(appRole.getRoleCode())); if (existRole) { errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_NAMEORCODE_EXISTING, excel.getRoleName(), diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppTabbarServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppTabbarServiceImpl.java new file mode 100644 index 000000000..cf60510ba --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppTabbarServiceImpl.java @@ -0,0 +1,18 @@ +package com.pig4cloud.pigx.app.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.pig4cloud.pigx.app.api.entity.AppTabbarEntity; +import com.pig4cloud.pigx.app.mapper.AppTabbarMapper; +import com.pig4cloud.pigx.app.service.AppTabbarService; +import org.springframework.stereotype.Service; + +/** + * 导航栏 + * + * @author lengleng + * @date 2023-06-08 11:18:46 + */ +@Service +public class AppTabbarServiceImpl extends ServiceImpl implements AppTabbarService { + +} diff --git a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppUserServiceImpl.java b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppUserServiceImpl.java index 49babcc56..82603ba2c 100644 --- a/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppUserServiceImpl.java +++ b/pigx-app-server/pigx-app-server-biz/src/main/java/com/pig4cloud/pigx/app/service/impl/AppUserServiceImpl.java @@ -20,34 +20,38 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringPool; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.pig4cloud.pigx.app.api.dto.AppUserDTO; import com.pig4cloud.pigx.app.api.dto.AppUserInfo; -import com.pig4cloud.pigx.app.api.entity.AppMenu; import com.pig4cloud.pigx.app.api.entity.AppRole; import com.pig4cloud.pigx.app.api.entity.AppUser; import com.pig4cloud.pigx.app.api.entity.AppUserRole; import com.pig4cloud.pigx.app.api.vo.AppUserExcelVO; import com.pig4cloud.pigx.app.api.vo.AppUserVO; import com.pig4cloud.pigx.app.mapper.AppUserMapper; -import com.pig4cloud.pigx.app.service.AppMenuService; import com.pig4cloud.pigx.app.service.AppRoleService; import com.pig4cloud.pigx.app.service.AppUserRoleService; import com.pig4cloud.pigx.app.service.AppUserService; import com.pig4cloud.pigx.common.core.constant.CacheConstants; import com.pig4cloud.pigx.common.core.constant.CommonConstants; +import com.pig4cloud.pigx.common.core.constant.enums.LoginTypeEnum; +import com.pig4cloud.pigx.common.core.constant.enums.UserTypeEnum; import com.pig4cloud.pigx.common.core.exception.ErrorCodes; import com.pig4cloud.pigx.common.core.util.MsgUtils; import com.pig4cloud.pigx.common.core.util.R; import com.pig4cloud.pigx.common.excel.vo.ErrorMessage; +import com.pig4cloud.pigx.common.security.service.PigxUser; +import com.pig4cloud.pigx.common.security.util.SecurityUtils; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import org.springframework.cache.annotation.CacheEvict; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; @@ -73,9 +77,9 @@ public class AppUserServiceImpl extends ServiceImpl impl private final AppUserRoleService appUserRoleService; - private final AppRoleService appRoleService; + private final RedisTemplate redisTemplate; - private final AppMenuService appMenuService; + private final AppRoleService appRoleService; private final CacheManager cacheManager; @@ -87,7 +91,6 @@ public class AppUserServiceImpl extends ServiceImpl impl @Override @CacheEvict(value = CacheConstants.USER_DETAILS_MINI, key = "#userDTO.username") public Boolean updateUser(AppUserDTO userDTO) { - AppUser appUser = new AppUser(); BeanUtils.copyProperties(userDTO, appUser); if (StrUtil.isNotBlank(userDTO.getPassword())) { @@ -156,18 +159,14 @@ public class AppUserServiceImpl extends ServiceImpl impl AppUserInfo info = new AppUserInfo(); info.setAppUser(user); // 设置角色列表 (ID) - List roleIds = appRoleService.findRolesByUserId(user.getUserId()).stream().map(AppRole::getRoleId) - .collect(Collectors.toList()); + List roleIds = appRoleService.findRolesByUserId(user.getUserId()) + .stream() + .map(AppRole::getRoleId) + .collect(Collectors.toList()); info.setRoles(ArrayUtil.toArray(roleIds, Long.class)); // 设置权限列表(menu.permission) Set permissions = new HashSet<>(); - roleIds.forEach(roleId -> { - List permissionList = appMenuService.findMenuByRoleId(roleId).stream() - .filter(menu -> StrUtil.isNotEmpty(menu.getPermission())).map(AppMenu::getPermission) - .collect(Collectors.toList()); - permissions.addAll(permissionList); - }); info.setPermissions(ArrayUtil.toArray(permissions, String.class)); return info; } @@ -175,6 +174,23 @@ public class AppUserServiceImpl extends ServiceImpl impl @Override @CacheEvict(value = CacheConstants.USER_DETAILS_MINI, key = "#userDto.username") public R updateUserInfo(AppUserDTO userDto) { + // C端客户修改手机号需要判断验证码是否正确 + PigxUser user = SecurityUtils.getUser(); + if (UserTypeEnum.TOC.getStatus().equals(user.getUserType()) && StrUtil.isNotBlank(userDto.getPhone())) { + String key = CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + + userDto.getPhone(); + String codeObj = redisTemplate.opsForValue().get(key); + + if (!userDto.getMobileCode().equals(codeObj)) { + return R.failed("验证码错误"); + } + } + + // 更新密码 + if (StrUtil.isNotBlank(userDto.getPassword())) { + userDto.setPassword(ENCODER.encode(userDto.getPassword())); + } + AppUser appUser = baseMapper.selectById(userDto.getUserId()); BeanUtils.copyProperties(userDto, appUser); return R.ok(this.updateById(appUser)); @@ -197,7 +213,7 @@ public class AppUserServiceImpl extends ServiceImpl impl } // 删除用户关联表 this.appUserRoleService - .remove(Wrappers.lambdaQuery().in(AppUserRole::getUserId, CollUtil.toList(ids))); + .remove(Wrappers.lambdaQuery().in(AppUserRole::getUserId, CollUtil.toList(ids))); this.removeBatchByIds(CollUtil.toList(ids)); @@ -205,6 +221,32 @@ public class AppUserServiceImpl extends ServiceImpl impl } + @Override + public R registerAppUser(AppUserDTO appUser) { + List appUserList = baseMapper + .selectList(Wrappers.lambdaQuery().eq(AppUser::getPhone, appUser.getPhone())); + + if (CollUtil.isNotEmpty(appUserList)) { + return R.failed("手机号已注册,请使用验证码直接登录"); + } + + String key = CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + + appUser.getPhone(); + String codeObj = redisTemplate.opsForValue().get(key); + + if (!appUser.getMobileCode().equals(codeObj)) { + return R.failed("验证码错误"); + } + + AppUser app = new AppUser(); + BeanUtils.copyProperties(appUser, app); + appUser.setUsername(app.getPhone()); + appUser.setDelFlag(CommonConstants.STATUS_NORMAL); + appUser.setPassword(ENCODER.encode(appUser.getPassword())); + baseMapper.insert(appUser); + return null; + } + /** * @param excelVOList * @param bindingResult @@ -224,7 +266,7 @@ public class AppUserServiceImpl extends ServiceImpl impl Set errorMsg = new HashSet<>(); // 校验用户名是否存在 boolean exsitUserName = userList.stream() - .anyMatch(sysUser -> excel.getUsername().equals(sysUser.getUsername())); + .anyMatch(sysUser -> excel.getUsername().equals(sysUser.getUsername())); if (exsitUserName) { errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERNAME_EXISTING, excel.getUsername())); @@ -233,8 +275,8 @@ public class AppUserServiceImpl extends ServiceImpl impl // 判断输入的角色名称列表是否合法 List roleNameList = StrUtil.split(excel.getRoleNameList(), StrUtil.COMMA); List roleCollList = roleList.stream() - .filter(role -> roleNameList.stream().anyMatch(name -> role.getRoleName().equals(name))) - .collect(Collectors.toList()); + .filter(role -> roleNameList.stream().anyMatch(name -> role.getRoleName().equals(name))) + .collect(Collectors.toList()); if (roleCollList.size() != roleNameList.size()) { errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_ROLENAME_INEXISTENCE, excel.getRoleNameList())); diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppArticleCategoryMapper.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppArticleCategoryMapper.xml new file mode 100644 index 000000000..0422227c5 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppArticleCategoryMapper.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppArticleCollectMapper.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppArticleCollectMapper.xml new file mode 100644 index 000000000..31cbfbbc8 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppArticleCollectMapper.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppArticleMapper.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppArticleMapper.xml new file mode 100644 index 000000000..624ce3b21 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppArticleMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppMenuMapper.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppMenuMapper.xml deleted file mode 100644 index d98b45b9e..000000000 --- a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppMenuMapper.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppPageMapper.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppPageMapper.xml new file mode 100644 index 000000000..64777165e --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppPageMapper.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppRoleMenuMapper.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppRoleMenuMapper.xml deleted file mode 100644 index e974c1d8f..000000000 --- a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppRoleMenuMapper.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - diff --git a/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppTabbarMapper.xml b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppTabbarMapper.xml new file mode 100644 index 000000000..5b10e6e20 --- /dev/null +++ b/pigx-app-server/pigx-app-server-biz/src/main/resources/mapper/AppTabbarMapper.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + +