### Project Initialization and Development Source: https://www.ruoyi.plus/frontend/configuration.html Commands to install dependencies and start the development server. ```bash pnpm install ``` ```bash pnpm dev ``` -------------------------------- ### Start the Frontend Application Source: https://www.ruoyi.plus/practices Commands to navigate to the frontend directory, install dependencies, and launch the development server. ```bash # 进入前端目录 cd plus-ui # 安装依赖 pnpm install # 启动开发服务器 pnpm dev ``` -------------------------------- ### Install and Run Ollama Source: https://www.ruoyi.plus/backend/common/langchain4j/model-factory.html Commands for installing Ollama on Linux/Mac and starting the service. ```bash curl -fsSL https://ollama.com/install.sh | sh # 下载模型 ollama pull llama3.2 ollama pull mistral ollama pull codellama # 启动服务 ollama serve ``` -------------------------------- ### get Usage Examples Source: https://www.ruoyi.plus/frontend/utils/object.html Demonstrates usage with dot notation, array indices, and array paths. ```typescript import { get } from '@/utils/object' const data = { users: [ { name: 'John', roles: ['admin', 'user'], address: { city: 'New York' } }, { name: 'Jane', roles: ['user'] } ], config: { features: { darkMode: true } } } // 点表示法 get(data, 'config.features.darkMode') // true // 数组索引语法 get(data, 'users[0].name') // 'John' get(data, 'users[0].roles[0]') // 'admin' get(data, 'users[1].address.city', 'Unknown') // 'Unknown' // 数组形式的路径 get(data, ['users', '0', 'name']) // 'John' get(data, ['config', 'features', 'darkMode']) // true // 实际应用:安全地渲染数据 const renderUserInfo = (response: any) => { const userName = get(response, 'data.user.profile.name', '匿名用户') const avatar = get(response, 'data.user.profile.avatar', '/default-avatar.png') return `
${userName} ${userName}
` } ``` -------------------------------- ### Semantic Versioning Examples Source: https://www.ruoyi.plus/practices/standards/git.html Examples of pre-release and official version tags. ```bash v1.0.0-alpha.1 # 第一个内测版本 v1.0.0-beta.1 # 第一个公测版本 v1.0.0-rc.1 # 第一个候选版本 v1.0.0 # 正式版本 ``` -------------------------------- ### Install project dependencies Source: https://www.ruoyi.plus/frontend/getting-started.html Initializes the project environment by installing required packages from the registry. ```bash # 确保在 plus-ui 目录下 pwd # 应显示: .../ruoyi-plus-uniapp/plus-ui # 安装依赖 pnpm install # 安装完成后会显示类似信息: # Packages: +XXX # Progress: resolved XXX, reused XXX, downloaded X, added XXX, done ``` -------------------------------- ### Start the Mobile Application Source: https://www.ruoyi.plus/practices Commands to install dependencies and launch the mobile development environment for H5 or WeChat Mini Program. ```bash # 进入移动端目录 cd plus-uniapp # 安装依赖 pnpm install # H5 开发 pnpm dev:h5 # 微信小程序开发 pnpm dev:mp-weixin ``` -------------------------------- ### Field Configuration Examples Source: https://www.ruoyi.plus/backend/modules/generator/column-config.html Examples of how specific fields are configured for different operations. ```text 字段: id 插入: ✗ (主键通常自动生成) 编辑: ✗ (主键不允许修改) 列表: ✓ (显示在列表中) 查询: ✓ (支持按ID查询) ``` ```text 字段: username 插入: ✓ (新增时必须填写) 编辑: ✓ (支持修改) 列表: ✓ (显示在列表中) 查询: ✓ (支持按用户名查询) ``` ```text 字段: create_time 插入: ✗ (系统自动设置) 编辑: ✗ (不允许修改) 列表: ✓ (显示创建时间) 查询: ✓ (支持时间范围查询) ``` -------------------------------- ### Example Backend File Path Configuration Source: https://www.ruoyi.plus/practices/engineering/code-generator.html Concrete example of file paths generated for a specific package and class name. ```bash # 配置: packageName=plus.ruoyi.business.base, className=Ad ruoyi-modules/ruoyi-business/src/main/java/plus/ruoyi/business/base/domain/Ad.java ruoyi-modules/ruoyi-business/src/main/java/plus/ruoyi/business/base/domain/bo/AdBo.java ruoyi-modules/ruoyi-business/src/main/java/plus/ruoyi/business/base/domain/vo/AdVo.java ruoyi-modules/ruoyi-business/src/main/java/plus/ruoyi/business/base/controller/AdController.java ruoyi-modules/ruoyi-business/src/main/java/plus/ruoyi/business/base/service/IAdService.java ruoyi-modules/ruoyi-business/src/main/java/plus/ruoyi/business/base/service/impl/AdServiceImpl.java ruoyi-modules/ruoyi-business/src/main/java/plus/ruoyi/business/base/dao/IAdDao.java ruoyi-modules/ruoyi-business/src/main/java/plus/ruoyi/business/base/dao/impl/AdDaoImpl.java ruoyi-modules/ruoyi-business/src/main/java/plus/ruoyi/business/base/mapper/AdMapper.java ruoyi-modules/ruoyi-business/src/main/resources/mapper/base/AdMapper.xml ``` -------------------------------- ### Install RocketMQ via Docker Source: https://www.ruoyi.plus/backend/common/rocketmq/quick-start.html Commands to pull the RocketMQ image and start the NameServer and Broker containers. ```bash # 拉取镜像 docker pull apache/rocketmq:5.1.0 # 启动 NameServer docker run -d \ --name rmqnamesrv \ -p 9876:9876 \ apache/rocketmq:5.1.0 \ sh mqnamesrv # 启动 Broker docker run -d \ --name rmqbroker \ -p 10911:10911 \ -p 10909:10909 \ --link rmqnamesrv:namesrv \ -e "NAMESRV_ADDR=namesrv:9876" \ apache/rocketmq:5.1.0 \ sh mqbroker ``` -------------------------------- ### Install Project Dependencies Source: https://www.ruoyi.plus/mobile/getting-started.html Standard installation command and troubleshooting steps for clearing cache and lock files. ```bash # 安装项目依赖 pnpm install # 如果安装失败,尝试以下步骤 # 1. 清除 pnpm 缓存 pnpm store prune # 2. 删除已有的 node_modules rm -rf node_modules # 3. 删除 lock 文件 rm pnpm-lock.yaml # 4. 重新安装 pnpm install ``` -------------------------------- ### Locate MQTT Usage Examples Source: https://www.ruoyi.plus/backend/common/mqtt.html Path to the test class containing comprehensive MQTT implementation examples. ```text ruoyi-common-mqtt/src/test/java/plus/ruoyi/common/mqtt/MqttClientUsageTest.java ``` -------------------------------- ### Install and Initialize Husky Source: https://www.ruoyi.plus/practices/standards/git.html Install necessary dependencies and initialize Husky for Git hooks. ```bash # 安装依赖 pnpm install -D husky lint-staged @commitlint/cli @commitlint/config-conventional # 初始化 Husky npx husky init ``` -------------------------------- ### Install Testing Dependencies Source: https://www.ruoyi.plus/frontend/dev/testing.html Install the necessary testing framework and utility packages via pnpm. ```bash pnpm add -D vitest @vue/test-utils happy-dom @vitest/ui ``` -------------------------------- ### Clone and Install Project Dependencies Source: https://www.ruoyi.plus/mobile/build/wechat-deploy.html Download the project repository and install required dependencies. ```bash git clone https://gitee.com/bkywksj/ruoyi-plus-uniapp-workflow.git cd ruoyi-plus-uniapp-workflow/plus-app pnpm install ``` -------------------------------- ### useDict Usage Examples Source: https://www.ruoyi.plus/mobile/composables/use-dict.html Examples demonstrating basic usage, loading multiple dictionaries, and using string literals. ```typescript // 基本用法 const { sys_user_sex, dictLoading } = useDict(DictTypes.SYS_USER_SEX) // 加载多个字典 const { sys_user_sex, sys_normal_disable, sys_yes_no, dictLoading } = useDict( DictTypes.SYS_USER_SEX, DictTypes.SYS_NORMAL_DISABLE, DictTypes.SYS_YES_NO ) // 使用字符串(不推荐) const { my_custom_dict, dictLoading } = useDict('my_custom_dict') ``` -------------------------------- ### Example Basic Table Configuration Source: https://www.ruoyi.plus/backend/modules/generator/table-management.html Example values for the basic table information configuration. ```text 表名: demo_user 表描述: 演示用户管理 实体类名称: DemoUser 作者: 抓蛙师 ``` -------------------------------- ### Vue Component Setup Example Source: https://www.ruoyi.plus/frontend/architecture/directory-structure.html Basic setup for a Vue component using the script setup syntax. ```typescript ``` -------------------------------- ### Install and Configure pnpm Source: https://www.ruoyi.plus/mobile/getting-started.html Global installation of pnpm and registry configuration for faster package downloads. ```bash # 全局安装 pnpm npm install -g pnpm # 验证安装 pnpm -v # 配置 pnpm 镜像源(可选,加速下载) pnpm config set registry https://registry.npmmirror.com ``` -------------------------------- ### Install Apache Web Server Source: https://www.ruoyi.plus/mobile/build/h5-deploy.html Installation commands for Apache on common Linux distributions. ```bash # Ubuntu/Debian sudo apt install apache2 # CentOS/RHEL sudo yum install httpd ``` -------------------------------- ### Get Task Assignees Response Source: https://www.ruoyi.plus/backend/modules/workflow/task.html Example JSON response for the GET /workflow/task/listTaskAssignees/{taskId} endpoint. ```json { "code": 200, "msg": "操作成功", "data": [ { "userId": 5, "userName": "李四", "nickName": "部门经理", "deptName": "技术部" } ] } ``` -------------------------------- ### Icon Generation Output Example Source: https://www.ruoyi.plus/frontend/icons/type-generation.html Example console output when icon files are detected and types are generated. ```text 检测到图标文件变化: src/assets/icons/iconify/preset.json 发现 iconify 图标文件: D:\project\plus-ui\src\assets\icons\iconify\preset.json, 图标数量: 173 图标扫描完成 - iconfont: 644, iconify: 173, 总计: 817 图标类型已生成: src/types/icons.d.ts (817 个图标) ``` -------------------------------- ### Start Development Server Source: https://www.ruoyi.plus/frontend/getting-started.html Commands to navigate to the project directory and launch the development server. ```bash # 确保在 plus-ui 目录下 cd plus-ui # 启动开发服务器 pnpm dev ``` -------------------------------- ### Get Task Details Response Source: https://www.ruoyi.plus/backend/modules/workflow/task.html Example JSON response for the GET /workflow/task/getTask/{taskId} endpoint. ```json { "code": 200, "msg": "操作成功", "data": { "id": 101, "instanceId": 1, "definitionId": 100, "flowCode": "leave_apply", "flowName": "请假申请", "version": "1", "businessId": "1001", "nodeCode": "manager", "nodeName": "部门经理", "nodeType": 1, "flowStatus": "waiting", "assigneeIds": "5", "buttonList": ["back", "file", "copy", "transfer"], "copyList": [ {"userId": 10, "userName": "王五"} ], "varList": [], "nodeRatio": 0, "applyNode": false, "createTime": "2024-01-01 10:30:00" } } ``` -------------------------------- ### Install and Verify Modules Source: https://www.ruoyi.plus/backend/common/bom.html Commands to install all modules into the local Maven repository and verify the existence of the artifacts. ```bash # 安装所有模块到本地仓库 mvn clean install -DskipTests # 检查本地仓库 ls ~/.m2/repository/plus/ruoyi/ ``` -------------------------------- ### Start Development Server Source: https://www.ruoyi.plus/mobile/build/wechat-deploy.html Run the development build command to compile the project. ```bash cd ruoyi-plus-uniapp-workflow/plus-app pnpm dev:mp-weixin ``` -------------------------------- ### Form Validation Setup Source: https://www.ruoyi.plus/frontend/components/form/radio.html Example of a standard form setup using AFormRadio with Element Plus validation rules. ```vue ``` -------------------------------- ### Preview Build Results Source: https://www.ruoyi.plus/frontend/getting-started.html Starts a local server to preview the generated production build. ```bash # 预览构建结果 pnpm preview # 预览服务器会在本地启动: # ➜ Local: http://localhost:4173/ # ➜ Network: http://192.168.x.x:4173/ ``` -------------------------------- ### Identify Dependency Fetch Error Source: https://www.ruoyi.plus/frontend/getting-started.html Example of a 404 error encountered during dependency installation. ```text ERR_PNPM_FETCH_404 GET https://registry.npmjs.org/xxx: Not Found - 404 ``` -------------------------------- ### RocketMQ Initialization Log Source: https://www.ruoyi.plus/backend/common/rocketmq/quick-start.html Example of the console output upon successful RocketMQ client startup. ```text ======================================== 🚀 RocketMQ 模块开始初始化 - NameServer: 127.0.0.1:9876 - 集群名称: RuoYiCluster - Broker地址: 127.0.0.1:10911 - 生产者组: ruoyi-producer-group - 发送超时: 3000ms - 自动创建Topic: true - 消费线程: 20-64 ======================================== ✅ RocketMQ 客户端启动完成! ======================================== ``` -------------------------------- ### Get Tree Depth Usage Source: https://www.ruoyi.plus/frontend/utils/tree.html Example of calculating tree depth and using it for UI logic. ```typescript const tree = buildTree(departmentList) const depth = getTreeDepth(tree) console.log(`组织架构层级深度: ${depth}`) // 根据深度调整UI显示 if (depth > 5) { console.warn('层级过深,考虑优化组织结构') } ``` -------------------------------- ### Get Leaf Nodes Usage Source: https://www.ruoyi.plus/frontend/utils/tree.html Example of extracting leaf nodes from a tree and performing operations on them. ```typescript const tree = buildTree(departmentList) const leaves = getLeafNodes(tree) // 获取所有末级部门 console.log('末级部门:', leaves.map(leaf => leaf.name)) // 统计叶子节点数量 console.log('叶子节点数量:', leaves.length) ``` -------------------------------- ### Initialize Component Directory and Files Source: https://www.ruoyi.plus/frontend/dev/custom-component.html Commands to create the necessary directory and files for a new component in the project structure. ```bash # 在 components 目录下创建组件 cd src/components # 创建组件目录(如果需要多个文件) mkdir AMyComponent # 创建组件文件 touch AMyComponent/AMyComponent.vue touch AMyComponent/types.ts touch AMyComponent/index.ts ``` -------------------------------- ### Start the Backend Application Source: https://www.ruoyi.plus/practices Commands to clone the repository, initialize the database, configure settings, and run the Spring Boot application. ```bash # 克隆项目 git clone https://github.com/xxx/ruoyi-plus-uniapp-workflow.git # 进入项目目录 cd ruoyi-plus-uniapp-workflow # 执行 SQL 脚本 mysql -u root -p < script/sql/ruoyi.sql # 修改配置文件 vim ruoyi-admin/src/main/resources/application-dev.yml # 启动项目 mvn spring-boot:run -pl ruoyi-admin ``` -------------------------------- ### Get Token API Definition and Usage Source: https://www.ruoyi.plus/frontend/composables/use-token.html Definition of the getToken function and an example of how to use it within a component. ```typescript const getToken = (): string | null ``` ```typescript import { useToken } from '@/composables/useToken' const { getToken } = useToken() // 基本使用 const token = getToken() console.log('当前Token:', token) // 返回: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." 或 null ``` -------------------------------- ### Initialize Project Dependencies Source: https://www.ruoyi.plus/frontend/getting-started.html Commands to configure the registry, clear cache, and install dependencies for the project. ```bash # 切换到国内镜像源 pnpm config set registry https://registry.npmmirror.com # 清除缓存 pnpm store prune # 删除现有依赖 rm -rf node_modules pnpm-lock.yaml # 重新安装 pnpm install ``` -------------------------------- ### Get Workflow Variables Response Source: https://www.ruoyi.plus/backend/modules/workflow/instance.html Example response structure for retrieving variables associated with a workflow instance. ```json { "code": 200, "msg": "操作成功", "data": { "variableList": [ {"key": "initiator", "value": "1"}, {"key": "initiatorDeptId", "value": "100"}, {"key": "businessId", "value": "1001"}, {"key": "days", "value": 3}, {"key": "leaveType", "value": "annual"} ], "variable": "{\"initiator\":\"1\",\"initiatorDeptId\":\"100\",...}" } } ``` -------------------------------- ### Configure Environment Variables Source: https://www.ruoyi.plus/mobile/getting-started.html Example configuration for the .env file, including various platform App IDs. ```bash # 应用标识 VITE_APP_ID=ryplus_uni # 微信小程序 AppID (必须配置才能运行小程序) VITE_WECHAT_MINI_APP_ID=your_wechat_appid # 微信公众号 AppID VITE_WECHAT_OFFICIAL_APP_ID=your_wechat_h5_appid # 支付宝小程序 AppID VITE_ALIPAY_MINI_APP_ID=your_alipay_appid # 百度小程序 App Key VITE_BAIDU_MINI_APP_KEY=your_baidu_appkey # 抖音小程序 AppID VITE_TOUTIAO_MINI_APP_ID=your_toutiao_appid ``` -------------------------------- ### HBuilderX Initial Configuration Source: https://www.ruoyi.plus/mobile/uniapp/hbuilderx.html Steps for logging in, installing necessary plugins, and configuring network proxy settings. ```text 1. 登录 DCloud 账号 - 菜单:帮助 -> 登录 - 使用手机号或邮箱注册 2. 配置插件 - 菜单:工具 -> 插件安装 - 安装 uni-app 编译插件 - 安装 App 真机运行插件 3. 配置代理(可选) - 菜单:工具 -> 设置 - 网络设置 -> HTTP 代理 ``` -------------------------------- ### Get Current Week Range Source: https://www.ruoyi.plus/frontend/utils/date.html Returns the start (Monday) and end (Sunday) dates for the current week. ```typescript getCurrentWeekRange(): [Date, Date] ``` ```typescript export const getCurrentWeekRange = (): [Date, Date] => { const now = new Date() const currentDay = now.getDay() || 7 // 周日是0,转为7 const monday = new Date(now) monday.setDate(now.getDate() - (currentDay - 1)) monday.setHours(0, 0, 0, 0) const sunday = new Date(now) sunday.setDate(now.getDate() + (7 - currentDay)) sunday.setHours(23, 59, 59, 999) return [monday, sunday] } ``` ```typescript const [monday, sunday] = getCurrentWeekRange() console.log(formatDay(monday)) // "2023-01-09" (本周一) console.log(formatDay(sunday)) // "2023-01-15" (本周日) // 本周数据统计 const weeklyStats = await api.getStats({ startDate: formatDay(monday), endDate: formatDay(sunday) }) ``` -------------------------------- ### Optimize JVM Parameters for Production Source: https://www.ruoyi.plus/backend/common/job.html Recommended JVM startup arguments for production environments, including G1GC settings and heap dump configuration. ```bash # 生产环境JVM参数建议 JAVA_OPTS="-Xms2g -Xmx2g \ -XX:+UseG1GC \ -XX:MaxGCPauseMillis=200 \ -XX:+HeapDumpOnOutOfMemoryError \ -XX:HeapDumpPath=/logs/heapdump.hprof \ -XX:+PrintGCDetails \ -XX:+PrintGCDateStamps \ -Xloggc:/logs/gc.log" ``` -------------------------------- ### Start Monitor Admin via Maven Source: https://www.ruoyi.plus/backend/extend/monitor-admin.html Navigates to the monitor admin module directory to prepare for service startup. ```bash # 进入模块目录 cd ruoyi-extend/ruoyi-monitor-admin ``` -------------------------------- ### Configure and Use Vue I18n Source: https://www.ruoyi.plus/frontend/architecture/tech-stack.html Setup for Vue I18n initialization and a component example for switching languages dynamically. ```typescript // src/i18n/index.ts import { createI18n } from 'vue-i18n' import zhCn from './locales/zh-cn' import en from './locales/en' const i18n = createI18n({ legacy: false, locale: localStorage.getItem('language') || 'zh-cn', fallbackLocale: 'zh-cn', messages: { 'zh-cn': zhCn, 'en': en } }) export default i18n ``` ```vue ``` -------------------------------- ### Get Next Node Information Source: https://www.ruoyi.plus/backend/modules/workflow/task.html Request and response examples for calculating the next workflow node based on variables. ```json { "taskId": 101, "variables": { "amount": 15000 } } ``` ```json { "code": 200, "msg": "操作成功", "data": [ { "nodeCode": "gm", "nodeName": "总经理", "nodeType": 1, "permissionFlag": "5,6,7" } ] } ``` -------------------------------- ### Clone and Initialize Project Source: https://www.ruoyi.plus/frontend/getting-started.html Commands to clone the repository and navigate to the project directory. ```bash git clone https://gitee.com/your-org/ruoyi-plus-uniapp.git cd ruoyi-plus-uniapp/plus-ui ``` -------------------------------- ### Configure Basic Settings Source: https://www.ruoyi.plus/backend/common/langchain4j/quick-start.html Minimal configuration example for setting up the DeepSeek model. ```yaml langchain4j: ``` -------------------------------- ### Retrieve Rejectable Nodes API Response Source: https://www.ruoyi.plus/backend/modules/workflow/task.html Example JSON response for the GET /workflow/task/listRejectableNodes/{taskId}/{nowNodeCode} endpoint. ```json { "code": 200, "msg": "操作成功", "data": [ { "nodeCode": "apply", "nodeName": "申请人", "nodeType": 1 }, { "nodeCode": "leader", "nodeName": "部门主管", "nodeType": 1 } ] } ``` -------------------------------- ### Initialize Development Environment Source: https://www.ruoyi.plus/mobile/build/wechat-deploy.html Verify Node.js version and install the pnpm package manager. ```bash # 检查 Node.js 版本(需要 ≥18.0.0) node -v # 安装 pnpm(需要 ≥7.30) npm install -g pnpm ``` -------------------------------- ### Get Workflow Definition JSON Response Source: https://www.ruoyi.plus/backend/modules/workflow/definition.html Example response structure when retrieving a workflow definition as a JSON string. ```json { "code": 200, "msg": "操作成功", "data": "{\"flowCode\":\"leave_apply\",\"flowName\":\"请假申请\",...}" } ``` -------------------------------- ### Retrieve Workflow Definition Details Source: https://www.ruoyi.plus/backend/modules/workflow/definition.html Example response for a GET request to fetch workflow definition details by ID. ```json { "code": 200, "msg": "操作成功", "data": { "id": 1, "flowCode": "leave_apply", "flowName": "请假申请", "version": "1", "isPublish": 1, "category": "100", "formPath": "/business/leave/apply", "formCustom": "Y", "ext": "{\"autoPass\":true}", "nodeList": [ { "nodeCode": "start", "nodeName": "开始", "nodeType": 0 }, { "nodeCode": "apply", "nodeName": "申请人", "nodeType": 1, "permissionFlag": "${initiator}" }, { "nodeCode": "manager", "nodeName": "部门经理", "nodeType": 1, "permissionFlag": "role:3" }, { "nodeCode": "end", "nodeName": "结束", "nodeType": 2 } ], "skipList": [ { "nowNodeCode": "start", "nextNodeCode": "apply" }, { "nowNodeCode": "apply", "nextNodeCode": "manager" }, { "nowNodeCode": "manager", "nextNodeCode": "end" } ] } } ``` -------------------------------- ### Integrate Performance Monitoring in Vue Components Source: https://www.ruoyi.plus/mobile/performance/startup.html Usage example of the startup performance composable within a Vue setup script. ```vue ``` -------------------------------- ### Query Login Logs Example Source: https://www.ruoyi.plus/backend/modules/system/monitor.html Demonstrates how to build query criteria and execute a paginated search for login logs. ```java // 构建查询条件 SysLoginLogBo loginLogBo = new SysLoginLogBo(); loginLogBo.setUserName("admin"); loginLogBo.setStatus("0"); // 成功登录 loginLogBo.setIpaddr("192.168.1.1"); // 分页参数 PageQuery pageQuery = new PageQuery(); pageQuery.setPageNum(1); pageQuery.setPageSize(10); // 执行查询 R> result = loginLogController.pageLoginLogs(loginLogBo, pageQuery); ``` -------------------------------- ### Usage Example Source: https://www.ruoyi.plus/frontend/utils/tree.html Demonstrates initializing the manager, building the tree, and performing operations. ```typescript // 使用示例 const manager = new IndexedTreeManager() console.time('indexedBuild') manager.build(hugeList) // 优化后:~200ms console.timeEnd('indexedBuild') console.time('indexedFind') const node = manager.findById(99999) // O(1): <1ms console.timeEnd('indexedFind') // 增量更新 manager.updateNode(99999, { name: '新名称' }) ``` -------------------------------- ### Implement Few-Shot Learning Source: https://www.ruoyi.plus/backend/common/langchain4j.html Construct prompts using predefined examples to guide the model's output format and logic. ```java @Service public class SentimentAnalysisService { public String analyzeSentiment(String text) { // 构建示例 List examples = List.of( new PromptUtils.Example("这个产品太棒了,强烈推荐!", "正面"), new PromptUtils.Example("质量很差,完全不值这个价格", "负面"), new PromptUtils.Example("还可以吧,没什么特别的", "中性") ); // 构建少样本提示词 String prompt = PromptUtils.buildFewShotPrompt( "请判断以下文本的情感倾向(正面/负面/中性)", examples, text ); ChatRequest request = new ChatRequest(); request.setMessage(prompt); request.setMode(ChatMode.SINGLE); request.setTemperature(0.1); return chatService.chat(request).getContent(); } } ``` -------------------------------- ### Development Startup Commands Source: https://www.ruoyi.plus/mobile/build/environment.html Commands to initiate development servers for H5, WeChat Mini Program, Alipay Mini Program, and App platforms. ```bash pnpm dev:h5 pnpm dev:mp-weixin pnpm dev:mp-alipay pnpm dev:app ``` -------------------------------- ### Implement Batch Query API Source: https://www.ruoyi.plus/practices/standards/api-design.html Provides examples for batch querying using both GET (with request parameters) and POST (with request body) methods, with a 100-item limit. ```java @RestController @RequestMapping("/api/users") public class UserController { /** * 批量查询用户 - GET 方式 */ @GetMapping("/batch") public R> getUsersByIds( @RequestParam @Size(max = 100, message = "一次最多查询100条") List ids) { return R.ok(userService.selectUsersByIds(ids)); } /** * 批量查询用户 - POST 方式(推荐,URL长度无限制) */ @PostMapping("/batch/query") public R> batchQueryUsers( @RequestBody @Valid BatchQueryRequest request) { return R.ok(userService.selectUsersByIds(request.getIds())); } } @Data public class BatchQueryRequest { @NotEmpty(message = "ID列表不能为空") @Size(max = 100, message = "一次最多查询100条") private List ids; } ``` -------------------------------- ### Configuration Key Naming Examples Source: https://www.ruoyi.plus/backend/modules/system/config.html Standardized hierarchical naming conventions for system, business, tenant, and module configurations. ```text system.account.register-enabled # 注册开关 system.captcha.enabled # 验证码开关 business.order.auto-confirm # 订单自动确认 tenant.theme.primary-color # 租户主题色 ``` -------------------------------- ### get Function Signature Source: https://www.ruoyi.plus/frontend/utils/object.html Defines the TypeScript signature for the get utility. ```typescript function get(object: any, path: string | string[], defaultValue?: any): any ``` -------------------------------- ### Install Dependencies Source: https://www.ruoyi.plus/frontend/getting-started.html Install required project dependencies using pnpm. ```bash pnpm install ``` -------------------------------- ### Install and Configure Alibaba Cloud ossutil Source: https://www.ruoyi.plus/mobile/build/h5-deploy.html Download, install, and configure the ossutil tool for managing Alibaba Cloud OSS. ```bash # 下载并安装 ossutil wget https://gosspublic.alicdn.com/ossutil/1.7.15/ossutil64 chmod 755 ossutil64 # 配置 ./ossutil64 config ``` -------------------------------- ### 使用 setup 组合式 API 入口 Source: https://www.ruoyi.plus/mobile/components/lifecycle.html setup 在组件实例创建时执行,适合进行响应式数据初始化、计算属性定义和方法定义。注意此时无法访问 DOM 元素。 ```vue ``` -------------------------------- ### Start Mini-Program Development Environments Source: https://www.ruoyi.plus/mobile/getting-started.html Commands to launch development mode for specific mini-program platforms. ```bash pnpm dev:mp-baidu ``` ```bash pnpm dev:mp-toutiao ``` ```bash pnpm dev:mp-qq ``` ```bash pnpm dev:mp-jd ``` ```bash pnpm dev:mp-kuaishou ``` ```bash pnpm dev:mp-lark ``` ```bash pnpm dev:mp-xhs ``` ```bash pnpm dev:mp-harmony ``` -------------------------------- ### Spacing Usage Example Source: https://www.ruoyi.plus/mobile/uniapp/app-config.html Examples of applying spacing variables to layout properties. ```scss .container { padding: $uni-spacing-row-base; // 左右10px margin-top: $uni-spacing-col-lg; // 上方12px } .item + .item { margin-top: $uni-spacing-col-base; // 项目间距8px } ``` -------------------------------- ### Startup Initialization Log Source: https://www.ruoyi.plus/backend/common/langchain4j/quick-start.html Expected console output upon successful initialization of the LangChain4j module. ```text ======================================== LangChain4j 模块初始化完成 默认提供商: deepseek 默认模型: deepseek-chat 对话记忆功能: 已启用 对话存储类型: redis RAG功能: 已禁用 ======================================== ``` -------------------------------- ### Border Radius Usage Example Source: https://www.ruoyi.plus/mobile/uniapp/app-config.html Examples of applying border radius variables. ```scss .button { border-radius: $uni-border-radius-base; // 按钮圆角 } .card { border-radius: $uni-border-radius-lg; // 卡片圆角 } .avatar { border-radius: $uni-border-radius-circle; // 圆形头像 } ``` -------------------------------- ### Directive Usage Example Source: https://www.ruoyi.plus/frontend/architecture/directory-structure.html Example of using a custom permission directive in a template. ```vue