From e13bdef5975744d67e59c4cc42d399a57dab657c Mon Sep 17 00:00:00 2001 From: linlw Date: Sat, 18 Nov 2017 10:28:15 +0800 Subject: [PATCH 01/10] merge apijson for news & newsCategory --- APIJSON-Java-Server/APIJSON-Idea/pom.xml | 4 +- .../java/apijson/demo/server/Verifier.java | 12 +- .../apijson/demo/server/model/NetsbdNews.java | 146 ++++++++++++++++++ .../demo/server/model/NetsbdNewsCategory.java | 119 ++++++++++++++ .../biao/apijson/server/sql/SQLConfig.java | 6 +- .../src/main/resources/application.properties | 1 + 6 files changed, 278 insertions(+), 10 deletions(-) create mode 100644 APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/model/NetsbdNews.java create mode 100644 APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/model/NetsbdNewsCategory.java diff --git a/APIJSON-Java-Server/APIJSON-Idea/pom.xml b/APIJSON-Java-Server/APIJSON-Idea/pom.xml index 3e26692f0..fc2d89108 100755 --- a/APIJSON-Java-Server/APIJSON-Idea/pom.xml +++ b/APIJSON-Java-Server/APIJSON-Idea/pom.xml @@ -5,7 +5,7 @@ zuo.biao.apijson.server apijson - 0.0.1-SNAPSHOT + 0.0.3-SNAPSHOT jar APIJSON(Idea) @@ -21,7 +21,7 @@ UTF-8 UTF-8 - 1.7 + 1.8 diff --git a/APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/Verifier.java b/APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/Verifier.java index 2cdc02754..f42b69b92 100644 --- a/APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/Verifier.java +++ b/APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/Verifier.java @@ -30,16 +30,10 @@ import javax.activation.UnsupportedDataTypeException; import javax.servlet.http.HttpSession; +import apijson.demo.server.model.*; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import apijson.demo.server.model.BaseModel; -import apijson.demo.server.model.Comment; -import apijson.demo.server.model.Login; -import apijson.demo.server.model.Moment; -import apijson.demo.server.model.Privacy; -import apijson.demo.server.model.User; -import apijson.demo.server.model.Verify; import zuo.biao.apijson.JSON; import zuo.biao.apijson.JSONResponse; import zuo.biao.apijson.Log; @@ -88,6 +82,10 @@ public class Verifier { ACCESS_MAP.put(Comment.class.getSimpleName(), getAccessMap(Comment.class.getAnnotation(MethodAccess.class))); ACCESS_MAP.put(Verify.class.getSimpleName(), getAccessMap(Verify.class.getAnnotation(MethodAccess.class))); ACCESS_MAP.put(Login.class.getSimpleName(), getAccessMap(Login.class.getAnnotation(MethodAccess.class))); + + ACCESS_MAP.put(NetsbdNews.class.getSimpleName(), getAccessMap(NetsbdNews.class.getAnnotation(MethodAccess.class))); + ACCESS_MAP.put(NetsbdNewsCategory.class.getSimpleName(), getAccessMap(NetsbdNewsCategory.class.getAnnotation(MethodAccess.class))); + } /**获取权限Map,每种操作都只允许对应的角色 diff --git a/APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/model/NetsbdNews.java b/APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/model/NetsbdNews.java new file mode 100644 index 000000000..4200cde5e --- /dev/null +++ b/APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/model/NetsbdNews.java @@ -0,0 +1,146 @@ +/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.*/ + +package apijson.demo.server.model; + +import zuo.biao.apijson.MethodAccess; + +import static zuo.biao.apijson.RequestRole.ADMIN; +import static zuo.biao.apijson.RequestRole.UNKNOWN; + +/**用户类 + * @author Lemon + * @see + *
POST:post/register/user
+{
+    "User":{
+        "disallow":"id",
+        "necessary":"name,phone"
+    },
+    "necessary":"loginPassword,verify"
+}
+ * 
+ *
PUT:
+{
+    "User":{
+        "disallow":"phone",
+        "necessary":"id"
+    }
+}
+ * 
+ *
PUT(User.phone):put/user/phone
+{
+    "User":{
+        "disallow":"!",
+        "necessary":"id,phone"
+    },
+    "necessary":"loginPassword,verify"
+}
+ * 
+ */ +@MethodAccess( + GET = {UNKNOWN}, + POST = {UNKNOWN, ADMIN}, + DELETE = {ADMIN} + ) +public class NetsbdNews extends BaseModel { + private static final long serialVersionUID = 1L; + +// public static final int SEX_MAIL = 0; +// public static final int SEX_FEMALE = 1; +// public static final int SEX_UNKNOWN = 2; + +// private Integer sex; //性别 +// private String head; //头像url +// private String name; //姓名 +// private String tag; //标签 +// private List pictureList; //照片列表 +// private List contactIdList; //朋友列表 + +// private Long uid; //对应ims_user表中的uid,外键 + private Long cid; //对应ims_netsbd_news_category表中的id,外键 + private Long uid; //对应ims_users表中的id,外键 == 5 (0750kj) + private String title; + private String content; + private String tag; + private Integer ishide; + private Integer sort; + + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + public Long getCid() { + return cid; + } + + public void setCid(Long cid) { + this.cid = cid; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public Integer getIshide() { + return ishide; + } + + public void setIshide(Integer ishide) { + this.ishide = ishide; + } + + public Integer getSort() { + return sort; + } + + public void setSort(Integer sort) { + this.sort = sort; + } + + /**默认构造方法,JSON等解析时必须要有 + */ + public NetsbdNews() { + super(); + } + public NetsbdNews(long id) { + this(); + setId(id); + } + +} diff --git a/APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/model/NetsbdNewsCategory.java b/APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/model/NetsbdNewsCategory.java new file mode 100644 index 000000000..fc4af63d0 --- /dev/null +++ b/APIJSON-Java-Server/APIJSON-Idea/src/main/java/apijson/demo/server/model/NetsbdNewsCategory.java @@ -0,0 +1,119 @@ +/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON) + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License.*/ + +package apijson.demo.server.model; + +import zuo.biao.apijson.MethodAccess; + +import static zuo.biao.apijson.RequestRole.ADMIN; +import static zuo.biao.apijson.RequestRole.UNKNOWN; + +/**用户类 + * @author Lemon + * @see + *
POST:post/register/user
+{
+"User":{
+"disallow":"id",
+"necessary":"name,phone"
+},
+"necessary":"loginPassword,verify"
+}
+ * 
+ *
PUT:
+{
+"User":{
+"disallow":"phone",
+"necessary":"id"
+}
+}
+ * 
+ *
PUT(User.phone):put/user/phone
+{
+"User":{
+"disallow":"!",
+"necessary":"id,phone"
+},
+"necessary":"loginPassword,verify"
+}
+ * 
+ */ +@MethodAccess( + GET = {UNKNOWN}, + POST = {UNKNOWN, ADMIN}, + DELETE = {ADMIN} +) +public class NetsbdNewsCategory extends BaseModel { + private static final long serialVersionUID = 1L; + +// public static final int SEX_MAIL = 0; +// public static final int SEX_FEMALE = 1; +// public static final int SEX_UNKNOWN = 2; + +// private Integer sex; //性别 +// private String head; //头像url +// private String name; //姓名 +// private String tag; //标签 +// private List pictureList; //照片列表 +// private List contactIdList; //朋友列表 + + // private Long uid; //对应ims_user表中的uid,外键 + private Long uid; //对应ims_users表中的id,外键 == 5 (0750kj) + private String name; + private Integer ishide; + private Integer sort; + + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getIshide() { + return ishide; + } + + public void setIshide(Integer ishide) { + this.ishide = ishide; + } + + public Integer getSort() { + return sort; + } + + public void setSort(Integer sort) { + this.sort = sort; + } + + /**默认构造方法,JSON等解析时必须要有 + */ + public NetsbdNewsCategory() { + super(); + } + public NetsbdNewsCategory(long id) { + this(); + setId(id); + } + +} diff --git a/APIJSON-Java-Server/APIJSON-Idea/src/main/java/zuo/biao/apijson/server/sql/SQLConfig.java b/APIJSON-Java-Server/APIJSON-Idea/src/main/java/zuo/biao/apijson/server/sql/SQLConfig.java index 8e344c090..6a5e146b3 100755 --- a/APIJSON-Java-Server/APIJSON-Idea/src/main/java/zuo/biao/apijson/server/sql/SQLConfig.java +++ b/APIJSON-Java-Server/APIJSON-Idea/src/main/java/zuo/biao/apijson/server/sql/SQLConfig.java @@ -52,8 +52,10 @@ import com.alibaba.fastjson.annotation.JSONField; import apijson.demo.server.model.BaseModel; -import apijson.demo.server.model.Privacy; import apijson.demo.server.model.User; +import apijson.demo.server.model.Privacy; +import apijson.demo.server.model.NetsbdNews; +import apijson.demo.server.model.NetsbdNewsCategory; import zuo.biao.apijson.Log; import zuo.biao.apijson.RequestMethod; import zuo.biao.apijson.RequestRole; @@ -115,6 +117,8 @@ public class SQLConfig { TABLE_KEY_MAP.put(User.class.getSimpleName(), "apijson_user"); TABLE_KEY_MAP.put(Privacy.class.getSimpleName(), "apijson_privacy"); + TABLE_KEY_MAP.put(NetsbdNews.class.getSimpleName(), "ims_netsbd_news"); + TABLE_KEY_MAP.put(NetsbdNewsCategory.class.getSimpleName(), "ims_netsbd_news_category"); } diff --git a/APIJSON-Java-Server/APIJSON-Idea/src/main/resources/application.properties b/APIJSON-Java-Server/APIJSON-Idea/src/main/resources/application.properties index e69de29bb..78ec26f78 100755 --- a/APIJSON-Java-Server/APIJSON-Idea/src/main/resources/application.properties +++ b/APIJSON-Java-Server/APIJSON-Idea/src/main/resources/application.properties @@ -0,0 +1 @@ +server.port=8118 \ No newline at end of file From 3e37a82e7c279708052066c57d33323a8e81383f Mon Sep 17 00:00:00 2001 From: linlw Date: Sat, 18 Nov 2017 10:48:15 +0800 Subject: [PATCH 02/10] Merge with my APIJSON news & newsCategory --- .idea/vcs.xml | 6 ++ .idea/workspace.xml | 252 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 258 insertions(+) create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..35eb1ddfb --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 000000000..19f416fa9 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,252 @@ + + + + + + + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +