guanxf

          我的博客:http://blog.sina.com.cn/17learning

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            71 隨筆 :: 1 文章 :: 41 評論 :: 0 Trackbacks

          2016年1月14日 #


          createTree(1, orgNodeTree, sameOrgNodes, 0);


          @NoArgsConstructor
          @AllArgsConstructor
          @Getter
          @Setter
          public class NodeTree {
          private String pName;
          private String name;
          private int level;
          private List<NodeTree> children;
          }

          private void createTree(int leave, int ind, Map<String, NodeTree> pIndexNodeNameMap, List<NodeVo> childNodes) {
          Map<String, NodeTree> cIndexNodeNameMap = new HashMap();
          //構建樹
          int treeNo = pIndexNodeNameMap.size();
          if (treeNo == 0) {
          return;
          }
          int group = 0;
          for (int i = ind; i < childNodes.size(); i++) {
          NodeVo node = childNodes.get(i);
          long index = node.getId() % treeNo;
          NodeTree pNode = pIndexNodeNameMap.get(index + "");
          List<NodeTree> children = pNode.getChildren();
          if (CollectionUtils.isEmpty(children)) {
          children = new ArrayList();
          }
          if (children.size() > 2) {
          leave++;
          createTree(leave, i, cIndexNodeNameMap, childNodes);
          break;
          } else {
          NodeTree child = new NodeTree();
          child.setLevel(leave);
          child.setPName(pNode.getName());
          child.setName(node.getNodeName());
          children.add(child);
          pNode.setChildren(children);
          cIndexNodeNameMap.put(group + "", child);
          group++;
          }
          }
          }


          private boolean createTree(int level, List<NodeTree> parentNodes, List<NodeVo> childNodes, int beginIndex) {
          //構建樹
          List<NodeTree> nextLevelNodes = new ArrayList<>();
          for (int i = beginIndex; i < childNodes.size(); i++) {
          int parentCount = 1;
          for (NodeTree pNode : parentNodes) {
          List<NodeTree> children = pNode.getChildren();
          if (CollectionUtils.isEmpty(children)) {
          children = new ArrayList();
          pNode.setChildren(children);
          }
          if (children.size() >= 3) {
          if(parentCount >= parentNodes.size()){
          return createTree(++level, nextLevelNodes, childNodes, beginIndex);
          }
          } else {
          if (beginIndex >= childNodes.size()) {
          return true;
          }
          NodeTree child = new NodeTree();
          child.setLevel(level);
          child.setPName(pNode.getName());
          NodeVo node = childNodes.get(beginIndex);
          child.setName(node.getNodeName());
          pNode.getChildren().add(child);
          nextLevelNodes.add(child);
          beginIndex++;
          }
          parentCount++;
          }
          }
          return true;
          }
          posted @ 2020-09-07 09:56 管先飛 閱讀(259) | 評論 (0)編輯 收藏

          執行命名:
          git pull github master --allow-unrelated-histories

          執行結果如下:

          E:\WorkSpace\workspaceJ2ee\abocode\jfaster>git pull github master --allow-unrelated-histories
          remote: Counting objects: 3, done.
          remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 3
          Unpacking objects: 100% (3/3), done.
          From https://github.com/abocode/jfaster
           * branch            master     -> FETCH_HEAD
           * [new branch]      master     -> github/master
          Merge made by the 'recursive' strategy.
           .gitattributes | 3 +++
           1 file changed, 3 insertions(+)
           create mode 100644 .gitattributes
          posted @ 2018-05-20 12:30 管先飛 閱讀(322) | 評論 (0)編輯 收藏

          進入“控制面板”——“用戶賬戶”-憑據管理器——windows憑據

          找到了git的用戶名密碼。修改正確后ok

          posted @ 2018-05-20 12:29 管先飛 閱讀(271) | 評論 (0)編輯 收藏

          元注解:

            元注解的作用就是負責注解其他注解。Java5.0定義了4個標準的meta-annotation類型,它們被用來提供對其它 annotation類型作說明。Java5.0定義的元注解:
              1.@Target,
              2.@Retention,
              3.@Documented,
              4.@Inherited

            這些類型和它們所支持的類在java.lang.annotation包中可以找到。下面我們看一下每個元注解的作用和相應分參數的使用說明。
          以下為一個簡單場景的應用:
           1.定義注解:
             
          @Target(TYPE)
          @Retention(RUNTIME)
          public @interface Table {
          /**
          * (Optional) The name of the table.
          * <p/>
          * Defaults to the entity name.
          */
          String name() default "";
          }
          @Target({METHOD, FIELD})
          @Retention(RUNTIME)
          public @interface Column {

          /**
          * (Optional) The name of the column. Defaults to
          * the property or field name.
          */
          String name() default "";
          }
          2、定義實體類:
            

          @Table(name = "t_s_user")
          public class User {
          @Column(name="name")
          private String name;

          @Column(name="pwd")
          private String pwd;

          public String getName() {
          return name;
          }

          public void setName(String name) {
          this.name = name;
          }

          public String getPwd() {
          return pwd;
          }

          public void setPwd(String pwd) {
          this.pwd = pwd;
          }
          }

          3、運行:

          public static void print() {
          System.out.println("table's name" + User.class.getAnnotation(Table.class).name());
          Field[] fields = User.class.getDeclaredFields();
          for (int i = 0; i < fields.length; i++) {
          Field field = fields[i];
          System.out.println("field's type:" + field.getType().getName());
          System.out.println("field's columnName:" + field.getAnnotation(Column.class).name());
          }
          }

          關于注解的詳細介紹:http://www.cnblogs.com/peida/archive/2013/04/24/3036689.html
          posted @ 2016-08-18 20:42 管先飛 閱讀(2845) | 評論 (0)編輯 收藏

          1.選擇:File->project structure->libraries

          2.左上角選擇添加,選擇添加java(還提供了添加maven項目),然后選擇所需要的目錄:

          3.idea 會提示選擇添加什么類型的文件,我們是單純的文件,所以選擇classes

             

           
          posted @ 2016-04-29 15:42 管先飛 閱讀(1706) | 評論 (0)編輯 收藏

          nginx 反向代理到 apache
          server {
                  listen       80;
                  server_name  app.haeee.com;
          index index.html index.htm index.php;
             root /alidata/www/movie-app;
               error_page 404 500 502 503 504 http://app.haeee.com; 
          location ~ .*\.(php|php5)?$
          {
          #fastcgi_pass  unix:/tmp/php-cgi.sock;
          fastcgi_pass  127.0.0.1:9000;
          fastcgi_index index.php;
          include fastcgi.conf;
          }
          location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
          {
          expires 30d;
          }
          location ~ .*\.(js|css)?$
          {
          expires 1h;
          }
          #偽靜態規則
          #include /alidata/server/nginx/conf/rewrite/phpwind.conf;
          access_log  /alidata/log/nginx/access/movie-app.log;
          }

          nginx 反向代理到 tomcat
          server {
              listen   80;
              server_name  hulasou.com www.hulasou.com;
          index index.html index.htm index.jsp;
          #location ~ .*\.(jsp)?$
          location /{      
          index index.jsp;
                  proxy_pass http://localhost:8181;
          }
          #偽靜態規則
          include /alidata/server/nginx/conf/rewrite/uuxiaohua.conf;
          access_log  /alidata/log/nginx/access/uuxiaohua.log;
          }
          posted @ 2016-01-19 17:46 管先飛 閱讀(410) | 評論 (0)編輯 收藏

          1、修改啟動項:
          @SpringBootApplication
          @ComponentScan
          @Import({DBConfiguration.class, ResourceConfiguration.class,AppConfiguration.class})
          public class Application extends SpringBootServletInitializer {
          @Override
          protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
          return application.sources(Application.class);
          }
          2、修改pom文件:
              修改packaging
              <packaging>war</packaging>
            加入打包到tomcat的配置:
          <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-tomcat</artifactId>
          <scope>provided</scope>
          </dependency>
          <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-legacy</artifactId>
          <version>1.0.2.RELEASE</version>
          </dependency>

          <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>javax.servlet-api</artifactId>
          <version>3.0.1</version>
          </dependency>
          <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>javax.servlet-api</artifactId>
          <version>3.0.1</version>
          </dependency>

          <dependency>
          <groupId>commons-fileupload</groupId>
          <artifactId>commons-fileupload</artifactId>
          <version>1.3.1</version>
          </dependency>

          3、如果不需要JMX在application.properties文件中加入配置項:
          endpoints.jmx.uniqueNames=true
          或者直接關閉:
           endpoints.jmx.enabled=false
          posted @ 2016-01-14 17:21 管先飛 閱讀(6565) | 評論 (1)編輯 收藏

          主站蜘蛛池模板: 邹平县| 始兴县| 文山县| 青浦区| 乌苏市| 赤峰市| 怀化市| 勃利县| 平果县| 喀喇沁旗| 台山市| 景洪市| 英吉沙县| 南靖县| 金溪县| 新津县| 阿克陶县| 油尖旺区| 英吉沙县| 夹江县| 汝城县| 获嘉县| 咸丰县| 兖州市| 枝江市| 乐陵市| 且末县| 上林县| 建宁县| 平乡县| 普格县| 庐江县| 眉山市| 阿克苏市| 民权县| 旬阳县| 盐城市| 资溪县| 泗水县| 长垣县| 普安县|