update
This commit is contained in:
1 parent
315475c38f
commit
119facec02
15 files changed
+64
-105
No files matched your search
+29
-1
@@ -34,6 +34,35 @@ type RoleMenuPost struct {
|
||||
RoleMenu []models.RoleMenu
|
||||
}
|
||||
|
||||
func InsertRoleMenu(c *gin.Context) {
|
||||
//roleId := c.Request.FormValue("role_id")
|
||||
//menuId := c.Request.FormValue("menu_id")
|
||||
//menus := strings.Split(menuId, ",")
|
||||
//fmt.Println(menus)
|
||||
//var t models.RoleMenu
|
||||
//_,err := t.DeleteRoleMenu(roleId)
|
||||
//if err != nil {
|
||||
// c.JSON(http.StatusOK, gin.H{
|
||||
// "code": -1,
|
||||
// "message": "添加失败1",
|
||||
// })
|
||||
// return
|
||||
//}
|
||||
//_, err2 := t.Insert(roleId, menus)
|
||||
//if err2 != nil {
|
||||
// c.JSON(http.StatusOK, gin.H{
|
||||
// "code": -1,
|
||||
// "message": "添加失败2",
|
||||
// })
|
||||
// return
|
||||
//}
|
||||
var res models.Response
|
||||
res.Msg = "添加成功"
|
||||
c.JSON(http.StatusOK, res.ReturnOK())
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
// @Summary 删除用户菜单数据
|
||||
// @Description 删除数据
|
||||
// @Tags 角色菜单
|
||||
@@ -43,7 +72,6 @@ type RoleMenuPost struct {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||
// @Router /api/v1/rolemenu/{id} [delete]
|
||||
func DeleteRoleMenu(c *gin.Context) {
|
||||
fmt.Println("!!!!!!!!!!!!!!")
|
||||
var t models.RoleMenu
|
||||
id := c.Param("id")
|
||||
menuId := c.Request.FormValue("menu_id")
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/shopspring/decimal"
|
||||
orm "go-admin/database"
|
||||
_ "log"
|
||||
"time"
|
||||
)
|
||||
|
||||
type AccountRecords struct {
|
||||
Ids []int `json:"ids"`
|
||||
}
|
||||
|
||||
type Accountrecord struct {
|
||||
Id int64 `gorm:"column:id" json:"id"`
|
||||
//AccountType int `gorm:"column:account_type" json:"account_type"`
|
||||
//Type int `gorm:"column:type" json:"type"`
|
||||
//OmId int64 `gorm:"column:om_id" json:"om_id"`
|
||||
//StId int64 `gorm:"column:st_id" json:"st_id"`
|
||||
//ContractId int64 `gorm:"column:contract_id" json:"contract_id"`
|
||||
//FeeDepartmentId int `gorm:"column:fee_department_id" json:"fee_department_id"`
|
||||
//FeeDepartment string `gorm:"column:fee_department" json:"fee_department"`
|
||||
//Payer string `gorm:"column:payer" json:"payer"`
|
||||
//PayerPhone string `gorm:"column:payer_phone" json:"payer_phone"`
|
||||
//FeeType int `gorm:"column:fee_type" json:"fee_type"`
|
||||
//OgFeeAmt decimal.Decimal `gorm:"column:og_fee_amt" json:"og_fee_amt"`
|
||||
//FeeAmt decimal.Decimal `gorm:"column:fee_amt" json:"fee_amt"`
|
||||
LeftAmt decimal.Decimal `gorm:"column:left_amt" json:"left_amt"`
|
||||
Status string `gorm:"column:status" json:"status"`
|
||||
Description string `gorm:"column:description" json:"description"`
|
||||
Certificate string `gorm:"column:certificate" json:"certificate"`
|
||||
FeeBeginTime string `gorm:"column:fee_begin_time" json:"fee_begin_time"`
|
||||
FeeEndTime string `gorm:"column:fee_end_time" json:"fee_end_time"`
|
||||
PayTime string `gorm:"column:pay_time" json:"pay_time"`
|
||||
ReceiptTime string `gorm:"column:receipt_time" json:"receipt_time"`
|
||||
PayType int `gorm:"column:pay_type" json:"pay_type"`
|
||||
BankOrderNo string `gorm:"column:bank_order_no" json:"bank_order_no"`
|
||||
BillNo string `gorm:"column:bill_no" json:"bill_no"`
|
||||
Appendix string `gorm:"column:appendix" json:"appendix"`
|
||||
TransId int64 `gorm:"column:trans_id" json:"trans_id"`
|
||||
Channel int `gorm:"column:channel" json:"channel"`
|
||||
DelFlag string `gorm:"column:del_flag" json:"del_flag"`
|
||||
OverdueDays int `gorm:"column:overdue_days" json:"overdue_days"`
|
||||
ParentId int64 `gorm:"column:parent_id" json:"parent_id"`
|
||||
CreateTime string `gorm:"column:create_time" json:"create_time"`
|
||||
Creator string `gorm:"column:creator" json:"creator"`
|
||||
CreatorId int `gorm:"column:creator_id" json:"creator_id"`
|
||||
UpdateTime string `gorm:"column:update_time" json:"update_time"`
|
||||
Updater string `gorm:"column:updater" json:"updater"`
|
||||
UpdaterId int `gorm:"column:updater_id" json:"updater_id"`
|
||||
Remark string `gorm:"column:remark" json:"remark"`
|
||||
}
|
||||
|
||||
func (data *Accountrecord) Get() (dataList Accountrecord, err error) {
|
||||
if err = orm.Eloquent.Table("tb_account_record").First(&dataList, data.Id).Error; err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (data *Accountrecord) GetList(ids []int) (dataList []Accountrecord, err error) {
|
||||
if err = orm.Eloquent.Table("tb_account_record").Where("id IN (?)", ids).Find(&dataList).Error; err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (data *Accountrecord) BatchUpdate(ids []int, maps map[string]interface{}) (err error) {
|
||||
data.UpdateTime = time.Now().String()
|
||||
if err = orm.Eloquent.Table("tb_account_record").Where("id IN (?)", ids).Updates(maps).Error; err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
+3
-3
@@ -3,7 +3,6 @@ package models
|
||||
import (
|
||||
orm "go-admin/database"
|
||||
"go-admin/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@@ -25,7 +24,7 @@ type Config struct {
|
||||
CreateTime string `json:"createTime" gorm:"column:create_time"`
|
||||
UpdateBy string `json:"updateBy" gorm:"column:update_by"`
|
||||
UpdateTime string `json:"updateTime" gorm:"column:update_time"`
|
||||
DataScope string `json:"dataScope" gorm:"_"`
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
Params string `json:"params" gorm:"column:params"`
|
||||
IsDel string `json:"isDel" gorm:"column:is_del"`
|
||||
}
|
||||
@@ -34,7 +33,8 @@ type Config struct {
|
||||
func (e *Config) Create() (Config, error) {
|
||||
var doc Config
|
||||
doc.IsDel = "0"
|
||||
e.CreateTime = time.Now().String()
|
||||
e.CreateTime = utils.GetCurrntTime()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
result := orm.Eloquent.Table("sys_config").Create(&e)
|
||||
if result.Error != nil {
|
||||
err := result.Error
|
||||
|
||||
+2
-1
@@ -36,7 +36,7 @@ type Dept struct {
|
||||
CreateTime string `json:"createTime" gorm:"column:create_time"`
|
||||
UpdateBy string `json:"updateBy" gorm:"column:update_by"`
|
||||
UpdateTime string `json:"updateTime" gorm:"column:update_time"`
|
||||
DataScope string `json:"dataScope" gorm:"_"`
|
||||
DataScope string `json:"dataScope" gorm:"-"`
|
||||
Params string `json:"params" gorm:"column:params"`
|
||||
IsDel string `json:"isDel" gorm:"column:is_del"`
|
||||
|
||||
@@ -52,6 +52,7 @@ type DeptLable struct {
|
||||
func (e *Dept) Create() (Dept, error) {
|
||||
var doc Dept
|
||||
e.CreateTime = utils.GetCurrntTime()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
e.IsDel = "0"
|
||||
result := orm.Eloquent.Table("sys_dept").Create(&e)
|
||||
if result.Error != nil {
|
||||
|
||||
+3
-3
@@ -3,7 +3,6 @@ package models
|
||||
import (
|
||||
orm "go-admin/database"
|
||||
"go-admin/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
type DictData struct {
|
||||
@@ -42,7 +41,8 @@ type DictData struct {
|
||||
|
||||
func (e *DictData) Create() (DictData, error) {
|
||||
var doc DictData
|
||||
e.CreateTime = time.Now().String()
|
||||
e.CreateTime = utils.GetCurrntTime()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
result := orm.Eloquent.Table("sys_dict_data").Create(&e)
|
||||
if result.Error != nil {
|
||||
err := result.Error
|
||||
@@ -124,7 +124,7 @@ func (e *DictData) GetPage(pageSize int, pageIndex int) ([]DictData, int32, erro
|
||||
}
|
||||
|
||||
func (e *DictData) Update(id int64) (update DictData, err error) {
|
||||
e.UpdateTime = time.Now().String()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
if err = orm.Eloquent.Table("sys_dict_data").Where("dictCode = ?", id).First(&update).Error; err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
+4
-4
@@ -3,7 +3,6 @@ package models
|
||||
import (
|
||||
orm "go-admin/database"
|
||||
"go-admin/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
type DictType struct {
|
||||
@@ -15,7 +14,7 @@ type DictType struct {
|
||||
//状态
|
||||
Status string `gorm:"column:status" json:"status"`
|
||||
|
||||
DataScope string `gorm:"_" json:"dataScope"`
|
||||
DataScope string `gorm:"-" json:"dataScope"`
|
||||
|
||||
Params string `gorm:"column:params" json:"params"`
|
||||
//创建者
|
||||
@@ -33,7 +32,8 @@ type DictType struct {
|
||||
|
||||
func (e *DictType) Create() (DictType, error) {
|
||||
var doc DictType
|
||||
e.CreateTime = time.Now().String()
|
||||
e.CreateTime = utils.GetCurrntTime()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
result := orm.Eloquent.Table("sys_dict_type").Create(&e)
|
||||
if result.Error != nil {
|
||||
err := result.Error
|
||||
@@ -109,7 +109,7 @@ func (e *DictType) GetPage(pageSize int, pageIndex int) ([]DictType, int32, erro
|
||||
}
|
||||
|
||||
func (e *DictType) Update(id int64) (update DictType, err error) {
|
||||
e.UpdateTime = time.Now().String()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
if err = orm.Eloquent.Table("sys_dict_type").First(&update, id).Error; err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
+3
-3
@@ -3,7 +3,6 @@ package models
|
||||
import (
|
||||
orm "go-admin/database"
|
||||
"go-admin/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
type LoginLog struct {
|
||||
@@ -87,6 +86,7 @@ func (e *LoginLog) GetPage(pageSize int, pageIndex int) ([]LoginLog, int32, erro
|
||||
func (e *LoginLog) Create() (LoginLog, error) {
|
||||
var doc LoginLog
|
||||
e.CreateTime = utils.GetCurrntTime()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
e.CreateBy = "0"
|
||||
e.UpdateBy = "0"
|
||||
result := orm.Eloquent.Table("sys_loginlog").Create(&e)
|
||||
@@ -99,7 +99,7 @@ func (e *LoginLog) Create() (LoginLog, error) {
|
||||
}
|
||||
|
||||
func (e *LoginLog) Update(id int64) (update LoginLog, err error) {
|
||||
e.UpdateTime = time.Now().String()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
|
||||
if err = orm.Eloquent.Table("sys_loginlog").First(&update, id).Error; err != nil {
|
||||
return
|
||||
@@ -114,7 +114,7 @@ func (e *LoginLog) Update(id int64) (update LoginLog, err error) {
|
||||
}
|
||||
|
||||
func (e *LoginLog) BatchDelete(id []int64) (Result bool, err error) {
|
||||
if err = orm.Eloquent.Table("sys_loginlog").Where("is_del=0 and infoId in (?)", id).Update(map[string]interface{}{"is_del": "1", "update_time": time.Now(), "update_by": e.UpdateBy}).Error; err != nil {
|
||||
if err = orm.Eloquent.Table("sys_loginlog").Where("is_del=0 and infoId in (?)", id).Update(map[string]interface{}{"is_del": "1", "update_time": utils.GetCurrntTime(), "update_by": e.UpdateBy}).Error; err != nil {
|
||||
return
|
||||
}
|
||||
Result = true
|
||||
|
||||
+2
-2
@@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
orm "go-admin/database"
|
||||
"go-admin/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Menu struct {
|
||||
@@ -272,6 +271,7 @@ func (e *Menu) GetPage() (Menus []Menu, err error) {
|
||||
|
||||
func (e *Menu) Create() (id int64, err error) {
|
||||
e.CreateTime = utils.GetCurrntTime()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
e.IsDel = "0"
|
||||
result := orm.Eloquent.Table("sys_menu").Create(&e)
|
||||
if result.Error != nil {
|
||||
@@ -303,7 +303,7 @@ func InitPaths(menu *Menu) (err error) {
|
||||
}
|
||||
|
||||
func (e *Menu) Update(id int64) (update Menu, err error) {
|
||||
e.UpdateTime = time.Now().String()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
if err = orm.Eloquent.Table("sys_menu").First(&update, id).Error; err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ func (e *SysOperLog) GetPage(pageSize int, pageIndex int) ([]SysOperLog, int32,
|
||||
func (e *SysOperLog) Create() (SysOperLog, error) {
|
||||
var doc SysOperLog
|
||||
e.CreateTime = utils.GetCurrntTime()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
e.CreateBy = "0"
|
||||
e.UpdateBy = "0"
|
||||
result := orm.Eloquent.Table("sys_operlog").Create(&e)
|
||||
|
||||
@@ -45,6 +45,7 @@ type Post struct {
|
||||
func (e *Post) Create() (Post, error) {
|
||||
var doc Post
|
||||
e.CreateTime = utils.GetCurrntTime()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
result := orm.Eloquent.Table("sys_post").Create(&e)
|
||||
if result.Error != nil {
|
||||
err := result.Error
|
||||
|
||||
+4
-5
@@ -3,7 +3,6 @@ package models
|
||||
import (
|
||||
orm "go-admin/database"
|
||||
"go-admin/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SysRole struct {
|
||||
@@ -29,7 +28,7 @@ type SysRole struct {
|
||||
//备注
|
||||
Remark string `gorm:"column:remark" json:"remark"`
|
||||
Params string `gorm:"column:params" json:"params"`
|
||||
DataScope string `gorm:"_" json:"dataScope"`
|
||||
DataScope string `gorm:"-" json:"dataScope"`
|
||||
IsDel string `gorm:"column:is_del" json:"isDel"`
|
||||
|
||||
Admin bool `gorm:"column:admin" json:"admin"`
|
||||
@@ -117,9 +116,9 @@ func (role *SysRole) GetRoleMeunId() ([]int64, error) {
|
||||
}
|
||||
|
||||
func (role *SysRole) Insert() (id int64, err error) {
|
||||
role.CreateTime = time.Now().Format("2006/01/02 15:04:05")
|
||||
role.CreateTime = utils.GetCurrntTime()
|
||||
role.UpdateBy = ""
|
||||
role.UpdateTime = time.Now().Format("2006/01/02 15:04:05")
|
||||
role.UpdateTime = utils.GetCurrntTime()
|
||||
role.IsDel = "0"
|
||||
result := orm.Eloquent.Table("sys_role").Create(&role)
|
||||
if result.Error != nil {
|
||||
@@ -150,7 +149,7 @@ func (role *SysRole) GetRoleDeptId() ([]int64, error) {
|
||||
|
||||
//修改
|
||||
func (role *SysRole) Update(id int64) (update SysRole, err error) {
|
||||
role.UpdateTime = time.Now().Format("2006/01/02 15:04:05.9999")
|
||||
role.UpdateTime = utils.GetCurrntTime()
|
||||
if err = orm.Eloquent.Table("sys_role").First(&update, id).Error; err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ type SysUserB struct {
|
||||
Remark string `gorm:"column:remark" json:"remark"`
|
||||
Params string `gorm:"column:params" json:"params"`
|
||||
Status string `gorm:"column:status" json:"status"`
|
||||
DataScope string `gorm:"_" json:"dataScope"`
|
||||
DataScope string `gorm:"-" json:"dataScope"`
|
||||
IsDel string `gorm:"column:is_del" json:"isDel"`
|
||||
}
|
||||
|
||||
|
||||
@@ -2,13 +2,11 @@ package tools
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"go-admin/config"
|
||||
orm "go-admin/database"
|
||||
)
|
||||
|
||||
type DBColumns struct {
|
||||
//select COLUMN_NAME,COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,CHARACTER_SET_NAME,COLUMN_TYPE,COLUMN_KEY,EXTRA,COLUMN_COMMENT
|
||||
//from information_schema.`COLUMNS` where table_schema='test1db' and TABLE_NAME='sys_config'
|
||||
|
||||
TableSchema string `gorm:"column:TABLE_SCHEMA" json:"tableSchema"`
|
||||
TableName string `gorm:"column:TABLE_NAME" json:"tableName"`
|
||||
ColumnName string `gorm:"column:COLUMN_NAME" json:"columnName"`
|
||||
@@ -27,7 +25,7 @@ func (e *DBColumns) GetPage(pageSize int, pageIndex int) ([]DBColumns, int32, er
|
||||
var doc []DBColumns
|
||||
|
||||
table := orm.Eloquent.Select("*").Table("information_schema.`COLUMNS`")
|
||||
table = table.Where("table_schema='test1db'")
|
||||
table = table.Where("table_schema= ? ", config.DatabaseConfig.Database)
|
||||
|
||||
if e.TableName != "" {
|
||||
return nil, 0, errors.New("table name cannot be empty!")
|
||||
@@ -48,7 +46,7 @@ func (e *DBColumns) GetList() ([]DBColumns, error) {
|
||||
var doc []DBColumns
|
||||
|
||||
table := orm.Eloquent.Select("*").Table("information_schema.columns")
|
||||
table = table.Where("table_schema='test1db'")
|
||||
table = table.Where("table_schema= ? ", config.DatabaseConfig.Database)
|
||||
|
||||
if e.TableName == "" {
|
||||
return nil, errors.New("table name cannot be empty!")
|
||||
|
||||
@@ -2,6 +2,7 @@ package tools
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"go-admin/config"
|
||||
orm "go-admin/database"
|
||||
)
|
||||
|
||||
@@ -19,7 +20,7 @@ func (e *DBTables) GetPage(pageSize int, pageIndex int) ([]DBTables, int32, erro
|
||||
var doc []DBTables
|
||||
|
||||
table := orm.Eloquent.Select("*").Table("information_schema.tables")
|
||||
table = table.Where("table_schema='test1db'")
|
||||
table = table.Where("table_schema= ? ", config.DatabaseConfig.Database)
|
||||
|
||||
if e.TableName != "" {
|
||||
table = table.Where("TABLE_NAME = ?", e.TableName)
|
||||
@@ -38,7 +39,7 @@ func (e *DBTables) Get() (DBTables, error) {
|
||||
var doc DBTables
|
||||
|
||||
table := orm.Eloquent.Select("*").Table("information_schema.tables")
|
||||
table = table.Where("table_schema='test1db'")
|
||||
table = table.Where("table_schema= ? ", config.DatabaseConfig.Database)
|
||||
if e.TableName == "" {
|
||||
return doc, errors.New("table name cannot be empty!")
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ type SysTables struct {
|
||||
//功能作者
|
||||
FunctionAuthor string `gorm:"column:function_author" json:"functionAuthor"`
|
||||
PkColumn string `gorm:"column:pk_column" json:"pkColumn"`
|
||||
PkGoField string `gorm:"column:pk_go_field" json:"pkGoField"`
|
||||
PkJsonField string `gorm:"column:pk_json_field" json:"pkJsonField"`
|
||||
Options string `gorm:"column:options" json:"options"`
|
||||
TreeCode string `gorm:"column:tree_code" json:"treeCode"`
|
||||
TreeParentCode string `gorm:"column:tree_parent_code" json:"treeParentCode"`
|
||||
@@ -33,7 +35,8 @@ type SysTables struct {
|
||||
Tree bool `gorm:"column:tree" json:"tree"`
|
||||
Crud bool `gorm:"column:crud" json:"crud"`
|
||||
Remark string `gorm:"column:remark" json:"remark"`
|
||||
IsLogicalDelete bool `gorm:"column:is_logical_delete" json:"isLogicalDelete"`
|
||||
IsLogicalDelete string `gorm:"column:is_logical_delete" json:"isLogicalDelete"`
|
||||
LogicalDelete bool `gorm:"column:logical_delete" json:"logicalDelete"`
|
||||
LogicalDeleteColumn string `gorm:"column:logical_delete_column" json:"logicalDeleteColumn"`
|
||||
CreateBy string `gorm:"column:create_by" json:"createBy"`
|
||||
CreateTime string `gorm:"column:create_time" json:"createTime"`
|
||||
@@ -101,6 +104,7 @@ func (e *SysTables) Get() (SysTables, error) {
|
||||
func (e *SysTables) Create() (SysTables, error) {
|
||||
var doc SysTables
|
||||
e.CreateTime = utils.GetCurrntTime()
|
||||
e.UpdateTime = utils.GetCurrntTime()
|
||||
result := orm.Eloquent.Table("sys_tables").Create(&e)
|
||||
if result.Error != nil {
|
||||
err := result.Error
|
||||
|
||||
Reference in new issue
Block a user