140 changed files with 11976 additions and 0 deletions
@ -0,0 +1,6 @@ |
|||
# .gitignore |
|||
log |
|||
*.yaml |
|||
*.log |
|||
|
|||
|
|||
@ -0,0 +1,9 @@ |
|||
package shiyan |
|||
|
|||
import "appPlatform/api/shiyan/maptostruct" |
|||
|
|||
type ApiEntry struct { |
|||
MapToStructApi maptostruct.ApiMethod |
|||
} |
|||
|
|||
var AppApiEntry = new(ApiEntry) |
|||
@ -0,0 +1,79 @@ |
|||
package maptostruct |
|||
|
|||
import ( |
|||
"appPlatform/models/modelsstorage" |
|||
"appPlatform/overall/publicmethod" |
|||
"sync" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
type ApiMethod struct{} |
|||
|
|||
// 协程设置
|
|||
var syncSeting = sync.WaitGroup{} |
|||
var syncSetings = sync.WaitGroup{} |
|||
|
|||
type readDataLock struct { |
|||
MaterialAry []MaterialCont `json:"materialary"` |
|||
} |
|||
|
|||
type MaterialCont struct { |
|||
modelsstorage.MaterialType |
|||
MaterialList []modelsstorage.Material `json:"materiallist"` |
|||
} |
|||
|
|||
// 菜单树
|
|||
type CaiDanShu struct { |
|||
MaterialCont |
|||
Child []CaiDanShu `json:"child"` |
|||
} |
|||
|
|||
// 实验入口
|
|||
func (a *ApiMethod) Index(c *gin.Context) { |
|||
outputCont := publicmethod.MapOut[string]() |
|||
outputCont["index"] = "实验入口" |
|||
publicmethod.Result(0, outputCont, c) |
|||
} |
|||
|
|||
// 实验数据
|
|||
type shiyanType struct { |
|||
Name string `json:"name"` |
|||
Age int `json:"age"` |
|||
Time int32 `json:"time"` |
|||
Time1 int64 `json:"time1"` |
|||
Time2 float32 `json:"time2"` |
|||
Time3 float64 `json:"time3"` |
|||
} |
|||
|
|||
// 模拟回调
|
|||
type callBackCont struct { |
|||
MsgSignature string `json:"msg_signature"` |
|||
Timestamp string `json:"timestamp"` |
|||
Nonce string `json:"nonce"` |
|||
Echostr string `json:"echostr"` |
|||
DataType string `json:"datatype"` |
|||
SystemApp string `json:"systemapp"` |
|||
ToUsername string `json:"ToUserName"` |
|||
Agentid uint32 `json:"AgentID"` |
|||
Encrypt string `json:"encrypt"` |
|||
} |
|||
|
|||
// Hr username AND password
|
|||
type hrUsernameAndPassword struct { |
|||
Username string `json:"username"` |
|||
Password string `json:"password"` |
|||
VerificationCode string `json:"verification_code"` |
|||
publicmethod.PublicName |
|||
} |
|||
|
|||
type XiaoZengTime struct { |
|||
DateTime string `json"datetime"` |
|||
} |
|||
|
|||
// 更新mini文本模板
|
|||
type UpdateMiniTemp struct { |
|||
Type int `json:"type"` //'类型(1:文本通知型;2:图文展示型;3:按钮交互型;4:投票选择型;5:多项选择型)'
|
|||
Orderkey string `json:"orderkey"` //流程识别符
|
|||
Enforcer string `json:"enforcer"` //执行人
|
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
package version1 |
|||
|
|||
import "appPlatform/api/version1/user" |
|||
|
|||
type ApiEntry struct { |
|||
UserApi user.ApiMethod //人员信息
|
|||
} |
|||
|
|||
var AppApiEntry = new(ApiEntry) |
|||
@ -0,0 +1,20 @@ |
|||
package user |
|||
|
|||
import ( |
|||
"appPlatform/overall/publicmethod" |
|||
"sync" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
type ApiMethod struct{} |
|||
|
|||
// 人员入口
|
|||
func (a *ApiMethod) Index(c *gin.Context) { |
|||
outputCont := publicmethod.MapOut[string]() |
|||
outputCont["index"] = "人员入口" |
|||
publicmethod.Result(0, outputCont, c) |
|||
} |
|||
|
|||
// 协程设置
|
|||
var syncSeting = sync.WaitGroup{} |
|||
@ -0,0 +1,5 @@ |
|||
package apishiyan |
|||
|
|||
//Api实验
|
|||
|
|||
type ApiRouter struct{} |
|||
@ -0,0 +1,20 @@ |
|||
package apishiyan |
|||
|
|||
import ( |
|||
"appPlatform/api/shiyan" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
//实验
|
|||
|
|||
func (a *ApiRouter) RouterGroup(router *gin.RouterGroup) { |
|||
apiRouter := router.Group("shiyan") |
|||
|
|||
var methodBinding = shiyan.AppApiEntry.MapToStructApi |
|||
{ |
|||
apiRouter.GET("", methodBinding.Index) //入口
|
|||
apiRouter.POST("", methodBinding.Index) //入口
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
package apirouter |
|||
|
|||
import ( |
|||
"appPlatform/apirouter/apishiyan" |
|||
userrouters "appPlatform/apirouter/v1/userRouters" |
|||
) |
|||
|
|||
// 路由结构
|
|||
type RouterGroup struct { |
|||
ShiyanApi apishiyan.ApiRouter |
|||
UserRouter userrouters.ApiRouter |
|||
} |
|||
|
|||
var RouterGroupEntry = new(RouterGroup) |
|||
@ -0,0 +1,19 @@ |
|||
package userrouters |
|||
|
|||
import ( |
|||
"appPlatform/api/version1" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 权限管理PC端
|
|||
func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { |
|||
apiRouter := router.Group("user") |
|||
|
|||
var methodBinding = version1.AppApiEntry.UserApi |
|||
{ |
|||
apiRouter.GET("", methodBinding.Index) //入口
|
|||
apiRouter.POST("", methodBinding.Index) //入口
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
package userrouters |
|||
|
|||
//系统权限
|
|||
type ApiRouter struct{} |
|||
@ -0,0 +1,53 @@ |
|||
package configApp |
|||
|
|||
//服务基础配置
|
|||
type Server struct { |
|||
Appsetup appsetup `mapstructure:"appsetup" json:"appsetup" yaml:"appsetup"` |
|||
Logsetup logsetup `mapstructure:"logconfig" json:"logconfig" yaml:"logconfig"` |
|||
Captcha captcha `mapstructure:"captcha" json:"captcha" yaml:"captcha"` |
|||
RedisPrefixStr redisPrefixStr `mapstructure:"redisprefix" json:"redisprefix" yaml:"redisprefix"` |
|||
WechatCompany wechatCompany `mapstructure:"wechatcompany" json:"wechatcompany" yaml:"wechatcompany"` //企业ID
|
|||
WechatSchool wechatConfig `mapstructure:"wechatschool" json:"wechatschool" yaml:"wechatschool"` //知行学院
|
|||
WechatKpi wechatConfig `mapstructure:"wechatkpi" json:"wechatkpi" yaml:"wechatkpi"` //绩效考核
|
|||
} |
|||
|
|||
//服务配置详情
|
|||
type appsetup struct { |
|||
Port int `mapstructure:"port" json:"port" yaml:"port"` |
|||
Readtime int `mapstructure:"readtime" json:"readtime" yaml:"readtime"` |
|||
Writetime int `mapstructure:"writetime" json:"writetime" yaml:"writetime"` |
|||
AppKey string `mapstructure:"appkey" json:"appkey" yaml:"appkey"` |
|||
DefaultPassword string `mapstructure:"password" json:"password" yaml:"password"` |
|||
PreFix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` |
|||
WebUrl string `mapstructure:"weburl" json:"weburl" yaml:"weburl"` |
|||
PcbUrl string `mapstructure:"pcurl" json:"pcurl" yaml:"pcurl"` |
|||
} |
|||
|
|||
//日志配置
|
|||
type logsetup struct { |
|||
Path string `mapstructure:"path" json:"path" yaml:"path"` |
|||
} |
|||
|
|||
//验证码相关
|
|||
type captcha struct { |
|||
KeyLong int `mapstructure:"key-long" json:"keyLong" yaml:"key-long"` // 验证码长度
|
|||
ImgWidth int `mapstructure:"img-width" json:"imgWidth" yaml:"img-width"` // 验证码宽度
|
|||
ImgHeight int `mapstructure:"img-height" json:"imgHeight" yaml:"img-height"` // 验证码高度
|
|||
} |
|||
|
|||
type redisPrefixStr struct { |
|||
PreFix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` // redis键前缀
|
|||
Alias string `mapstructure:"alias" json:"alias" yaml:"alias"` // redis键前缀
|
|||
} |
|||
|
|||
//企业微信基础配置
|
|||
type wechatCompany struct { |
|||
CompanyId string `mapstructure:"companyid" json:"companyid" yaml:"companyid"` // 企业ID
|
|||
} |
|||
|
|||
type wechatConfig struct { |
|||
Agentid string `mapstructure:"agentid" json:"agentid" yaml:"agentid"` // Agentid
|
|||
Secret string `mapstructure:"secret" json:"secret" yaml:"secret"` // Secret
|
|||
Token string `mapstructure:"token" json:"token" yaml:"token"` // Token
|
|||
Encodingaeskey string `mapstructure:"encodingaeskey" json:"encodingaeskey" yaml:"encodingaeskey"` // EncodingAESKey
|
|||
} |
|||
@ -0,0 +1,88 @@ |
|||
package configDatabase |
|||
|
|||
import ( |
|||
"fmt" |
|||
"time" |
|||
|
|||
"gorm.io/driver/mysql" |
|||
"gorm.io/gorm" |
|||
"gorm.io/gorm/logger" |
|||
) |
|||
|
|||
type MysqlSetUp struct { |
|||
MasterMysql MasterMysqlSetUp `mapstructure:"master" json:"master" yaml:"master"` //主数据库
|
|||
AppPlatformDatabase MasterMysqlSetUp `mapstructure:"appPlatformDatabase" json:"appPlatformDatabase" yaml:"appPlatformDatabase"` //应用平台
|
|||
//其他数据库依次添加
|
|||
WechatMysql MasterMysqlSetUp `mapstructure:"wechat" json:"wechat" yaml:"wechat"` //微信数据库
|
|||
HrMysql MasterMysqlSetUp `mapstructure:"hrdatabase" json:"hrdatabase" yaml:"hrdatabase"` //HR数据库
|
|||
FileBookDate MasterMysqlSetUp `mapstructure:"fileBookDate" json:"fileBookDate" yaml:"fileBookDate"` //文档属性数据库
|
|||
ErrorSubjectDate MasterMysqlSetUp `mapstructure:"errorSubjectDate" json:"errorSubjectDate" yaml:"errorSubjectDate"` //错题库
|
|||
MyTestDate MasterMysqlSetUp `mapstructure:"myTestDate" json:"myTestDate" yaml:"myTestDate"` //自我测验
|
|||
ImageTextDate MasterMysqlSetUp `mapstructure:"imageTextDate" json:"imageTextDate" yaml:"imageTextDate"` //图文信息数据库
|
|||
ScoringDetailsDate MasterMysqlSetUp `mapstructure:"scoringDetailsDate" json:"scoringDetailsDate" yaml:"scoringDetailsDate"` //计分明细数据库
|
|||
QuestionsAnswersDate MasterMysqlSetUp `mapstructure:"questionsAnswersDate" json:"questionsAnswersDate" yaml:"questionsAnswersDate"` //趣味问答
|
|||
BillboardDate MasterMysqlSetUp `mapstructure:"billboardDate" json:"billboardDate" yaml:"billboardDate"` //风云榜统计数据库
|
|||
HealthReportDate MasterMysqlSetUp `mapstructure:"healthReportDate" json:"healthReportDate" yaml:"healthReportDate"` //健康上报数据库
|
|||
KpiDate MasterMysqlSetUp `mapstructure:"kpiDate" json:"kpiDate" yaml:"kpiDate"` //绩效考核数据库
|
|||
WechatCallBackLogDate MasterMysqlSetUp `mapstructure:"wechatCallBackLogDate" json:"wechatCallBackLogDate" yaml:"wechatCallBackLogDate"` //企业微信回调记录
|
|||
Managearchives MasterMysqlSetUp `mapstructure:"managearchives" json:"managearchives" yaml:"managearchives"` //管理档案
|
|||
SystemPermission MasterMysqlSetUp `mapstructure:"systempermission" json:"systempermission" yaml:"systempermission"` //系统权限配置数据库
|
|||
Storage MasterMysqlSetUp `mapstructure:"storage" json:"storage" yaml:"storage"` //仓储系统数据库
|
|||
} |
|||
|
|||
type MasterMysqlSetUp struct { |
|||
UrlPath string `mapstructure:"url_path" json:"url_path" yaml:"url_path"` // 服务器地址
|
|||
Port int `mapstructure:"port" json:"port" yaml:"port"` // 端口
|
|||
Charset string `mapstructure:"charset" json:"charset" yaml:"charset"` // 编码方式
|
|||
ParseTime bool `mapstructure:"parseTime" json:"parseTime" yaml:"parseTime"` // 是否自动转换时间
|
|||
Loc string `mapstructure:"loc" json:"loc" yaml:"loc"` // 时区
|
|||
Name string `mapstructure:"name" json:"name" yaml:"name"` // 数据库名称
|
|||
UserName string `mapstructure:"username" json:"username" yaml:"username"` // 账号
|
|||
PassWord string `mapstructure:"password" json:"password" yaml:"password"` // 密码
|
|||
MaxIdleConns int `mapstructure:"max_idle_conns" json:"max_idle_conns" yaml:"max_idle_conns"` // 最大空闲数
|
|||
MaxOpenConns int `mapstructure:"max_open_conns" json:"max_open_conns" yaml:"max_open_conns"` // 最大链接数
|
|||
GormLog bool `mapstructure:"gorm_log" json:"gorm_log" yaml:"gorm_log"` // 是否开启Gorm全局日志
|
|||
} |
|||
|
|||
func (m *MasterMysqlSetUp) SqlDsn() (dsnStr string) { |
|||
dsnStr = fmt.Sprintf("%v:%v@tcp(%v:%v)/%v?charset=%v", m.UserName, m.PassWord, m.UrlPath, m.Port, m.Name, m.Charset) |
|||
if m.ParseTime { |
|||
dsnStr = fmt.Sprintf("%v:%v@tcp(%v:%v)/%v?charset=%v&parseTime=%v&loc=%v", m.UserName, m.PassWord, m.UrlPath, m.Port, m.Name, m.Charset, m.ParseTime, m.Loc) |
|||
} |
|||
return |
|||
} |
|||
|
|||
func (m *MasterMysqlSetUp) OpenSql() *gorm.DB { |
|||
sqlConfig := mysql.Config{ |
|||
DSN: m.SqlDsn(), // DSN
|
|||
DefaultStringSize: 255, // string 类型字段的默认长度
|
|||
DisableDatetimePrecision: true, // 禁用 datetime 精度,MySQL 5.6 之前的数据库不支持
|
|||
DontSupportRenameIndex: true, // 重命名索引时采用删除并新建的方式,MySQL 5.7 之前的数据库和 MariaDB 不支持重命名索引
|
|||
DontSupportRenameColumn: true, // 用 `change` 重命名列,MySQL 8 之前的数据库和 MariaDB 不支持重命名列
|
|||
SkipInitializeWithVersion: false, // 根据版本自动配置
|
|||
} |
|||
if m.GormLog { |
|||
if opDb, err := gorm.Open(mysql.New(sqlConfig), &gorm.Config{ |
|||
Logger: logger.Default.LogMode(logger.Info), |
|||
}); err != nil { |
|||
return nil |
|||
} else { |
|||
sqlDb, _ := opDb.DB() |
|||
sqlDb.SetMaxIdleConns(m.MaxIdleConns) |
|||
sqlDb.SetMaxOpenConns(m.MaxOpenConns) |
|||
sqlDb.SetConnMaxLifetime(5 * time.Minute) |
|||
return opDb |
|||
} |
|||
} else { |
|||
if opDb, err := gorm.Open(mysql.New(sqlConfig)); err != nil { |
|||
return nil |
|||
} else { |
|||
sqlDb, _ := opDb.DB() |
|||
sqlDb.SetMaxIdleConns(m.MaxIdleConns) |
|||
sqlDb.SetMaxOpenConns(m.MaxOpenConns) |
|||
sqlDb.SetConnMaxLifetime(5 * time.Minute) |
|||
return opDb |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
{ |
|||
"group":[ |
|||
{ |
|||
"old":3, |
|||
"new":2 |
|||
} |
|||
], |
|||
"department":[ |
|||
{ |
|||
"newgroup":2, |
|||
"old":1, |
|||
"new":14 |
|||
}, |
|||
{ |
|||
"newgroup":2, |
|||
"old":2, |
|||
"new":13 |
|||
} |
|||
], |
|||
"workshopsection":[] |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
package confignosql |
|||
|
|||
import ( |
|||
"context" |
|||
"fmt" |
|||
|
|||
"github.com/go-redis/redis/v8" |
|||
) |
|||
|
|||
type RedisSetUp struct { |
|||
MasterRedis RedisConfitSetUp `mapstructure:"master" json:"master" yaml:"master"` //主数据库
|
|||
MasterRedis1 RedisConfitSetUp `mapstructure:"master1" json:"master1" yaml:"master1"` //主数据库
|
|||
MasterRedis2 RedisConfitSetUp `mapstructure:"master2" json:"master1" yaml:"master2"` //主数据库
|
|||
MasterRedis3 RedisConfitSetUp `mapstructure:"master3" json:"master1" yaml:"master3"` //主数据库
|
|||
MasterRedis4 RedisConfitSetUp `mapstructure:"master4" json:"master1" yaml:"master4"` //主数据库
|
|||
MasterRedis5 RedisConfitSetUp `mapstructure:"master5" json:"master1" yaml:"master5"` //主数据库
|
|||
} |
|||
|
|||
type RedisConfitSetUp struct { |
|||
UrlPath string `mapstructure:"url_path" json:"url_path" yaml:"url_path"` // 服务器地址
|
|||
Port int `mapstructure:"port" json:"port" yaml:"port"` // 端口
|
|||
Name int `mapstructure:"name" json:"name" yaml:"name"` // 数据库名称
|
|||
PassWord string `mapstructure:"password" json:"password" yaml:"password"` // 密码
|
|||
} |
|||
|
|||
func (r *RedisConfitSetUp) OpenRedis() *redis.Client { |
|||
address := fmt.Sprintf("%v:%v", r.UrlPath, r.Port) |
|||
fmt.Printf("开启%v Redis库 %v\n", address, r.Name) |
|||
redisClient := redis.NewClient(&redis.Options{ |
|||
Addr: address, |
|||
Password: r.PassWord, |
|||
DB: r.Name, |
|||
}) |
|||
pingLink, err := redisClient.Ping(context.Background()).Result() |
|||
if err != nil { |
|||
fmt.Printf("%v Redis链接失败!原因:%v\n", r.Name, err) |
|||
} else { |
|||
fmt.Printf("%v Redis链接成功!=====>%v\n", r.Name, pingLink) |
|||
} |
|||
return redisClient |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
module appPlatform |
|||
|
|||
go 1.18 |
|||
|
|||
require ( |
|||
github.com/flipped-aurora/gin-vue-admin/server v0.0.0-20220724010254-afab1fdbce13 |
|||
github.com/fsnotify/fsnotify v1.5.4 |
|||
github.com/gin-gonic/gin v1.8.1 |
|||
github.com/go-redis/redis/v8 v8.11.5 |
|||
github.com/mitchellh/mapstructure v1.5.0 |
|||
github.com/mojocn/base64Captcha v1.3.5 |
|||
github.com/mozillazg/go-pinyin v0.19.0 |
|||
github.com/spf13/viper v1.12.0 |
|||
gorm.io/driver/mysql v1.3.5 |
|||
gorm.io/gorm v1.23.8 |
|||
) |
|||
|
|||
require ( |
|||
github.com/cespare/xxhash/v2 v2.1.2 // indirect |
|||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect |
|||
github.com/gin-contrib/sse v0.1.0 // indirect |
|||
github.com/go-playground/locales v0.14.0 // indirect |
|||
github.com/go-playground/universal-translator v0.18.0 // indirect |
|||
github.com/go-playground/validator/v10 v10.10.0 // indirect |
|||
github.com/go-sql-driver/mysql v1.6.0 // indirect |
|||
github.com/goccy/go-json v0.9.7 // indirect |
|||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect |
|||
github.com/hashicorp/hcl v1.0.0 // indirect |
|||
github.com/jinzhu/inflection v1.0.0 // indirect |
|||
github.com/jinzhu/now v1.1.5 // indirect |
|||
github.com/json-iterator/go v1.1.12 // indirect |
|||
github.com/leodido/go-urn v1.2.1 // indirect |
|||
github.com/magiconair/properties v1.8.6 // indirect |
|||
github.com/mattn/go-isatty v0.0.14 // indirect |
|||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect |
|||
github.com/modern-go/reflect2 v1.0.2 // indirect |
|||
github.com/pelletier/go-toml v1.9.5 // indirect |
|||
github.com/pelletier/go-toml/v2 v2.0.1 // indirect |
|||
github.com/spf13/afero v1.8.2 // indirect |
|||
github.com/spf13/cast v1.5.0 // indirect |
|||
github.com/spf13/jwalterweatherman v1.1.0 // indirect |
|||
github.com/spf13/pflag v1.0.5 // indirect |
|||
github.com/subosito/gotenv v1.3.0 // indirect |
|||
github.com/ugorji/go/codec v1.2.7 // indirect |
|||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect |
|||
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb // indirect |
|||
golang.org/x/net v0.0.0-20220520000938-2e3eb7b945c2 // indirect |
|||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect |
|||
golang.org/x/text v0.3.7 // indirect |
|||
google.golang.org/protobuf v1.28.0 // indirect |
|||
gopkg.in/ini.v1 v1.66.4 // indirect |
|||
gopkg.in/yaml.v2 v2.4.0 // indirect |
|||
gopkg.in/yaml.v3 v3.0.0 // indirect |
|||
) |
|||
File diff suppressed because it is too large
@ -0,0 +1,167 @@ |
|||
package interceptor |
|||
|
|||
import ( |
|||
"fmt" |
|||
"appPlatform/middleware/grocerystore" |
|||
"appPlatform/models/modelshr" |
|||
"appPlatform/overall" |
|||
"appPlatform/overall/publicmethod" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
"github.com/mitchellh/mapstructure" |
|||
) |
|||
|
|||
// 身份验证器
|
|||
func IdentificationToken() gin.HandlerFunc { |
|||
return func(c *gin.Context) { |
|||
userToken := c.Request.Header.Get("token") |
|||
randomNumber := c.Request.Header.Get("number") |
|||
ContentType := c.Request.Header.Get("Content-Type") |
|||
Origin := c.Request.Header.Get("Origin") |
|||
userAgent := c.Request.Header.Get("User-Agent") |
|||
|
|||
if ContentType == "" || userToken == "" || userAgent == "" || randomNumber == "" { |
|||
iii := publicmethod.MapOut[string]() |
|||
iii["ContentType"] = ContentType |
|||
iii["userToken"] = userToken |
|||
iii["userAgent"] = userAgent |
|||
iii["Origin"] = Origin |
|||
iii["randomNumber"] = randomNumber |
|||
publicmethod.Result(2001, "请输入关键信息数据!", c) |
|||
c.Abort() |
|||
return |
|||
} |
|||
//设定redis Key名称
|
|||
redisKey := fmt.Sprintf("Authentication:ApiAuthent_%v", userToken) |
|||
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS3) |
|||
tokenInfo, isTrue := redisClient.HashGetAll(redisKey) |
|||
if isTrue != true { |
|||
iii := publicmethod.MapOut[string]() |
|||
iii["ContentType"] = ContentType |
|||
iii["userToken"] = userToken |
|||
iii["userAgent"] = userAgent |
|||
iii["Origin"] = Origin |
|||
iii["randomNumber"] = randomNumber |
|||
iii["redisKey"] = redisKey |
|||
iii["isTrue"] = isTrue |
|||
publicmethod.Result(2002, "您的指令不正确!或已经超时!请重新获取指令!", c) |
|||
c.Abort() |
|||
return |
|||
} |
|||
var validator ValidatorToken |
|||
identityErr := mapstructure.Decode(tokenInfo, &validator) |
|||
if identityErr != nil { |
|||
publicmethod.Result(2003, "对不起!身份验证失败!", c) |
|||
c.Abort() |
|||
return |
|||
} |
|||
|
|||
//密码加密
|
|||
var passWordMd5 publicmethod.Md5Encryption |
|||
passWordMd5.Md5EncryptionInit(validator.PassWord) |
|||
passWordMd5Str := passWordMd5.Md5EncryptionAlgorithm() |
|||
|
|||
var empowerUser modelshr.EmpowerUser |
|||
userErr := empowerUser.GetCont(map[string]interface{}{"userkey": validator.UserKey, "password": passWordMd5Str}, "verification_code") |
|||
if userErr != nil { |
|||
publicmethod.Result(2000, userErr, c) |
|||
return |
|||
} |
|||
|
|||
//头文件加密
|
|||
//ContentType
|
|||
var ContentTypeMd5 publicmethod.Md5Encryption |
|||
ContentTypeMd5.Md5EncryptionInit(ContentType) |
|||
if empowerUser.VerificationCode != "" { |
|||
ContentTypeMd5.AppKey = empowerUser.VerificationCode |
|||
} |
|||
|
|||
fmt.Printf("ContentTypeMd5Str ----->%v\n", ContentTypeMd5) |
|||
|
|||
ContentTypeMd5Str := ContentTypeMd5.Md5EncryptionAlgorithm() |
|||
//Origin
|
|||
var OriginMd5 publicmethod.Md5Encryption |
|||
OriginMd5.Md5EncryptionInit(Origin) |
|||
if empowerUser.VerificationCode != "" { |
|||
OriginMd5.AppKey = empowerUser.VerificationCode |
|||
} |
|||
originMd5Str := OriginMd5.Md5EncryptionAlgorithm() |
|||
//userAgent
|
|||
var userAgentMd5 publicmethod.Md5Encryption |
|||
userAgentMd5.Md5EncryptionInit(userAgent) |
|||
if empowerUser.VerificationCode != "" { |
|||
userAgentMd5.AppKey = empowerUser.VerificationCode |
|||
} |
|||
|
|||
userAgentMd5Str := userAgentMd5.Md5EncryptionAlgorithm() |
|||
|
|||
//随机数加密
|
|||
var randomNumberMd5 publicmethod.Md5Encryption |
|||
randomNumberMd5.Md5EncryptionInit(validator.Number) |
|||
if empowerUser.VerificationCode != "" { |
|||
randomNumberMd5.AppKey = empowerUser.VerificationCode |
|||
} |
|||
|
|||
numberMd5 := randomNumberMd5.Md5EncryptionAlgorithm() |
|||
|
|||
//用户名加密
|
|||
var userKeyMd5 publicmethod.Md5Encryption |
|||
userKeyMd5.Md5EncryptionInit(validator.UserKey) |
|||
if empowerUser.VerificationCode != "" { |
|||
userKeyMd5.AppKey = empowerUser.VerificationCode |
|||
} |
|||
|
|||
userKeyMd5Str := userKeyMd5.Md5EncryptionAlgorithm() |
|||
|
|||
clearCodeToken := fmt.Sprintf("%v-%v-%v-%v-%v-%v", ContentTypeMd5Str, originMd5Str, userAgentMd5Str, numberMd5, userKeyMd5Str, passWordMd5Str) |
|||
|
|||
fmt.Printf("redisKey---->ContentTypeMd5Str:%v-originMd5Str:%v-userAgentMd5Str:%v-numberMd5:%v-userKeyMd5Str:%v-passwordMd5Str:%v\n", ContentTypeMd5Str, originMd5Str, userAgentMd5Str, numberMd5, userKeyMd5Str, passWordMd5Str) |
|||
|
|||
//token 加密
|
|||
var tokenMd5 publicmethod.Md5Encryption |
|||
tokenMd5.Md5EncryptionInit(clearCodeToken) |
|||
if empowerUser.VerificationCode != "" { |
|||
tokenMd5.AppKey = empowerUser.VerificationCode |
|||
} |
|||
fmt.Printf("tokenMd5Appk ----->%v\n", tokenMd5) |
|||
tokenMd5Str := tokenMd5.Md5EncryptionAlgorithm() |
|||
|
|||
clearTokenStr := fmt.Sprintf("%v-%v", tokenMd5Str, numberMd5) |
|||
var clearTokenMd5 publicmethod.Md5Encryption |
|||
clearTokenMd5.Md5EncryptionInit(clearTokenStr) |
|||
if empowerUser.VerificationCode != "" { |
|||
clearTokenMd5.AppKey = empowerUser.VerificationCode |
|||
} |
|||
clearTokenMd5Str := clearTokenMd5.Md5EncryptionAlgorithm() |
|||
|
|||
//提交Token转化
|
|||
submitTokenStr := fmt.Sprintf("%v-%v", userToken, randomNumber) |
|||
|
|||
var submitTokenMd5 publicmethod.Md5Encryption |
|||
submitTokenMd5.Md5EncryptionInit(submitTokenStr) |
|||
if empowerUser.VerificationCode != "" { |
|||
submitTokenMd5.AppKey = empowerUser.VerificationCode |
|||
} |
|||
submitTokenMd5Str := submitTokenMd5.Md5EncryptionAlgorithm() |
|||
|
|||
if submitTokenMd5Str != clearTokenMd5Str { |
|||
sss := publicmethod.MapOut[string]() |
|||
sss["numberMd5"] = numberMd5 |
|||
sss["submitTokenMd5Str"] = submitTokenMd5Str |
|||
sss["clearTokenMd5Str"] = clearTokenMd5Str |
|||
sss["tokenMd5Str"] = tokenMd5Str |
|||
sss["clearCodeToken"] = clearCodeToken |
|||
sss["submitTokenStr"] = submitTokenStr |
|||
sss["clearTokenStr"] = clearTokenStr |
|||
sss["userToken"] = userToken |
|||
|
|||
// tokenMd5Str, numberMd5
|
|||
// publicmethod.Result(2004, "对不起!非法令牌!不可访问系统", c)
|
|||
publicmethod.Result(2004, sss, c, "对不起!非法令牌!不可访问系统") |
|||
c.Abort() |
|||
return |
|||
} |
|||
c.Set("token", validator) |
|||
c.Next() |
|||
} |
|||
} |
|||
@ -0,0 +1,161 @@ |
|||
package interceptor |
|||
|
|||
import ( |
|||
"appPlatform/middleware/grocerystore" |
|||
"appPlatform/overall" |
|||
"appPlatform/overall/publicmethod" |
|||
"fmt" |
|||
|
|||
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response" |
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 验证用户是否登录
|
|||
func AuthenticateUser() gin.HandlerFunc { |
|||
return func(c *gin.Context) { |
|||
userKey := c.Request.Header.Get("user-key") |
|||
userToken := c.Request.Header.Get("user-token") |
|||
userAgent := c.Request.Header.Get("User-Agent") |
|||
userAgent = overall.CONSTANT_CONFIG.Appsetup.AppKey |
|||
// fmt.Printf("userKey---------->%v----------userToken---------->%v--------userAgent---------->%v\n", userKey, userToken, userAgent)
|
|||
if userKey == "" || userToken == "" || userAgent == "" { |
|||
response.FailWithDetailed(gin.H{"reload": false, "code": 300}, "未登录或非法访问", c) |
|||
c.Abort() |
|||
return |
|||
} |
|||
|
|||
redisFileKey := fmt.Sprintf("ScanCode:Authentication:LoginApi_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, userKey) |
|||
redisClient := grocerystore.RunRedis(overall.CONSTANT_REDIS5) |
|||
userRedisToken, isTrue := redisClient.HashGetAll(redisFileKey) |
|||
if isTrue == false { |
|||
response.FailWithDetailed(gin.H{"reload": false, "code": 301}, redisFileKey, c) |
|||
c.Abort() |
|||
return |
|||
} |
|||
if userToken != userRedisToken["usertoken"] { |
|||
response.FailWithDetailed(gin.H{"reload": false, "code": 302}, "令牌不正确!非法访问!", c) |
|||
c.Abort() |
|||
return |
|||
} |
|||
myCont, myErr := publicmethod.GetUserRedisCont(userRedisToken["usernumber"]) |
|||
// var myCont modelshr.ManCont
|
|||
// myErr := myCont.GetCont(map[string]interface{}{"`number`": userRedisToken["usernumber"]})
|
|||
if myErr != nil { |
|||
response.FailWithDetailed(gin.H{"reload": false, "code": 303, "data": myErr}, "登录超时!请重新登录", c) |
|||
c.Abort() |
|||
return |
|||
} |
|||
|
|||
// myContJson, _ := json.Marshal(myCont)
|
|||
// fmt.Printf("myCont---------------->%v\n", string(myContJson))
|
|||
c.Set(overall.MyContJwt, myCont) |
|||
writeRedisData := publicmethod.MapOut[string]() |
|||
for i, v := range userRedisToken { |
|||
writeRedisData[i] = v |
|||
} |
|||
redisClient.SetRedisTime(10800) |
|||
redisClient.HashMsetAdd(redisFileKey, writeRedisData) |
|||
myContRedis := publicmethod.MapOut[string]() |
|||
myContRedis["id"] = myCont.Id |
|||
myContRedis["number"] = myCont.Number //员工工号
|
|||
myContRedis["name"] = myCont.Name //姓名
|
|||
myContRedis["icon"] = myCont.Icon //头像
|
|||
myContRedis["hireclass"] = myCont.HireClass //雇佣类型(1:雇佣入职;2:再入职;)
|
|||
myContRedis["emptype"] = myCont.EmpType //用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职)
|
|||
myContRedis["company"] = myCont.Company //入职公司
|
|||
myContRedis["maindeparment"] = myCont.MainDeparment //主部门
|
|||
myContRedis["sunmaindeparment"] = myCont.SunMainDeparment //二级主部门
|
|||
myContRedis["deparment"] = myCont.Deparment //部门
|
|||
myContRedis["adminorg"] = myCont.AdminOrg //所属行政组织
|
|||
myContRedis["teamid"] = myCont.TeamId //班组
|
|||
myContRedis["position"] = myCont.Position //职位
|
|||
myContRedis["jobclass"] = myCont.JobClass //职务分类
|
|||
myContRedis["jobid"] = myCont.JobId //职务
|
|||
myContRedis["jobleve"] = myCont.JobLeve //职务等级
|
|||
myContRedis["wechat"] = myCont.Wechat //微信UserId
|
|||
myContRedis["workwechat"] = myCont.WorkWechat //企业微信UserId
|
|||
myContRedis["state"] = myCont.State //状态(1:启用;2:禁用;3:删除)
|
|||
myContRedis["key"] = myCont.Key //key
|
|||
myContRedis["isadmin"] = myCont.IsAdmin //是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管
|
|||
myContRedis["password"] = myCont.Password //密码
|
|||
myContRedis["role"] = myCont.Role //角色
|
|||
myContRedis["idcardno"] = myCont.Idcardno //身份证号
|
|||
myContRedis["passportno"] = myCont.Passportno //护照号码
|
|||
myContRedis["globalroaming"] = myCont.Globalroaming //国际区号
|
|||
myContRedis["mobilephone"] = myCont.Mobilephone //手机号码
|
|||
myContRedis["email"] = myCont.Email //电子邮件
|
|||
myContRedis["gender"] = myCont.Gender //性别(1:男性;2:女性;3:中性)
|
|||
myContRedis["birthday"] = myCont.Birthday //birthday
|
|||
myContRedis["myfolk"] = myCont.Myfolk //民族
|
|||
myContRedis["nativeplace"] = myCont.Nativeplace //籍贯
|
|||
myContRedis["idcardstartdate"] = myCont.Idcardstartdate //身份证有效期开始
|
|||
myContRedis["idcardenddate"] = myCont.Idcardenddate //身份证有效期结束
|
|||
myContRedis["idcardaddress"] = myCont.Idcardaddress //身份证地址
|
|||
myContRedis["idcardIssued"] = myCont.IdcardIssued //身份证签发机关
|
|||
myContRedis["health"] = myCont.Health //健康状况(1:良好;2:一般;3:较弱,4:有生理缺陷;5:残废)
|
|||
myContRedis["maritalstatus"] = myCont.Maritalstatus //婚姻状况(1:未婚;2:已婚;3:丧偶;4:离异)
|
|||
myContRedis["internaltelephone"] = myCont.Internaltelephone //内线电话
|
|||
myContRedis["currentresidence"] = myCont.Currentresidence //现居住地址
|
|||
myContRedis["constellationing"] = myCont.Constellation //星座(1:白羊座;2:金牛座;3:双子座;4:巨蟹座;5:狮子座;6:处女座;7:天枰座;8:天蝎座;9:射手座;10:摩羯座;11:水瓶座;12:双鱼座)
|
|||
myContRedis["isdoubleworker"] = myCont.Isdoubleworker //是否双职工(1:是;2:否)
|
|||
myContRedis["isveterans"] = myCont.Isveterans //是否为退役军人(1:是;2:否)
|
|||
myContRedis["veteransnumber"] = myCont.Veteransnumber //退役证编号
|
|||
myContRedis["jobstartdate"] = myCont.Jobstartdate //参加工作日期
|
|||
myContRedis["entrydate"] = myCont.Entrydate //入职日期
|
|||
myContRedis["probationperiod"] = myCont.Probationperiod //试用期
|
|||
myContRedis["planformaldate"] = myCont.Planformaldate //预计转正日期
|
|||
myContRedis["political_outlook"] = myCont.PoliticalOutlook //政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)
|
|||
redisMyContKey := fmt.Sprintf("ScanCode:Authentication:UserCont_%v_%v", overall.CONSTANT_CONFIG.RedisPrefixStr.Alias, myCont.Number) |
|||
|
|||
// fmt.Printf("redisMyContKey------------>%v\n", redisMyContKey)
|
|||
// myContRedisJson, _ := json.Marshal(myContRedis)
|
|||
// fmt.Printf("myContRedisJson------------>%v\n", string(myContRedisJson))
|
|||
|
|||
redisClient.HashMsetAdd(redisMyContKey, myContRedis) |
|||
|
|||
//获取授权信息
|
|||
// powerCont, powerErr := publicmethod.GetPostOfUsEmpowerCont(myCont.AdminOrg, myCont.Position, "kpi")
|
|||
// c.Set(overall.MyContJwtPower, powerCont)
|
|||
// fmt.Printf("redisMyContKey------Login----->%v----->%v\n", powerErr, powerCont)
|
|||
//获取权限
|
|||
var powerCont EmpowerCont |
|||
powerCont.RoleName, powerCont.PointId, powerCont.Operation, powerCont.Level = publicmethod.GetNewAccredit("kpi", myCont.Role, myCont.Key, myCont.AdminOrg, myCont.Position) |
|||
c.Set(overall.MyContJwtPower, powerCont) |
|||
c.Next() |
|||
} |
|||
} |
|||
|
|||
// 验证用户是否具备权限
|
|||
func VerifyUrl() gin.HandlerFunc { |
|||
return func(c *gin.Context) { |
|||
systemClass := c.Request.Header.Get("system-class") |
|||
context, exi := publicmethod.LoginMyCont(c) |
|||
if exi != nil { |
|||
response.FailWithDetailed(gin.H{"reload": false, "code": 401}, "对不起!你没有访问此功能的权限!", c) |
|||
c.Abort() |
|||
return |
|||
} |
|||
// 获取请求的PATH
|
|||
obj := c.Request.URL.Path |
|||
// 获取请求方法
|
|||
act := c.Request.Method |
|||
|
|||
menuIdAry, menuUrl, err := publicmethod.GetPostPower(context.AdminOrg, context.Position, "kpi") |
|||
|
|||
//此功能暂时不开启
|
|||
// if err != nil || len(menuUrl) < 1 || len(menuIdAry) < 1 {
|
|||
// response.FailWithDetailed(gin.H{"reload": false, "code": 402}, "对不起!你没有访问此功能的权限!", c)
|
|||
// c.Abort()
|
|||
// return
|
|||
// }
|
|||
fmt.Printf("obj---url--->%v-----------act------->%v---systemClass------------>%v------------------context-------->%v-------->menuIdAry-------->%v-------->menuUrl-------->%v-------->err-------->%v\n", obj, act, systemClass, context.Role, menuIdAry, menuUrl, err) |
|||
//此功能暂时不开启
|
|||
// if publicmethod.IsInTrue[string](obj, menuUrl) == false {
|
|||
// response.FailWithDetailed(gin.H{"reload": false, "code": 403}, "对不起!你没有访问此功能的权限!", c)
|
|||
// c.Abort()
|
|||
// return
|
|||
// }
|
|||
|
|||
c.Next() |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package interceptor |
|||
|
|||
//验证器结构Token
|
|||
type ValidatorToken struct { |
|||
Number string `json:"number"` //随机数
|
|||
UserKey string `json:"userkey"` //用户名
|
|||
PassWord string `json:"password"` //密码
|
|||
} |
|||
|
|||
//权限相关
|
|||
type EmpowerCont struct { |
|||
RoleName string `json:"roleName"` |
|||
PointId string `json:"pointid"` |
|||
Operation string `json:"operation"` |
|||
Level int `json:"level"` |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package app |
|||
|
|||
import ( |
|||
"net/http" |
|||
"time" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
//设置服务启动
|
|||
func InitServer(port string, handler *gin.Engine) server { |
|||
return &http.Server{ |
|||
Addr: port, //监听的TCP地址,如果为空字符串会使用":http"
|
|||
Handler: handler, //调用的处理器,如为nil会调用http.DefaultServeMux
|
|||
ReadTimeout: 3600 * time.Second, //请求的读取操作在超时前的最大持续时间
|
|||
WriteTimeout: 3600 * time.Second, //回复的写入操作在超时前的最大持续时间
|
|||
MaxHeaderBytes: 1 << 40, //请求的头域最大长度,如为0则用DefaultMaxHeaderBytes
|
|||
} |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
package app |
|||
|
|||
import ( |
|||
"fmt" |
|||
"appPlatform/initialization/initviper" |
|||
"appPlatform/initialization/route" |
|||
"appPlatform/overall" |
|||
) |
|||
|
|||
type server interface { |
|||
ListenAndServe() error |
|||
} |
|||
|
|||
// 启动服务
|
|||
func RunItem() { |
|||
//加载基础配置
|
|||
// var appConfig configApp.Server
|
|||
initviper.RunViper(&overall.CONSTANT_CONFIG) |
|||
// fmt.Printf("CONSTANT_CONFIG----------->%v", overall.CONSTANT_CONFIG)
|
|||
routers := route.InitialRouter() |
|||
portStr := fmt.Sprintf(":%d", overall.CONSTANT_CONFIG.Appsetup.Port) |
|||
startUp := InitServer(portStr, routers) |
|||
fmt.Printf("\n\n默认API运行地址:http://127.0.0.1%s\n", portStr) |
|||
runErr := startUp.ListenAndServe().Error() |
|||
panic(fmt.Errorf(runErr)) |
|||
} |
|||
@ -0,0 +1,131 @@ |
|||
package databaseinit |
|||
|
|||
import ( |
|||
"appPlatform/initialization/initviper" |
|||
"appPlatform/overall" |
|||
"fmt" |
|||
) |
|||
|
|||
func LoadDatabase() { |
|||
sqlConfig := overall.CONSTANT_MYSQL |
|||
initviper.RunViper(&sqlConfig, overall.ConfigDatabaseConstant) |
|||
//开启主数据库
|
|||
overall.CONSTANT_DB_Master = sqlConfig.MasterMysql.OpenSql() |
|||
if overall.CONSTANT_DB_Master == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.MasterMysql.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.MasterMysql.Name) |
|||
} |
|||
//开启主数据库
|
|||
overall.CONSTANT_DB_AppPlatform = sqlConfig.AppPlatformDatabase.OpenSql() |
|||
if overall.CONSTANT_DB_AppPlatform == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.AppPlatformDatabase.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.AppPlatformDatabase.Name) |
|||
} |
|||
//开启微信数据库
|
|||
overall.CONSTANT_DB_Wechat = sqlConfig.WechatMysql.OpenSql() |
|||
if overall.CONSTANT_DB_Master == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.WechatMysql.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.WechatMysql.Name) |
|||
} |
|||
//开启Hr数据库
|
|||
overall.CONSTANT_DB_HR = sqlConfig.HrMysql.OpenSql() |
|||
if overall.CONSTANT_DB_HR == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.HrMysql.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.HrMysql.Name) |
|||
} |
|||
//文档属性数据库
|
|||
overall.CONSTANT_DB_FILE_BOOK = sqlConfig.FileBookDate.OpenSql() |
|||
if overall.CONSTANT_DB_HR == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.FileBookDate.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.FileBookDate.Name) |
|||
} |
|||
//错题库
|
|||
overall.CONSTANT_DB_ERROR_SUBJECT = sqlConfig.ErrorSubjectDate.OpenSql() |
|||
if overall.CONSTANT_DB_HR == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.ErrorSubjectDate.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.ErrorSubjectDate.Name) |
|||
} |
|||
//自我测验
|
|||
overall.CONSTANT_DB_MY_TEST = sqlConfig.MyTestDate.OpenSql() |
|||
if overall.CONSTANT_DB_HR == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.MyTestDate.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.MyTestDate.Name) |
|||
} |
|||
//图文信息数据库
|
|||
overall.CONSTANT_DB_IMAGES_TEST = sqlConfig.ImageTextDate.OpenSql() |
|||
if overall.CONSTANT_DB_HR == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.ImageTextDate.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.ImageTextDate.Name) |
|||
} |
|||
//计分明细数据库
|
|||
overall.CONSTANT_DB_SCORING = sqlConfig.ScoringDetailsDate.OpenSql() |
|||
if overall.CONSTANT_DB_HR == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.ScoringDetailsDate.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.ScoringDetailsDate.Name) |
|||
} |
|||
//趣味问答
|
|||
overall.CONSTANT_DB_QA = sqlConfig.QuestionsAnswersDate.OpenSql() |
|||
if overall.CONSTANT_DB_HR == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.QuestionsAnswersDate.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.QuestionsAnswersDate.Name) |
|||
} |
|||
//风云榜统计数据库
|
|||
overall.CONSTANT_DB_BILLBOARD = sqlConfig.BillboardDate.OpenSql() |
|||
if overall.CONSTANT_DB_HR == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.BillboardDate.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.BillboardDate.Name) |
|||
} |
|||
//健康上报数据库
|
|||
overall.CONSTANT_DB_HEALTH = sqlConfig.HealthReportDate.OpenSql() |
|||
if overall.CONSTANT_DB_HR == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.HealthReportDate.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.HealthReportDate.Name) |
|||
} |
|||
//绩效考核数据库
|
|||
overall.CONSTANT_DB_KPI = sqlConfig.KpiDate.OpenSql() |
|||
if overall.CONSTANT_DB_HR == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.KpiDate.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.KpiDate.Name) |
|||
} |
|||
//企业微信回调记录
|
|||
overall.CONSTANT_DB_WECHAT_LOG = sqlConfig.WechatCallBackLogDate.OpenSql() |
|||
if overall.CONSTANT_DB_HR == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.WechatCallBackLogDate.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.WechatCallBackLogDate.Name) |
|||
} |
|||
//管理档案
|
|||
overall.CONSTANT_DB_MANAGE_ARCHIVES = sqlConfig.Managearchives.OpenSql() |
|||
if overall.CONSTANT_DB_MANAGE_ARCHIVES == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.Managearchives.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.Managearchives.Name) |
|||
} |
|||
//系统权限配置数据库
|
|||
overall.CONSTANT_DB_System_Permission = sqlConfig.SystemPermission.OpenSql() |
|||
if overall.CONSTANT_DB_System_Permission == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.SystemPermission.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.SystemPermission.Name) |
|||
} |
|||
//仓储系统
|
|||
overall.CONSTANT_DB_Storage = sqlConfig.Storage.OpenSql() |
|||
if overall.CONSTANT_DB_Storage == nil { |
|||
fmt.Printf("%v数据库开启失败!\n", sqlConfig.Storage.Name) |
|||
} else { |
|||
fmt.Printf("%v数据库开启成功!\n", sqlConfig.Storage.Name) |
|||
} |
|||
} |
|||
@ -0,0 +1,55 @@ |
|||
package initviper |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"fmt" |
|||
|
|||
"github.com/fsnotify/fsnotify" |
|||
"github.com/spf13/viper" |
|||
) |
|||
|
|||
// 使用viper 处理包解决配置读取问题
|
|||
func RunViper(configInfo interface{}, path ...string) *viper.Viper { |
|||
var config string |
|||
if len(path) == 0 { |
|||
config = overall.ConfigFilePathConstant |
|||
fmt.Printf("你正在使用系统默认值。配置路径为:%v\n", config) |
|||
} else { |
|||
config = path[0] |
|||
fmt.Printf("你正在使用RunViper传值。配置路径为:%v\n", config) |
|||
} |
|||
v := viper.New() |
|||
// 设置配置文件信息
|
|||
v.SetConfigFile(config) |
|||
v.SetConfigType("yaml") |
|||
//读取配置信息
|
|||
err := v.ReadInConfig() |
|||
if err != nil { |
|||
panic(fmt.Errorf("配置文件读取失败?原因:%s\n", err)) |
|||
} |
|||
// 监控配置和重新获取配置
|
|||
v.WatchConfig() |
|||
|
|||
v.OnConfigChange(func(e fsnotify.Event) { |
|||
fmt.Printf("配置文件已经更改:%v\n", e.Name) |
|||
if errSet := v.Unmarshal(&configInfo); errSet != nil { |
|||
fmt.Printf("新配置文件解析失败!系统继续使用原配置!失败原因:%s\n", errSet) |
|||
} else { |
|||
// LoadDatabase()
|
|||
if e.Name == "config\\configDatabase\\database.yaml" { |
|||
LoadDatabase() |
|||
} |
|||
if e.Name == "config\\configNosql\\redis.yaml" { |
|||
LoadRedis() |
|||
} |
|||
} |
|||
}) |
|||
//解析配置映射到切片
|
|||
if errStruct := v.Unmarshal(&configInfo); errStruct != nil { |
|||
fmt.Printf("配置解析失败!原因:%s\n", errStruct) |
|||
} |
|||
// json.Marshal(configInfo)
|
|||
// cfi, _ := json.Marshal(configInfo)
|
|||
// fmt.Printf("============>%v\n", string(cfi))
|
|||
return v |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package initviper |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
) |
|||
|
|||
func LoadDatabase() { |
|||
sqlConfig := overall.CONSTANT_MYSQL |
|||
RunViper(&sqlConfig, overall.ConfigDatabaseConstant) |
|||
|
|||
} |
|||
|
|||
// 加载Redis
|
|||
func LoadRedis() { |
|||
//读取Redis配置
|
|||
redisConfig := overall.CONSTANT_Redis |
|||
RunViper(&redisConfig, overall.ConfigRedisConstant) |
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package nosql |
|||
|
|||
import ( |
|||
"appPlatform/initialization/initviper" |
|||
"appPlatform/overall" |
|||
) |
|||
|
|||
// 加载Redis
|
|||
func LoadRedis() { |
|||
//读取Redis配置
|
|||
redisConfig := overall.CONSTANT_Redis |
|||
initviper.RunViper(&redisConfig, overall.ConfigRedisConstant) |
|||
overall.CONSTANT_REDIS0 = redisConfig.MasterRedis.OpenRedis() |
|||
overall.CONSTANT_REDIS1 = redisConfig.MasterRedis1.OpenRedis() |
|||
overall.CONSTANT_REDIS2 = redisConfig.MasterRedis2.OpenRedis() |
|||
overall.CONSTANT_REDIS3 = redisConfig.MasterRedis3.OpenRedis() |
|||
overall.CONSTANT_REDIS4 = redisConfig.MasterRedis4.OpenRedis() |
|||
overall.CONSTANT_REDIS5 = redisConfig.MasterRedis5.OpenRedis() |
|||
} |
|||
@ -0,0 +1,59 @@ |
|||
package route |
|||
|
|||
import ( |
|||
"appPlatform/apirouter" |
|||
"appPlatform/identification/interceptor" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 初始化主路由
|
|||
func InitialRouter() *gin.Engine { |
|||
var router = gin.Default() |
|||
|
|||
//app默认相应
|
|||
appLoadRouterGroup := router.Group("") |
|||
{ |
|||
|
|||
// 跨域设置
|
|||
// router.Use(middleware.CrossDomainRequest()) // 如需跨域可以打开
|
|||
//app默认相应
|
|||
appLoadRouterGroup.GET("/", func(c *gin.Context) { |
|||
c.JSON(0, "通讯成功!") |
|||
}) |
|||
appLoadRouterGroup.POST("/", func(c *gin.Context) { |
|||
c.JSON(0, "通讯成功!") |
|||
}) |
|||
//实验路由
|
|||
|
|||
shiyanApi := apirouter.RouterGroupEntry.ShiyanApi |
|||
{ |
|||
shiyanApi.RouterGroup(appLoadRouterGroup) |
|||
} |
|||
|
|||
} |
|||
|
|||
//验证身份接口 鉴权Url(主要应用端使用)
|
|||
VerifyIdentity := router.Group("") |
|||
VerifyIdentity.Use(interceptor.AuthenticateUser()).Use(interceptor.VerifyUrl()) |
|||
{ |
|||
|
|||
//主体内容
|
|||
version1HonorsApi := apirouter.RouterGroupEntry.UserRouter |
|||
version1HonorsApi.RouterGroupPc(VerifyIdentity) |
|||
|
|||
} |
|||
//验证身份接口 无需鉴权Url(主要web端使用)
|
|||
VerifyIdentityWeb := router.Group("") |
|||
VerifyIdentityWeb.Use(interceptor.AuthenticateUser()) |
|||
{ |
|||
|
|||
} |
|||
//Token身份验证
|
|||
VerifyIdentityToken := router.Group("") |
|||
VerifyIdentityToken.Use(interceptor.IdentificationToken()) |
|||
{ |
|||
|
|||
} |
|||
return router |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
package main |
|||
|
|||
import ( |
|||
"appPlatform/initialization/app" |
|||
"appPlatform/initialization/databaseinit" |
|||
"appPlatform/initialization/nosql" |
|||
) |
|||
|
|||
func main() { |
|||
//加载数据库
|
|||
databaseinit.LoadDatabase() |
|||
//加载Redis
|
|||
nosql.LoadRedis() |
|||
//启动定时任务
|
|||
// scheduledtask.TimeTask()
|
|||
app.RunItem() |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
package middleware |
|||
|
|||
import ( |
|||
"net/http" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 处理跨域请求,支持options访问
|
|||
func CrossDomainRequest() gin.HandlerFunc { |
|||
return func(c *gin.Context) { |
|||
method := c.Request.Method |
|||
origin := c.Request.Header.Get("Origin") |
|||
c.Header("Access-Control-Allow-Origin", origin) |
|||
c.Header("Access-Control-Allow-Headers", "Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id") |
|||
c.Header("Access-Control-Allow-Methods", "POST, GET, OPTIONS,DELETE,PUT") |
|||
c.Header("Access-Control-Expose-Headers", "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type") |
|||
c.Header("Access-Control-Allow-Credentials", "true") |
|||
// 放行所有OPTIONS方法
|
|||
if method == "OPTIONS" { |
|||
c.AbortWithStatus(http.StatusNoContent) |
|||
} |
|||
// 处理请求
|
|||
c.Next() |
|||
} |
|||
} |
|||
@ -0,0 +1,415 @@ |
|||
package grocerystore |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"context" |
|||
"fmt" |
|||
"time" |
|||
|
|||
"github.com/go-redis/redis/v8" |
|||
) |
|||
|
|||
// redis 基础设定
|
|||
type RedisStoreType struct { |
|||
Expiration time.Duration |
|||
PreKey string |
|||
Context context.Context |
|||
RedisDb *redis.Client |
|||
} |
|||
|
|||
// 启动redis
|
|||
func RunRedis(redisClient *redis.Client) *RedisStoreType { |
|||
var redisStoreType RedisStoreType |
|||
redisStoreType.Expiration = time.Second * 300 |
|||
redisStoreType.PreKey = fmt.Sprintf("%v:", overall.CONSTANT_CONFIG.RedisPrefixStr.PreFix) |
|||
redisStoreType.Context = context.Background() |
|||
redisStoreType.RedisDb = redisClient |
|||
return &redisStoreType |
|||
} |
|||
|
|||
// 设置键前缀
|
|||
func (r *RedisStoreType) SetRedisPrefix(prefix string) { |
|||
r.PreKey = prefix |
|||
} |
|||
|
|||
// 设置过期时间
|
|||
func (r *RedisStoreType) SetRedisTime(timeDate int64) { |
|||
r.Expiration = time.Second * time.Duration(timeDate) |
|||
} |
|||
|
|||
// 设置字符串
|
|||
func (r *RedisStoreType) Set(key string, value string) bool { |
|||
err := r.RedisDb.Set(r.Context, r.PreKey+key, value, r.Expiration).Err() |
|||
if err != nil { |
|||
return false |
|||
} |
|||
return true |
|||
} |
|||
|
|||
// 获取字符串
|
|||
func (r *RedisStoreType) Get(key string) (bool, string) { |
|||
err := r.RedisDb.Get(r.Context, r.PreKey+key) |
|||
if err.Err() != nil { |
|||
return false, "" |
|||
} |
|||
return true, err.Val() |
|||
} |
|||
|
|||
// 删除键
|
|||
func (r *RedisStoreType) DelKey(key string) bool { |
|||
err := r.RedisDb.Del(r.Context, r.PreKey+key).Err() |
|||
if err != nil { |
|||
return false |
|||
} |
|||
return true |
|||
} |
|||
|
|||
//哈希操作
|
|||
/* |
|||
获取单个哈希键值 |
|||
@hashName 集合名称 |
|||
@hashKey 哈希键 |
|||
callback |
|||
errs 状态 |
|||
hashVal 获得值 |
|||
*/ |
|||
func (r *RedisStoreType) HashGet(hashName, hashKey string) (errs bool, hashVal string) { |
|||
err := r.RedisDb.HGet(r.Context, r.PreKey+hashName, hashKey) |
|||
if err.Err() != nil { |
|||
return false, "" |
|||
} |
|||
return true, err.Val() |
|||
} |
|||
|
|||
/* |
|||
为哈希表中的字段赋值 。 单一设置 |
|||
@hashName 集合名称 |
|||
@hashKey 哈希键 |
|||
@hashVal 要添加的值 |
|||
*/ |
|||
func (r *RedisStoreType) HashSet(hashName, hashKey, hashVal string) bool { |
|||
err := r.RedisDb.HSet(r.Context, r.PreKey+hashName, hashKey, hashVal).Err() |
|||
if err != nil { |
|||
return false |
|||
} |
|||
if r.Expiration == 0 { |
|||
r.RedisDb.Persist(r.Context, r.PreKey+hashName) |
|||
} else { |
|||
r.RedisDb.PExpire(r.Context, r.PreKey+hashName, r.Expiration) |
|||
} |
|||
// global.GVA_REDIS.PExpire(r.Context, r.PreKey+hashName, r.Expiration)
|
|||
return true |
|||
} |
|||
|
|||
/* |
|||
同时将多个 field-value (字段-值)对设置到哈希表中。 |
|||
@hashName 集合名称 |
|||
@hashVal 要添加的键与值 |
|||
*/ |
|||
func (r *RedisStoreType) HashMsetAdd(hashName string, hashVal map[string]interface{}) bool { |
|||
// rdb := RedisInit()
|
|||
err := r.RedisDb.HMSet(r.Context, r.PreKey+hashName, hashVal).Err() |
|||
// fmt.Printf("错误sss=========》%v=====2====》%v\n", err, hashVal)
|
|||
// err := rdb.HMSet(ctx, "userfg", hashVal).Err()
|
|||
if err != nil { |
|||
return false |
|||
} |
|||
if r.Expiration == 0 { |
|||
r.RedisDb.Persist(r.Context, r.PreKey+hashName) |
|||
} else { |
|||
r.RedisDb.PExpire(r.Context, r.PreKey+hashName, r.Expiration) |
|||
} |
|||
|
|||
return true |
|||
} |
|||
func (r *RedisStoreType) HashMsetAddinterface(hashName string, hashVal interface{}) bool { |
|||
// rdb := RedisInit()
|
|||
err := r.RedisDb.HMSet(r.Context, r.PreKey+hashName, hashVal).Err() |
|||
// fmt.Printf("错误sss=========》%v=====2====》%v\n", err, hashVal)
|
|||
// err := rdb.HMSet(ctx, "userfg", hashVal).Err()
|
|||
if err != nil { |
|||
return false |
|||
} |
|||
if r.Expiration == 0 { |
|||
r.RedisDb.Persist(r.Context, r.PreKey+hashName) |
|||
} else { |
|||
r.RedisDb.PExpire(r.Context, r.PreKey+hashName, r.Expiration) |
|||
} |
|||
|
|||
return true |
|||
} |
|||
func (r *RedisStoreType) HashMsetAddAry(hashName string, hashVal []map[string]interface{}) bool { |
|||
// rdb := RedisInit()
|
|||
err := r.RedisDb.HMSet(r.Context, r.PreKey+hashName, hashVal).Err() |
|||
// err := rdb.HMSet(ctx, "userfg", hashVal).Err()
|
|||
if err != nil { |
|||
return false |
|||
} |
|||
if r.Expiration == 0 { |
|||
r.RedisDb.Persist(r.Context, r.PreKey+hashName) |
|||
} else { |
|||
r.RedisDb.PExpire(r.Context, r.PreKey+hashName, r.Expiration) |
|||
} |
|||
// global.GVA_REDIS.PExpire(r.Context, r.PreKey+hashName, r.Expiration)
|
|||
// fmt.Printf("错误sss=========》%v\n", hashVal)
|
|||
return true |
|||
} |
|||
|
|||
/* |
|||
返回哈希表中,所有的字段和值。 |
|||
@hashName 集合名称 |
|||
@hashKey 哈希键 |
|||
*/ |
|||
func (r *RedisStoreType) HashGetAll(hashName string) (map[string]string, bool) { |
|||
// rdb := RedisInit()
|
|||
// fmt.Printf("strKEy:===>%v\n", r.PreKey+hashName)
|
|||
val, err := r.RedisDb.HGetAll(r.Context, r.PreKey+hashName).Result() |
|||
if err != nil { |
|||
return val, false |
|||
} |
|||
if len(val) == 0 { |
|||
return val, false |
|||
} |
|||
return val, true |
|||
} |
|||
|
|||
//Redis 列表(List)
|
|||
|
|||
/* |
|||
* |
|||
Linsert 命令用于在列表的元素前或者后插入元素。当指定元素不存在于列表中时,不执行任何操作。 |
|||
当列表不存在时,被视为空列表,不执行任何操作。 |
|||
如果 key 不是列表类型,返回一个错误。 |
|||
@key 列表 |
|||
@op 插入状态 (1:在pivot之后;2:在pivot之前) |
|||
@pivot 定位值 |
|||
@value 要插入值 |
|||
*/ |
|||
func (r *RedisStoreType) Linsert(key string, op int, pivot, value interface{}) (int64, bool) { |
|||
BeforeOrAfter := "BEFORE" |
|||
if op != 1 { |
|||
BeforeOrAfter = "AFTER" |
|||
} |
|||
linsert, linsertErr := r.RedisDb.LInsert(r.Context, key, BeforeOrAfter, pivot, value).Result() |
|||
if linsertErr != nil { |
|||
return 0, false |
|||
} |
|||
return linsert, true |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Lindex 命令用于通过索引获取列表中的元素。你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。 |
|||
@key 列表 |
|||
@index 索引 |
|||
*/ |
|||
func (r *RedisStoreType) Lindex(key string, index int64) (val string, err error) { |
|||
val, err = r.RedisDb.LIndex(r.Context, key, index).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Llen 命令用于返回列表的长度。 如果列表 key 不存在,则 key 被解释为一个空列表,返回 0 。 如果 key 不是列表类型,返回一个错误。 |
|||
@key 列表 |
|||
*/ |
|||
func (r *RedisStoreType) Llen(key string) (val int64, err error) { |
|||
val, err = r.RedisDb.LLen(r.Context, key).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Lpop 命令用于移除并返回列表的第一个元素。 |
|||
@key 列表 |
|||
*/ |
|||
func (r *RedisStoreType) Lpop(key string) (val string, err error) { |
|||
val, err = r.RedisDb.LPop(r.Context, key).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Lpush 命令将一个或多个值插入到列表头部。 如果 key 不存在,一个空列表会被创建并执行 LPUSH 操作。 当 key 存在但不是列表类型时,返回一个错误。 |
|||
@key 列表 |
|||
@value 要插入的字符串 |
|||
*/ |
|||
func (r *RedisStoreType) Lpush(key string, value ...interface{}) (val int64, err error) { |
|||
val, err = r.RedisDb.LPush(r.Context, key, value).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Lpushx 将一个值插入到已存在的列表头部,列表不存在时操作无效。 |
|||
@key 列表 |
|||
@value 要插入的字符串 |
|||
*/ |
|||
func (r *RedisStoreType) Lpushx(key, value string) (val int64, err error) { |
|||
val, err = r.RedisDb.LPushX(r.Context, key, value).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Lrange 返回列表中指定区间内的元素,区间以偏移量 START 和 END 指定。 其中 0 表示列表的第一个元素, 1 表示列表的第二个元素,以此类推。 你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。 |
|||
@key 列表 |
|||
@start 起始值 |
|||
@stop 结束值 |
|||
*/ |
|||
func (r *RedisStoreType) Lrange(key string, start, stop int64) (val []string, err error) { |
|||
val, err = r.RedisDb.LRange(r.Context, key, start, stop).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Lrem 根据参数 COUNT 的值,移除列表中与参数 VALUE 相等的元素。 |
|||
COUNT 的值可以是以下几种: |
|||
|
|||
count > 0 : 从表头开始向表尾搜索,移除与 VALUE 相等的元素,数量为 COUNT 。 |
|||
count < 0 : 从表尾开始向表头搜索,移除与 VALUE 相等的元素,数量为 COUNT 的绝对值。 |
|||
count = 0 : 移除表中所有与 VALUE 相等的值。 |
|||
|
|||
@start = COUNT |
|||
@key 列表 |
|||
*/ |
|||
func (r *RedisStoreType) Lrem(key string, start int64, value ...interface{}) (val int64, err error) { |
|||
val, err = r.RedisDb.LRem(r.Context, key, start, value).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Redis Lset 通过索引来设置元素的值。 |
|||
|
|||
当索引参数超出范围,或对一个空列表进行 LSET 时,返回一个错误。 |
|||
@key 列表 |
|||
@indexes 索引值 |
|||
*/ |
|||
func (r *RedisStoreType) Lset(key string, indexes int64, value ...interface{}) (val string, err error) { |
|||
val, err = r.RedisDb.LSet(r.Context, key, indexes, value).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Ltrim 对一个列表进行修剪(trim),就是说,让列表只保留指定区间内的元素,不在指定区间之内的元素都将被删除。 |
|||
|
|||
下标 0 表示列表的第一个元素,以 1 表示列表的第二个元素,以此类推。 你也可以使用负数下标,以 -1 表示列表的最后一个元素, -2 表示列表的倒数第二个元素,以此类推。 |
|||
@key 列表 |
|||
@start 起始值 |
|||
@stop 结束值 |
|||
*/ |
|||
func (r *RedisStoreType) Ltrim(key string, start, stop int64) (val string, err error) { |
|||
val, err = r.RedisDb.LTrim(r.Context, key, start, stop).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Rpop 命令用于移除列表的最后一个元素,返回值为移除的元素。 |
|||
@key 列表 |
|||
*/ |
|||
func (r *RedisStoreType) Rpop(key string) (val string, err error) { |
|||
val, err = r.RedisDb.RPop(r.Context, key).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Rpoplpush 命令用于移除列表的最后一个元素,并将该元素添加到另一个列表并返回。 |
|||
@sourceKey 源列表 |
|||
@newKey 目标列表 |
|||
*/ |
|||
func (r *RedisStoreType) Rpoplpush(sourceKey, newKey string) (val string, err error) { |
|||
val, err = r.RedisDb.RPopLPush(r.Context, sourceKey, newKey).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Rpush 命令用于将一个或多个值插入到列表的尾部(最右边)。 |
|||
如果列表不存在,一个空列表会被创建并执行 RPUSH 操作。 当列表存在但不是列表类型时,返回一个错误。 |
|||
@key 列表 |
|||
@value 要插入的字符串 |
|||
*/ |
|||
func (r *RedisStoreType) Rpush(key string, value ...interface{}) (val int64, err error) { |
|||
val, err = r.RedisDb.RPush(r.Context, key, value).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Rpushx 命令用于将一个值插入到已存在的列表尾部(最右边)。如果列表不存在,操作无效。 |
|||
@key 列表 |
|||
@value 要插入的字符串 |
|||
*/ |
|||
func (r *RedisStoreType) Rpushx(key string, value ...interface{}) (val int64, err error) { |
|||
val, err = r.RedisDb.RPushX(r.Context, key, value).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Blpop 命令移出并获取列表的第一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止。 |
|||
@key 列表 |
|||
*/ |
|||
func (r *RedisStoreType) Blpop(key string) (val []string, err error) { |
|||
val, err = r.RedisDb.BLPop(r.Context, r.Expiration, key).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Brpop 命令移出并获取列表的最后一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止。 |
|||
@key 列表 |
|||
*/ |
|||
func (r *RedisStoreType) Brpop(key string) (val []string, err error) { |
|||
val, err = r.RedisDb.BRPop(r.Context, r.Expiration, key).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
* |
|||
Brpoplpush 命令从列表中取出最后一个元素,并插入到另外一个列表的头部; 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止。 |
|||
@source 源列表 |
|||
@destination 目标列表 |
|||
*/ |
|||
func (r *RedisStoreType) Brpoplpush(source, destination string) (val string, err error) { |
|||
val, err = r.RedisDb.BRPopLPush(r.Context, source, destination, r.Expiration).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
Redis 键(key) |
|||
Redis 键命令用于管理 redis 的键。 |
|||
*/ |
|||
|
|||
/* |
|||
Redis SCAN 命令 |
|||
Redis Scan 命令用于迭代数据库中的数据库键。 |
|||
|
|||
SCAN 命令是一个基于游标的迭代器,每次被调用之后, 都会向用户返回一个新的游标, 用户在下次迭代时需要使用这个新游标作为 SCAN 命令的游标参数, 以此来延续之前的迭代过程。 |
|||
|
|||
SCAN 返回一个包含两个元素的数组, 第一个元素是用于进行下一次迭代的新游标, 而第二个元素则是一个数组, 这个数组中包含了所有被迭代的元素。如果新游标返回 0 表示迭代已结束。 |
|||
|
|||
相关命令: |
|||
|
|||
SSCAN 命令用于迭代集合键中的元素。 |
|||
HSCAN 命令用于迭代哈希键中的键值对。 |
|||
ZSCAN 命令用于迭代有序集合中的元素(包括元素成员和元素分值)。 |
|||
*/ |
|||
|
|||
func (r *RedisStoreType) Scan(cursor uint64, match string, count int64) (keys []string, cursores uint64, err error) { |
|||
keys, cursores, err = r.RedisDb.Scan(r.Context, cursor, match, count).Result() |
|||
return |
|||
} |
|||
|
|||
/* |
|||
*Keys 命令用于查找所有符合给定模式 pattern 的 key 。。 |
|||
*/ |
|||
func (r *RedisStoreType) Keys(key string) (val []string, err error) { |
|||
val, err = r.RedisDb.Keys(r.Context, key).Result() |
|||
return |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
package snowflake |
|||
|
|||
import ( |
|||
"errors" |
|||
"time" |
|||
) |
|||
|
|||
//雪花算法
|
|||
func NewWorker(workerId int64) (*Worker, error) { |
|||
if workerId < 0 || workerId > workerMax { |
|||
return nil, errors.New("工作机器的ID超出范围!") |
|||
} |
|||
// 生成一个新节点
|
|||
return &Worker{ |
|||
timestamp: 0, |
|||
workerId: workerId, |
|||
number: 0, |
|||
}, nil |
|||
} |
|||
|
|||
func (w *Worker) GetId() int64 { |
|||
w.mu.Lock() |
|||
defer w.mu.Unlock() |
|||
now := time.Now().UnixNano() / 1e6 |
|||
if w.timestamp == now { |
|||
w.number++ |
|||
if w.number > numberMax { |
|||
for now <= w.timestamp { |
|||
now = time.Now().UnixNano() / 1e6 |
|||
} |
|||
} |
|||
} else { |
|||
w.number = 0 |
|||
w.timestamp = now |
|||
} |
|||
ID := int64((now-startTime)<<timeShift | (w.workerId << workerShift) | (w.number)) |
|||
return ID |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package snowflake |
|||
|
|||
import "sync" |
|||
|
|||
//雪花算法
|
|||
const ( |
|||
workerBits uint8 = 10 |
|||
numberBits uint8 = 12 |
|||
workerMax int64 = -1 ^ (-1 << workerBits) |
|||
numberMax int64 = -1 ^ (-1 << numberBits) |
|||
timeShift uint8 = workerBits + numberBits |
|||
workerShift uint8 = numberBits |
|||
startTime int64 = 1655827200000 // 如果在程序跑了一段时间修改了epoch这个值 可能会导致生成相同的ID
|
|||
) |
|||
|
|||
type Worker struct { |
|||
mu sync.Mutex |
|||
timestamp int64 |
|||
workerId int64 |
|||
number int64 |
|||
} |
|||
@ -0,0 +1,45 @@ |
|||
package modelbookimg |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 档案管理分类
|
|||
type ArchivesType struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:at_id;type:bigint unsigned;not null;comment:ID"` |
|||
Title string `json:"title" gorm:"column:at_title;type:varchar(255);comment:档案分类名称"` |
|||
Stater int `json:"stater" gorm:"column:at_stater;type:tinyint unsigned;not null;default:1;comment:档案分类状态"` |
|||
ParentId int64 `json:"parentid" gorm:"column:at_parent_id;type:bigint unsigned;not null;default:0;comment:档案分类父级"` |
|||
Time int64 `json:"time" gorm:"column:at_time;type:bigint unsigned;not null;default:0;comment:写入时间"` |
|||
Uid int64 `json:"uid" gorm:"column:at_uid;type:bigint unsigned;not null;default:0;comment:添加人员"` |
|||
Sort int `json:"sort" gorm:"column:at_sort;type:smallint unsigned;not null;default:50;comment:排序"` |
|||
} |
|||
|
|||
func (at *ArchivesType) TableName() string { |
|||
return "archives_type" |
|||
} |
|||
|
|||
// 编辑档案管理分类内容
|
|||
func (cont *ArchivesType) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_Master.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取档案管理分类内容
|
|||
func (cont *ArchivesType) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_Master.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *ArchivesType) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_Master.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package modelbookimg |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 文档属性
|
|||
type BookAttribute struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:b_id;type:bigint unsigned;not null;auto_increment;comment:ID"` |
|||
FileId int64 `json:"fileid" gorm:"column:b_file_id;type:bigint unsigned;not null;default:0;comment:文档ID"` |
|||
UserId int64 `json:"userid" gorm:"column:b_userid;type:bigint unsigned;not null;default:0;comment:阅读人ID"` |
|||
Time int64 `json:"time" gorm:"column:b_time;type:bigint unsigned;not null;default:0;comment:阅读时间"` |
|||
Type int `json:"type" gorm:"column:b_type;type:tinyint unsigned;not null;default:1;comment:类型 (1:阅读量;2:收藏数;3:赞;4:踩)"` |
|||
Stater int `json:"stater" gorm:"column:b_stater;type:tinyint unsigned;not null;default:1;comment:状态(1:有效;2:无效)"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:b_eite_time;type:bigint unsigned;not null;default:0;comment:编辑时间"` |
|||
Source int `json:"source" gorm:"column:b_source;type:tinyint unsigned;not null;default:1;comment:来源(1:文档类;2:文档类评论;3:问题;4:问题答案;5:问题答案评论)"` |
|||
} |
|||
|
|||
func (ba *BookAttribute) TableName() string { |
|||
return "bookattribute" |
|||
} |
|||
|
|||
// 编辑文档属性内容
|
|||
func (cont *BookAttribute) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_FILE_BOOK.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取文档属性内容
|
|||
func (cont *BookAttribute) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_FILE_BOOK.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *BookAttribute) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_FILE_BOOK.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
package modelbookimg |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 评论列表
|
|||
type DiscussMsg struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:dis_id;type:bigint unsigned;not null;auto_increment;comment:ID"` |
|||
FileId int64 `json:"fileid" gorm:"column:dis_file_id;type:bigint unsigned;not null;default:0;comment:文档ID"` |
|||
UserId int64 `json:"userid" gorm:"column:dis_user_id;type:bigint unsigned;not null;default:0;comment:评论人ID"` |
|||
Prent int64 `json:"prent" gorm:"column:dis_prent;type:bigint unsigned;not null;default:0;comment:归属(0:评论源)"` |
|||
Cont string `json:"cont" gorm:"column:dis_cont;type:text;comment:评论内容"` |
|||
Time int64 `json:"time" gorm:"column:dis_time;type:bigint unsigned;default:0;comment:评论时间"` |
|||
Stater int `json:"stater" gorm:"column:dis_stater;type:tinyint unsigned;not null;default:1;comment:状态(1:审核;2:发布;3:下架;4:删除)"` |
|||
Source int `json:"source" gorm:"column:dis_source;type:tinyint unsigned;not null;default:1;comment:来源(1:文档类;2:文档类评论;3:问题;4:问题答案;5:问题答案评论)"` |
|||
UserJson string `json:"userjson" gorm:"column:dis_user_json;type:mediumtext;comment:评论人基本信息"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:dis_eite_time;type:bigint unsigned;not null;default:0;comment:修改时间"` |
|||
} |
|||
|
|||
func (dm *DiscussMsg) TableName() string { |
|||
return "discussmsg" |
|||
} |
|||
|
|||
// 编辑评论列表内容
|
|||
func (cont *DiscussMsg) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_FILE_BOOK.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取评论列表内容
|
|||
func (cont *DiscussMsg) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_FILE_BOOK.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *DiscussMsg) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_FILE_BOOK.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,72 @@ |
|||
package modelbookimg |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 图文信息表
|
|||
type GraphicForm struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:g_id;type:bigint unsigned;not null;comment:ID"` |
|||
Title string `json:"title" gorm:"column:g_title;type:varchar(255);comment:标题"` |
|||
Key string `json:"key" gorm:"column:g_key;type:varchar(255);comment:关键字"` |
|||
Describe string `json:"describe" gorm:"column:g_describe;type:mediumtext;comment:描述"` |
|||
Parent int64 `json:"parent" gorm:"column:g_parent;type:bigint unsigned;not null;default:0;comment:父级"` |
|||
ParentSun int64 `json:"parentsun" gorm:"column:g_parent_sun;type:bigint unsigned;not null;default:0;comment:父类"` |
|||
Source int `json:"source" gorm:"column:g_source;type:tinyint unsigned;default:1;not null;comment:文档来源(1:原创;2:转载)"` |
|||
SourceUrl string `json:"sourceurl" gorm:"column:g_source_url;type:varchar(255);comment:转载地址"` |
|||
Thumbnail string `json:"thumbnail" gorm:"column:g_thumbnail;type:varchar(255);comment:缩略图"` |
|||
Sort int64 `json:"sort" gorm:"column:g_sort;type:bigint unsigned;default:50;not null;comment:排序"` |
|||
Comment int `json:"comment" gorm:"column:g_comment;type:tinyint unsigned;default:1;not null;comment:评论设置(1:允许评论;2:禁止评论)"` |
|||
VisitStrat int `json:"visitstrat" gorm:"column:g_visit_strat;type:tinyint unsigned;default:1;not null;comment:访问权限(1:公开;2:分厂;3:工段;4:自定义)"` |
|||
State int `json:"state" gorm:"column:g_state;type:tinyint unsigned;default:1;not null;comment:状态(1:草稿;2:发表;3:下架;4:删除)"` |
|||
AddTime int64 `json:"addtime" gorm:"column:g_add_time;type:bigint unsigned;default:0;not null;comment:写入时间"` |
|||
EiteTime int64 `json:"eite" gorm:"column:g_eite_time;type:bigint;not null;comment:修改时间"` |
|||
UserKey int64 `json:"userkey" gorm:"column:g_user_key;type:bigint;comment:编辑人员"` |
|||
BfId int64 `json:"bfid" gorm:"column:g_bf_id;type:bigint unsigned;default:0;not null;comment:分厂"` |
|||
WsId int64 `json:"wsid" gorm:"column:g_ws_id;type:bigint unsigned;default:0;not null;comment:工段"` |
|||
Team int64 `json:"team" gorm:"column:g_team;type:bigint unsigned;default:0;not null;comment:班组"` |
|||
DownLoadState int `json:"downloadstate" gorm:"column:g_download_state;type:tinyint unsigned;default:1;not null;comment:是否允许下载(1:允许;2:禁止)"` |
|||
Read int `json:"read" gorm:"column:g_read;type:int unsigned;default:0;not null;comment:阅读量"` |
|||
ComSum int `json:"comsum" gorm:"column:g_com_sum;type:int unsigned;default:0;not null;comment:评论数"` |
|||
CollectionSum int `json:"collectionsum" gorm:"column:g_collection_sum;type:int unsigned;default:0;not null;comment:收藏数"` |
|||
Likes int `json:"likes" gorm:"column:g_likes;type:int unsigned;default:0;not null;comment:点赞数"` |
|||
Recommend int `json:"recommend" gorm:"column:g_recommend;type:tinyint unsigned;default:2;not null;comment:推荐(1:推荐,2:不推荐)"` |
|||
Content string `json:"content" gorm:"column:g_content;type:longtext;comment:图文详情"` |
|||
StepOn int `json:"stepon" gorm:"column:g_step_on;type:int unsigned;default:0;not null;comment:踩数量"` |
|||
Range string `json:"range" gorm:"column:g_range;type:mediumtext;comment:自定义可见范围"` |
|||
WriteBfid string `json:"writebfid" gorm:"column:g_write_bfid;type:bigint unsigned;default:0;not null;comment:写入分厂"` |
|||
TextName string `json:"textname" gorm:"column:g_text_name;type:varchar(255);default:'';comment:正文文档名称"` |
|||
TestUrl string `json:"testurl" gorm:"column:g_test_url;type:varchar(255);default:'';comment:正文文档URL"` |
|||
PhysicsPath string `json:"physicspath" gorm:"column:g_physics_path;type:varchar(255);default:'';comment:物理地址"` |
|||
WriteGroup int64 `json:"writegroup" gorm:"column:g_write_group;type:bigint unsigned;default:3;not null;comment:写入人员组织"` |
|||
OuterLink string `json:"outerlink" gorm:"column:g_outer_link;type:varchar(255);default:'';comment:外部链接"` |
|||
} |
|||
|
|||
func (gf *GraphicForm) TableName() string { |
|||
return "graphicform" |
|||
} |
|||
|
|||
// 编辑图文信息内容
|
|||
func (cont *GraphicForm) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_IMAGES_TEST.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取图文信息内容
|
|||
func (cont *GraphicForm) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_IMAGES_TEST.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *GraphicForm) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_IMAGES_TEST.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package modelbookimg |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 举报
|
|||
type Reporting struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:r_id;type:bigint unsigned;not null;auto_increment;comment:ID"` |
|||
UserKey int64 `json:"userkey" gorm:"column:r_user_key;type:bigint unsigned;not null;default:0;comment:编辑人员"` |
|||
UserJson string `json:"userjson" gorm:"column:r_user_json;type:mediumtext;comment:举报人基本信息"` |
|||
Content string `json:"content" gorm:"column:r_content;type:mediumtext;comment:举报内容"` |
|||
AnsId int64 `json:"ansid" gorm:"column:r_ans_id;type:bigint unsigned;not null;comment:被举报答案ID"` |
|||
AnsCont string `json:"anscont" gorm:"column:r_ans_cont;type:mediumtext;comment:被举报内容"` |
|||
Time int64 `json:"time" gorm:"column:r_time;type:bigint unsigned;default:0;not null;comment:举报时间"` |
|||
State int `json:"state" gorm:"column:r_state;type:tinyint unsigned;default:1;not null;comment:状态(1:审核,2:有效;3:无效;4:删除)"` |
|||
} |
|||
|
|||
func (r *Reporting) TableName() string { |
|||
return "reporting" |
|||
} |
|||
|
|||
// 编辑举报内容
|
|||
func (cont *Reporting) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_FILE_BOOK.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取举报内容
|
|||
func (cont *Reporting) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_FILE_BOOK.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *Reporting) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_FILE_BOOK.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
package modelbookimg |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 关键词记录
|
|||
type SearchLog struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:sea_id;type:bigint unsigned;not null;auto_increment;comment:ID"` |
|||
Cont string `json:"cont" gorm:"column:sea_cont;type:varchar(255);comment:关键词"` |
|||
UserKey int64 `json:"userkey" gorm:"column:sea_user_key;type:bigint unsigned;not null;default:0;comment:搜索人"` |
|||
Num int `json:"num" gorm:"column:sea_num;type:int unsigned;not null;default:0;comment:搜索次数"` |
|||
Time int64 `json:"time" gorm:"column:sea_time;type:bigint unsigned;not null;default:0;comment:时间"` |
|||
State int `json:"state" gorm:"column:sea_state;type:tinyint unsigned;not null;default:1;comment:1:启用,2:删除"` |
|||
} |
|||
|
|||
func (sl *SearchLog) TableName() string { |
|||
return "reporting" |
|||
} |
|||
|
|||
// 编辑关键词记录内容
|
|||
func (cont *SearchLog) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_FILE_BOOK.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取关键词记录内容
|
|||
func (cont *SearchLog) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_FILE_BOOK.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *SearchLog) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_FILE_BOOK.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
package modelbookimg |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 追问
|
|||
type Traceing struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:tr_id;type:bigint unsigned;not null;auto_increment;comment:ID"` |
|||
AnsId int64 `json:"ansid" gorm:"column:tr_ans_id;type:bigint unsigned;not null;default:0;comment:答案ID"` |
|||
UserKey int64 `json:"userkey" gorm:"column:tr_user_key;type:bigint unsigned;not null;default:0;comment:追问人Key"` |
|||
UserJson string `json:"userjson" gorm:"column:tr_user_json;type:mediumtext;comment:追问人基本信息"` |
|||
Cont string `json:"cont" gorm:"column:tr_cont;type:mediumtext;comment:内容"` |
|||
Type int `json:"type" gorm:"column:tr_type;type:tinyint unsigned;not null;default:1;comment:类型(1:追问;2:追答)"` |
|||
State int `json:"state" gorm:"column:tr_state;type:tinyint unsigned;not null;default:1;comment:状态(1:启用;2:禁用)"` |
|||
Time int64 `json:"time" gorm:"column:tr_time;type:bigint unsigned;not null;default:0;comment:时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:tr_eite_time;type:bigint unsigned;not null;default:0;comment:编辑时间"` |
|||
AnsUserKey int64 `json:"ansuserkey" gorm:"column:tr_ans_user_key;type:bigint unsigned;not null;default:0;comment:问题回答人"` |
|||
IsRes int `json:"isres" gorm:"column:tr_is_res;type:tinyint unsigned;not null;default:1;comment:是否已经解决(1:未解决;2:已解决)"` |
|||
} |
|||
|
|||
func (ri *Traceing) TableName() string { |
|||
return "traceing" |
|||
} |
|||
|
|||
// 编辑追问内容
|
|||
func (cont *Traceing) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_FILE_BOOK.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取追问内容
|
|||
func (cont *Traceing) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_FILE_BOOK.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *Traceing) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_FILE_BOOK.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,42 @@ |
|||
package modelshonory |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 载体类型
|
|||
type CarrierType struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:荣誉名称"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
} |
|||
|
|||
func (CarrierType *CarrierType) TableName() string { |
|||
return "carrier_type" |
|||
} |
|||
|
|||
// 编辑载体类型内容
|
|||
func (cont *CarrierType) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取载体类型内容
|
|||
func (cont *CarrierType) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *CarrierType) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
package modelshonory |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 荣誉档案
|
|||
type HonoraryArchives struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:荣誉名称"` |
|||
IssuingUnit string `json:"issuingunit" gorm:"column:issuing_unit;type:varchar(255) unsigned;default:'';not null;comment:发放单位"` |
|||
Carrier int64 `json:"carrier" gorm:"column:carrier;type:bigint(20) unsigned;default:0;not null;comment:载体"` |
|||
AwardTime int64 `json:"awardtime" gorm:"column:award_time;type:bigint(20) ;default:0;not null;comment:获奖时间"` |
|||
TermOfValidity int64 `json:"termvalidity" gorm:"column:term_of_validity;type:bigint(20) unsigned;default:0;not null;comment:有效期限"` |
|||
Contet string `json:"contet" gorm:"column:contet;type:mediumtext unsigned;comment:备注"` |
|||
Organization int64 `json:"organization" gorm:"column:organization;type:bigint(20) unsigned;default:0;not null;comment:归属行政组织"` |
|||
Userid int64 `json:"userid" gorm:"column:userid;type:bigint(20) unsigned;default:0;not null;comment:归属人员"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
} |
|||
|
|||
func (HonoraryArchives *HonoraryArchives) TableName() string { |
|||
return "honorary_archives" |
|||
} |
|||
|
|||
// 编辑荣誉档案内容
|
|||
func (cont *HonoraryArchives) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取荣誉档案内容
|
|||
func (cont *HonoraryArchives) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *HonoraryArchives) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
package modelshonory |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 图片库
|
|||
type PhotosGallery struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Url string `json:"url" gorm:"column:url;type:varchar(255) unsigned;default:'';not null;comment:图片地址"` |
|||
ImgPath string `json:"imgpath" gorm:"column:img_path;type:varchar(255) unsigned;default:'';not null;comment:物理地址"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:文档名称"` |
|||
FileSize string `json:"filesize" gorm:"column:file_size;type:varchar(255) unsigned;default:'';not null;comment:文档大小"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
AscriptionId int64 `json:"ascriptionid" gorm:"column:ascription_id;type:bigint(20) unsigned;default:0;not null;comment:归属"` |
|||
AscriptionDataSheet string `json:"ascriptiondatasheet" gorm:"column:ascription_data_sheet;type:varchar(255) unsigned;default:'';not null;comment:归属拿个数据表"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
} |
|||
|
|||
func (PhotosGallery *PhotosGallery) TableName() string { |
|||
return "photos_gallery" |
|||
} |
|||
|
|||
// 编辑图片库内容
|
|||
func (cont *PhotosGallery) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取图片库内容
|
|||
func (cont *PhotosGallery) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_MANAGE_ARCHIVES.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *PhotosGallery) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_MANAGE_ARCHIVES.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,63 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 行政组织
|
|||
type AdministrativeOrganization struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:行政编码"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:组织名称"` |
|||
Superior int64 `json:"superior" gorm:"column:superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"` |
|||
OrganizationType int64 `json:"organizationtype" gorm:"column:organization_type;type:bigint(20) unsigned;default:0;not null;comment:行政组织类型"` |
|||
Abbreviation string `json:"abbreviation" gorm:"column:abbreviation;type:varchar(255) unsigned;default:'';not null;comment:行政组织简称"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
WechatOrganizationId int64 `json:"wechatorganizationid" gorm:"column:wechat_organization_id;type:bigint(20) unsigned;default:0;not null;comment:微信组织架构对照码"` |
|||
SuperiorSun string `json:"superiorsun" gorm:"column:superior_sun;type:mediumtext;comment:级联ID"` |
|||
Schoole int64 `json:"schoole" gorm:"column:schoole;type:bigint(20) unsigned;default:0;not null;comment:原知行学院对照码"` |
|||
KingdeeId string `json:"kingdeeid" gorm:"column:kingdeeid;type:varchar(255) unsigned;default:'';comment:金蝶对照ID"` |
|||
IsPower int `json:"ispower" gorm:"column:ispower;type:int(1) unsigned;default:2;not null;comment:是否为实权部门"` |
|||
Sort int `json:"sort" gorm:"column:sort;type:int(6) unsigned;default:100;not null;comment:是否为实权部门"` |
|||
} |
|||
|
|||
func (AdministrativeOrganization *AdministrativeOrganization) TableName() string { |
|||
return "administrative_organization" |
|||
} |
|||
|
|||
// 编辑行政组织内容
|
|||
func (cont *AdministrativeOrganization) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取行政组织内容
|
|||
func (cont *AdministrativeOrganization) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *AdministrativeOrganization) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *AdministrativeOrganization) ContMap(whereMap interface{}, field ...string) (countAry []AdministrativeOrganization) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb.Where(whereMap).Find(&countAry) |
|||
return |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 行政组织类型
|
|||
type AdministrativeOrganizationType struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:类型名称"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Level int64 `json:"level" gorm:"column:level;type:int(5) unsigned;default:1;not null;comment:级别"` |
|||
KingdeeId string `json:"kingdeeid" gorm:"column:kingdeeid;type:varchar(255) unsigned;default:'';comment:金蝶对照ID"` |
|||
} |
|||
|
|||
func (AdministrativeOrganizationType *AdministrativeOrganizationType) TableName() string { |
|||
return "administrative_organization_type" |
|||
} |
|||
|
|||
// 编辑职务分类内容
|
|||
func (cont *AdministrativeOrganizationType) EiteCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取详细内容
|
|||
func (cont *AdministrativeOrganizationType) GetCont(whereMap map[string]interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,42 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 双职工
|
|||
type DoubleWorker struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号;index"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` |
|||
Company string `json:"company" gorm:"column:company;type:varchar(255) unsigned;default:'';not null;comment:所在公司"` |
|||
Department string `json:"department" gorm:"column:department;type:varchar(255) unsigned;default:'';not null;comment:所在部门"` |
|||
Position string `json:"position" gorm:"column:position;type:varchar(255) unsigned;default:'';not null;comment:所在岗位"` |
|||
Tel string `json:"tel" gorm:"column:tel;type:varchar(255) unsigned;default:'';not null;comment:联系方式"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` |
|||
} |
|||
|
|||
func (DoubleWorker *DoubleWorker) TableName() string { |
|||
return "double_worker" |
|||
} |
|||
|
|||
// 编辑双职工内容
|
|||
func (DoubleWorker *DoubleWorker) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&DoubleWorker).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取双职工内容
|
|||
func (cont *DoubleWorker) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,41 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 职务
|
|||
type Duties struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:职务名称"` |
|||
JobType int64 `json:"jobtype" gorm:"column:job_type;type:bigint(20) unsigned;default:0;not null;comment:归属职务类型"` |
|||
Weight int64 `json:"weight" gorm:"column:weight;type:bigint(20) unsigned;default:1;not null;comment:权重"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:编码"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
KingdeeId string `json:"kingdeeid" gorm:"column:kingdeeid;type:varchar(255) unsigned;default:'';comment:金蝶对照ID"` |
|||
KingdeeNum string `json:"kingdeenum" gorm:"column:kingdeenum;type:varchar(255) unsigned;default:'';comment:金蝶对照编码"` |
|||
} |
|||
|
|||
func (Duties *Duties) TableName() string { |
|||
return "duties" |
|||
} |
|||
|
|||
// 编辑职务分类内容
|
|||
func (Duties *Duties) EiteCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&Duties).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取详细内容
|
|||
func (cont *Duties) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,37 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 职务信息及类别、等级视图
|
|||
type DutiesClassLeve struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:d_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Name string `json:"name" gorm:"column:d_name;type:varchar(255) unsigned;default:'';not null;comment:职务名称"` |
|||
Weight int64 `json:"weight" gorm:"column:d_weight;type:bigint(20) unsigned;default:1;not null;comment:权重"` |
|||
Number string `json:"number" gorm:"column:d_num;type:varchar(50) unsigned;default:'';not null;comment:编码"` |
|||
State int `json:"state" gorm:"column:d_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
KingdeeId string `json:"kingdeeid" gorm:"column:d_king;type:varchar(255) unsigned;default:'';comment:金蝶对照ID"` |
|||
ClassId int64 `json:"classid" gorm:"column:c_id;type:bigint(20) unsigned;not null;comment:Id;index"` //职务分类Id
|
|||
ClassName string `json:"classname" gorm:"column:c_name;type:varchar(255) unsigned;default:'';not null;comment:职务分类名称"` |
|||
// LeveId int64 `json:"leveid" gorm:"column:l_id;type:bigint(20) unsigned;not null;comment:Id;index"` //职务等级Id
|
|||
// LeveNumber string `json:"levenumber" gorm:"column:l_num;type:varchar(50) unsigned;default:'';not null;comment:等级编号"`
|
|||
// LeveName string `json:"levename" gorm:"column:l_name;type:varchar(255) unsigned;default:'';not null;comment:等级名称"`
|
|||
} |
|||
|
|||
func (DutiesClassLeve *DutiesClassLeve) TableName() string { |
|||
return "duties_class_leve" |
|||
} |
|||
|
|||
// 获取详细内容
|
|||
func (cont *DutiesClassLeve) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 紧急联系人
|
|||
type EmergencyContact struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Number string `json:"number" gorm:"primaryKey;column:number;type:varchar(30) unsigned;not null;comment:员工工号;index"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:紧急联系人姓名"` |
|||
Relationship string `json:"relationship" gorm:"column:relationship;type:varchar(255) unsigned;default:'';not null;comment:与紧急联系人关系"` |
|||
Tel string `json:"tel" gorm:"column:tel;type:varchar(255) unsigned;default:'';not null;comment:紧急联系人电话"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` |
|||
} |
|||
|
|||
func (EmergencyContact *EmergencyContact) TableName() string { |
|||
return "emergency_contact" |
|||
} |
|||
|
|||
// 编辑职务分类内容
|
|||
func (EmergencyContact *EmergencyContact) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&EmergencyContact).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取行政组织内容
|
|||
func (cont *EmergencyContact) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *EmergencyContact) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 授权账户
|
|||
type EmpowerUser struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
UserKey string `json:"userkey" gorm:"column:userkey;type:varchar(255) unsigned;not null;comment:账户"` |
|||
Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:使用人(组织)名称"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` |
|||
Time int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
|||
VerificationCode string `json:"verificationcode" gorm:"column:verification_code;type:mediumtext unsigned;comment:身份识别码"` |
|||
} |
|||
|
|||
func (Position *EmpowerUser) TableName() string { |
|||
return "empoweruser" |
|||
} |
|||
|
|||
// 编辑职务分类内容
|
|||
func (cont *EmpowerUser) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取行政组织内容
|
|||
func (cont *EmpowerUser) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *EmpowerUser) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 员工家属
|
|||
type FamilyMembers struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` |
|||
Relationship string `json:"relationship" gorm:"column:relation;type:varchar(255) unsigned;default:'';not null;comment:亲属关系"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` |
|||
Company string `json:"company" gorm:"column:company;type:varchar(255) unsigned;default:'';not null;comment:所在公司"` |
|||
Deparment string `json:"deparment" gorm:"column:deparment;type:varchar(255) unsigned;default:'';not null;comment:所在部门"` |
|||
Postnme string `json:"postnme" gorm:"column:postnme;type:varchar(255) unsigned;default:'';not null;comment:所在岗位"` |
|||
Tel string `json:"tel" gorm:"column:tel;type:varchar(255) unsigned;default:'';not null;comment:紧急联系人电话"` |
|||
PoliticalOutlook int `json:"politicaloutlook" gorm:"column:political_outlook;type:int(3) unsigned;default:1;not null;comment:政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
|
|||
PoliticalOutlookCn string `json:"politicaloutlookcn" gorm:"column:political_outlook_cn;type:varchar(30) unsigned;not null;comment:政治面貌汉字说明"` |
|||
} |
|||
|
|||
func (FamilyMembers *FamilyMembers) TableName() string { |
|||
return "family_members" |
|||
} |
|||
|
|||
// 编辑员工家属内容
|
|||
func (FamilyMembers *FamilyMembers) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&FamilyMembers).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取员工家属内容
|
|||
func (cont *FamilyMembers) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 集团内部工作经历
|
|||
type InsideWorkHistory struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(20) unsigned;default:0;not null;comment:员工识别符"` |
|||
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团"` |
|||
Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
Department int64 `json:"department" gorm:"column:department;type:bigint(20) unsigned;default:0;not null;comment:部室"` |
|||
WorkShop int64 `json:"workshop" gorm:"column:workshop;type:bigint(20) unsigned;default:0;not null;comment:二级部门或车间"` |
|||
WorkshopSection int64 `json:"workshopsection" gorm:"column:workshop_section;type:bigint(20) unsigned;default:0;not null;comment:工段"` |
|||
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"` |
|||
GradePositions int64 `json:"gradepositions" gorm:"column:grade_positions;type:bigint(20) unsigned;default:0;not null;comment:职等"` |
|||
StartTime int64 `json:"starttime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:开始日期"` |
|||
EndTime int64 `json:"endtime" gorm:"column:end_time;type:bigint(20) unsigned;default:0;not null;comment:结束日期"` |
|||
Team int64 `json:"team" gorm:"column:team;type:int(1) unsigned;default:1;not null;comment:班组(1:长白;2:甲;3:乙;4:丙;5:丁)"` |
|||
ChangeType int `json:"changetype" gorm:"column:change_type;type:int(1) unsigned;default:1;not null;comment:变动类型(1:预入职;2:雇佣入职;3:转正;4:晋升;5:降级;6:职等调整;7:调动调入;8:跨公司调动调入;9:借调;10:平调;11:兼职;12:预离职;13:离职;14:退休;15:返聘;16:员工初始化;)"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AssignType int `json:"assigntype" gorm:"column:assign_type;type:int(1) unsigned;default:1;not null;comment:1、主职;2:兼职"` |
|||
} |
|||
|
|||
func (InsideWorkHistory *InsideWorkHistory) TableName() string { |
|||
return "inside_work_history" |
|||
} |
|||
|
|||
// 编辑集团内部工作经历内容
|
|||
func (cont *InsideWorkHistory) EditCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取详细内容
|
|||
func (cont *InsideWorkHistory) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
type InsideWorkView struct { |
|||
InsideWorkHistory |
|||
GroupNumber string `json:"groupnumber" gorm:"column:g_number;type:varchar(50) unsigned;default:'';not null;comment:行政编码"` |
|||
GroupName string `json:"groupname" gorm:"column:g_name;type:varchar(255) unsigned;default:'';not null;comment:组织名称"` |
|||
CompanyNumber string `json:"companynumber" gorm:"column:c_number;type:varchar(50) unsigned;default:'';not null;comment:行政编码"` |
|||
CompanyName string `json:"companyname" gorm:"column:c_name;type:varchar(255) unsigned;default:'';not null;comment:组织名称"` |
|||
DepartmentNumber string `json:"departmentnumber" gorm:"column:d_number;type:varchar(50) unsigned;default:'';not null;comment:行政编码"` |
|||
DepartmentName string `json:"departmentname" gorm:"column:d_name;type:varchar(255) unsigned;default:'';not null;comment:组织名称"` |
|||
WorkShopNumber string `json:"workshopnumber" gorm:"column:ws_number;type:varchar(50) unsigned;default:'';not null;comment:行政编码"` |
|||
WorkShopName string `json:"workshopname" gorm:"column:ws_name;type:varchar(255) unsigned;default:'';not null;comment:组织名称"` |
|||
SectionNumber string `json:"sectionnumber" gorm:"column:w_number;type:varchar(50) unsigned;default:'';not null;comment:行政编码"` |
|||
SectionName string `json:"sectionnasectionme" gorm:"column:w_name;type:varchar(255) unsigned;default:'';not null;comment:组织名称"` |
|||
PostJobNumber string `json:"postjobnumber" gorm:"column:p_number;type:varchar(50) unsigned;default:'';not null;comment:职位编码"` |
|||
PostJobName string `json:"postjobname" gorm:"column:p_name;type:varchar(255) unsigned;default:'';not null;comment:职位名称"` |
|||
TeamName string `json:"teamname" gorm:"column:r_name;type:varchar(255) unsigned;default:'';not null;comment:班组名称"` |
|||
} |
|||
|
|||
func (InsideWorkView *InsideWorkView) TableName() string { |
|||
return "inside_work_view" |
|||
} |
|||
|
|||
// 获取详细内容
|
|||
func (cont *InsideWorkView) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 职务分类
|
|||
type JobClass struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:职务分类名称"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
KingdeeId string `json:"kingdeeid" gorm:"column:kingdeeid;type:varchar(255) unsigned;default:'';comment:金蝶对照ID"` |
|||
KingdeeNum string `json:"kingdeenum" gorm:"column:kingdeenum;type:varchar(255) unsigned;default:'';comment:金蝶对照编码"` |
|||
} |
|||
|
|||
func (JobClass *JobClass) TableName() string { |
|||
return "job_class" |
|||
} |
|||
|
|||
// 编辑职务分类内容
|
|||
func (JobClass *JobClass) EiteJobClassCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&JobClass).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取详细内容
|
|||
func (cont *JobClass) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 金蝶对照记录
|
|||
type KingdeeLog struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(255) unsigned;default:'';not null;comment:工号"` |
|||
Cont string `json:"cont" gorm:"column:cont;type:longtext unsigned;default:'';not null;comment:内容"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
} |
|||
|
|||
func (KingdeeLog *KingdeeLog) TableName() string { |
|||
return "kingdee_log" |
|||
} |
|||
|
|||
// 编辑职务分类内容
|
|||
func (KingdeeLog *KingdeeLog) EidtCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&KingdeeLog).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取详细内容
|
|||
func (cont *KingdeeLog) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,76 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
type ManCont struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` |
|||
Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"` |
|||
HireClass int `json:"hireclass" gorm:"column:hire_class;type:tinyint(1) unsigned;default:1;not null;comment:雇佣类型(1:雇佣入职;2:再入职;)"` |
|||
EmpType int `json:"emptype" gorm:"column:emp_type;type:tinyint(1) unsigned;default:1;not null;comment:用工关系(1:临时工 , 2:编外人员 ;3:实习&实习生;4:试用员工;5:待分配;6:待岗;7:临时调入;8:正式员工;9:长期病假;10:停薪留职;11:退休;12:辞职;13:辞退;14:离职)"` |
|||
Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"` |
|||
MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` |
|||
SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_department;type:bigint(20) unsigned;default:0;not null;comment:二级主部门"` |
|||
Deparment string `json:"deparment" gorm:"column:deparment;type:text;comment:部门"` |
|||
AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` |
|||
TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"` |
|||
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"` |
|||
JobClass int64 `json:"jobclass" gorm:"column:job_class;type:bigint(20) unsigned;default:2;not null;comment:职务分类"` |
|||
JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"` |
|||
JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:eite_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
|||
Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` |
|||
WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` |
|||
IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` |
|||
Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` |
|||
Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` |
|||
Idcardno string `json:"idcardno" gorm:"column:idcardno;type:varchar(50) unsigned;default:'';not null;comment:身份证号"` |
|||
Passportno string `json:"passportno" gorm:"column:passportno;type:varchar(50) unsigned;default:'';not null;comment:护照号码"` |
|||
Globalroaming string `json:"globalroaming" gorm:"column:globalroaming;type:varchar(50) unsigned;default:'';not null;comment:国际区号"` |
|||
Mobilephone string `json:"mobilephone" gorm:"column:mobilephone;type:varchar(50) unsigned;default:'';not null;comment:手机号码"` |
|||
Email string `json:"email" gorm:"column:email;type:varchar(255) unsigned;default:'';not null;comment:电子邮件"` |
|||
Gender int `json:"gender" gorm:"column:gender;type:tinyint(1) unsigned;default:1;not null;comment:性别(1:男性;2:女性;3:中性)"` |
|||
Birthday int64 `json:"birthday" gorm:"column:birthday;type:bigint(20) unsigned;default:0;not null;comment:birthday"` |
|||
Myfolk string `json:"myfolk" gorm:"column:myfolk;type:varchar(50) unsigned;default:'';not null;comment:民族"` |
|||
Nativeplace string `json:"nativeplace" gorm:"column:nativeplace;type:varchar(255) unsigned;default:'';not null;comment:籍贯"` |
|||
Idcardstartdate int64 `json:"idcardstartdate" gorm:"column:idcardstartdate;type:bigint(20) unsigned;default:0;not null;comment:身份证有效期开始"` |
|||
Idcardenddate int64 `json:"idcardenddate" gorm:"column:idcardenddate;type:bigint(20) unsigned;default:0;not null;comment:身份证有效期结束"` |
|||
Idcardaddress string `json:"idcardaddress" gorm:"column:idcardaddress;type:varchar(255) unsigned;default:'';not null;comment:身份证地址"` |
|||
IdcardIssued string `json:"idcardIssued" gorm:"column:idcardIssued;type:varchar(255) unsigned;default:'';not null;comment:身份证签发机关"` |
|||
Health int `json:"health" gorm:"column:health;type:tinyint(1) unsigned;default:1;not null;comment:健康状况(1:良好;2:一般;3:较弱,4:有生理缺陷;5:残废)"` |
|||
Maritalstatus int `json:"maritalstatus" gorm:"column:maritalstatus;type:tinyint(1) unsigned;default:1;not null;comment:婚姻状况(1:未婚;2:已婚;3:丧偶;4:离异)"` |
|||
Internaltelephone string `json:"internaltelephone" gorm:"column:internaltelephone;type:varchar(255) unsigned;default:'';not null;comment:内线电话"` |
|||
Currentresidence string `json:"currentresidence" gorm:"column:currentresidence;type:varchar(255) unsigned;default:'';not null;comment:现居住地址"` |
|||
Constellation int `json:"constellationing" gorm:"column:constellationing;type:tinyint(3) unsigned;comment:星座(1:白羊座;2:金牛座;3:双子座;4:巨蟹座;5:狮子座;6:处女座;7:天枰座;8:天蝎座;9:射手座;10:摩羯座;11:水瓶座;12:双鱼座)"` |
|||
Isdoubleworker int `json:"isdoubleworker" gorm:"column:isdoubleworker;type:tinyint(1) unsigned;default:1;comment:是否双职工(1:是;2:否)"` |
|||
Isveterans int `json:"isveterans" gorm:"column:isveterans;type:tinyint(1) unsigned;default:1;comment:是否为退役军人(1:是;2:否)"` |
|||
Veteransnumber string `json:"veteransnumber" gorm:"column:veteransnumber;type:varchar(255) unsigned;default:'';comment:退役证编号"` |
|||
Jobstartdate int64 `json:"jobstartdate" gorm:"column:jobstartdate;type:bigint(20) unsigned;default:0;comment:参加工作日期"` |
|||
Entrydate int64 `json:"entrydate" gorm:"column:entrydate;type:bigint(20) unsigned;default:0;comment:入职日期"` |
|||
Probationperiod int `json:"probationperiod" gorm:"column:probationperiod;type:int(5) unsigned;default:0;comment:试用期"` |
|||
Planformaldate int64 `json:"planformaldate" gorm:"column:planformaldate;type:bigint(20) unsigned;default:0;comment:预计转正日期"` |
|||
PoliticalOutlook int `json:"politicaloutlook" gorm:"column:political_outlook;type:tinyint(3) unsigned;default:1;comment:政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)"` |
|||
} |
|||
|
|||
func (ManCont *ManCont) TableName() string { |
|||
return "man_cont" |
|||
} |
|||
|
|||
// 获取职务分类内容
|
|||
func (cont *ManCont) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 职务信息及类别、等级视图
|
|||
type OrgContType struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:行政编码"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:组织名称"` |
|||
Superior int64 `json:"superior" gorm:"column:superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
TypeName string `json:"typename" gorm:"column:typename;type:varchar(255) unsigned;default:'';not null;comment:类型名称"` |
|||
Level int64 `json:"level" gorm:"column:level;type:int(5) unsigned;default:1;not null;comment:级别"` |
|||
IsPower int `json:"ispower" gorm:"column:ispower;type:int(1) unsigned;default:2;not null;comment:是否为实权部门"` |
|||
} |
|||
|
|||
func (OrgContType *OrgContType) TableName() string { |
|||
return "org_cont_type" |
|||
} |
|||
|
|||
// 获取详细内容
|
|||
func (cont *OrgContType) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,61 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 员工档案(主)
|
|||
type PersonArchives struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` |
|||
Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"` |
|||
HireClass int `json:"hireclass" gorm:"column:hire_class;type:tinyint(1) unsigned;default:1;not null;comment:雇佣类型(1:雇佣入职;2:再入职;)"` |
|||
EmpType int `json:"emptype" gorm:"column:emp_type;type:tinyint(1) unsigned;default:1;not null;comment:用工关系(1:实习生;2:待分配;3:试用员工;4:正式员工;5:停薪留职;6:退休;7:辞退;8:离职)"` |
|||
Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"` |
|||
MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` |
|||
Deparment string `json:"deparment" gorm:"column:deparment;type:text;comment:部门"` |
|||
AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` |
|||
TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"` |
|||
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"` |
|||
JobClass int64 `json:"jobclass" gorm:"column:job_class;type:bigint(20) unsigned;default:2;not null;comment:职务分类"` |
|||
JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"` |
|||
JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:eite_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
|||
Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` |
|||
WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` |
|||
IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` |
|||
Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` |
|||
Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` |
|||
|
|||
EmpTypeName string `json:"emptypename" gorm:"column:emp_type_name;type:varchar(255) unsigned;default:'';not null;comment:用工关系中文"` |
|||
HireClassName string `json:"hireclassname" gorm:"column:hire_class_name;type:varchar(255) unsigned;default:'';not null;comment:雇佣类型中文"` |
|||
IconPhoto string `json:"iconphoto" gorm:"column:icon_photo;type:varchar(255) unsigned;default:'';not null;comment:头像"` |
|||
SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` |
|||
} |
|||
|
|||
func (PersonArchives *PersonArchives) TableName() string { |
|||
return "person_archives" |
|||
} |
|||
|
|||
// 编辑员工档案
|
|||
func (PersonArchives *PersonArchives) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&PersonArchives).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取员工档案
|
|||
func (cont *PersonArchives) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,54 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 员工档案(主)
|
|||
type Personnel struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` |
|||
HireClass int `json:"hireclass" gorm:"column:hire_class;type:tinyint(1) unsigned;default:1;not null;comment:雇佣类型(1:雇佣入职;2:再入职;)"` |
|||
PositionLevel int64 `json:"positionleveles" gorm:"column:positionleveles;type:bigint(20) unsigned;default:0;not null;comment:职位"` |
|||
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"` |
|||
AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` |
|||
Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"` |
|||
EmpType int `json:"emptype" gorm:"column:emp_type;type:tinyint(1) unsigned;default:1;not null;comment:用工关系(1:实习生;2:待分配;3:试用员工;4:正式员工;5:停薪留职;6:退休;7:辞退;8:离职)"` |
|||
Deparment string `json:"deparment" gorm:"column:deparment;type:text;comment:部门"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:eite_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
|||
JobClass int64 `json:"jobclass" gorm:"column:job_class;type:bigint(20) unsigned;default:2;not null;comment:职务分类"` |
|||
PositionGrade int64 `json:"positiongrade" gorm:"column:position_grade;type:bigint(20) unsigned;default:0;not null;comment:入职职等"` |
|||
Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` |
|||
Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` |
|||
WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` |
|||
Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"` |
|||
Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` |
|||
IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` |
|||
} |
|||
|
|||
func (Personnel *Personnel) TableName() string { |
|||
return "personnel" |
|||
} |
|||
|
|||
// 编辑员工档案
|
|||
func (Personnel *Personnel) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&Personnel).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取员工档案
|
|||
func (cont *Personnel) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,58 @@ |
|||
package modelshr |
|||
|
|||
import "appPlatform/overall" |
|||
|
|||
//人员变动记录
|
|||
type PersonnelChangeRecord struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` |
|||
Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;comment:变动类型(1:雇佣入职;2:再入职;3:职位分配;4:转正;5:停薪留职;6:退休;7:辞退;8:离职)"` |
|||
Reason string `json:"reason" gorm:"column:reason;type:text;comment:变动原因"` |
|||
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;comment:职位"` |
|||
JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;comment:职务"` |
|||
JobLevel int64 `json:"joblevel" gorm:"column:job_level;type:bigint(20) unsigned;default:'';comment:职务等级"` |
|||
JobClass int64 `json:"jobclass" gorm:"column:job_class;type:bigint(20) unsigned;default:0;comment:职务分类"` |
|||
Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;comment:入职公司"` |
|||
MainDepartment int64 `json:"maindepartment" gorm:"column:main_department;type:bigint(20) unsigned;default:0;comment:主部门"` |
|||
Department string `json:"department" gorm:"column:department;type:varchar(255) unsigned;default:0;comment:入职分厂"` |
|||
Adminorg int64 `json:"adminorg" gorm:"column:adminorg;type:bigint(20) unsigned;default:0;comment:入职行政组织"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;comment:写入时间"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` |
|||
} |
|||
|
|||
func (PersonnelChangeRecord *PersonnelChangeRecord) TableName() string { |
|||
return "personnel_change_record" |
|||
} |
|||
|
|||
//编辑职务分类内容
|
|||
func (PersonnelChangeRecord *PersonnelChangeRecord) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&PersonnelChangeRecord).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
type ManTransferLog struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` |
|||
Type int `json:"classtype" gorm:"column:classtype;type:tinyint(1) unsigned;default:1;comment:变动类型(1:雇佣入职;2:再入职;3:职位分配;4:转正;5:停薪留职;6:退休;7:辞退;8:离职)"` |
|||
Reason string `json:"reason" gorm:"column:reason;type:text;comment:变动原因"` |
|||
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;comment:职位"` |
|||
JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;comment:职务"` |
|||
JobLevel int64 `json:"joblevel" gorm:"column:job_level;type:bigint(20) unsigned;default:'';comment:职务等级"` |
|||
JobClass int64 `json:"jobclass" gorm:"column:job_class;type:bigint(20) unsigned;default:0;comment:职务分类"` |
|||
Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;comment:入职公司"` |
|||
MainDepartment int64 `json:"maindepartment" gorm:"column:main_department;type:bigint(20) unsigned;default:0;comment:主部门"` |
|||
Department string `json:"department" gorm:"column:department;type:varchar(255) unsigned;default:0;comment:入职分厂"` |
|||
Adminorg int64 `json:"adminorg" gorm:"column:adminorg;type:bigint(20) unsigned;default:0;comment:入职行政组织"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;comment:写入时间"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` |
|||
} |
|||
|
|||
func (ManTransferLog *ManTransferLog) TableName() string { |
|||
return "man_transfer_log" |
|||
} |
|||
|
|||
//编辑职务分类内容
|
|||
func (ManTransferLog *ManTransferLog) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&ManTransferLog).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,67 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
//员工附属信息
|
|||
|
|||
type PersonnelContent struct { |
|||
Number string `json:"number" gorm:"primaryKey;column:number;type:varchar(30) unsigned;not null;comment:员工工号;index"` |
|||
Idcardno string `json:"idcardno" gorm:"column:idcardno;type:varchar(50) unsigned;default:'';not null;comment:身份证号"` |
|||
Passportno string `json:"passportno" gorm:"column:passportno;type:varchar(50) unsigned;default:'';not null;comment:护照号码"` |
|||
Globalroaming string `json:"globalroaming" gorm:"column:globalroaming;type:varchar(50) unsigned;default:'';not null;comment:国际区号"` |
|||
Mobilephone string `json:"mobilephone" gorm:"column:mobilephone;type:varchar(50) unsigned;default:'';not null;comment:手机号码"` |
|||
Email string `json:"email" gorm:"column:email;type:varchar(255) unsigned;default:'';not null;comment:电子邮件"` |
|||
Gender int `json:"gender" gorm:"column:gender;type:tinyint(1) unsigned;default:1;not null;comment:性别(1:男性;2:女性;3:中性)"` |
|||
Birthday int64 `json:"birthday" gorm:"column:birthday;type:bigint(20) unsigned;default:0;not null;comment:birthday"` |
|||
Myfolk string `json:"myfolk" gorm:"column:myfolk;type:varchar(50) unsigned;default:'';not null;comment:民族"` |
|||
Nativeplace string `json:"nativeplace" gorm:"column:nativeplace;type:varchar(255) unsigned;default:'';not null;comment:籍贯"` |
|||
Idcardstartdate int64 `json:"idcardstartdate" gorm:"column:idcardstartdate;type:bigint(20) unsigned;default:0;not null;comment:身份证有效期开始"` |
|||
Idcardenddate int64 `json:"idcardenddate" gorm:"column:idcardenddate;type:bigint(20) unsigned;default:0;not null;comment:身份证有效期结束"` |
|||
Idcardaddress string `json:"idcardaddress" gorm:"column:idcardaddress;type:varchar(255) unsigned;default:'';not null;comment:身份证地址"` |
|||
IdcardIssued string `json:"idcardIssued" gorm:"column:idcardIssued;type:varchar(255) unsigned;default:'';not null;comment:身份证签发机关"` |
|||
Health int `json:"health" gorm:"column:health;type:tinyint(1) unsigned;default:1;not null;comment:健康状况(1:良好;2:一般;3:较弱,4:有生理缺陷;5:残废)"` |
|||
Maritalstatus int `json:"maritalstatus" gorm:"column:maritalstatus;type:tinyint(1) unsigned;default:1;not null;comment:婚姻状况(1:未婚;2:已婚;3:丧偶;4:离异)"` |
|||
Internaltelephone string `json:"internaltelephone" gorm:"column:internaltelephone;type:varchar(255) unsigned;default:'';not null;comment:内线电话"` |
|||
Currentresidence string `json:"currentresidence" gorm:"column:currentresidence;type:varchar(255) unsigned;default:'';not null;comment:现居住地址"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
Constellation int `json:"constellationing" gorm:"column:constellationing;type:tinyint(3) unsigned;comment:星座(1:白羊座;2:金牛座;3:双子座;4:巨蟹座;5:狮子座;6:处女座;7:天枰座;8:天蝎座;9:射手座;10:摩羯座;11:水瓶座;12:双鱼座)"` |
|||
Isdoubleworker int `json:"isdoubleworker" gorm:"column:isdoubleworker;type:tinyint(1) unsigned;default:1;comment:是否双职工(1:是;2:否)"` |
|||
Isveterans int `json:"isveterans" gorm:"column:isveterans;type:tinyint(1) unsigned;default:1;comment:是否为退役军人(1:是;2:否)"` |
|||
Veteransnumber string `json:"veteransnumber" gorm:"column:veteransnumber;type:varchar(255) unsigned;default:'';comment:退役证编号"` |
|||
Jobstartdate int64 `json:"jobstartdate" gorm:"column:jobstartdate;type:bigint(20) unsigned;default:0;comment:参加工作日期"` |
|||
Entrydate int64 `json:"entrydate" gorm:"column:entrydate;type:bigint(20) unsigned;default:0;comment:入职日期"` |
|||
Probationperiod int `json:"probationperiod" gorm:"column:probationperiod;type:int(5) unsigned;default:0;comment:试用期"` |
|||
Planformaldate int64 `json:"planformaldate" gorm:"column:planformaldate;type:bigint(20) unsigned;default:0;comment:预计转正日期"` |
|||
PoliticalOutlook int `json:"politicaloutlook" gorm:"column:political_outlook;type:tinyint(3) unsigned;default:1;comment:政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` |
|||
|
|||
MaritalstatusCn string `json:"maritalstatuscn" gorm:"column:maritalstatus_cn;type:varchar(50) unsigned;default:'';not null;comment:婚姻状况汉字说明"` |
|||
ConstellationingCn string `json:"constellationingcn" gorm:"column:constellationing_cn;type:varchar(50) unsigned;default:'';not null;comment:星座汉字说明"` |
|||
PoliticalOutlookCn string `json:"politicaloutlookcn" gorm:"column:political_outlook_cn;type:varchar(50) unsigned;default:'';not null;comment:政治面貌汉字说明"` |
|||
HealthCn string `json:"healthcn" gorm:"column:health_cn;type:varchar(50) unsigned;default:'';not null;comment:健康状况中文说明"` |
|||
} |
|||
|
|||
func (PersonnelContent *PersonnelContent) TableName() string { |
|||
return "personnel_content" |
|||
} |
|||
|
|||
// 编辑职务分类内容
|
|||
func (PersonnelContent *PersonnelContent) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&PersonnelContent).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取职务分类内容
|
|||
func (cont *PersonnelContent) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,48 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
//教育经历
|
|||
|
|||
type PersonnelEducation struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;comment:员工工号"` |
|||
Education int `json:"education" gorm:"column:education;type:int(5) unsigned;default:1;comment:学历(1:初中及以下;2:中专;3:高中;4:中技;5:高技;6:函数专科;7:大学专科;8:函数本科;9:大学本科;10:硕士研究生;11:博士研究生;12:专家、教授)"` |
|||
GraduationSchool string `json:"graduationschool" gorm:"column:graduation_school;type:varchar(255) unsigned;default:'';comment:毕业学校"` |
|||
Subject string `json:"subject" gorm:"column:subject;type:varchar(255) unsigned;default:'';comment:专业"` |
|||
AdmissionTime int64 `json:"admissiontime" gorm:"column:admission_time;type:bigint(20) unsigned;default:0;comment:入学时间"` |
|||
GraduationTime int64 `json:"graduationtime" gorm:"column:graduation_time;type:bigint(20) unsigned;default:0;comment:毕业时间"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;comment:写入时间"` |
|||
Level int `json:"level" gorm:"column:level;type:tinyint(1) unsigned;default:1;comment:学历类型(1:普通;2:第一学历;3:最高学历)"` |
|||
AcademicDegree int `json:"academicdegree" gorm:"column:academic_degree;type:tinyint(2) unsigned;default:1;comment:学位(1:无;2:学士;3:硕士;4:博士)"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
|
|||
AcademicDegreeCn string `json:"academicdegreecn" gorm:"column:academic_degree_cn;type:varchar(30) unsigned;comment:学位中文说明"` |
|||
EducationCn string `json:"educationcn" gorm:"column:education_cn;type:varchar(30) unsigned;comment:学历中文说明"` |
|||
} |
|||
|
|||
func (PersonnelEducation *PersonnelEducation) TableName() string { |
|||
return "personnel_education" |
|||
} |
|||
|
|||
// 编辑教育经历内容
|
|||
func (PersonnelEducation *PersonnelEducation) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&PersonnelEducation).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取教育经历内容
|
|||
func (cont *PersonnelEducation) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 职位(岗位)
|
|||
type Position struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:职位编码"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:职位名称"` |
|||
Duties int64 `json:"duties" gorm:"column:duties;type:bigint(20) unsigned;default:0;not null;comment:职务"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AdministrativeOrganization int64 `json:"administrativeorganization" gorm:"column:administrative_organization;type:bigint(20) unsigned;default:0;not null;comment:归属行政组织"` |
|||
Superior int64 `json:"superior" gorm:"column:superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"` |
|||
PersonInCharge int `json:"personincharge" gorm:"column:person_in_charge;type:int(1) unsigned;default:2;not null;comment:是否为本部门负责人(1:是;2:否)"` |
|||
Department int64 `json:"department" gorm:"column:department;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
MenuPermit string `json:"menupermit" gorm:"column:menu_permit;type:longtext;comment:菜单许可证"` |
|||
ButtonPermit string `json:"buttonpermit" gorm:"column:button_permit;type:longtext;comment:按钮许可"` |
|||
School int64 `json:"school" gorm:"column:school;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
KingdeeId string `json:"kingdeeid" gorm:"column:kingdeeid;type:varchar(255) unsigned;default:'';comment:金蝶对照ID"` |
|||
UnifyId int64 `json:"unifyid" gorm:"column:unify_id;type:bigint(20) unsigned;default:0;not null;comment:统一名称"` |
|||
} |
|||
|
|||
func (Position *Position) TableName() string { |
|||
return "position" |
|||
} |
|||
|
|||
// 编辑职务分类内容
|
|||
func (cont *Position) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取行政组织内容
|
|||
func (cont *Position) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *Position) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package modelshr |
|||
|
|||
import "appPlatform/overall" |
|||
|
|||
//职位等级
|
|||
type PositionLevel struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:等级编号"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:等级名称"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
PositionId int64 `json:"positionid" gorm:"column:positionid;type:bigint(20) unsigned;default:0;not null;comment:归属哪个职务"` |
|||
} |
|||
|
|||
func (PositionLevel *PositionLevel) TableName() string { |
|||
return "position_level" |
|||
} |
|||
|
|||
//编辑职务分类内容
|
|||
func (PositionLevel *PositionLevel) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&PositionLevel).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 职位(岗位)
|
|||
type PositionUnify struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(200) unsigned;default:'';not null;comment:职位名称"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Content string `json:"content" gorm:"column:content;type:longtext;comment:关联具体岗位ID"` |
|||
} |
|||
|
|||
func (PositionUnify *PositionUnify) TableName() string { |
|||
return "position_unify" |
|||
} |
|||
|
|||
// 编辑职务分类内容
|
|||
func (cont *PositionUnify) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取行政组织内容
|
|||
func (cont *PositionUnify) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *PositionUnify) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
//职务与岗位视图
|
|||
|
|||
type PostDutiesJob struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:职位编码"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:职位名称"` |
|||
PersonInCharge int `json:"personincharge" gorm:"column:perincha;type:int(1) unsigned;default:2;not null;comment:是否为本部门负责人(1:是;2:否)"` |
|||
Superior int64 `json:"superior" gorm:"column:superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"` |
|||
Duties int64 `json:"duties" gorm:"column:duties;type:bigint(20) unsigned;default:0;not null;comment:职务"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AdministrativeOrganization int64 `json:"administrativeorganization" gorm:"column:adm_org;type:bigint(20) unsigned;default:0;not null;comment:归属行政组织"` |
|||
Department int64 `json:"department" gorm:"column:department;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
MenuPermit string `json:"menupermit" gorm:"column:menu_permit;type:longtext;comment:菜单许可证"` |
|||
ButtonPermit string `json:"buttonpermit" gorm:"column:button_permit;type:longtext;comment:按钮许可"` |
|||
School int64 `json:"school" gorm:"column:school;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
DutiesName string `json:"dutiesname" gorm:"column:duties_name;type:varchar(255) unsigned;default:'';not null;comment:职务名称"` |
|||
DutiesNumber string `json:"dutiesnumber" gorm:"column:duties_number;type:varchar(50) unsigned;default:'';not null;comment:编码"` |
|||
Weight int64 `json:"weight" gorm:"column:weight;type:bigint(20) unsigned;default:1;not null;comment:权重"` |
|||
JobType int64 `json:"jobtype" gorm:"column:job_type;type:bigint(20) unsigned;default:0;not null;comment:归属职务类型"` |
|||
JobName string `json:"jobname" gorm:"column:job_name;type:varchar(255) unsigned;default:'';not null;comment:职务分类名称"` |
|||
} |
|||
|
|||
func (PostDutiesJob *PostDutiesJob) TableName() string { |
|||
return "post_duties_job" |
|||
} |
|||
|
|||
// 获取详细内容
|
|||
func (cont *PostDutiesJob) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,36 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 班组
|
|||
type TeamGroup struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:班组名称"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
} |
|||
|
|||
func (TeamGroup *TeamGroup) TableName() string { |
|||
return "teamgroup" |
|||
} |
|||
|
|||
// 编辑班组内容
|
|||
func (TeamGroup *TeamGroup) EiteTeamGroupCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&TeamGroup).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取详细内容
|
|||
func (cont *TeamGroup) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,82 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
type UserPostDuties struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` |
|||
Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` |
|||
Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"` |
|||
Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"` |
|||
MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` |
|||
AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` |
|||
TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"` |
|||
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"` |
|||
JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"` |
|||
JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"` |
|||
Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` |
|||
WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` |
|||
IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` |
|||
Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` |
|||
Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` |
|||
SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` |
|||
|
|||
Mobilephone string `json:"mobilephone" gorm:"column:mobilephone;type:varchar(50) unsigned;default:'';not null;comment:手机号码"` |
|||
Gender int `json:"gender" gorm:"column:gender;type:tinyint(1) unsigned;default:1;not null;comment:性别(1:男性;2:女性;3:中性)"` |
|||
|
|||
PostName string `json:"postname" gorm:"column:postname;type:varchar(255) unsigned;default:'';not null;comment:职位名称"` |
|||
PersonInCharge int `json:"personincharge" gorm:"column:leading_cadre;type:int(1) unsigned;default:2;not null;comment:是否为本部门负责人(1:是;2:否)"` |
|||
Superior int64 `json:"superior" gorm:"column:post_superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"` |
|||
MenuPermit string `json:"menupermit" gorm:"column:menu_permit;type:longtext;comment:菜单许可证"` |
|||
ButtonPermit string `json:"buttonpermit" gorm:"column:button_permit;type:longtext;comment:按钮许可"` |
|||
DutiesName string `json:"dutiesname" gorm:"column:duties_name;type:varchar(255) unsigned;default:'';not null;comment:职务名称"` |
|||
} |
|||
|
|||
func (UserPostDuties *UserPostDuties) TableName() string { |
|||
return "user_post_duties" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *UserPostDuties) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *UserPostDuties) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *UserPostDuties) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *UserPostDuties) ContMap(whereMap interface{}, field ...string) (countAry []UserPostDuties, err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *UserPostDuties) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,51 @@ |
|||
package modelshr |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 工作履历
|
|||
type WorkHistory struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:工号"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:身份识别"` |
|||
Company string `json:"company" gorm:"column:company;type:varchar(255) unsigned;default:'';comment:公司"` |
|||
Deparment string `json:"deparment" gorm:"column:deparment;type:varchar(255) unsigned;default:'';comment:部门"` |
|||
Job string `json:"job" gorm:"column:job;type:varchar(255) unsigned;default:'';comment:职务"` |
|||
EntryTime int64 `json:"entrytime" gorm:"column:entry_time;type:bigint(20) unsigned;default:0;not null;comment:入职时间"` |
|||
Leavedate int64 `json:"leavedate" gorm:"column:leavedate;type:bigint(20) unsigned;default:0;not null;comment:离职日期"` |
|||
Witness string `json:"witness" gorm:"column:witness;type:varchar(255) unsigned;default:'';comment:证明人"` |
|||
WitnessTel string `json:"witnesstel" gorm:"column:witness_tel;type:varchar(255) unsigned;default:'';comment:证明人电话"` |
|||
Remarks string `json:"remarks" gorm:"column:remarks;type:text unsigned;default:'';comment:备注"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
} |
|||
|
|||
func (WorkHistory *WorkHistory) TableName() string { |
|||
return "work_history" |
|||
} |
|||
|
|||
// 编辑职务分类内容
|
|||
func (cont *WorkHistory) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取行政组织内容
|
|||
func (cont *WorkHistory) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_HR.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *WorkHistory) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
@ -0,0 +1,119 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 审批记录 视图
|
|||
// 岗位审批工作流
|
|||
type AppFlowLog struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"` |
|||
OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"` |
|||
Step int `json:"step" gorm:"column:step;type:int(5) unsigned;default:0;not null;comment:当前执行到第几步"` |
|||
NextStep int `json:"nextstep" gorm:"column:next_step;type:int(5) unsigned;default:0;not null;comment:下一步执行哪个步骤"` |
|||
NextExecutor string `json:"nextexecutor" gorm:"column:next_executor;type:longtext;comment:下一步执行人"` |
|||
CountStep int `json:"countstep" gorm:"column:count_step;type:int(5) unsigned;default:0;not null;comment:总共几步"` |
|||
WorkFlow string `json:"workflow" gorm:"column:work_flow;type:longtext;comment:工作流(审批json字符串)"` |
|||
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
Class int `json:"class" gorm:"column:class;type:tinyint(1) unsigned;default:1;not null;comment:属性1、定性;2、定量"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
SonTarget int64 `json:"sontarget" gorm:"column:son_target;type:bigint(20) unsigned;default:0;not null;comment:指标子栏目"` |
|||
Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` |
|||
Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"` |
|||
ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:流程状态 1:草稿;2:审批中;3:驳回;4:归档;5:废弃;6:删除"` |
|||
StartTime int64 `json:"starttime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:流程开始时间"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"` |
|||
EnclosureFormat string `json:"enclosureformat" gorm:"column:enclosure_format;type:longtext;comment:附件"` |
|||
Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:流程参与人"` |
|||
Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年"` |
|||
Quarter int64 `json:"quarter" gorm:"column:quarter;type:int(3) unsigned;default:0;not null;comment:季度"` |
|||
Month int64 `json:"month" gorm:"column:month;type:int(3) unsigned;default:0;not null;comment:月"` |
|||
Week int64 `json:"week" gorm:"column:week;type:int(3) unsigned;default:0;not null;comment:周"` |
|||
PersonLiable int64 `json:"personliable" gorm:"column:person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"` |
|||
HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` |
|||
//post_target
|
|||
PtTitle string `json:"pt_title" gorm:"column:pt_title;type:varchar(255) unsigned;default:'';not null;comment:指标标题"` |
|||
PtCycle int `json:"pt_cycle" gorm:"column:pt_cycle;type:int(1) unsigned;default:1;not null;comment:指标1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
PtCycleattr int `json:"pt_cycleattr" gorm:"column:pt_cycleattr;type:int(9) unsigned;default:1;not null;comment:指标辅助计数"` |
|||
//post_sun_target
|
|||
PstTitle string `json:"pst_title" gorm:"column:pst_title;type:varchar(255) unsigned;default:'';not null;comment:子栏目标题"` |
|||
//post_target_details
|
|||
PtdTitle string `json:"ptd_title" gorm:"column:ptd_title;type:text;comment:指标细则"` |
|||
PtdCycles int `json:"ptd_cycle" gorm:"column:ptd_cycle;type:tinyint(1) unsigned;default:1;not null;comment:指标细则1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
PtdCycleAttres int `json:"ptd_cycleattr" gorm:"column:ptd_cycleattr;type:int(9) unsigned;default:1;not null;comment:指标细则辅助计数"` |
|||
//post_metering_flow
|
|||
PmfId int64 `json:"pmf_id" gorm:"primaryKey;column:pmf_id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"` |
|||
PmfShemeId int64 `json:"pmf_shem_id" gorm:"column:pmf_shem_id;type:bigint(20) unsigned;default:0;not null;comment:方案ID"` |
|||
PmfPersonLiable int64 `json:"pmf_person_liable" gorm:"column:pmf_person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"` |
|||
PmfCompanyId int64 `json:"pmf_company_id" gorm:"column:pmf_company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
PmfDepartmentId int64 `json:"pmf_department_id" gorm:"column:pmf_department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
PmfOrgId int64 `json:"pmf_org_id" gorm:"column:pmf_org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
PmfPostId int64 `json:"pmf_post_id" gorm:"column:pmf_post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
PmfExecutor int64 `json:"pmf_executor" gorm:"column:pmf_executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"` |
|||
PmfExecutorDepartment int64 `json:"pmf_executor_depart" gorm:"column:pmf_executor_depart;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"` |
|||
PmfHappenTime int64 `json:"pmf_happen_time" gorm:"column:pmf_happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` |
|||
PmfTime int64 `json:"pmf_time" gorm:"column:pmf_time;type:bigint(20) unsigned;default:0;not null;comment:时间"` |
|||
//post_nature_flow
|
|||
PnfId int64 `json:"pnf_id" gorm:"primaryKey;column:pnf_id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"` |
|||
PnfShemeId int64 `json:"pnf_sheme_id" gorm:"column:pnf_sheme_id;type:bigint(20) unsigned;default:0;not null;comment:方案ID"` |
|||
PnfPersonLiable int64 `json:"pnf_person_liable" gorm:"column:pnf_person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"` |
|||
PnfCompanyId int64 `json:"pnf_company" gorm:"column:pnf_company;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
PnfDepartmentId int64 `json:"pnf_department_id" gorm:"column:pnf_department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
PnfOrgId int64 `json:"pnf_org_id" gorm:"column:pnf_org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
PnfPostId int64 `json:"pnf_post_id" gorm:"column:pnf_post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
PnfExecutor int64 `json:"pnf_executor" gorm:"column:pnf_executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"` |
|||
PnfExecutorDepartment int64 `json:"pnf_executor_depart" gorm:"column:pnf_executor_depart;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"` |
|||
PnfHappenTime int64 `json:"pnf_happen_time" gorm:"column:pnf_happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` |
|||
PnfTime int64 `json:"pnf_time" gorm:"column:pnf_time;type:bigint(20) unsigned;default:0;not null;comment:时间"` |
|||
} |
|||
|
|||
func (AppFlowLog *AppFlowLog) TableName() string { |
|||
return "app_flow_log" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *AppFlowLog) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *AppFlowLog) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *AppFlowLog) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *AppFlowLog) ContMap(whereMap interface{}, field ...string) (countAry []AppFlowLog, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *AppFlowLog) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,95 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位审批工作流查询视图
|
|||
type AppNewFlowLog struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"` |
|||
OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"` |
|||
Step int `json:"step" gorm:"column:step;type:int(5) unsigned;default:0;not null;comment:当前执行到第几步"` |
|||
NextStep int `json:"nextstep" gorm:"column:next_step;type:int(5) unsigned;default:0;not null;comment:下一步执行哪个步骤"` |
|||
NextExecutor string `json:"nextexecutor" gorm:"column:next_executor;type:longtext;comment:下一步执行人"` |
|||
CountStep int `json:"countstep" gorm:"column:count_step;type:int(5) unsigned;default:0;not null;comment:总共几步"` |
|||
WorkFlow string `json:"workflow" gorm:"column:work_flow;type:longtext;comment:工作流(审批json字符串)"` |
|||
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
Class int `json:"class" gorm:"column:class;type:tinyint(1) unsigned;default:1;not null;comment:属性1、定性;2、定量"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
SonTarget int64 `json:"sontarget" gorm:"column:son_target;type:bigint(20) unsigned;default:0;not null;comment:指标子栏目"` |
|||
Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` |
|||
Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"` |
|||
ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:流程状态 流程状态 1:草稿;2:审批中;3:驳回;4:归档;5:废弃;6:删除"` |
|||
StartTime int64 `json:"starttime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:流程开始时间"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"` |
|||
EnclosureFormat string `json:"enclosureformat" gorm:"column:enclosure_format;type:longtext;comment:附件"` |
|||
Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:流程参与人"` |
|||
Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年"` |
|||
Quarter int64 `json:"quarter" gorm:"column:quarter;type:int(3) unsigned;default:0;not null;comment:季度"` |
|||
Month int64 `json:"month" gorm:"column:month;type:int(3) unsigned;default:0;not null;comment:月"` |
|||
Week int64 `json:"week" gorm:"column:week;type:int(3) unsigned;default:0;not null;comment:周"` |
|||
PersonLiable int64 `json:"personliable" gorm:"column:person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"` |
|||
HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` |
|||
|
|||
//post_target
|
|||
PtTitle string `json:"pt_title" gorm:"column:pt_title;type:varchar(255) unsigned;default:'';not null;comment:指标标题"` |
|||
PtCycle int `json:"pt_cycle" gorm:"column:pt_cycle;type:int(1) unsigned;default:1;not null;comment:指标1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
PtCycleattr int `json:"pt_cycleattr" gorm:"column:pt_cycleattr;type:int(9) unsigned;default:1;not null;comment:指标辅助计数"` |
|||
//post_sun_target
|
|||
PstTitle string `json:"pst_title" gorm:"column:pst_title;type:varchar(255) unsigned;default:'';not null;comment:子栏目标题"` |
|||
//post_target_details
|
|||
PtdTitle string `json:"ptd_title" gorm:"column:ptd_title;type:text;comment:指标细则"` |
|||
PtdCycles int `json:"ptd_cycle" gorm:"column:ptd_cycle;type:tinyint(1) unsigned;default:1;not null;comment:指标细则1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
PtdCycleAttres int `json:"ptd_cycleattr" gorm:"column:ptd_cycleattr;type:int(9) unsigned;default:1;not null;comment:指标细则辅助计数"` |
|||
} |
|||
|
|||
func (AppNewFlowLog *AppNewFlowLog) TableName() string { |
|||
return "app_new_flow_log" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *AppNewFlowLog) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *AppNewFlowLog) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *AppNewFlowLog) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *AppNewFlowLog) ContMap(whereMap interface{}, field ...string) (countAry []AppNewFlowLog, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *AppNewFlowLog) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,97 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
/* |
|||
* |
|||
@ 作者: 秦东 |
|||
@ 时间: 2023-04-08 10:28:42 |
|||
@ 功能: 审批记录视图 |
|||
@ 参数 |
|||
|
|||
# |
|||
|
|||
@ 返回值 |
|||
|
|||
# |
|||
|
|||
@ 方法原型 |
|||
|
|||
# |
|||
*/ |
|||
type ApprovalRecord struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:ep_id;type:bigint(20) unsigned;not null"` |
|||
OrderKey int64 `json:"orderkey" gorm:"column:ep_order_key;type:bigint(20) unsigned;default:0;not null;comment:发起表单key"` |
|||
Step int `json:"step" gorm:"column:ep_step;type:int(7) unsigned;default:1;not null;comment:当前执行到第几部"` |
|||
Content string `json:"content" gorm:"column:ep_cont;type:longtext;comment:流程步进值"` |
|||
NextContent string `json:"nextcontent" gorm:"column:ep_next_cont;type:mediumtext;comment:下一步内容"` |
|||
Time int64 `json:"time" gorm:"column:ep_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:ep_state;type:int(2) unsigned;default:1;not null;comment:1:草稿,2:审批中;3:驳回;4:归档;5:删除"` |
|||
RoleGroup int64 `json:"rolegroup" gorm:"column:ep_role_group;type:bigint(20) unsigned;default:0;not null;comment:角色组"` |
|||
TypeClass int `json:"type" gorm:"column:ep_type;type:tinyint(1) unsigned;default:1;not null;comment:1、定性;2、定量"` |
|||
Participants string `json:"participants" gorm:"column:ep_participants;type:mediumtext;comment:参与人"` |
|||
StartTime int64 `json:"starttime" gorm:"column:ep_start_time;type:bigint(20) unsigned;default:0;not null;comment:流程开始时间"` |
|||
NextStep int `json:"nextstep" gorm:"column:ep_next_step;type:int(7) unsigned;default:1;not null;comment:下一步"` |
|||
NextExecutor string `json:"nextexecutor" gorm:"column:ep_next_executor;type:mediumtext;comment:下一步执行人"` |
|||
SetupDepartment int64 `json:"setupdepartment" gorm:"column:ep_setup_department;type:bigint(20) unsigned;default:0;not null;comment:发起部门"` |
|||
Dimension string `json:"dimension" gorm:"column:ep_dimension;type:mediumtext;comment:维度"` |
|||
Target string `json:"target" gorm:"column:ep_target;type:mediumtext;comment:指标"` |
|||
DetailedTarget string `json:"detailedtarget" gorm:"column:ep_detailedtarget;type:mediumtext;comment:指标细则"` |
|||
AcceptDepartment int64 `json:"acceptdepartment" gorm:"column:ep_accept_department;type:bigint(20) unsigned;default:0;not null;comment:接受考核部门"` |
|||
HappenTime int64 `json:"happentime" gorm:"column:ep_happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` |
|||
FlowKey int64 `json:"flowkey" gorm:"column:ep_flow_key;type:bigint(20) unsigned;default:0;not null;comment:工作流识别符"` |
|||
FlowVid int64 `json:"flowvid" gorm:"column:ep_flow_vid;type:bigint(20) unsigned;default:0;not null;comment:当前工作流版本号"` |
|||
EpOld int `json:"epold" gorm:"column:ep_old;type:int(1) unsigned;default:1;not null;comment:1:旧流程;2:新流程"` |
|||
Creater int64 `json:"creater" gorm:"column:ep_creater;type:bigint(20) unsigned;default:0;not null;comment:流程创始人"` |
|||
TargetTitle string `json:"targettitle" gorm:"column:target_title;type:varchar(255);comment:指标名称"` |
|||
BylawsTitle string `json:"bylawstitle" gorm:"column:bylaws_title;type:varchar(255);comment:细则名称"` |
|||
Clique int64 `json:"clique" gorm:"column:ep_clique;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
} |
|||
|
|||
func (ApprovalRecord *ApprovalRecord) TableName() string { |
|||
return "approval_record" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *ApprovalRecord) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *ApprovalRecord) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *ApprovalRecord) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *ApprovalRecord) ContMap(whereMap interface{}, field ...string) (countAry []ApprovalRecord, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *ApprovalRecord) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 定性考核指标关系指定
|
|||
type Assesstarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:at_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"` |
|||
Departmentmap string `json:"departmentmap" gorm:"column:departmentmap;type:mediumtext unsigned;default:0;comment:部门ID"` |
|||
TargetId int64 `json:"targetid" gorm:"column:targetid;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
SunTargetId int64 `json:"suntargetid" gorm:"column:suntargetid;type:bigint(20) unsigned;default:0;not null;comment:子栏目ID"` |
|||
Content string `json:"content" gorm:"column:content;type:longtext;comment:描述"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
} |
|||
|
|||
func (Assesstarget *Assesstarget) TableName() string { |
|||
return "assesstarget" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *Assesstarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *Assesstarget) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *Assesstarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *Assesstarget) ContMap(whereMap interface{}, field ...string) (countAry []Assesstarget, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *Assesstarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,123 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
"time" |
|||
) |
|||
|
|||
// 岗位考核指标权重
|
|||
type DepartDimePostWeight struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Type int64 `json:"type" gorm:"column:type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"` |
|||
Orgid int64 `json:"orgid" gorm:"column:orgid;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
Postid int64 `json:"postid" gorm:"column:postid;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"` |
|||
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
Weight float64 `json:"weight" gorm:"column:weight;type:int(6) unsigned;default:0;not null;comment:权重"` |
|||
Addtime int64 `json:"addtime" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:添加时间"` |
|||
Hierarchy int64 `json:"hierarchy" gorm:"column:hierarchy;type:bigint(20) unsigned;default:0;not null;comment:维度;2:指标"` |
|||
Quote int64 `json:"quote" gorm:"column:is_quote;type:bigint(20) unsigned;default:0;not null;comment:1:不是引用;2:引用部门"` |
|||
} |
|||
|
|||
func (DepartDimePostWeight *DepartDimePostWeight) TableName() string { |
|||
return "depart_dime_post_weight" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DepartDimePostWeight) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DepartDimePostWeight) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *DepartDimePostWeight) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DepartDimePostWeight) ContMap(whereMap interface{}, field ...string) (countAry []DepartDimePostWeight, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *DepartDimePostWeight) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
|
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2022-10-25 14:47:00 |
|||
@ 功能: |
|||
@ 参数 |
|||
# |
|||
@ 返回值 |
|||
# |
|||
*/ |
|||
// 写入岗位考核维度与指标权重
|
|||
func (cont *DepartDimePostWeight) WriteTargetWeight() (err error) { |
|||
where := make(map[string]interface{}) |
|||
// where := publicmethod.MapOut[string]()
|
|||
where["`orgid`"] = cont.Orgid |
|||
where["`postid`"] = cont.Postid |
|||
where["`dimension`"] = cont.Dimension |
|||
where["`hierarchy`"] = cont.Hierarchy |
|||
where["`is_quote`"] = cont.Quote |
|||
if cont.Hierarchy == 1 { |
|||
var oldCont DepartDimePostWeight |
|||
err = oldCont.GetCont(where) |
|||
if err != nil { |
|||
err = overall.CONSTANT_DB_KPI.Create(&cont).Error |
|||
return |
|||
} else { |
|||
// editWhe := publicmethod.MapOut[string]()
|
|||
editWhe := make(map[string]interface{}) |
|||
editWhe["`id`"] = oldCont.Id |
|||
// saveAry := publicmethod.MapOut[string]()
|
|||
saveAry := make(map[string]interface{}) |
|||
saveAry["`weight`"] = cont.Weight |
|||
saveAry["`time`"] = time.Now().Unix() |
|||
err = oldCont.EiteCont(editWhe, saveAry) |
|||
return |
|||
} |
|||
} else { |
|||
where["`target`"] = cont.Target |
|||
var oldCont DepartDimePostWeight |
|||
err = oldCont.GetCont(where) |
|||
if err != nil { |
|||
err = overall.CONSTANT_DB_KPI.Create(&cont).Error |
|||
return |
|||
} else { |
|||
// editWhe := publicmethod.MapOut[string]()
|
|||
editWhe := make(map[string]interface{}) |
|||
editWhe["`id`"] = oldCont.Id |
|||
// saveAry := publicmethod.MapOut[string]()
|
|||
saveAry := make(map[string]interface{}) |
|||
saveAry["`weight`"] = cont.Weight |
|||
saveAry["`time`"] = time.Now().Unix() |
|||
err = oldCont.EiteCont(editWhe, saveAry) |
|||
return |
|||
} |
|||
} |
|||
return |
|||
} |
|||
@ -0,0 +1,64 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 性质考核方案权重
|
|||
type DepartmentDimensionWeight struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:ddw_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Type int64 `json:"type" gorm:"column:ddw_type;type:bigint(20) unsigned;default:0;not null;comment:1:定性考核;2:定量考核"` |
|||
Group int64 `json:"group" gorm:"column:ddw_group;type:bigint(20) unsigned;default:0;not null;comment:归属集团"` |
|||
DepartmentId int64 `json:"parentid" gorm:"column:ddw_derpatment;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` |
|||
Dimension int64 `json:"dimension" gorm:"column:ddw_dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"` |
|||
Target int64 `json:"target" gorm:"column:ddw_target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
Weight int64 `json:"weight" gorm:"column:ddw_weight;type:int(6) unsigned;default:0;not null;comment:权重"` |
|||
Addtime int64 `json:"addtime" gorm:"column:ddw_time;type:bigint(20) unsigned;default:0;not null;comment:添加时间"` |
|||
Hierarchy int64 `json:"hierarchy" gorm:"column:ddw_hierarchy;type:bigint(20) unsigned;default:0;not null;comment:维度;2:指标"` |
|||
} |
|||
|
|||
func (DepartmentDimensionWeight *DepartmentDimensionWeight) TableName() string { |
|||
return "department_dimension_weight" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DepartmentDimensionWeight) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DepartmentDimensionWeight) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *DepartmentDimensionWeight) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DepartmentDimensionWeight) ContMap(whereMap interface{}, field ...string) (countAry []DepartmentDimensionWeight, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *DepartmentDimensionWeight) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,73 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 指标细则
|
|||
type DetailedTarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:dt_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:dt_title;type:text;comment:指标细则"` |
|||
Content string `json:"content" gorm:"column:dt_content;type:text;comment:指标说明"` |
|||
ParentId int64 `json:"parentid" gorm:"column:dt_parentid;type:bigint(20) unsigned;default:0;not null;comment:归属指标栏目"` |
|||
ParentIdSun int64 `json:"parentidsun" gorm:"column:dt_parentid_sun;type:bigint(20) unsigned;default:0;not null;comment:归属指标子栏目"` |
|||
State int `json:"state" gorm:"column:dt_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addtime" gorm:"column:dt_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"` |
|||
MinScore int64 `json:"minscore" gorm:"column:dt_min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"` |
|||
MaxScore int64 `json:"maxscore" gorm:"column:dt_max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"` |
|||
Company string `json:"company" gorm:"column:dt_company;type:varchar(20) unsigned;default:0;not null;comment:单位"` |
|||
AddReduce int `json:"addreduce" gorm:"column:dt_add_reduce;type:int(1) unsigned;default:1;not null;comment:1:减少;2:增加;3:无属性,现场确认加或减"` |
|||
CensorType string `json:"censortype" gorm:"column:dt_censor_type;type:text;comment:检查方式"` |
|||
CensorCont string `json:"censorcont" gorm:"column:dt_censor_cont;type:longtext;comment:检查依据"` |
|||
CensorRate int `json:"censorrate" gorm:"column:dt_censor_rate;type:int(5) unsigned;default:1;not null;comment:检查频次"` |
|||
Cycles int `json:"cycle" gorm:"column:dt_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
CycleAttres int `json:"cycleattr" gorm:"column:dt_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
Paretment string `json:"paretment" gorm:"column:dt_paretment;type:longtext;comment:接受考核的部门"` |
|||
Reportary string `json:"reportary" gorm:"column:reportary;type:longtext;comment:提报人"` |
|||
} |
|||
|
|||
func (DetailedTarget *DetailedTarget) TableName() string { |
|||
return "detailed_target" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DetailedTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(&saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DetailedTarget) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *DetailedTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DetailedTarget) ContMap(whereMap interface{}, field ...string) (countAry []DetailedTarget, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *DetailedTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,77 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 划分责任 division_responsibilities
|
|||
type DivisionResponsibilities struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:df_id;type:bigint(20) unsigned;not null"` |
|||
ScoreFlow int64 `json:"scoreflow" gorm:"column:df_sf_id;type:bigint(20) unsigned;default:0;not null;comment:归属加减分关联值"` |
|||
Type int `json:"type" gorm:"column:df_type;type:tinyint(1) unsigned;default:1;not null;comment:责任类型(1、主要责任人;2、互保责任人;3、责任班组;4、责任班组长;5、主管;6、三大员;7、厂长、主任)"` |
|||
UserName string `json:"username" gorm:"column:df_user_name;type:varchar(100);comment:责任人名"` |
|||
UserNumber string `json:"usernumber" gorm:"column:df_user_number;type:varchar(100);comment:责任人工号"` |
|||
UserKey int64 `json:"userkey" gorm:"column:df_user_key;type:bigint(20) unsigned;default:0;not null;comment:责任人KEY"` |
|||
Department int64 `json:"department" gorm:"column:df_department_id;type:bigint(20) unsigned;default:0;not null;comment:责任人部门"` |
|||
Group int64 `json:"group" gorm:"column:df_group;type:bigint(20) unsigned;default:0;not null;comment:责任人集团"` |
|||
Tema int64 `json:"tema" gorm:"column:df_tema;type:bigint(20) unsigned;default:0;not null;comment:责任人班组"` |
|||
Weight int64 `json:"weight" gorm:"column:df_weight;type:int(7) unsigned;default:0;not null;comment:比重"` |
|||
Time int64 `json:"time" gorm:"column:df_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:df_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` |
|||
DistributionUser int64 `json:"distributionuser" gorm:"column:df_distribution_user;type:bigint(20) unsigned;default:0;not null;comment:分配任key"` |
|||
EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:df_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` |
|||
EvaluationUser int64 `json:"evaluationuser" gorm:"column:df_evaluation_user;type:bigint(20) unsigned;default:0;not null;comment:测评人"` |
|||
EvaluationGroup int64 `json:"evaluationgroup" gorm:"column:df_evaluation_group;type:bigint(20) unsigned;default:0;not null;comment:测评集团"` |
|||
} |
|||
|
|||
func (DivisionResponsibilities *DivisionResponsibilities) TableName() string { |
|||
return "division_responsibilities" |
|||
} |
|||
|
|||
// 添加
|
|||
func (cont *DivisionResponsibilities) AddCont() (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Create(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DivisionResponsibilities) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DivisionResponsibilities) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *DivisionResponsibilities) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DivisionResponsibilities) ContMap(whereMap interface{}, field ...string) (countAry []DivisionResponsibilities, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *DivisionResponsibilities) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,81 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 定量考核数据流
|
|||
type DutyFlowData struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:fld_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
EvaluationPlan int64 `json:"evaluationplan" gorm:"column:fld_evaluation_id;type:bigint(20) unsigned;default:0;not null;comment:考核方案项目ID"` |
|||
Key int64 `json:"key" gorm:"column:fld_flow_log;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` |
|||
Score int64 `json:"score" gorm:"column:fld_score;type:bigint(20) unsigned;default:0;not null;comment:数据"` |
|||
Content string `json:"content" gorm:"column:fld_cont;type:mediumtext;comment:描述"` |
|||
Enclosure string `json:"enclosure" gorm:"column:fld_enclosure;type:longtext;comment:附件"` |
|||
Time int64 `json:"time" gorm:"column:fld_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:fld_scoring_method;type:int(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` |
|||
ScoringScore float64 `json:"scoringscore" gorm:"column:fld_scoring_score;type:bigint(20) unsigned;default:0;not null;comment:手动分"` |
|||
PlanVersion string `json:"planversion" gorm:"column:fld_planversion;type:varchar(255);comment:版本号"` |
|||
Year int64 `json:"year" gorm:"column:fld_year;type:int(7) unsigned;default:0;not null;comment:年分"` |
|||
Quarter int64 `json:"quarter" gorm:"column:fld_quarter;type:int(2) unsigned;default:0;not null;comment:季度"` |
|||
Month int64 `json:"month" gorm:"column:fld_month;type:int(2) unsigned;default:0;not null;comment:月"` |
|||
Week int64 `json:"week" gorm:"column:fld_week;type:int(5) unsigned;default:0;not null;comment:周"` |
|||
ToDay int64 `json:"today" gorm:"column:fld_day;type:int(5) unsigned;default:0;not null;comment:天"` |
|||
TargetId int64 `json:"targetid" gorm:"column:fld_target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"` |
|||
|
|||
EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:fl_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` |
|||
EvaluationUser int64 `json:"evaluationuser" gorm:"column:fl_evaluation_user;type:bigint(20) unsigned;default:0;not null;comment:测评人"` |
|||
EvaluationGroup int64 `json:"evaluationgroup" gorm:"column:fl_evaluation_group;type:bigint(20) unsigned;default:0;not null;comment:测评集团"` |
|||
EnclosureFlow string `json:"enclosure" gorm:"column:fl_enclosure;type:longtext;comment:附件"` |
|||
DutyGroup int64 `json:"dutygroup" gorm:"column:fl_duty_group;type:bigint(20) unsigned;default:0;not null;comment:职责集团"` |
|||
DutyDepartment int64 `json:"dutydepartment" gorm:"column:fl_duty_department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"` |
|||
Reply int `json:"reply" gorm:"column:fl_reply;type:int(2) unsigned;default:1;not null;comment:状态(0:删除;1:起草;2:审批;3:通过)"` |
|||
ContentFlow string `json:"content" gorm:"column:fl_content;type:mediumtext;comment:描述"` |
|||
Baseline string `json:"baseline" gorm:"column:fl_baseline;type:longtext;comment:基准线 "` |
|||
} |
|||
|
|||
func (DutyFlowData *DutyFlowData) TableName() string { |
|||
return "duty_flow_data" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DutyFlowData) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DutyFlowData) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *DutyFlowData) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DutyFlowData) ContMap(whereMap interface{}, field ...string) (countAry []DutyFlowData, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *DutyFlowData) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 考核维度
|
|||
type DutyClass struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id"` |
|||
Title string `json:"title" gorm:"column:title;type:varchar(255);comment:考核维度名称"` |
|||
Type int `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:定性考核;2:定量考核)"` |
|||
Weight int `json:"weight" gorm:"column:weight;type:int(3) unsigned;default:0;not null;comment:权重比例"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态"` |
|||
Sort int `json:"sort" gorm:"column:sort;type:int(5) unsigned;default:0;not null;comment:排序"` |
|||
} |
|||
|
|||
func (DutyClass *DutyClass) TableName() string { |
|||
return "dutyclass" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *DutyClass) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *DutyClass) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *DutyClass) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *DutyClass) ContMap(whereMap interface{}, field ...string) (countAry []DutyClass, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *DutyClass) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,79 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 流程步进器
|
|||
type EvaluationProcess struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:ep_id;type:bigint(20) unsigned;not null"` |
|||
OrderKey int64 `json:"orderkey" gorm:"column:ep_order_key;type:bigint(20) unsigned;default:0;not null;comment:发起表单key"` |
|||
Step int `json:"step" gorm:"column:ep_step;type:int(7) unsigned;default:1;not null;comment:当前执行到第几部"` |
|||
Content string `json:"content" gorm:"column:ep_cont;type:longtext;comment:流程步进值"` |
|||
NextContent string `json:"nextcontent" gorm:"column:ep_next_cont;type:mediumtext;comment:下一步内容"` |
|||
Time int64 `json:"time" gorm:"column:ep_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:ep_state;type:int(2) unsigned;default:1;not null;comment:1:草稿,2:审批中;3:驳回;4:归档;5:删除"` |
|||
RoleGroup int64 `json:"rolegroup" gorm:"column:ep_role_group;type:bigint(20) unsigned;default:0;not null;comment:角色组"` |
|||
TypeClass int `json:"type" gorm:"column:ep_type;type:tinyint(1) unsigned;default:1;not null;comment:1、定性;2、定量"` |
|||
Participants string `json:"participants" gorm:"column:ep_participants;type:mediumtext;comment:参与人"` |
|||
StartTime int64 `json:"starttime" gorm:"column:ep_start_time;type:bigint(20) unsigned;default:0;not null;comment:流程开始时间"` |
|||
NextStep int `json:"nextstep" gorm:"column:ep_next_step;type:int(7) unsigned;default:1;not null;comment:下一步"` |
|||
NextExecutor string `json:"nextexecutor" gorm:"column:ep_next_executor;type:mediumtext;comment:下一步执行人"` |
|||
SetupDepartment int64 `json:"setupdepartment" gorm:"column:ep_setup_department;type:bigint(20) unsigned;default:0;not null;comment:发起部门"` |
|||
Dimension string `json:"dimension" gorm:"column:ep_dimension;type:mediumtext;comment:维度"` |
|||
Target string `json:"target" gorm:"column:ep_target;type:mediumtext;comment:指标"` |
|||
DetailedTarget string `json:"detailedtarget" gorm:"column:ep_detailedtarget;type:mediumtext;comment:指标细则"` |
|||
AcceptDepartment int64 `json:"acceptdepartment" gorm:"column:ep_accept_department;type:bigint(20) unsigned;default:0;not null;comment:接受考核部门"` |
|||
HappenTime int64 `json:"happentime" gorm:"column:ep_happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` |
|||
FlowKey int64 `json:"flowkey" gorm:"column:ep_flow_key;type:bigint(20) unsigned;default:0;not null;comment:工作流识别符"` |
|||
FlowVid int64 `json:"flowvid" gorm:"column:ep_flow_vid;type:bigint(20) unsigned;default:0;not null;comment:当前工作流版本号"` |
|||
EpOld int `json:"epold" gorm:"column:ep_old;type:int(7) unsigned;default:1;not null;comment:1:旧流程;2:新流程"` |
|||
Creater int64 `json:"creater" gorm:"column:ep_creater;type:bigint(20) unsigned;default:0;not null;comment:流程创始人"` |
|||
Clique int64 `json:"clique" gorm:"column:ep_clique;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
} |
|||
|
|||
func (EvaluationProcess *EvaluationProcess) TableName() string { |
|||
return "evaluation_process" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *EvaluationProcess) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *EvaluationProcess) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *EvaluationProcess) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *EvaluationProcess) ContMap(whereMap interface{}, field ...string) (countAry []EvaluationProcess, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *EvaluationProcess) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,71 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 测评指标
|
|||
type EvaluationTarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:et_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:et_title;type:varchar(255);comment:指标名称"` |
|||
Type int `json:"type" gorm:"column:et_type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` |
|||
State int `json:"state" gorm:"column:et_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addTime" gorm:"column:et_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"` |
|||
Share int `json:"share" gorm:"column:et_share;type:int(1) unsigned;default:1;not null;comment:1:共用;2:私用"` |
|||
RelevantDepartments string `json:"relevantdepartments" gorm:"column:et_relevant_departments;type:text;comment:相关部门"` |
|||
Dimension int64 `json:"dimension" gorm:"column:et_dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Key int64 `json:"key" gorm:"column:et_key;type:bigint(20) unsigned;default:0;not null;comment:UUID"` |
|||
Report string `json:"report" gorm:"column:et_report;type:text;comment:上报人"` |
|||
Uniteing string `json:"unites" gorm:"column:et_unit;type:varchar(255);comment:计量单位"` |
|||
Cycles int `json:"cycle" gorm:"column:et_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
CycleAttres int `json:"cycleattr" gorm:"column:et_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
VisibleRange string `json:"visiblerange" gorm:"column:et_visible_range;type:text;comment:可见范围"` |
|||
VisibleRangeGroup string `json:"visiblerangegroup" gorm:"column:et_visible_group;type:text;comment:可见范围(集团)"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:et_scoring_method;type:tinyint(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` |
|||
} |
|||
|
|||
func (EvaluationTarget *EvaluationTarget) TableName() string { |
|||
return "evaluationtarget" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *EvaluationTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *EvaluationTarget) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *EvaluationTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *EvaluationTarget) ContMap(whereMap interface{}, field ...string) (countAry []EvaluationTarget, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *EvaluationTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
package modelskpi |
|||
|
|||
// 定量柳树视图
|
|||
type FlowDataLogType struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` |
|||
Score int64 `json:"score" gorm:"column:score;type:bigint(20) unsigned;default:0;not null;comment:数据"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:method;type:int(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` |
|||
ScoringScore float64 `json:"scoringscore" gorm:"column:scoring_score;type:bigint(20) unsigned;default:0;not null;comment:手动分"` |
|||
EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:eval_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` |
|||
DutyGroup int64 `json:"dutygroup" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:职责集团"` |
|||
DutyDepartment int64 `json:"dutydepartment" gorm:"column:department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"` |
|||
Baseline string `json:"baseline" gorm:"column:baseline;type:longtext;comment:基准线 "` |
|||
Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年分"` |
|||
Quarter int64 `json:"quarter" gorm:"column:quarte;type:int(2) unsigned;default:0;not null;comment:季度"` |
|||
Month int64 `json:"month" gorm:"column:month;type:int(2) unsigned;default:0;not null;comment:月"` |
|||
Week int64 `json:"week" gorm:"column:week;type:int(5) unsigned;default:0;not null;comment:周"` |
|||
ToDay int64 `json:"today" gorm:"column:today;type:int(5) unsigned;default:0;not null;comment:天"` |
|||
TargetId int64 `json:"targetid" gorm:"column:targetid;type:bigint(20) unsigned;default:0;not null;comment:指标ID"` |
|||
Edition string `json:"edition" gorm:"column:edition;type:longtext;comment:版本号 "` |
|||
Content string `json:"content" gorm:"column:content;type:longtext;comment:评测内容 "` |
|||
} |
|||
|
|||
func (FlowDataLogType *FlowDataLogType) TableName() string { |
|||
return "flow_data_log" |
|||
} |
|||
@ -0,0 +1,76 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 定量考核数据表
|
|||
type FlowLog struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:fl_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
EvaluationPlan string `json:"evaluationplan" gorm:"column:fl_evaluation_id;type:mediumtext unsigned;default:0;not null;comment:考核方案项目ID"` |
|||
Score int64 `json:"score" gorm:"column:fl_data;type:bigint(20) unsigned;default:0;not null;comment:数据"` |
|||
Key int64 `json:"key" gorm:"column:fl_key;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` |
|||
Content string `json:"content" gorm:"column:fl_content;type:mediumtext;comment:描述"` |
|||
Time int64 `json:"time" gorm:"column:fl_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:fl_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` |
|||
EvaluationDepartment int64 `json:"evaluationdepartment" gorm:"column:fl_evaluation_department;type:bigint(20) unsigned;default:0;not null;comment:测评部门"` |
|||
EvaluationUser int64 `json:"evaluationuser" gorm:"column:fl_evaluation_user;type:bigint(20) unsigned;default:0;not null;comment:测评人"` |
|||
EvaluationGroup int64 `json:"evaluationgroup" gorm:"column:fl_evaluation_group;type:bigint(20) unsigned;default:0;not null;comment:测评集团"` |
|||
Year int64 `json:"year" gorm:"column:fl_year;type:int(7) unsigned;default:0;not null;comment:年分"` |
|||
Quarter int64 `json:"quarter" gorm:"column:fl_quarter;type:int(2) unsigned;default:0;not null;comment:季度"` |
|||
Month int64 `json:"month" gorm:"column:fl_month;type:int(2) unsigned;default:0;not null;comment:月"` |
|||
Week int64 `json:"week" gorm:"column:fl_week;type:int(5) unsigned;default:0;not null;comment:周"` |
|||
ToDay int64 `json:"today" gorm:"column:fl_day;type:int(5) unsigned;default:0;not null;comment:天"` |
|||
Enclosure string `json:"enclosure" gorm:"column:fl_enclosure;type:longtext;comment:附件"` |
|||
DutyGroup int64 `json:"dutygroup" gorm:"column:fl_duty_group;type:bigint(20) unsigned;default:0;not null;comment:职责集团"` |
|||
DutyDepartment int64 `json:"dutydepartment" gorm:"column:fl_duty_department;type:bigint(20) unsigned;default:0;not null;comment:职责部门"` |
|||
Reply int `json:"reply" gorm:"column:fl_reply;type:int(2) unsigned;default:1;not null;comment:状态(0:删除;1:起草;2:审批;3:通过)"` |
|||
PlanVersion string `json:"planversion" gorm:"column:fl_planversion;type:varchar(255);comment:版本号"` |
|||
Baseline string `json:"baseline" gorm:"column:fl_baseline;type:longtext;comment:基准线 "` |
|||
} |
|||
|
|||
func (FlowLog *FlowLog) TableName() string { |
|||
return "flow_log" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *FlowLog) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *FlowLog) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *FlowLog) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *FlowLog) ContMap(whereMap interface{}, field ...string) (countAry []FlowLog, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *FlowLog) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,71 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 定量考核数据流
|
|||
type FlowLogData struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:fld_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
EvaluationPlan int64 `json:"evaluationplan" gorm:"column:fld_evaluation_id;type:bigint(20) unsigned;default:0;not null;comment:考核方案项目ID"` |
|||
Key int64 `json:"key" gorm:"column:fld_flow_log;type:bigint(20) unsigned;default:0;not null;comment:识别标志"` |
|||
Score int64 `json:"score" gorm:"column:fld_score;type:bigint(20) unsigned;default:0;not null;comment:数据"` |
|||
Content string `json:"content" gorm:"column:fld_cont;type:mediumtext;comment:描述"` |
|||
Enclosure string `json:"enclosure" gorm:"column:fld_enclosure;type:longtext;comment:附件"` |
|||
Time int64 `json:"time" gorm:"column:fld_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:fld_scoring_method;type:int(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` |
|||
ScoringScore float64 `json:"scoringscore" gorm:"column:fld_scoring_score;type:bigint(20) unsigned;default:0;not null;comment:手动分"` |
|||
PlanVersion string `json:"planversion" gorm:"column:fld_planversion;type:varchar(255);comment:版本号"` |
|||
Year int64 `json:"year" gorm:"column:fld_year;type:int(7) unsigned;default:0;not null;comment:年分"` |
|||
Quarter int64 `json:"quarter" gorm:"column:fld_quarter;type:int(2) unsigned;default:0;not null;comment:季度"` |
|||
Month int64 `json:"month" gorm:"column:fld_month;type:int(2) unsigned;default:0;not null;comment:月"` |
|||
Week int64 `json:"week" gorm:"column:fld_week;type:int(5) unsigned;default:0;not null;comment:周"` |
|||
ToDay int64 `json:"today" gorm:"column:fld_day;type:int(5) unsigned;default:0;not null;comment:天"` |
|||
TargetId int64 `json:"targetid" gorm:"column:fld_target_id;type:bigint(20) unsigned;default:0;not null;comment:指标ID"` |
|||
} |
|||
|
|||
func (FlowLogData *FlowLogData) TableName() string { |
|||
return "flow_log_data" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *FlowLogData) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *FlowLogData) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *FlowLogData) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *FlowLogData) ContMap(whereMap interface{}, field ...string) (countAry []FlowLogData, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *FlowLogData) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,86 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 定性考核流水
|
|||
type NatureFlowOrder struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"` |
|||
OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"` |
|||
AddOrDecrease int `json:"addordecrease" gorm:"column:add_or_decrease;type:tinyint(1) unsigned;default:1;not null;comment:增加或减少(1:增加;2:减少)"` |
|||
Score float64 `json:"score" gorm:"column:score;type:bigint(20) unsigned;default:0;not null;comment:分值(*100保存)"` |
|||
Money float64 `json:"money" gorm:"column:money;type:bigint(20) unsigned;default:0;not null;comment:钱(扣款或奖励)*100保存"` |
|||
Reason string `json:"reason" gorm:"column:reason;type:text;comment:这样操作的原因"` |
|||
ShemeId int64 `json:"shemeid" gorm:"column:sheme_id;type:bigint(20) unsigned;default:0;not null;comment:方案ID"` |
|||
ShemeVersion string `json:"shemeversion" gorm:"column:sheme_version;type:varchar(255) ;not null;comment:方案版本编号"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
SonTarget int64 `json:"sontarget" gorm:"column:son_target;type:bigint(20) unsigned;default:0;not null;comment:指标子栏目"` |
|||
Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` |
|||
Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年"` |
|||
Quarter int64 `json:"quarter" gorm:"column:quarter;type:int(3) unsigned;default:0;not null;comment:季度"` |
|||
Month int64 `json:"month" gorm:"column:month;type:int(3) unsigned;default:0;not null;comment:月"` |
|||
Week int64 `json:"week" gorm:"column:week;type:int(3) unsigned;default:0;not null;comment:周"` |
|||
PersonLiable int64 `json:"personliable" gorm:"column:person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"` |
|||
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"` |
|||
ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"` |
|||
Rectification int `json:"rectification" gorm:"column:rectification;type:tinyint(1) unsigned;default:2;not null;comment:是否需要整改 1、需要整改;2:无需整改"` |
|||
CorrectionTime int64 `json:"correctiontime" gorm:"column:correction_time;type:bigint(20) unsigned;default:0;not null;comment:整改期限"` |
|||
HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` |
|||
HappenCount int `json:"happencount" gorm:"column:happen_count;type:int(7) unsigned;default:0;not null;comment:发生次数"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"` |
|||
Class int `json:"class" gorm:"column:class;type:tinyint(1) unsigned;default:1;not null;comment:属性1、定性;2、定量"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:流程状态 1:草稿;2:驳回;3:审批中;4:归档;5:废弃;6:删除"` |
|||
Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:流程参与人"` |
|||
} |
|||
|
|||
func (NatureFlowOrder *NatureFlowOrder) TableName() string { |
|||
return "nature_flow_order" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *NatureFlowOrder) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *NatureFlowOrder) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *NatureFlowOrder) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *NatureFlowOrder) ContMap(whereMap interface{}, field ...string) (countAry []NatureFlowOrder, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *NatureFlowOrder) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,94 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 审批记录
|
|||
type OpenApprovalChangeLog struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Type int `json:"type" gorm:"column:type;type:int(1) unsigned;default:1;not null;comment:类型(1:部门;2:岗位)"` |
|||
Title string `json:"title" gorm:"column:title;type:varchar(255);comment:节点名称"` |
|||
Operator int64 `json:"operator" gorm:"column:operator;type:bigint(20);comment:操作人"` |
|||
OrderId int64 `json:"orderid" gorm:"column:orderid;type:bigint(20) unsigned;default:0;not null;comment:订单ID"` |
|||
OperatorTime int64 `json:"operatortime" gorm:"column:operatortime;type:bigint(20) unsigned;default:0;not null;comment:操作时间"` |
|||
Step int64 `json:"step" gorm:"column:step;type:int(5) unsigned;default:1;not null;comment:操作第几步"` |
|||
OperatorType int `json:"operatortype" gorm:"column:operatortype;type:int(1) unsigned;default:1;not null;comment:操作状态(1:位操作;2:已操作)"` |
|||
Msgid string `json:"msgid" gorm:"column:msgid;type:varchar(255);comment:消息id,用于撤回应用消息"` |
|||
ResponseCode string `json:"responsecode" gorm:"column:response_code;type:varchar(255);comment:仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,24小时内有效,且只能使用一次"` |
|||
Stepper int `json:"stepper" gorm:"column:stepper;type:int(5) unsigned;default:1;not null;comment:步进器"` |
|||
ChangeIsTrue int `json:"changeistrue" gorm:"column:change_is_true;type:int(1) unsigned;default:1;not null;comment:是否可变更(1:可变更;2:不可变更)"` |
|||
Eiteyime int64 `json:"eiteyime" gorm:"column:eiteyime;type:bigint(20) unsigned;default:0;not null;comment:变动时间"` |
|||
YesOrNo int `json:"yesorno" gorm:"column:yesorno;type:int(1) unsigned;default:0;not null;comment:1:草稿,2:审批中;3:驳回;4:归档;5:删除"` |
|||
Idea string `json:"idea" gorm:"column:idea;type:longtext;comment:操作意见"` |
|||
Annex string `json:"annex" gorm:"column:annex;type:longtext;comment:附件"` |
|||
} |
|||
|
|||
func (OpenApprovalChangeLog *OpenApprovalChangeLog) TableName() string { |
|||
return "open_approval_change_log" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *OpenApprovalChangeLog) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *OpenApprovalChangeLog) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *OpenApprovalChangeLog) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *OpenApprovalChangeLog) ContMap(whereMap interface{}, field ...string) (countAry []OpenApprovalChangeLog, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *OpenApprovalChangeLog) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 添加记录
|
|||
func (cont *OpenApprovalChangeLog) AddCont() (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Create(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 获取最大数
|
|||
func (cont *OpenApprovalChangeLog) GetMAx(orderId int64, userKey []string) (maxData int, err error) { |
|||
if len(userKey) > 0 { |
|||
err = overall.CONSTANT_DB_KPI.Model(&OpenApprovalChangeLog{}).Select("`stepper`,`operatortype`,`change_is_true`").Where("`orderid` = ? AND `operator` IN ?", orderId, userKey).First(&cont).Error |
|||
if cont.ChangeIsTrue == 1 { |
|||
maxData = cont.Stepper |
|||
return |
|||
} else { |
|||
err = overall.CONSTANT_DB_KPI.Model(&OpenApprovalChangeLog{}).Select("MAX(`stepper`) AS maxstep").Where("`orderid` = ?", orderId).First(&maxData).Error |
|||
} |
|||
} else { |
|||
err = overall.CONSTANT_DB_KPI.Model(&OpenApprovalChangeLog{}).Select("MAX(`stepper`) AS maxstep").Where("`orderid` = ?", orderId).First(&maxData).Error |
|||
} |
|||
|
|||
return |
|||
} |
|||
@ -0,0 +1,69 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 当前节点是否可操作
|
|||
type OperatorIsTrue struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
OrderId int64 `json:"orderid" gorm:"column:orderid;type:bigint(20) unsigned;default:0;not null;comment:订单ID"` |
|||
Step int `json:"step" gorm:"column:step;type:int(5) unsigned;default:1;not null;comment:审批到第几步"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态:1:可操作;2:不可操作"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:操作时间"` |
|||
Msgid string `json:"msgid" gorm:"column:msgid;type:varchar(255);comment:消息id,用于撤回应用消息"` |
|||
ResponseCode string `json:"responsecode" gorm:"column:response_code;type:varchar(255);comment:仅消息类型为“按钮交互型”,“投票选择型”和“多项选择型”的模板卡片消息返回,应用可使用response_code调用更新模版卡片消息接口,24小时内有效,且只能使用一次"` |
|||
Stepper int `json:"stepper" gorm:"column:stepper;type:int(5) unsigned;default:1;not null;comment:步进器"` |
|||
} |
|||
|
|||
func (OperatorIsTrue *OperatorIsTrue) TableName() string { |
|||
return "operator_is_true" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *OperatorIsTrue) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *OperatorIsTrue) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *OperatorIsTrue) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *OperatorIsTrue) ContMap(whereMap interface{}, field ...string) (countAry []OperatorIsTrue, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *OperatorIsTrue) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 添加记录
|
|||
func (cont *OperatorIsTrue) AddCont() (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Create(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,65 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 考核方案版本管理
|
|||
type PlanVersio struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:集团ID"` |
|||
Department int64 `json:"department" gorm:"column:department;type:bigint(20) unsigned;default:0;comment:部门ID"` |
|||
Year int64 `json:"year" gorm:"column:yeares;type:int(5) unsigned;default:0;not null;comment:年度"` |
|||
Versio string `json:"versio" gorm:"column:versio;type:varchar(20) unsigned;default:0;not null;comment:版本号"` |
|||
Key string `json:"key" gorm:"column:key;type:varchar(200) unsigned;default:0;not null;comment:编码"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` |
|||
Content string `json:"content" gorm:"column:content;type:longtext;comment:版本内容"` |
|||
} |
|||
|
|||
func (PlanVersio *PlanVersio) TableName() string { |
|||
return "plan_versio" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *PlanVersio) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *PlanVersio) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *PlanVersio) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *PlanVersio) ContMap(whereMap interface{}, field ...string) (countAry []PlanVersio, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *PlanVersio) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,67 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位考核方案版本管理
|
|||
type PositionPlanVersio struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Group int64 `json:"group" gorm:"column:group;type:bigint(20) unsigned;default:0;not null;comment:归属集团"` |
|||
Department int64 `json:"department" gorm:"column:department;type:bigint(20) unsigned;default:0;comment:归属部门"` |
|||
OrgId int64 `json:"orgid" gorm:"column:orgid;type:bigint(20) unsigned;default:0;comment:行政组织"` |
|||
Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;comment:归属岗位"` |
|||
Key string `json:"key" gorm:"column:key;type:varchar(200) unsigned;default:0;not null;comment:编码"` |
|||
Versio string `json:"versio" gorm:"column:version;type:varchar(20) unsigned;default:0;not null;comment:版本号"` |
|||
Year int64 `json:"year" gorm:"column:years;type:int(5) unsigned;default:0;not null;comment:年度"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
EiteTime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:修改时间"` |
|||
Content string `json:"content" gorm:"column:content;type:longtext;comment:版本内容"` |
|||
} |
|||
|
|||
func (PositionPlanVersio *PositionPlanVersio) TableName() string { |
|||
return "position_plan_version" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *PositionPlanVersio) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *PositionPlanVersio) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *PositionPlanVersio) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *PositionPlanVersio) ContMap(whereMap interface{}, field ...string) (countAry []PositionPlanVersio, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *PositionPlanVersio) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,79 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 定量考核流水
|
|||
type PostMeteringFlow struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"` |
|||
OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"` |
|||
ShemeId int64 `json:"shemeid" gorm:"column:sheme_id;type:bigint(20) unsigned;default:0;not null;comment:方案ID"` |
|||
ShemeVersion string `json:"shemeversion" gorm:"column:sheme_version;type:varchar(255) ;not null;comment:方案版本编号"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
Score float64 `json:"score" gorm:"column:score;type:bigint(20) unsigned;default:0;not null;comment:分值(*100保存)"` |
|||
Reason string `json:"reason" gorm:"column:reason;type:text;comment:这样操作的原因"` |
|||
Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年"` |
|||
Quarter int64 `json:"quarter" gorm:"column:quarter;type:int(3) unsigned;default:0;not null;comment:季度"` |
|||
Month int64 `json:"month" gorm:"column:month;type:int(3) unsigned;default:0;not null;comment:月"` |
|||
Week int64 `json:"week" gorm:"column:week;type:int(3) unsigned;default:0;not null;comment:周"` |
|||
PersonLiable int64 `json:"personliable" gorm:"column:person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"` |
|||
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"` |
|||
ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"` |
|||
HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"` |
|||
Baseline string `json:"baseline" gorm:"column:baseline;type:text;comment:基准线"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:scoring_method;type:tinyint(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` |
|||
ScoringScore float64 `json:"scoringscore" gorm:"column:scoring_score;type:bigint(20) unsigned;default:0;not null;comment:手动分"` |
|||
} |
|||
|
|||
func (PostMeteringFlow *PostMeteringFlow) TableName() string { |
|||
return "post_metering_flow" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *PostMeteringFlow) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *PostMeteringFlow) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *PostMeteringFlow) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *PostMeteringFlow) ContMap(whereMap interface{}, field ...string) (countAry []PostMeteringFlow, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *PostMeteringFlow) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,84 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 定性考核流水
|
|||
type PostNatureFlow struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"` |
|||
OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"` |
|||
AddOrDecrease int `json:"addordecrease" gorm:"column:add_or_decrease;type:tinyint(1) unsigned;default:1;not null;comment:增加或减少(1:增加;2:减少)"` |
|||
Score float64 `json:"score" gorm:"column:score;type:bigint(20) unsigned;default:0;not null;comment:分值(*100保存)"` |
|||
Money float64 `json:"money" gorm:"column:money;type:bigint(20) unsigned;default:0;not null;comment:钱(扣款或奖励)*100保存"` |
|||
Reason string `json:"reason" gorm:"column:reason;type:text;comment:这样操作的原因"` |
|||
ShemeId int64 `json:"shemeid" gorm:"column:sheme_id;type:bigint(20) unsigned;default:0;not null;comment:方案ID"` |
|||
ShemeVersion string `json:"shemeversion" gorm:"column:sheme_version;type:varchar(255) ;not null;comment:方案版本编号"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
SonTarget int64 `json:"sontarget" gorm:"column:son_target;type:bigint(20) unsigned;default:0;not null;comment:指标子栏目"` |
|||
Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` |
|||
Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年"` |
|||
Quarter int64 `json:"quarter" gorm:"column:quarter;type:int(3) unsigned;default:0;not null;comment:季度"` |
|||
Month int64 `json:"month" gorm:"column:month;type:int(3) unsigned;default:0;not null;comment:月"` |
|||
Week int64 `json:"week" gorm:"column:week;type:int(3) unsigned;default:0;not null;comment:周"` |
|||
PersonLiable int64 `json:"personliable" gorm:"column:person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"` |
|||
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"` |
|||
ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"` |
|||
Rectification int `json:"rectification" gorm:"column:rectification;type:tinyint(1) unsigned;default:2;not null;comment:是否需要整改 1、需要整改;2:无需整改"` |
|||
CorrectionTime int64 `json:"correctiontime" gorm:"column:correction_time;type:bigint(20) unsigned;default:0;not null;comment:整改期限"` |
|||
HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` |
|||
HappenCount int `json:"happencount" gorm:"column:happen_count;type:int(7) unsigned;default:0;not null;comment:发生次数"` |
|||
HappenCountMoney int `json:"happencountmoney" gorm:"column:happen_count_money;type:int(7) unsigned;default:0;not null;comment:发生次数(钱)"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"` |
|||
} |
|||
|
|||
func (PostNatureFlow *PostNatureFlow) TableName() string { |
|||
return "post_nature_flow" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *PostNatureFlow) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *PostNatureFlow) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *PostNatureFlow) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *PostNatureFlow) ContMap(whereMap interface{}, field ...string) (countAry []PostNatureFlow, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *PostNatureFlow) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位定性指标子栏目
|
|||
type PostSonTarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:title;type:varchar(255) unsigned;default:'';not null;comment:标题"` |
|||
ParentId int64 `json:"parentid" gorm:"column:parent_id;type:bigint(20) unsigned;default:0;not null;comment:归属指标"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Depart string `json:"depart" gorm:"column:depart;type:longtext ;default:0;comment:关联部门"` |
|||
DepartPost string `json:"departpost" gorm:"column:depart_post;type:longtext ;default:'';comment:关联部门岗位"` |
|||
} |
|||
|
|||
func (PostSonTarget *PostSonTarget) TableName() string { |
|||
return "post_sun_target" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *PostSonTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *PostSonTarget) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *PostSonTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *PostSonTarget) ContMap(whereMap interface{}, field ...string) (countAry []PostSonTarget, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *PostSonTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,77 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"fmt" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位指标
|
|||
type PostTarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:title;type:varchar(255) unsigned;default:'';not null;comment:标题"` |
|||
Type int `json:"type" gorm:"column:type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
Share int `json:"share" gorm:"column:share;type:int(1) unsigned;default:1;not null;comment:1:共用;2:私用"` |
|||
ReleDepart int64 `json:"reledepart" gorm:"column:rele_depart;type:bigint(20) unsigned;default:0;not null;comment:相关部门"` |
|||
DepartmentsPost string `json:"departmentspost" gorm:"column:departments_post;type:text ;default:'';comment:相关岗位"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Key int64 `json:"key" gorm:"column:key;type:bigint(20) unsigned;default:0;not null;comment:UUID"` |
|||
Report string `json:"report" gorm:"column:report;type:text ;default:'';comment:上报人"` |
|||
Unit string `json:"unit" gorm:"column:unit;type:varchar(255) unsigned;default:'';not null;comment:单位"` |
|||
Cycle int `json:"cycle" gorm:"column:cycle;type:int(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
Cycleattr int `json:"cycleattr" gorm:"column:cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:scoring_method;type:int(1) unsigned;default:0;not null;comment:计分方式(1:自动;2:手动)"` |
|||
VisibleRange string `json:"visiblerange" gorm:"column:visible_range;type:text ;default:'';comment:可见范围"` |
|||
VisibleGroup string `json:"visiblegroup" gorm:"column:visible_group;type:text ;default:'';comment:可见范围(集团)"` |
|||
} |
|||
|
|||
func (PostTarget *PostTarget) TableName() string { |
|||
return "post_target" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *PostTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *PostTarget) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
// fieldStr := strings.Join(field, ",")
|
|||
// gormDb = gormDb.Select(fieldStr)
|
|||
for _, v := range field { |
|||
gormDb = gormDb.Select(v) |
|||
} |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
fmt.Printf("GetCont---------->%v------->%v\n", err, cont) |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *PostTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *PostTarget) ContMap(whereMap interface{}, field ...string) (countAry []PostTarget, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *PostTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,77 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 指标细则
|
|||
type PostTargetDetails struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:title;type:text;comment:指标细则"` |
|||
Content string `json:"content" gorm:"column:content;type:text;comment:指标说明"` |
|||
ParentId int64 `json:"parentid" gorm:"column:parentid;type:bigint(20) unsigned;default:0;not null;comment:归属指标栏目"` |
|||
ParentIdSun int64 `json:"parentidsun" gorm:"column:parentid_sun;type:bigint(20) unsigned;default:0;not null;comment:归属指标子栏目"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addtime" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"` |
|||
MinScore int64 `json:"minscore" gorm:"column:min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"` |
|||
MaxScore int64 `json:"maxscore" gorm:"column:max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"` |
|||
Company string `json:"company" gorm:"column:company;type:varchar(20) unsigned;default:0;not null;comment:单位"` |
|||
AddReduce int `json:"addreduce" gorm:"column:add_reduce;type:int(1) unsigned;default:1;not null;comment:1:减少;2:增加;3:无属性,现场确认加或减"` |
|||
CensorType string `json:"censortype" gorm:"column:censor_type;type:text;comment:检查方式"` |
|||
CensorCont string `json:"censorcont" gorm:"column:censor_cont;type:longtext;comment:检查依据"` |
|||
CensorRate int `json:"censorrate" gorm:"column:censor_rate;type:int(5) unsigned;default:1;not null;comment:检查频次"` |
|||
Cycles int `json:"cycle" gorm:"column:cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
CycleAttres int `json:"cycleattr" gorm:"column:cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
Paretment string `json:"paretment" gorm:"column:paretment;type:longtext;comment:接受考核的部门"` |
|||
ParetmentPost string `json:"paretmentpost" gorm:"column:paretment_post;type:longtext;comment:接受考核的部门岗位"` |
|||
Reportary string `json:"reportary" gorm:"column:reportary;type:longtext;comment:提报人"` |
|||
Punishmode int `json:"punishmode" gorm:"column:punishmode;type:tinyint(1) unsigned;default:1;not null;comment:处罚方式 1:扣分;2:现金处罚;3:扣分加现金"` |
|||
Maxmoney int64 `json:"maxmoney" gorm:"column:maxmoney;type:bigint(20) unsigned;default:0;not null;comment:最高罚款"` |
|||
Minmoney int64 `json:"minmoney" gorm:"column:minmoney;type:bigint(20) unsigned;default:0;not null;comment:最低罚款"` |
|||
} |
|||
|
|||
func (PostTargetDetails *PostTargetDetails) TableName() string { |
|||
return "post_target_details" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *PostTargetDetails) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *PostTargetDetails) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *PostTargetDetails) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *PostTargetDetails) ContMap(whereMap interface{}, field ...string) (countAry []PostTargetDetails, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *PostTargetDetails) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,84 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位审批工作流
|
|||
type PostWorkflowOrders struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;autoIncrement;comment:ID"` |
|||
OrderId int64 `json:"orderid" gorm:"column:order_id;type:bigint(20) unsigned;default:0;not null;comment:审批单ID"` |
|||
Step int `json:"step" gorm:"column:step;type:int(5) unsigned;default:0;not null;comment:当前执行到第几步"` |
|||
NextStep int `json:"nextstep" gorm:"column:next_step;type:int(5) unsigned;default:0;not null;comment:下一步执行哪个步骤"` |
|||
NextExecutor string `json:"nextexecutor" gorm:"column:next_executor;type:longtext;comment:下一步执行人"` |
|||
CountStep int `json:"countstep" gorm:"column:count_step;type:int(5) unsigned;default:0;not null;comment:总共几步"` |
|||
WorkFlow string `json:"workflow" gorm:"column:work_flow;type:longtext;comment:工作流(审批json字符串)"` |
|||
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门"` |
|||
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
Class int `json:"class" gorm:"column:class;type:tinyint(1) unsigned;default:1;not null;comment:属性1、定性;2、定量"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
SonTarget int64 `json:"sontarget" gorm:"column:son_target;type:bigint(20) unsigned;default:0;not null;comment:指标子栏目"` |
|||
Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` |
|||
Executor int64 `json:"executor" gorm:"column:executor;type:bigint(20) unsigned;default:0;not null;comment:执行人"` |
|||
ExecutorDepartment int64 `json:"executordepartment" gorm:"column:executor_department;type:bigint(20) unsigned;default:0;not null;comment:执行人部门"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:流程状态 流程状态 1:草稿;2:审批中;3:驳回;4:归档;5:废弃;6:删除"` |
|||
StartTime int64 `json:"starttime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:流程开始时间"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:时间"` |
|||
EnclosureFormat string `json:"enclosureformat" gorm:"column:enclosure_format;type:longtext;comment:附件"` |
|||
Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:流程参与人"` |
|||
Year int64 `json:"year" gorm:"column:year;type:int(7) unsigned;default:0;not null;comment:年"` |
|||
Quarter int64 `json:"quarter" gorm:"column:quarter;type:int(3) unsigned;default:0;not null;comment:季度"` |
|||
Month int64 `json:"month" gorm:"column:month;type:int(3) unsigned;default:0;not null;comment:月"` |
|||
Week int64 `json:"week" gorm:"column:week;type:int(3) unsigned;default:0;not null;comment:周"` |
|||
PersonLiable int64 `json:"personliable" gorm:"column:person_liable;type:bigint(20) unsigned;default:0;not null;comment:责任人"` |
|||
HappenTime int64 `json:"happentime" gorm:"column:happen_time;type:bigint(20) unsigned;default:0;not null;comment:发生时间"` |
|||
} |
|||
|
|||
func (PostWorkflowOrders *PostWorkflowOrders) TableName() string { |
|||
return "post_workflow_orders" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *PostWorkflowOrders) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *PostWorkflowOrders) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *PostWorkflowOrders) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *PostWorkflowOrders) ContMap(whereMap interface{}, field ...string) (countAry []PostWorkflowOrders, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *PostWorkflowOrders) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,89 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 部门方案
|
|||
// 性质考核方案明细
|
|||
type QualitativeEvaluation struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:qe_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:qe_title;type:text;comment:考核名称"` |
|||
DepartmentId string `json:"parentid" gorm:"column:qe_department_id;type:text;comment:执行考核部门ID"` |
|||
Dimension int64 `json:"dimension" gorm:"column:qe_dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"` |
|||
Target int64 `json:"target" gorm:"column:qe_target;type:bigint(20) unsigned;default:0;not null;comment:考核指标"` |
|||
TargetSun int64 `json:"targetsun" gorm:"column:qe_target_sun;type:bigint(20) unsigned;default:0;not null;comment:考核指标子栏目"` |
|||
DetailedTarget int64 `json:"detailedtarget" gorm:"column:qe_detailed_target;type:bigint(20) unsigned;default:0;not null;comment:考核细则"` |
|||
Type int `json:"type" gorm:"column:qe_type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` |
|||
Weight int64 `json:"weight" gorm:"column:qe_weight;type:int(5) unsigned;default:0;not null;comment:权重"` |
|||
Unit string `json:"unit" gorm:"column:qe_unit;type:varchar(255);comment:单位"` |
|||
ReferenceScore int64 `json:"referencescore" gorm:"column:qe_reference_score;type:int(9) unsigned;default:0;not null;comment:标准分值"` |
|||
State int `json:"state" gorm:"column:qe_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Addtime int64 `json:"addtime" gorm:"column:qe_addtime;type:bigint(20) unsigned;default:0;not null;comment:添加时间"` |
|||
Eitetime int64 `json:"eitetime" gorm:"column:qe_eitetime;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
|||
Group int64 `json:"group" gorm:"column:qe_group;type:bigint(20) unsigned;default:0;not null;comment:归属集团"` |
|||
QualEvalId string `json:"qualevalid" gorm:"column:qe_qual_eval_id;type:varchar(200) unsigned;default:0;not null;comment:性质考核方案"` |
|||
Cycles int `json:"cycle" gorm:"column:qe_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
CycleAttres int `json:"cycleattr" gorm:"column:qe_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
AcceptEvaluation int64 `json:"acceptevaluation" gorm:"column:qe_accept_evaluation;type:bigint(20) unsigned;default:0;not null;comment:接受考核部门"` |
|||
Operator string `json:"operator" gorm:"column:qe_operator;type:text;comment:执行人"` |
|||
Content string `json:"content" gorm:"column:qe_content;type:text;comment:补充说明"` |
|||
MinScore int64 `json:"minscore" gorm:"column:qe_min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"` |
|||
MaxScore int64 `json:"maxscore" gorm:"column:qe_max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"` |
|||
CensorType string `json:"censortype" gorm:"column:qe_censor_type;type:tinyint(1) unsigned;default:1;not null;comment:检查方式"` |
|||
CensorCont string `json:"censorcont" gorm:"column:qe_censor_cont;type:longtext;comment:检查依据"` |
|||
CensorRate int `json:"censorrate" gorm:"column:qe_censor_rate;type:int(5) unsigned;default:1;not null;comment:检查频次"` |
|||
Observer int `json:"observer" gorm:"column:observer;type:tinyint(1) unsigned;default:1;not null;comment:1:启用;2:禁用;3:观察"` |
|||
} |
|||
|
|||
func (QualitativeEvaluation *QualitativeEvaluation) TableName() string { |
|||
return "qualitative_evaluation" |
|||
} |
|||
|
|||
// 新增内容
|
|||
func (cont *QualitativeEvaluation) AddCont() (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Create(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *QualitativeEvaluation) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *QualitativeEvaluation) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *QualitativeEvaluation) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *QualitativeEvaluation) ContMap(whereMap interface{}, field ...string) (countAry []QualitativeEvaluation, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *QualitativeEvaluation) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,81 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位评估方案
|
|||
type QualitativeEvaluationScheme struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
VersionNumber string `json:"versionnumber" gorm:"column:version_number;type:varchar(255) unsigned;not null;comment:版本编号"` |
|||
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:归属公司"` |
|||
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:归属部门"` |
|||
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:归属行政组织"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:归属岗位"` |
|||
Title string `json:"title" gorm:"column:title;type:varchar(255) ;default:'';comment:考核项名称"` |
|||
Content string `json:"content" gorm:"column:content;type:text ;default:'';comment:考核说明"` |
|||
DimensionId int64 `json:"dimensionid" gorm:"column:dimension_id;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
TargetId int64 `json:"targetid" gorm:"column:target_id;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
SonTargetId int64 `json:"sontargetid" gorm:"column:son_target_id;type:bigint(20) unsigned;default:0;not null;comment:子栏目"` |
|||
DetailsId int64 `json:"detailsid" gorm:"column:details_id;type:bigint(20) unsigned;default:0;not null;comment:细则"` |
|||
Attribute int `json:"attribute" gorm:"column:attribute;type:tinyint(1) unsigned;default:1;not null;comment:属性 1:定性考核;2:定量考核"` |
|||
MinScore int64 `json:"minscore" gorm:"column:min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"` |
|||
MaxScore int64 `json:"maxscore" gorm:"column:max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"` |
|||
ScoringMethod int `json:"scoringmethod" gorm:"column:scoring_method;type:tinyint(1) unsigned;default:1;not null;comment:计分方式(1:自动;2:手动)"` |
|||
State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Addtime int64 `json:"addtime" gorm:"column:addtime;type:bigint(20) unsigned;default:0;not null;comment:添加时间"` |
|||
Eitetime int64 `json:"eitetime" gorm:"column:eitetime;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
|||
CensorType string `json:"censortype" gorm:"column:censor_type;type:tinytext;comment:检查方式(1:现场检查;2:资料检查;3:事件触发)"` |
|||
Source int `json:"source" gorm:"column:source;type:tinyint(1) unsigned;default:1;not null;comment:来源(1:岗位;2:部门引用)"` |
|||
RunState int `json:"run_state" gorm:"column:run_state;type:tinyint(1) unsigned;default:1;not null;comment:运行状态(1:启用;2:禁用;3:观察)"` |
|||
Punishmode int `json:"punishmode" gorm:"column:punishmode;type:tinyint(1) unsigned;default:1;not null;comment:处罚方式 1:扣分;2:现金处罚;3:扣分加现金"` |
|||
Maxmoney int64 `json:"maxmoney" gorm:"column:maxmoney;type:bigint(20) unsigned;default:0;not null;comment:最高罚款*100保存"` |
|||
Minmoney int64 `json:"minmoney" gorm:"column:minmoney;type:bigint(20) unsigned;default:0;not null;comment:最低罚款*100保存"` |
|||
AddReduce int `json:"add_reduce" gorm:"column:add_reduce;type:int(1) unsigned;default:0;not null;comment:1:减少;2:增加;3:无属性,现场确认加或减"` |
|||
} |
|||
|
|||
func (QualitativeEvaluationScheme *QualitativeEvaluationScheme) TableName() string { |
|||
return "qualitative_evaluation_scheme" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *QualitativeEvaluationScheme) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *QualitativeEvaluationScheme) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *QualitativeEvaluationScheme) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *QualitativeEvaluationScheme) ContMap(whereMap interface{}, field ...string) (countAry []QualitativeEvaluationScheme, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *QualitativeEvaluationScheme) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,95 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
"time" |
|||
) |
|||
|
|||
type QualitativeEvaluationView struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:qe_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:qe_title;type:text;comment:考核名称"` |
|||
DepartmentId string `json:"parentid" gorm:"column:qe_department_id;type:text;comment:执行考核部门ID"` |
|||
Dimension int64 `json:"dimension" gorm:"column:qe_dimension;type:bigint(20) unsigned;default:0;not null;comment:考核维度"` |
|||
Target int64 `json:"target" gorm:"column:qe_target;type:bigint(20) unsigned;default:0;not null;comment:考核指标"` |
|||
TargetSun int64 `json:"targetsun" gorm:"column:qe_target_sun;type:bigint(20) unsigned;default:0;not null;comment:考核指标子栏目"` |
|||
DetailedTarget int64 `json:"detailedtarget" gorm:"column:qe_detailed_target;type:bigint(20) unsigned;default:0;not null;comment:考核细则"` |
|||
Type int `json:"type" gorm:"column:qe_type;type:int(1) unsigned;default:1;not null;comment:1:定性考核;2:定量考核"` |
|||
Weight int64 `json:"weight" gorm:"column:qe_weight;type:int(5) unsigned;default:0;not null;comment:权重"` |
|||
Unit string `json:"unit" gorm:"column:qe_unit;type:varchar(255);comment:单位"` |
|||
ReferenceScore int64 `json:"referencescore" gorm:"column:qe_reference_score;type:int(9) unsigned;default:0;not null;comment:标准分值"` |
|||
State int `json:"state" gorm:"column:qe_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Addtime int64 `json:"addtime" gorm:"column:qe_addtime;type:bigint(20) unsigned;default:0;not null;comment:添加时间"` |
|||
Eitetime int64 `json:"eitetime" gorm:"column:qe_eitetime;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
|||
Group int64 `json:"group" gorm:"column:qe_group;type:bigint(20) unsigned;default:0;not null;comment:归属集团"` |
|||
QualEvalId string `json:"qualevalid" gorm:"column:qe_qual_eval_id;type:varchar(200) unsigned;default:0;not null;comment:性质考核方案"` |
|||
Cycles int `json:"cycle" gorm:"column:qe_cycle;type:tinyint(1) unsigned;default:1;not null;comment:1:班;2:天;3:周;4:月;5:季度;6:年"` |
|||
CycleAttres int `json:"cycleattr" gorm:"column:qe_cycleattr;type:int(9) unsigned;default:1;not null;comment:辅助计数"` |
|||
AcceptEvaluation int64 `json:"acceptevaluation" gorm:"column:qe_accept_evaluation;type:bigint(20) unsigned;default:0;not null;comment:接受考核部门"` |
|||
Operator string `json:"operator" gorm:"column:qe_operator;type:text;comment:执行人"` |
|||
Content string `json:"content" gorm:"column:qe_content;type:text;comment:补充说明"` |
|||
MinScore int64 `json:"minscore" gorm:"column:qe_min_score;type:bigint(20) unsigned;default:0;not null;comment:最小分*100保存"` |
|||
MaxScore int64 `json:"maxscore" gorm:"column:qe_max_score;type:bigint(20) unsigned;default:0;not null;comment:最大分*100保存"` |
|||
CensorType string `json:"censortype" gorm:"column:qe_censor_type;type:tinyint(1) unsigned;default:1;not null;comment:检查方式"` |
|||
CensorCont string `json:"censorcont" gorm:"column:qe_censor_cont;type:longtext;comment:检查依据"` |
|||
CensorRate int `json:"censorrate" gorm:"column:qe_censor_rate;type:int(5) unsigned;default:1;not null;comment:检查频次"` |
|||
EtTitle string `json:"ettitle" gorm:"column:et_title;type:varchar(255);comment:指标名称"` |
|||
} |
|||
|
|||
func (QualitativeEvaluationView *QualitativeEvaluationView) TableName() string { |
|||
return "qualitative_evaluation_view" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *QualitativeEvaluationView) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *QualitativeEvaluationView) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *QualitativeEvaluationView) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *QualitativeEvaluationView) ContMap(whereMap interface{}, field ...string) (countAry []QualitativeEvaluationView, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *QualitativeEvaluationView) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 判断子目标是否存在
|
|||
func (cont *QualitativeEvaluationView) JudgeIsTrue(whereMap interface{}, addCont QualitativeEvaluationView) (err error) { |
|||
err = cont.GetCont(whereMap) |
|||
if err != nil { |
|||
err = overall.CONSTANT_DB_KPI.Create(&addCont).Error |
|||
} else { |
|||
if cont.State != 1 { |
|||
err = cont.EiteCont(map[string]interface{}{"`q_id`": cont.Id}, map[string]interface{}{"`q_state`": 1, "`q_time`": time.Now().Unix()}) |
|||
} |
|||
} |
|||
return nil |
|||
} |
|||
@ -0,0 +1,75 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
"time" |
|||
) |
|||
|
|||
// 定性测评指标子栏目
|
|||
type QualitativeTarget struct { |
|||
Id int64 `json:"id" gorm:"primary_key;column:q_id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:q_title;type:varchar(255);comment:指标子栏目名称"` |
|||
ParentId int64 `json:"parentid" gorm:"column:q_parent_id;type:bigint(20) unsigned;default:0;not null;comment:归属指标"` |
|||
State int `json:"state" gorm:"column:q_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
AddTime int64 `json:"addTime" gorm:"column:q_time;type:bigint(20) unsigned;default:0;not null;comment:制定时间"` |
|||
Depart string `json:"depart" gorm:"column:q_depart;type:mediumtext;comment:关联部门"` |
|||
} |
|||
|
|||
func (QualitativeTarget *QualitativeTarget) TableName() string { |
|||
return "qualitative_target" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *QualitativeTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *QualitativeTarget) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *QualitativeTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *QualitativeTarget) ContMap(whereMap interface{}, field ...string) (countAry []QualitativeTarget, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Order("sort ASC").Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *QualitativeTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 判断子目标是否存在
|
|||
func (cont *QualitativeTarget) JudgeIsTrue(whereMap interface{}, addCont QualitativeTarget) (err error) { |
|||
err = cont.GetCont(whereMap) |
|||
if err != nil { |
|||
err = overall.CONSTANT_DB_KPI.Create(&addCont).Error |
|||
} else { |
|||
if cont.State != 1 { |
|||
err = cont.EiteCont(map[string]interface{}{"`q_id`": cont.Id}, map[string]interface{}{"`q_state`": 1, "`q_time`": time.Now().Unix()}) |
|||
} |
|||
} |
|||
return nil |
|||
} |
|||
@ -0,0 +1,73 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位定量考核目标设定
|
|||
type QuanPeopleConfig struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
UserKey int64 `json:"userkey" gorm:"column:user_key;type:bigint(20) unsigned;default:0;not null;comment:人员key"` |
|||
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` |
|||
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` |
|||
Type int64 `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:0;not null;comment:1、年度;2、季度;3、月度"` |
|||
Year int64 `json:"year" gorm:"column:year;type:bigint(20) unsigned;default:0;not null;comment:年度"` |
|||
Timecopy int64 `json:"timecopy" gorm:"column:timecopy;type:int(3) unsigned;default:0;not null;comment:季度与月度辅助值"` |
|||
Zeroprize float64 `json:"zeroprize" gorm:"column:zeroprize;type:int(7) unsigned;default:0;not null;comment:零奖值"` |
|||
Allprize float64 `json:"allprize" gorm:"column:allprize;type:int(7) unsigned;default:0;not null;comment:全奖值"` |
|||
Capping int `json:"capping" gorm:"column:capping;type:int(1) unsigned;default:2;not null;comment:是否封顶(1、是;2:否)"` |
|||
CappingVal float64 `json:"cappingval" gorm:"column:capping_val;type:bigint(20) unsigned;default:0;not null;comment:封顶值"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
} |
|||
|
|||
func (QuanPeopleConfig *QuanPeopleConfig) TableName() string { |
|||
return "quan_people_config" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *QuanPeopleConfig) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *QuanPeopleConfig) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *QuanPeopleConfig) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *QuanPeopleConfig) ContMap(whereMap interface{}, field ...string) (countAry []QuanPeopleConfig, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *QuanPeopleConfig) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,76 @@ |
|||
package modelskpi |
|||
|
|||
//
|
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位定量考核目标设定
|
|||
type QuanPeopleConfigTarget struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
Title string `json:"title" gorm:"column:title;type:varchar(255) unsigned;default:'';not null;comment:标题"` |
|||
UserKey int64 `json:"userkey" gorm:"column:user_key;type:bigint(20) unsigned;default:0;not null;comment:使用人"` |
|||
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` |
|||
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` |
|||
Type int64 `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:0;not null;comment:1、年度;2、季度;3、月度"` |
|||
Year int64 `json:"year" gorm:"column:year;type:bigint(20) unsigned;default:0;not null;comment:年度"` |
|||
Timecopy int64 `json:"timecopy" gorm:"column:timecopy;type:int(3) unsigned;default:0;not null;comment:季度与月度辅助值"` |
|||
Zeroprize float64 `json:"zeroprize" gorm:"column:zeroprize;type:int(7) unsigned;default:0;not null;comment:零奖值"` |
|||
Allprize float64 `json:"allprize" gorm:"column:allprize;type:int(7) unsigned;default:0;not null;comment:全奖值"` |
|||
Capping int `json:"capping" gorm:"column:capping;type:int(1) unsigned;default:2;not null;comment:是否封顶(1、是;2:否)"` |
|||
CappingVal float64 `json:"cappingval" gorm:"column:capping_val;type:bigint(20) unsigned;default:0;not null;comment:封顶值"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
} |
|||
|
|||
func (QuanPeopleConfigTarget *QuanPeopleConfigTarget) TableName() string { |
|||
return "quan_people_config_target" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *QuanPeopleConfigTarget) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *QuanPeopleConfigTarget) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *QuanPeopleConfigTarget) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *QuanPeopleConfigTarget) ContMap(whereMap interface{}, field ...string) (countAry []QuanPeopleConfigTarget, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *QuanPeopleConfigTarget) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,72 @@ |
|||
package modelskpi |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 岗位定量考核目标设定
|
|||
type QuanPostConfig struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
CompanyId int64 `json:"companyid" gorm:"column:company_id;type:bigint(20) unsigned;default:0;not null;comment:公司"` |
|||
DepartmentId int64 `json:"departmentid" gorm:"column:department_id;type:bigint(20) unsigned;default:0;not null;comment:部门ID"` |
|||
OrgId int64 `json:"orgid" gorm:"column:org_id;type:bigint(20) unsigned;default:0;not null;comment:行政组织"` |
|||
PostId int64 `json:"postid" gorm:"column:post_id;type:bigint(20) unsigned;default:0;not null;comment:岗位"` |
|||
Dimension int64 `json:"dimension" gorm:"column:dimension;type:bigint(20) unsigned;default:0;not null;comment:维度"` |
|||
Target int64 `json:"target" gorm:"column:target;type:bigint(20) unsigned;default:0;not null;comment:指标"` |
|||
Detailed int64 `json:"detailed" gorm:"column:detailed;type:bigint(20) unsigned;default:0;not null;comment:指标细则"` |
|||
Type int64 `json:"type" gorm:"column:type;type:tinyint(1) unsigned;default:0;not null;comment:1、年度;2、季度;3、月度"` |
|||
Year int64 `json:"year" gorm:"column:year;type:bigint(20) unsigned;default:0;not null;comment:年度"` |
|||
Timecopy int64 `json:"timecopy" gorm:"column:timecopy;type:int(3) unsigned;default:0;not null;comment:季度与月度辅助值"` |
|||
Zeroprize float64 `json:"zeroprize" gorm:"column:zeroprize;type:int(7) unsigned;default:0;not null;comment:零奖值"` |
|||
Allprize float64 `json:"allprize" gorm:"column:allprize;type:int(7) unsigned;default:0;not null;comment:全奖值"` |
|||
Capping int `json:"capping" gorm:"column:capping;type:int(1) unsigned;default:2;not null;comment:是否封顶(1、是;2:否)"` |
|||
CappingVal float64 `json:"cappingval" gorm:"column:capping_val;type:bigint(20) unsigned;default:0;not null;comment:封顶值"` |
|||
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` |
|||
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
} |
|||
|
|||
func (QuanPostConfig *QuanPostConfig) TableName() string { |
|||
return "quan_post_config" |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *QuanPostConfig) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *QuanPostConfig) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *QuanPostConfig) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_KPI.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *QuanPostConfig) ContMap(whereMap interface{}, field ...string) (countAry []QuanPostConfig, err error) { |
|||
gormDb := overall.CONSTANT_DB_KPI.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *QuanPostConfig) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_KPI.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue