Pārlūkot izejas kodu

添加可见列接口

huangyh 6 gadi atpakaļ
vecāks
revīzija
6efaa2b05e

+ 89 - 0
controllers/partial/SystemController.go

@@ -2454,6 +2454,95 @@ func System_GetOptionsetByCode(c *entitys.CtrlContext) {
 	}
 }
 
+// _AddTableColUser
+// @Title _AddTableColUser
+// @Description 添加用户可见列
+// @Param	      false  "用户可见列"
+// @Success 200 {object} Account
+// @Failure 403 :id is empty
+func System_AddTableColUser(c *entitys.CtrlContext) {
+	var paramObj0 models.SysTableColUser
+	c.Ctx.BindJSON(&paramObj0)
+
+	user_id := c.Ctx.GetString("user_id")
+
+	// 查询用户是否有此可见列数据
+	var tabelColUser sysmodel.SysTableColUser
+	exit, err := c.Db.Where("user_id = ? and code = ?", user_id, paramObj0.Code).Get(&tabelColUser)
+	if err != nil {
+		c.Ctx.JSON(500, sysmodel.SysReturn{500, err.Error(), nil})
+		return
+	}
+
+	// 如果存在,更新,不存在插入
+	if exit {
+		tabelColUser.Value = paramObj0.Value
+		_, err = c.Db.Update(&tabelColUser)
+		if err == nil {
+			c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
+		} else {
+			c.Ctx.JSON(500, sysmodel.SysReturn{500, err.Error(), nil})
+		}
+		return
+	}
+
+	paramObj0.Id = sysutils.NewUUID()
+	paramObj0.UserId = user_id
+	paramObj0.DelFlag = 0
+	paramObj0.CreateTime = sysmodel.NowLocal()
+	paramObj0.LastUpdateTime = time.Now().UnixNano()
+	paramObj0.CreateBy = user_id
+	paramObj0.LastUpdateBy = user_id
+
+	_, err = c.Db.Insert(&paramObj0)
+
+	if err == nil {
+		c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
+	} else {
+		c.Ctx.JSON(500, sysmodel.SysReturn{500, err.Error(), nil})
+	}
+}
+
+// _UpdateTableColUser
+// @Title _UpdateTableColUser
+// @Description 修改用户可见列
+// @Param	      false  "用户可见列"
+// @Success 200 {object} Account
+// @Failure 403 :id is empty
+func System_UpdateTableColUser(c *entitys.CtrlContext) {
+	var paramObj0 models.SysTableColUser
+	c.Ctx.BindJSON(&paramObj0)
+	ret := __none_func_system__(paramObj0)
+	if ret {
+		c.Ctx.JSON(200, sysmodel.SysReturn{200, "", nil})
+	} else {
+		c.Ctx.JSON(500, sysmodel.SysReturn{500, "", nil})
+	}
+}
+
+// _FindTableColUserpage
+// @Title _FindTableColUserpage
+// @Description 分页获取用户可见列
+// @Success 200 {object} Account
+// @Failure 403 :id is empty
+func System_FindTableColUserpage(c *entitys.CtrlContext) {
+
+	page, _ := strconv.Atoi(c.Ctx.DefaultQuery("page", "1"))
+	rows, _ := strconv.Atoi(c.Ctx.DefaultQuery("rows", "10"))
+
+	code := c.Ctx.DefaultQuery("code", "")
+	user_id := c.Ctx.DefaultQuery("user_id", "")
+
+	paramMap_i_t := map[string]interface{}{"page": page, "rows": rows, "code": code, "user_id": user_id}
+	result, err := sysutils.PageSearch(c.Db, "system", "find_table_col_userpage", "sys_table_col_user", paramMap_i_t)
+	if err == nil {
+		c.Ctx.JSON(200, sysmodel.SysReturn{200, "", result})
+	} else {
+		c.Ctx.JSON(500, sysmodel.SysReturn{500, err.Error(), nil})
+	}
+
+}
+
 // _AddDataPermission
 // @Title _AddDataPermission
 // @Description 添加数据权限

+ 32 - 0
light-apiengine.xml

@@ -532,6 +532,23 @@
                     <failure ref="$sys_return"></failure>
                 </return>
             </api>
+            <api name="add_table_col_user" desc="添加用户可见列" method="post,get,put">
+                <param name=""  ref="$sys_table_col_user" desc="用户可见列"/>
+                <return>
+                    <success ref="$sys_return"></success>
+                    <success ref="$sys_return"></success>
+                    <failure ref="$sys_return"></failure>
+                </return>
+            </api>
+            <api name="update_table_col_user" desc="修改用户可见列" method="post,get,put">
+                <param name=""  ref="$sys_table_col_user" desc="用户可见列"/>
+                <return>
+                    <success ref="$sys_return"></success>
+                    <failure ref="$sys_return"></failure>
+                </return>
+            </api>
+            <api name="find_table_col_userpage" desc="分页获取用户可见列" function="page" table="sys_table_col_user" method="get,post" >
+            </api>
             <api name="add_data_permission" desc="添加数据权限" method="post,get,put">
                 <param name="" ref="$sys_data_permission" type="string" desc="数据权限"/>
                 <return>
@@ -1060,6 +1077,21 @@
             <column isNull="false" name="last_update_time" caption="最后更新时间" type="int64" />
             <column isNull="false" name="del_flag" caption="是否删除 1:删除   0:正常" type="int32"/>
         </table>
+        <table name="sys_table_col_user" desc="列表用户可见列">
+            <column isNull="false" isPK="true" name="id" caption="主键" dbtype="varchar(36)"
+                    type="string" size="36">
+                <auto value="$uuid" update="false">
+                </auto>
+            </column>
+            <column isNull="false" name="code" caption="编码" type="string" size="200" dbtype="varchar(200)"/>
+            <column isNull="false" name="value" caption="值" type="string" dbtype="text"/>
+            <column isNull="false" name="user_id" caption="用户id" type="string" size="36" dbtype="varchar(36)"/>
+            <column isNull="false" name="create_by" caption="创建人" type="string" size="36" dbtype="varchar(36)"/>
+            <column isNull="false" name="create_time" caption="创建时间" type="local_time" />
+            <column isNull="false" name="last_update_by" caption="最后更新人" type="string" size="36" dbtype="varchar(36)"/>
+            <column isNull="false" name="last_update_time" caption="最后更新时间" type="int64" />
+            <column isNull="false" name="del_flag" caption="是否删除 1:删除   0:正常" type="int32"/>
+        </table>
         <table name="sys_app_fun" desc="APP功能表">
             <column isNull="false" isPK="true" name="id" caption="主键" dbtype="varchar(36)"
                     type="string" size="36">

+ 13 - 0
sqlconfig/system_controller/system_find_table_col_userpage_count.tpl

@@ -0,0 +1,13 @@
+
+select
+    count(*) records
+from
+    sys_table_col_user
+where
+	del_flag = 0
+	{{if ne .code ""}}
+        and code like '%{{.code}}%'
+    {{end}}
+    {{if ne .user_id ""}}
+        and user_id like '%{{.user_id}}%'
+    {{end}}

+ 14 - 0
sqlconfig/system_controller/system_find_table_col_userpage_select.tpl

@@ -0,0 +1,14 @@
+
+select
+    sys_table_col_user.*
+from
+    sys_table_col_user
+where
+    del_flag = 0
+    {{if ne .code ""}}
+        and code like '%{{.code}}%'
+    {{end}}
+    {{if ne .user_id ""}}
+        and user_id like '%{{.user_id}}%'
+    {{end}}
+LIMIT {{.rows}} OFFSET {{.offset}}