Future 3 سال پیش
والد
کامیت
03cfd7b673

+ 9 - 2
src/main/java/group04/BasicNode.java

@@ -235,7 +235,14 @@ public class BasicNode implements Iterable<BasicNode>
      */
     public boolean vaildity()
     {
-        return getId() >= 0;
+        if(getId() >= 0)
+        {
+            for (BasicNode basicNode : NeedUpload) {
+                if(this.equals(basicNode) && basicNode != this) return false;
+            }
+            return true;
+        }
+        return false;
     }
 
     /**
@@ -244,7 +251,7 @@ public class BasicNode implements Iterable<BasicNode>
      */
     public boolean defineded()
     {
-        return getId() > 0;
+        return vaildity() && getId() > 0;
     }
 
     /**

+ 24 - 29
src/main/resources/DataBase.sql

@@ -1,12 +1,27 @@
+drop database if exists ShoppingWebsite;
 create database if not exists ShoppingWebsite;
 use ShoppingWebsite;
 
 
 
+
+/*  node*/
+create table if not exists nodeinfo
+(
+    id bigint not null primary key,
+    prev_id bigint null,
+    next_id bigint null,
+    parent_id bigint null,
+    child_id bigint null,
+    obj_type varchar(100) default 'group04.BasicNode'
+);
+
 /*  node stuctor
     userAccount
-    +   user_cart
-    +   user_collect
+    +   cart
+        +   user_cart[]
+    +   collect
+        +   goods[]
 */
 create table if not exists userAccount
 (
@@ -17,27 +32,19 @@ create table if not exists userAccount
     primary key(email,userId)
 );
 
+/*goods*/
 create table if not exists user_cart
 (
     user_Cart_Id bigint not null primary key,
-    password varchar(16) not null,
-    permission int not null default 0
-);
-
-create table if not exists user_collect
-(
-    user_collect_Id bigint not null primary key,
-    password varchar(16) not null,
-    permission int not null default 0
+    count int not null,
 );
 
-
 /*  node stuctor
     store
-    +   goods
-        +   selectionGroup
-            +   selection
-        +   comment
+    +   goods[]
+        +   selectionGroup[]
+            +   selection[]
+        +   comment[]
 */
 create table if not exists store
 (
@@ -55,7 +62,7 @@ create table if not exists goods
     star int
 );
 
-create table if not exists selectionGroup
+create table if not exists selection_group
 (
     selection_group_id bigint not null primary key,
     name varchar(50) not null
@@ -67,15 +74,3 @@ create table if not exists selection
     name varchar(50) not null,
     price float(13,2)
 );
-
-
-/*  node*/
-create table if not exists nodeinfo
-(
-    id bigint not null primary key,
-    prev_id bigint null,
-    next_id bigint null,
-    parent_id bigint null,
-    child_id bigint null,
-    obj_type varchar(100) default 'group04.BasicNode'
-);

+ 44 - 4
src/main/resources/generatorConfig.xml

@@ -11,7 +11,7 @@
         </commentGenerator>
         <jdbcConnection
                 driverClass="com.mysql.jdbc.Driver"
-                connectionURL="jdbc:mysql://localhost:3306/dsnodetree"
+                connectionURL="jdbc:mysql://localhost:3306/ShoppingWebsite"
                 userId="root"
                 password="123456"
         />
@@ -19,7 +19,7 @@
             <property name="forceBigDecimals" value="false"/>
         </javaTypeResolver>
 
-        <javaModelGenerator targetPackage="group04.myBatis" targetProject="src/main/java">
+        <javaModelGenerator targetPackage="WebsiteES.myBatis" targetProject="src/main/java">
             <property name="enableSubPackages" value="true"/>
             <property name="trimStrings" value="false"/>
         </javaModelGenerator>
@@ -28,12 +28,52 @@
             <property name="enableSubPackages" value="true"/>
         </sqlMapGenerator>
 
-        <javaClientGenerator targetPackage="group04.myBatis" targetProject="src/main/java" type="XMLMAPPER">
+        <javaClientGenerator targetPackage="WebsiteES.myBatis" targetProject="src/main/java" type="XMLMAPPER">
             <property name="enableSubPackages" value="true"/>
         </javaClientGenerator>
 
         <table
-                tableName="nodeinfo"
+                tableName="userAccount"
+        enableCountByExample="false"
+        enableDeleteByExample="false"
+        enableSelectByExample="false"
+        enableUpdateByExample="false"
+        />
+
+        <table
+                tableName="user_cart"
+        enableCountByExample="false"
+        enableDeleteByExample="false"
+        enableSelectByExample="false"
+        enableUpdateByExample="false"
+        />
+
+        <table
+                tableName="store"
+        enableCountByExample="false"
+        enableDeleteByExample="false"
+        enableSelectByExample="false"
+        enableUpdateByExample="false"
+        />
+
+        <table
+                tableName="goods"
+        enableCountByExample="false"
+        enableDeleteByExample="false"
+        enableSelectByExample="false"
+        enableUpdateByExample="false"
+        />
+
+        <table
+                tableName="selectionGroup"
+        enableCountByExample="false"
+        enableDeleteByExample="false"
+        enableSelectByExample="false"
+        enableUpdateByExample="false"
+        />
+
+        <table
+                tableName="selection"
         enableCountByExample="false"
         enableDeleteByExample="false"
         enableSelectByExample="false"

+ 37 - 37
src/main/resources/myBatisMap/NodeinfoMapper.xml

@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="group04.myBatis.NodeinfoMapper" >
-  <resultMap id="BaseResultMap" type="group04.myBatis.Nodeinfo" >
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="WebsiteES.myBatis.NodeinfoMapper">
+  <resultMap id="BaseResultMap" type="WebsiteES.myBatis.Nodeinfo">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
-    <id column="id" property="id" jdbcType="BIGINT" />
-    <result column="prev_id" property="prevId" jdbcType="BIGINT" />
-    <result column="next_id" property="nextId" jdbcType="BIGINT" />
-    <result column="parent_id" property="parentId" jdbcType="BIGINT" />
-    <result column="child_id" property="childId" jdbcType="BIGINT" />
-    <result column="obj_type" property="objType" jdbcType="VARCHAR" />
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="prev_id" jdbcType="BIGINT" property="prevId" />
+    <result column="next_id" jdbcType="BIGINT" property="nextId" />
+    <result column="parent_id" jdbcType="BIGINT" property="parentId" />
+    <result column="child_id" jdbcType="BIGINT" property="childId" />
+    <result column="obj_type" jdbcType="VARCHAR" property="objType" />
   </resultMap>
-  <sql id="Base_Column_List" >
+  <sql id="Base_Column_List">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
     id, prev_id, next_id, parent_id, child_id, obj_type
   </sql>
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
@@ -30,7 +30,7 @@
     from nodeinfo
     where id = #{id,jdbcType=BIGINT}
   </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
@@ -38,7 +38,7 @@
     delete from nodeinfo
     where id = #{id,jdbcType=BIGINT}
   </delete>
-  <insert id="insert" parameterType="group04.myBatis.Nodeinfo" >
+  <insert id="insert" parameterType="WebsiteES.myBatis.Nodeinfo">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
@@ -50,79 +50,79 @@
       #{parentId,jdbcType=BIGINT}, #{childId,jdbcType=BIGINT}, #{objType,jdbcType=VARCHAR}
       )
   </insert>
-  <insert id="insertSelective" parameterType="group04.myBatis.Nodeinfo" >
+  <insert id="insertSelective" parameterType="WebsiteES.myBatis.Nodeinfo">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
     insert into nodeinfo
-    <trim prefix="(" suffix=")" suffixOverrides="," >
-      <if test="id != null" >
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
         id,
       </if>
-      <if test="prevId != null" >
+      <if test="prevId != null">
         prev_id,
       </if>
-      <if test="nextId != null" >
+      <if test="nextId != null">
         next_id,
       </if>
-      <if test="parentId != null" >
+      <if test="parentId != null">
         parent_id,
       </if>
-      <if test="childId != null" >
+      <if test="childId != null">
         child_id,
       </if>
-      <if test="objType != null" >
+      <if test="objType != null">
         obj_type,
       </if>
     </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides="," >
-      <if test="id != null" >
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
         #{id,jdbcType=BIGINT},
       </if>
-      <if test="prevId != null" >
+      <if test="prevId != null">
         #{prevId,jdbcType=BIGINT},
       </if>
-      <if test="nextId != null" >
+      <if test="nextId != null">
         #{nextId,jdbcType=BIGINT},
       </if>
-      <if test="parentId != null" >
+      <if test="parentId != null">
         #{parentId,jdbcType=BIGINT},
       </if>
-      <if test="childId != null" >
+      <if test="childId != null">
         #{childId,jdbcType=BIGINT},
       </if>
-      <if test="objType != null" >
+      <if test="objType != null">
         #{objType,jdbcType=VARCHAR},
       </if>
     </trim>
   </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="group04.myBatis.Nodeinfo" >
+  <update id="updateByPrimaryKeySelective" parameterType="WebsiteES.myBatis.Nodeinfo">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
     update nodeinfo
-    <set >
-      <if test="prevId != null" >
+    <set>
+      <if test="prevId != null">
         prev_id = #{prevId,jdbcType=BIGINT},
       </if>
-      <if test="nextId != null" >
+      <if test="nextId != null">
         next_id = #{nextId,jdbcType=BIGINT},
       </if>
-      <if test="parentId != null" >
+      <if test="parentId != null">
         parent_id = #{parentId,jdbcType=BIGINT},
       </if>
-      <if test="childId != null" >
+      <if test="childId != null">
         child_id = #{childId,jdbcType=BIGINT},
       </if>
-      <if test="objType != null" >
+      <if test="objType != null">
         obj_type = #{objType,jdbcType=VARCHAR},
       </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
-  <update id="updateByPrimaryKey" parameterType="group04.myBatis.Nodeinfo" >
+  <update id="updateByPrimaryKey" parameterType="WebsiteES.myBatis.Nodeinfo">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.

+ 24 - 29
target/classes/DataBase.sql

@@ -1,12 +1,27 @@
+drop database if exists ShoppingWebsite;
 create database if not exists ShoppingWebsite;
 use ShoppingWebsite;
 
 
 
+
+/*  node*/
+create table if not exists nodeinfo
+(
+    id bigint not null primary key,
+    prev_id bigint null,
+    next_id bigint null,
+    parent_id bigint null,
+    child_id bigint null,
+    obj_type varchar(100) default 'group04.BasicNode'
+);
+
 /*  node stuctor
     userAccount
-    +   user_cart
-    +   user_collect
+    +   cart
+        +   user_cart[]
+    +   collect
+        +   goods[]
 */
 create table if not exists userAccount
 (
@@ -17,27 +32,19 @@ create table if not exists userAccount
     primary key(email,userId)
 );
 
+/*goods*/
 create table if not exists user_cart
 (
     user_Cart_Id bigint not null primary key,
-    password varchar(16) not null,
-    permission int not null default 0
-);
-
-create table if not exists user_collect
-(
-    user_collect_Id bigint not null primary key,
-    password varchar(16) not null,
-    permission int not null default 0
+    count int not null,
 );
 
-
 /*  node stuctor
     store
-    +   goods
-        +   selectionGroup
-            +   selection
-        +   comment
+    +   goods[]
+        +   selectionGroup[]
+            +   selection[]
+        +   comment[]
 */
 create table if not exists store
 (
@@ -55,7 +62,7 @@ create table if not exists goods
     star int
 );
 
-create table if not exists selectionGroup
+create table if not exists selection_group
 (
     selection_group_id bigint not null primary key,
     name varchar(50) not null
@@ -67,15 +74,3 @@ create table if not exists selection
     name varchar(50) not null,
     price float(13,2)
 );
-
-
-/*  node*/
-create table if not exists nodeinfo
-(
-    id bigint not null primary key,
-    prev_id bigint null,
-    next_id bigint null,
-    parent_id bigint null,
-    child_id bigint null,
-    obj_type varchar(100) default 'group04.BasicNode'
-);

+ 44 - 4
target/classes/generatorConfig.xml

@@ -11,7 +11,7 @@
         </commentGenerator>
         <jdbcConnection
                 driverClass="com.mysql.jdbc.Driver"
-                connectionURL="jdbc:mysql://localhost:3306/dsnodetree"
+                connectionURL="jdbc:mysql://localhost:3306/ShoppingWebsite"
                 userId="root"
                 password="123456"
         />
@@ -19,7 +19,7 @@
             <property name="forceBigDecimals" value="false"/>
         </javaTypeResolver>
 
-        <javaModelGenerator targetPackage="group04.myBatis" targetProject="src/main/java">
+        <javaModelGenerator targetPackage="WebsiteES.myBatis" targetProject="src/main/java">
             <property name="enableSubPackages" value="true"/>
             <property name="trimStrings" value="false"/>
         </javaModelGenerator>
@@ -28,12 +28,52 @@
             <property name="enableSubPackages" value="true"/>
         </sqlMapGenerator>
 
-        <javaClientGenerator targetPackage="group04.myBatis" targetProject="src/main/java" type="XMLMAPPER">
+        <javaClientGenerator targetPackage="WebsiteES.myBatis" targetProject="src/main/java" type="XMLMAPPER">
             <property name="enableSubPackages" value="true"/>
         </javaClientGenerator>
 
         <table
-                tableName="nodeinfo"
+                tableName="userAccount"
+        enableCountByExample="false"
+        enableDeleteByExample="false"
+        enableSelectByExample="false"
+        enableUpdateByExample="false"
+        />
+
+        <table
+                tableName="user_cart"
+        enableCountByExample="false"
+        enableDeleteByExample="false"
+        enableSelectByExample="false"
+        enableUpdateByExample="false"
+        />
+
+        <table
+                tableName="store"
+        enableCountByExample="false"
+        enableDeleteByExample="false"
+        enableSelectByExample="false"
+        enableUpdateByExample="false"
+        />
+
+        <table
+                tableName="goods"
+        enableCountByExample="false"
+        enableDeleteByExample="false"
+        enableSelectByExample="false"
+        enableUpdateByExample="false"
+        />
+
+        <table
+                tableName="selectionGroup"
+        enableCountByExample="false"
+        enableDeleteByExample="false"
+        enableSelectByExample="false"
+        enableUpdateByExample="false"
+        />
+
+        <table
+                tableName="selection"
         enableCountByExample="false"
         enableDeleteByExample="false"
         enableSelectByExample="false"

BIN
target/classes/group04/BasicNode$NodeIterator.class


BIN
target/classes/group04/BasicNode.class


+ 37 - 37
target/classes/myBatisMap/NodeinfoMapper.xml

@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="group04.myBatis.NodeinfoMapper" >
-  <resultMap id="BaseResultMap" type="group04.myBatis.Nodeinfo" >
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="WebsiteES.myBatis.NodeinfoMapper">
+  <resultMap id="BaseResultMap" type="WebsiteES.myBatis.Nodeinfo">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
-    <id column="id" property="id" jdbcType="BIGINT" />
-    <result column="prev_id" property="prevId" jdbcType="BIGINT" />
-    <result column="next_id" property="nextId" jdbcType="BIGINT" />
-    <result column="parent_id" property="parentId" jdbcType="BIGINT" />
-    <result column="child_id" property="childId" jdbcType="BIGINT" />
-    <result column="obj_type" property="objType" jdbcType="VARCHAR" />
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="prev_id" jdbcType="BIGINT" property="prevId" />
+    <result column="next_id" jdbcType="BIGINT" property="nextId" />
+    <result column="parent_id" jdbcType="BIGINT" property="parentId" />
+    <result column="child_id" jdbcType="BIGINT" property="childId" />
+    <result column="obj_type" jdbcType="VARCHAR" property="objType" />
   </resultMap>
-  <sql id="Base_Column_List" >
+  <sql id="Base_Column_List">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
     id, prev_id, next_id, parent_id, child_id, obj_type
   </sql>
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
@@ -30,7 +30,7 @@
     from nodeinfo
     where id = #{id,jdbcType=BIGINT}
   </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
@@ -38,7 +38,7 @@
     delete from nodeinfo
     where id = #{id,jdbcType=BIGINT}
   </delete>
-  <insert id="insert" parameterType="group04.myBatis.Nodeinfo" >
+  <insert id="insert" parameterType="WebsiteES.myBatis.Nodeinfo">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
@@ -50,79 +50,79 @@
       #{parentId,jdbcType=BIGINT}, #{childId,jdbcType=BIGINT}, #{objType,jdbcType=VARCHAR}
       )
   </insert>
-  <insert id="insertSelective" parameterType="group04.myBatis.Nodeinfo" >
+  <insert id="insertSelective" parameterType="WebsiteES.myBatis.Nodeinfo">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
     insert into nodeinfo
-    <trim prefix="(" suffix=")" suffixOverrides="," >
-      <if test="id != null" >
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
         id,
       </if>
-      <if test="prevId != null" >
+      <if test="prevId != null">
         prev_id,
       </if>
-      <if test="nextId != null" >
+      <if test="nextId != null">
         next_id,
       </if>
-      <if test="parentId != null" >
+      <if test="parentId != null">
         parent_id,
       </if>
-      <if test="childId != null" >
+      <if test="childId != null">
         child_id,
       </if>
-      <if test="objType != null" >
+      <if test="objType != null">
         obj_type,
       </if>
     </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides="," >
-      <if test="id != null" >
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
         #{id,jdbcType=BIGINT},
       </if>
-      <if test="prevId != null" >
+      <if test="prevId != null">
         #{prevId,jdbcType=BIGINT},
       </if>
-      <if test="nextId != null" >
+      <if test="nextId != null">
         #{nextId,jdbcType=BIGINT},
       </if>
-      <if test="parentId != null" >
+      <if test="parentId != null">
         #{parentId,jdbcType=BIGINT},
       </if>
-      <if test="childId != null" >
+      <if test="childId != null">
         #{childId,jdbcType=BIGINT},
       </if>
-      <if test="objType != null" >
+      <if test="objType != null">
         #{objType,jdbcType=VARCHAR},
       </if>
     </trim>
   </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="group04.myBatis.Nodeinfo" >
+  <update id="updateByPrimaryKeySelective" parameterType="WebsiteES.myBatis.Nodeinfo">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
     -->
     update nodeinfo
-    <set >
-      <if test="prevId != null" >
+    <set>
+      <if test="prevId != null">
         prev_id = #{prevId,jdbcType=BIGINT},
       </if>
-      <if test="nextId != null" >
+      <if test="nextId != null">
         next_id = #{nextId,jdbcType=BIGINT},
       </if>
-      <if test="parentId != null" >
+      <if test="parentId != null">
         parent_id = #{parentId,jdbcType=BIGINT},
       </if>
-      <if test="childId != null" >
+      <if test="childId != null">
         child_id = #{childId,jdbcType=BIGINT},
       </if>
-      <if test="objType != null" >
+      <if test="objType != null">
         obj_type = #{objType,jdbcType=VARCHAR},
       </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
-  <update id="updateByPrimaryKey" parameterType="group04.myBatis.Nodeinfo" >
+  <update id="updateByPrimaryKey" parameterType="WebsiteES.myBatis.Nodeinfo">
     <!--
       WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.