小编THE*_*RIT的帖子

具有父子关系的递归查询

我正在尝试在 SQL Server 中进行递归查询,以分层方式显示数据。这是表的结构

    [id] [int] IDENTITY(1,1) NOT NULL,
    [name] [varchar(100)] NOT NULL,
    [Parent_Id] [int] NULL,
Run Code Online (Sandbox Code Playgroud)

每个产品都有一个父产品。Parent_Id 列包含父级的 id。对于根产品,parent_id 为空。

我想做一个 sql 查询来分层显示产品。下图是如何组织产品的示例。

在此输入图像描述

产品可以有产品子项。

对于上图,查询结果应如下所示:

id name      parent_id
1  P1        NULL
2  P2        NULL
3  P2-1      2
4  P2-2      2
5  P2-3      2
6  P2-3-1    5
7  P2-3-2    5
8  P3        NULL
9  P3-1      8
Run Code Online (Sandbox Code Playgroud)

这是我为实现它而写的请求:

with tree as (select * from products
               union all
               select * from tree where parent_id = tree.id
             )
select * from tree;
Run Code Online (Sandbox Code Playgroud)

但我得到类似于以下内容的结果:

1 …
Run Code Online (Sandbox Code Playgroud)

sql t-sql sql-server recursive-query hierarchical-data

4
推荐指数
1
解决办法
7191
查看次数

ionic 3 项目中的字体真棒安装

我正在尝试在我的 ionic 3 项目中安装 font-awesome。我使用了命令:

npm install font-awesome --save
Run Code Online (Sandbox Code Playgroud)

这是 package.json 文件的内容

    {
       "name": "ionic-hello-world",
       "version": "0.0.0",
      "author": "Ionic Framework",
      "homepage": "http://ionicframework.com/",
      "private": true,
      "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
      },
      "config": {
        "ionic_copy": "./config/copy.config.js"
      },
      "dependencies": {
        "@angular/common": "4.1.3",
        "@angular/compiler": "4.1.3",
        "@angular/compiler-cli": "4.1.3",
        "@angular/core": "4.1.3",
        "@angular/forms": "4.1.3",
        "@angular/http": "4.1.3",
        "@angular/platform-browser": "4.1.3",
        "@angular/platform-browser-dynamic": "4.1.3",
        "@ionic-native/camera": "^3.13.1",
        "@ionic-native/core": "3.10.2",
        "@ionic-native/network": "^4.2.1",
        "@ionic-native/splash-screen": "3.10.2",
        "@ionic-native/status-bar": "3.10.2",
        "@ionic/storage": "2.0.1",
        "angularfire2": "^4.0.0-rc0",
        "firebase": …
Run Code Online (Sandbox Code Playgroud)

css ionic-framework ionic2 ionic3 angular

3
推荐指数
1
解决办法
9078
查看次数

ionic 3:在app.module.ts中Googleplus不被识别为提供者

我正在尝试通过使用以下命令来构建用于生产的离子项目。 ionic cordova构建android --prod --release,但是我总是会遇到此错误: JavaScript 堆满了内存,因此我在网上查看了以下解决方案:在ionic中添加了节点--max_old_space_size = 4096。 cmd文件,但是没有用。当我使用Firebase时,我尝试使用以下命令降级Firebase:

npm install --save firebase@4.x
Run Code Online (Sandbox Code Playgroud)

因此,现在我的项目的googleplus插件GooglePlus类不被视为离子提供程序。这是我用来安装它的命令:

ionic cordova plugin add cordova-plugin-googleplus --save --variable REVERSED_CLIENT_ID=MY_REVERSE_CLIENT_ID

npm install --save @ionic-native/google-plus
Run Code Online (Sandbox Code Playgroud)

当我尝试在我的app.modules.ts中的providers部分中导入GooglePlus类时,无法识别该类。我尝试卸载并重新安装所有内容,但无法正常工作。

{


"name": "app name",
  "version": "2.0.1",
  "author": "auhtors name",
  "homepage": "website url",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/animations": "5.2.10",
    "@angular/common": …
Run Code Online (Sandbox Code Playgroud)

google-plus ionic-framework ionic3

0
推荐指数
1
解决办法
371
查看次数