From 0ed3dace699a8f696a6b2d5037a60066fdef8eb6 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期四, 31 十月 2019 17:35:28 +0800
Subject: [PATCH] add dbperson move and copy

---
 controllers/dbtableperson.go |   69 +++++++++++++++++++++++++++++++---
 1 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/controllers/dbtableperson.go b/controllers/dbtableperson.go
index 902e998..91c3550 100644
--- a/controllers/dbtableperson.go
+++ b/controllers/dbtableperson.go
@@ -508,7 +508,7 @@
 // @Success 200 {string} json "{"code":200, msg:"鐩綍缁撴瀯鏁版嵁", success:true}"
 // @Failure 500 {string} json "{"code":500,  msg:"杩斿洖閿欒淇℃伅", success:false}"
 // @Router /data/api-v/dbperson/joinDbTable [POST]
-func (sc *DbPersonController) JoinDbTable(c *gin.Context) {
+func (dbc *DbPersonController) JoinDbTable(c *gin.Context) {
 	var reqBody JoinDbTVo
 	c.BindJSON(&reqBody)
 	if reqBody.CaptureId == "" || len(reqBody.TableIds) ==0 {
@@ -547,10 +547,67 @@
 }
 
 type DbtSearch struct {
-	TableId string `json:"tableId"`
-	OrderName string `json:"orderName"`
-	OrderType string `json:"orderType"`
+	TableId string 		`json:"tableId"`
+	OrderName string 	`json:"orderName"`
+	OrderType string 	`json:"orderType"`
 	ContentValue string `json:"contentValue"`
-	Page int `json:"page"`
-	Size int `json:"size"`
+	Page int 			`json:"page"`
+	Size int 			`json:"size"`
 }
+
+type DbPersonMove struct {
+	PersonId string `json:"personId"`
+	TableIds []string `json:"tableIds"`
+}
+
+// @Security ApiKeyAuth
+// @Summary 浜哄憳绉诲姩
+// @Description 浜哄憳绉诲姩
+// @Accept  json
+// @Produce json
+// @Tags dbperson 搴曞簱浜哄憳
+// @Param obj body controllers.DbPersonMove true "绉诲姩鍙傛暟"
+// @Success 200 {string} json "{"code":200, msg:"", success:true}"
+// @Failure 500 {string} json "{"code":500, msg:"", success:false}"
+// @Router /data/api-v/dbperson/move [POST]
+func (dbc *DbPersonController) Move(c *gin.Context) {
+	var reqBody DbPersonMove
+	c.BindJSON(&reqBody)
+	if reqBody.PersonId == "" || len(reqBody.TableIds) == 0 {
+		util.ResponseFormat(c,code.RequestParamError, "鍙傛暟鏈夎")
+		return
+	}
+	var dbpApi dbapi.DbPersonApi
+	b,d := dbpApi.Move(reqBody.PersonId, reqBody.TableIds)
+	if b {
+		util.ResponseFormat(c,code.Success,d)
+	} else {
+		util.ResponseFormat(c,code.ComError,"")
+	}
+}
+
+// @Security ApiKeyAuth
+// @Summary 浜哄憳澶嶅埗
+// @Description 浜哄憳澶嶅埗
+// @Accept  json
+// @Produce json
+// @Tags dbperson 搴曞簱浜哄憳
+// @Param obj body controllers.DbPersonMove true "澶嶅埗鍙傛暟"
+// @Success 200 {string} json "{"code":200, msg:"", success:true}"
+// @Failure 500 {string} json "{"code":500, msg:"", success:false}"
+// @Router /data/api-v/dbperson/copy [POST]
+func (dbc *DbPersonController) Copy(c *gin.Context) {
+	var reqBody DbPersonMove
+	c.BindJSON(&reqBody)
+	if reqBody.PersonId == "" || len(reqBody.TableIds) == 0 {
+		util.ResponseFormat(c,code.RequestParamError, "鍙傛暟鏈夎")
+		return
+	}
+	var dbpApi dbapi.DbPersonApi
+	b,d := dbpApi.Copy(reqBody.PersonId, reqBody.TableIds)
+	if b {
+		util.ResponseFormat(c,code.Success,d)
+	} else {
+		util.ResponseFormat(c,code.ComError,"")
+	}
+}
\ No newline at end of file

--
Gitblit v1.8.0