80 changed files with 10651 additions and 940 deletions
@ -1,154 +0,0 @@ |
|||||
## Hr Server项目结构 1 |
|
||||
|
|
||||
```Project |
|
||||
|—— api |
|
||||
└── version1 |
|
||||
└── empower |
|
||||
|—— router |
|
||||
|—— initialization |
|
||||
└── database |
|
||||
└── nosql |
|
||||
└── app |
|
||||
└── route |
|
||||
|identification |
|
||||
|—— config |
|
||||
└── database |
|
||||
└── nosql |
|
||||
└── app |
|
||||
|—— models |
|
||||
|—— overall |
|
||||
|—— middleware |
|
||||
``` |
|
||||
|
|
||||
## Hr 文件结构说明 |
|
||||
|
|
||||
| 文件夹 | 说明 | 描述 | |
|
||||
| ------------------ | ---------------- | ---------------------------------- | |
|
||||
| `api` | api相关业务 | api业务实现 | |
|
||||
| `--version1` | 业务版本文件夹 | 版本界定 | |
|
||||
| `--empower` | OAuth 2.0 授权 | 授权Token | |
|
||||
| `router` | 路由器 | 业务路由设定 | |
|
||||
| `initialization` | 初始化相关业务 | 系统初始化方面的实现 | |
|
||||
| `--database` | 数据库业务 | 数据库业务初始化实现 | |
|
||||
| `--nosql` | nosql数据库业务 | nosql业务初始化实现(例:Redis) | |
|
||||
| `--app` | app数据库业务 | app业务初始化实现 | |
|
||||
| `--route` | 路由初始化 | 路由初始化 | |
|
||||
| `identification` | 授权验证器 | 授权验证器 | |
|
||||
| `config` | 系统配置相关业务 | 系统系统配置方面的实现 | |
|
||||
| `--database` | 数据库业务 | 数据库业务系统配置实现 | |
|
||||
| `--nosql` | nosql数据库业务 | nosql业务系统配置实现(例:Redis) | |
|
||||
| `--app` | app数据库业务 | app业务系统配置实现 | |
|
||||
| `models` | 数据模型 | 数据库方面的配置 | |
|
||||
| `overall` | 全局对象 | 全局对象 | |
|
||||
| `middleware` | 中间件 | 中间件 | |
|
||||
|
|
||||
## 加密规则 |
|
||||
|
|
||||
``` |
|
||||
1、分解步骤 |
|
||||
one = md5(CodeString)+md5(AppKey) |
|
||||
two = md5(one)+AppKey |
|
||||
therr = md5(two) |
|
||||
2、合并 |
|
||||
md5(md5(md5(CodeString)+md5(AppKey))+AppKey) |
|
||||
``` |
|
||||
|
|
||||
## 接口访问规则 |
|
||||
|
|
||||
1、以POST方式访问 http://xxxx/empower/gaintoken |
|
||||
|
|
||||
#### 参数 |
|
||||
|
|
||||
```json |
|
||||
{ |
|
||||
"username":"jindie", |
|
||||
"password":"jindie123" |
|
||||
} |
|
||||
``` |
|
||||
|
|
||||
| 参数 | 说明 | |
|
||||
| -------- | ---- | |
|
||||
| username | 账号 | |
|
||||
| password | 密码 | |
|
||||
|
|
||||
#### 返回值 |
|
||||
|
|
||||
```json |
|
||||
{ |
|
||||
"code": 0, |
|
||||
"msg": "成功", |
|
||||
"data": { |
|
||||
"token": "6235a9de7109ba50852f3f9d3b3052ae", |
|
||||
"number": "16534571868477" |
|
||||
} |
|
||||
} |
|
||||
``` |
|
||||
|
|
||||
| 参数 | 说明 | | |
|
||||
| ---- | ------ | -------------------------- | |
|
||||
| code | | 状态码 | |
|
||||
| msg | | 信息 | |
|
||||
| data | | 附加值 | |
|
||||
| | token | Token(有效时间为180分钟) | |
|
||||
| | number | 随机数 | |
|
||||
|
|
||||
1、以POST方式访问 http://xxxx/接口 |
|
||||
|
|
||||
#### Header参数 |
|
||||
|
|
||||
| 参数 | 说明 | |
|
||||
| ------------ | ------------------------------ | |
|
||||
| token | 获取到得参数 | |
|
||||
| number | 加密后得随机数(参考加密规则) | |
|
||||
| Content-Type | 内容类型 | |
|
||||
| Origin | 站点信息 | |
|
||||
| User-Agent | 用户代理 | |
|
||||
|
|
||||
#### Body参数 (接口需要得添加参数) |
|
||||
|
|
||||
```json |
|
||||
{ |
|
||||
"page":"1", |
|
||||
"pagesize":"20" |
|
||||
} |
|
||||
``` |
|
||||
|
|
||||
| 参数 | 说明 | |
|
||||
| -------- | -------------- | |
|
||||
| page | 页码 | |
|
||||
| pagesize | 每页显示多少条 | |
|
||||
|
|
||||
#### 返回值 |
|
||||
|
|
||||
```json |
|
||||
{ |
|
||||
"code": 0, |
|
||||
"msg": "成功", |
|
||||
"data": { |
|
||||
"count": 20, |
|
||||
"page": 1, |
|
||||
"pageSize": 20, |
|
||||
"total": 1147, |
|
||||
"list": [] |
|
||||
} |
|
||||
} |
|
||||
``` |
|
||||
|
|
||||
| 参数 | 说明 | | |
|
||||
| ---- | -------- | -------------- | |
|
||||
| code | | 状态码 | |
|
||||
| msg | | 信息 | |
|
||||
| data | | 附加值 | |
|
||||
| | count | 本页共多少数据 | |
|
||||
| | page | 当前页码 | |
|
||||
| | pageSize | 每页显示多少条 | |
|
||||
| | .... | .... | |
|
||||
|
|
||||
#### 认证信息 |
|
||||
|
|
||||
| 参数 | 说明 | |
|
||||
| ---------------- | ------------------------ | |
|
||||
| UserKey | SdRxjt@zhah001 | |
|
||||
| Password | Rx@Zhi$Hui%AnHuan | |
|
||||
| VerificationCode | rxjt_zhan | |
|
||||
| 访问地址 | http://120.224.6.6:39168 | |
|
||||
@ -0,0 +1,110 @@ |
|||||
|
## 加密规则 |
||||
|
|
||||
|
``` |
||||
|
1、分解步骤 |
||||
|
one = md5(CodeString)+md5(AppKey) |
||||
|
two = md5(one)+AppKey |
||||
|
therr = md5(two) |
||||
|
2、合并 |
||||
|
md5(md5(md5(CodeString)+md5(AppKey))+AppKey) |
||||
|
``` |
||||
|
|
||||
|
## 接口访问规则 |
||||
|
|
||||
|
1、以POST方式访问 http://xxxx/empower/gaintoken |
||||
|
|
||||
|
#### 参数 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"username":"luruankeji", |
||||
|
"password":"lu@ruan#ke$ji" |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
| 参数 | 说明 | |
||||
|
| -------- | ---- | |
||||
|
| username | 账号 | |
||||
|
| password | 密码 | |
||||
|
|
||||
|
#### 返回值 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"code": 0, |
||||
|
"msg": "成功", |
||||
|
"data": { |
||||
|
"token": "e869bb125d2ef2cd099f7f0bfc413eec", |
||||
|
"number": "17115918338182" |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
| 参数 | 说明 | | |
||||
|
| ---- | ------ | -------------------------- | |
||||
|
| code | | 状态码 | |
||||
|
| msg | | 信息 | |
||||
|
| data | | 附加值 | |
||||
|
| | token | Token(有效时间为180分钟) | |
||||
|
| | number | 随机数 | |
||||
|
|
||||
|
1、以POST方式访问 http://xxxx/接口 |
||||
|
|
||||
|
#### Header参数 |
||||
|
|
||||
|
| 参数 | 说明 | |
||||
|
| ------------ | ------------------------------ | |
||||
|
| token | 获取到得参数 | |
||||
|
| number | 加密后得随机数(参考加密规则) | |
||||
|
| Content-Type | 内容类型 | |
||||
|
| Origin | 站点信息 | |
||||
|
| User-Agent | 用户代理 | |
||||
|
|
||||
|
#### Body参数 (接口需要得添加参数) |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"page":"1", |
||||
|
"pagesize":"20" |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
| 参数 | 说明 | |
||||
|
| -------- | -------------- | |
||||
|
| page | 页码 | |
||||
|
| pagesize | 每页显示多少条 | |
||||
|
|
||||
|
#### 返回值 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"code": 0, |
||||
|
"msg": "成功", |
||||
|
"data": { |
||||
|
"count": 20, |
||||
|
"page": 1, |
||||
|
"pageSize": 20, |
||||
|
"total": 1147, |
||||
|
"list": [] |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
| 参数 | 说明 | | |
||||
|
| ---- | -------- | -------------- | |
||||
|
| code | | 状态码 | |
||||
|
| msg | | 信息 | |
||||
|
| data | | 附加值 | |
||||
|
| | count | 本页共多少数据 | |
||||
|
| | page | 当前页码 | |
||||
|
| | pageSize | 每页显示多少条 | |
||||
|
| | .... | .... | |
||||
|
|
||||
|
#### 认证信息 |
||||
|
|
||||
|
| 参数 | 说明 | |
||||
|
| ---------------- | ---------------------------------------------------------------------- | |
||||
|
| UserKey | luruankeji | |
||||
|
| Password | lu@ruan#ke$ji | |
||||
|
| VerificationCode | luquan_hr | |
||||
|
| 访问地址 | 外网--->http://120.224.6.6:39168<br />内网--->http://172.20.2.87:39168 | |
||||
@ -0,0 +1,110 @@ |
|||||
|
## 加密规则 |
||||
|
|
||||
|
``` |
||||
|
1、分解步骤 |
||||
|
one = md5(CodeString)+md5(AppKey) |
||||
|
two = md5(one)+AppKey |
||||
|
therr = md5(two) |
||||
|
2、合并 |
||||
|
md5(md5(md5(CodeString)+md5(AppKey))+AppKey) |
||||
|
``` |
||||
|
|
||||
|
## 接口访问规则 |
||||
|
|
||||
|
1、以POST方式访问 http://xxxx/empower/gaintoken |
||||
|
|
||||
|
#### 参数 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"username":"luruankeji", |
||||
|
"password":"lu@ruan#ke$ji" |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
| 参数 | 说明 | |
||||
|
| -------- | ---- | |
||||
|
| username | 账号 | |
||||
|
| password | 密码 | |
||||
|
|
||||
|
#### 返回值 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"code": 0, |
||||
|
"msg": "成功", |
||||
|
"data": { |
||||
|
"token": "e869bb125d2ef2cd099f7f0bfc413eec", |
||||
|
"number": "17115918338182" |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
| 参数 | 说明 | | |
||||
|
| ---- | ------ | -------------------------- | |
||||
|
| code | | 状态码 | |
||||
|
| msg | | 信息 | |
||||
|
| data | | 附加值 | |
||||
|
| | token | Token(有效时间为180分钟) | |
||||
|
| | number | 随机数 | |
||||
|
|
||||
|
1、以POST方式访问 http://xxxx/接口 |
||||
|
|
||||
|
#### Header参数 |
||||
|
|
||||
|
| 参数 | 说明 | |
||||
|
| ------------ | ------------------------------ | |
||||
|
| token | 获取到得参数 | |
||||
|
| number | 加密后得随机数(参考加密规则) | |
||||
|
| Content-Type | 内容类型 | |
||||
|
| Origin | 站点信息 | |
||||
|
| User-Agent | 用户代理 | |
||||
|
|
||||
|
#### Body参数 (接口需要得添加参数) |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"page":"1", |
||||
|
"pagesize":"20" |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
| 参数 | 说明 | |
||||
|
| -------- | -------------- | |
||||
|
| page | 页码 | |
||||
|
| pagesize | 每页显示多少条 | |
||||
|
|
||||
|
#### 返回值 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"code": 0, |
||||
|
"msg": "成功", |
||||
|
"data": { |
||||
|
"count": 20, |
||||
|
"page": 1, |
||||
|
"pageSize": 20, |
||||
|
"total": 1147, |
||||
|
"list": [] |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
| 参数 | 说明 | | |
||||
|
| ---- | -------- | -------------- | |
||||
|
| code | | 状态码 | |
||||
|
| msg | | 信息 | |
||||
|
| data | | 附加值 | |
||||
|
| | count | 本页共多少数据 | |
||||
|
| | page | 当前页码 | |
||||
|
| | pageSize | 每页显示多少条 | |
||||
|
| | .... | .... | |
||||
|
|
||||
|
#### 认证信息 |
||||
|
|
||||
|
| 参数 | 说明 | |
||||
|
| ---------------- | ---------------------------------------------------------------------- | |
||||
|
| UserKey | yikatong | |
||||
|
| Password | yi@ka#tong$app | |
||||
|
| VerificationCode | yiKaTong_hr | |
||||
|
| 访问地址 | 外网--->http://120.224.6.6:39168<br />内网--->http://172.20.2.87:39168 | |
||||
@ -0,0 +1,389 @@ |
|||||
|
package datacenter |
||||
|
|
||||
|
import ( |
||||
|
"encoding/json" |
||||
|
"errors" |
||||
|
"fmt" |
||||
|
"hr_server/overall" |
||||
|
"hr_server/overall/overallhandle" |
||||
|
"strings" |
||||
|
"time" |
||||
|
|
||||
|
"gorm.io/driver/mysql" |
||||
|
"gorm.io/driver/postgres" |
||||
|
"gorm.io/driver/sqlite" |
||||
|
"gorm.io/driver/sqlserver" |
||||
|
"gorm.io/gorm" |
||||
|
) |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-12-24 11:28:46 |
||||
|
@ 功能: 建立SqlServer |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (c *DatabaseConfig) ConnectToSqlServer() (*gorm.DB, error) { |
||||
|
// connStr := "provider=SQLOLEDB;data source=你的服务器名;initial catalog=你的数据库名;user id=你的用户名;password=你的密码;"
|
||||
|
// db, err := sql.Open("adodb", connStr)
|
||||
|
// connStr := fmt.Sprintf("server=%v;user id=<%v>;password=<%v>;port=<%v>;database=<%v>;", c.Host,
|
||||
|
// c.User, c.Password, c.Port, c.Name)
|
||||
|
// db, err := sql.Open("mssql", connStr)
|
||||
|
dsn := fmt.Sprintf("sqlserver://gorm:LoremIpsum86@%v:%v?database=%v", c.Host, c.Port, c.Name) |
||||
|
db, err := gorm.Open(sqlserver.Open(dsn), &gorm.Config{}) |
||||
|
if err != nil { |
||||
|
return nil, err |
||||
|
} |
||||
|
sqlDb, _ := db.DB() |
||||
|
sqlDb.SetMaxIdleConns(5) |
||||
|
sqlDb.SetMaxOpenConns(2) |
||||
|
sqlDb.SetConnMaxLifetime(time.Minute) |
||||
|
return db, nil |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-12-24 09:59:12 |
||||
|
@ 功能: 建立PostgreSQL |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (c *DatabaseConfig) ConnectToPostgreSQL() (*gorm.DB, error) { |
||||
|
connStr := fmt.Sprintf("user=%s password=%s dbname=%s host=%s port=%d sslmode=disable", |
||||
|
c.User, c.Password, c.Name, c.Host, c.Port) |
||||
|
// db, err := sql.Open("postgres", connStr)
|
||||
|
db, err := gorm.Open(postgres.Open(connStr), &gorm.Config{}) |
||||
|
if err != nil { |
||||
|
return nil, err |
||||
|
} |
||||
|
sqlDb, _ := db.DB() |
||||
|
sqlDb.SetMaxIdleConns(5) |
||||
|
sqlDb.SetMaxOpenConns(2) |
||||
|
sqlDb.SetConnMaxLifetime(time.Minute) |
||||
|
return db, nil |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-12-24 09:59:12 |
||||
|
@ 功能: 建立MySQL |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (c *DatabaseConfig) ConnectToMySQL() (*gorm.DB, error) { |
||||
|
connStr := fmt.Sprintf("%v:%v@tcp(%v:%v)/%v?charset=utf8mb4", c.User, c.Password, c.Host, c.Port, c.Name) |
||||
|
// db, err := sql.Open("mysql", connStr)
|
||||
|
fmt.Printf("sqlOpen: %v\n", connStr) |
||||
|
|
||||
|
sqlConfig := mysql.Config{ |
||||
|
DSN: connStr, // DSN
|
||||
|
DefaultStringSize: 255, // string 类型字段的默认长度
|
||||
|
DisableDatetimePrecision: true, // 禁用 datetime 精度,MySQL 5.6 之前的数据库不支持
|
||||
|
DontSupportRenameIndex: true, // 重命名索引时采用删除并新建的方式,MySQL 5.7 之前的数据库和 MariaDB 不支持重命名索引
|
||||
|
DontSupportRenameColumn: true, // 用 `change` 重命名列,MySQL 8 之前的数据库和 MariaDB 不支持重命名列
|
||||
|
SkipInitializeWithVersion: false, // 根据版本自动配置
|
||||
|
} |
||||
|
|
||||
|
db, err := gorm.Open(mysql.New(sqlConfig)) |
||||
|
if err != nil { |
||||
|
return nil, err |
||||
|
} |
||||
|
sqlDb, _ := db.DB() |
||||
|
sqlDb.SetMaxIdleConns(5) |
||||
|
sqlDb.SetMaxOpenConns(2) |
||||
|
sqlDb.SetConnMaxLifetime(time.Minute) |
||||
|
|
||||
|
return db, nil |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-12-24 09:59:12 |
||||
|
@ 功能: 建立SQLite |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (c *DatabaseConfig) ConnectToSQLite() (*gorm.DB, error) { |
||||
|
// db, err := sql.Open("sqlite3", c.Name)
|
||||
|
db, err := gorm.Open(sqlite.Open("gorm.db"), &gorm.Config{}) |
||||
|
if err != nil { |
||||
|
return nil, err |
||||
|
} |
||||
|
sqlDb, _ := db.DB() |
||||
|
sqlDb.SetMaxIdleConns(5) |
||||
|
sqlDb.SetMaxOpenConns(2) |
||||
|
sqlDb.SetConnMaxLifetime(time.Minute) |
||||
|
return db, nil |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-12-24 16:25:17 |
||||
|
@ 功能: Tidb |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (c *DatabaseConfig) ConnectToTiDb() (*gorm.DB, error) { |
||||
|
sql := fmt.Sprintf("%v:%v@tcp(%v:%v)/%v", c.User, c.Password, c.Host, c.Port, c.Name) |
||||
|
db, err := gorm.Open(mysql.Open(sql), &gorm.Config{}) |
||||
|
if err != nil { |
||||
|
return nil, err |
||||
|
} |
||||
|
sqlDb, _ := db.DB() |
||||
|
sqlDb.SetMaxIdleConns(5) |
||||
|
sqlDb.SetMaxOpenConns(2) |
||||
|
sqlDb.SetConnMaxLifetime(time.Minute) |
||||
|
return db, nil |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-12-24 10:04:00 |
||||
|
@ 功能: 启动数据库 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (d *DataBastType) StartDataBast() (openDb *gorm.DB, err error) { |
||||
|
var configInfo DatabaseConfig |
||||
|
|
||||
|
if d.Ip == overall.CONSTANT_CONFIG.Appsetup.DefaultIP { |
||||
|
d.Ip = "127.0.0.1" |
||||
|
} |
||||
|
// fmt.Printf("对不起!当前不支持'%v'数据库。", d.Ip, overall.CONSTANT_CONFIG.Appsetup.DefaultIP)
|
||||
|
configInfo.Name = d.DataBaseName |
||||
|
configInfo.Host = d.Ip |
||||
|
configInfo.Port = d.Port |
||||
|
configInfo.User = d.UserName |
||||
|
configInfo.Password = d.Pwd |
||||
|
switch strings.ToLower(d.Type) { |
||||
|
case "PostgreSQL", "postgresql", "postgre sql": |
||||
|
openDb, err = configInfo.ConnectToPostgreSQL() |
||||
|
case "MySQL", "mysql": |
||||
|
openDb, err = configInfo.ConnectToMySQL() |
||||
|
case "SQLite", "sqlite": |
||||
|
openDb, err = configInfo.ConnectToSQLite() |
||||
|
case "SqlServer", "sql server", "sqlserver": |
||||
|
openDb, err = configInfo.ConnectToSqlServer() |
||||
|
case "Tidb", "tidb", "TiDb", "TIDB": |
||||
|
openDb, err = configInfo.ConnectToMySQL() |
||||
|
default: |
||||
|
msg := fmt.Sprintf("对不起!当前不支持'%v'数据库。", d.DataBaseName) |
||||
|
err = errors.New(msg) |
||||
|
} |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-12-24 13:07:56 |
||||
|
@ 功能: 获取数据库中说有表 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
#获取数据库表comment |
||||
|
*/ |
||||
|
func (d *DataBastType) ObtainDataBaseAllTableMysql() (tableKeyValue []DataBaseTableInfo, err error) { |
||||
|
// tableKeyValue := overallhandle.MapOut[string]()
|
||||
|
sqlDb, err := d.StartDataBast() |
||||
|
if err != nil { |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
var valData []string |
||||
|
// // sql := fmt.Sprintf("SHOW %v", d.DataBaseName)
|
||||
|
sqlDb.Raw("SHOW TABLES").Scan(&valData) |
||||
|
// if err != nil {
|
||||
|
// return tableKeyValue, err
|
||||
|
// }
|
||||
|
// fmt.Println(rows)
|
||||
|
fmt.Printf("%T----->%v\n", valData, valData) |
||||
|
// var
|
||||
|
for _, v := range valData { |
||||
|
fmt.Printf("%T----->%v\n", v, v) |
||||
|
// sqlStr := fmt.Sprintf("SHOW `%v`", v)
|
||||
|
|
||||
|
// sql := "SELECT TABLE_NAME AS `Table`, TABLE_COMMENT AS `Table Comment` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ?"
|
||||
|
|
||||
|
// var list []Result
|
||||
|
// err = sqlDb.Raw(sqlStr).Scan(&list).Error
|
||||
|
// tableKeyValue[v] = list
|
||||
|
var tableName string |
||||
|
sql := fmt.Sprintf("SELECT TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = \"%v\" AND TABLE_NAME = \"%v\";", d.DataBaseName, v) |
||||
|
err = sqlDb.Raw(sql).Scan(&tableName).Error |
||||
|
// tableKeyValue[v] = tableInfo
|
||||
|
var tableInfo DataBaseTableInfo |
||||
|
tableInfo.TableName = tableName |
||||
|
tableInfo.TableKey = v |
||||
|
sqlStr := fmt.Sprintf("SHOW FULL COLUMNS FROM `%v`", v) |
||||
|
err = sqlDb.Raw(sqlStr).Scan(&tableInfo.Fields).Error |
||||
|
tableKeyValue = append(tableKeyValue, tableInfo) |
||||
|
} |
||||
|
// defer rows.Close()
|
||||
|
// var tableName []string
|
||||
|
// for rows.Next() {
|
||||
|
// var table string
|
||||
|
// err = rows.Scan(&table)
|
||||
|
// if err == nil {
|
||||
|
// tableName = append(tableName, table)
|
||||
|
// }
|
||||
|
// }
|
||||
|
// if len(tableName) > 0 {
|
||||
|
|
||||
|
// rows, err = sqlDb.Query("SHOW TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IS NOT NULL")
|
||||
|
// for _,v := range tableName{
|
||||
|
// sql := fmt.Sprintf("SHOW TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = %v AND TABLE_NAME = %v",d.DataBaseName,v)
|
||||
|
// rows, err = sqlDb.Query("SHOW TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA IS NOT NULL")
|
||||
|
// }
|
||||
|
// if err != nil {
|
||||
|
// return tableKeyValue, err
|
||||
|
// }
|
||||
|
// defer rows.Close()
|
||||
|
|
||||
|
// var tableComments = make(map[string]string)
|
||||
|
// for rows.Next() {
|
||||
|
// var table, comment string
|
||||
|
// if err := rows.Scan(&table, &comment); err != nil {
|
||||
|
// // log.Fatal(err)
|
||||
|
// fmt.Printf("rows----err---->:%v\n", err)
|
||||
|
// }
|
||||
|
// tableComments[table] = comment
|
||||
|
// }
|
||||
|
// fmt.Printf("rows-------->:%v\n", tableComments)
|
||||
|
// }
|
||||
|
|
||||
|
return tableKeyValue, err |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-12-30 16:49:14 |
||||
|
@ 功能: 获取数据源 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func GainDataStorce(dataId string) (openDb *gorm.DB, err error) { |
||||
|
sendUrl := fmt.Sprintf("http://120.224.6.6:29911/prod-api/database/app/datasource/page?pageNum=1&pageSize=%v&databaseName=&dataType=", 100000) |
||||
|
// fmt.Printf("1获取数据源===>%v\n", sendUrl)
|
||||
|
getData := overallhandle.CurlGet(sendUrl) |
||||
|
// fmt.Printf("2获取数据源===>%v\n", getData)
|
||||
|
var sendMap map[string]interface{} |
||||
|
json.Unmarshal(getData, &sendMap) |
||||
|
var sqlDb DataBastType |
||||
|
// fmt.Printf("3获取数据源===>%v\n", sendMap)
|
||||
|
if code, ok := sendMap["code"]; ok { |
||||
|
// fmt.Printf("4获取数据源===>%v\n", code)
|
||||
|
|
||||
|
codeInt, _ := overallhandle.StringToInt64(code) |
||||
|
if codeInt == 200 { |
||||
|
// jsonval, _ := json.Marshal(sendMap)
|
||||
|
// fmt.Printf("\n\n\n6获取数据源===>%v\n\n\n", string(jsonval))
|
||||
|
if dataval, isOk := sendMap["data"]; isOk { |
||||
|
if dataMap, ok := dataval.(map[string]interface{}); ok { |
||||
|
if records, isOk := dataMap["records"]; isOk { |
||||
|
if recordAry, isOk := records.([]interface{}); isOk { |
||||
|
for _, v := range recordAry { |
||||
|
if vMAp, ok := v.(map[string]interface{}); ok { |
||||
|
// fmt.Printf("5获取数据源===>%T\n===>%v\n\n\n", vMAp, vMAp["id"])
|
||||
|
idStr := overallhandle.TypeToInterface(vMAp["id"]) |
||||
|
if idStr == dataId { |
||||
|
typeVal, _ := overallhandle.StringToInt64(vMAp["datasourceType"]) |
||||
|
sqlDb.Type = overallhandle.DatabaseIntToString(typeVal) |
||||
|
sqlDb.Ip = overallhandle.TypeToInterface(vMAp["ipAddress"]) |
||||
|
sqlDb.DataBaseName = overallhandle.TypeToInterface(vMAp["databaseName"]) |
||||
|
sqlDb.Port, _ = overallhandle.StringToInt64(vMAp["port"]) |
||||
|
sqlDb.UserName = overallhandle.TypeToInterface(vMAp["account"]) |
||||
|
sqlDb.Pwd = overallhandle.TypeToInterface(vMAp["password"]) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
// fmt.Printf("5获取数据源===>%T\n===>%v\n\n\n", v, v)
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
// fmt.Printf("7获取数据源===>%T\n===>%v\n\n\n", sqlDb, sqlDb)
|
||||
|
openDb, err = sqlDb.StartDataBast() |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,202 @@ |
|||||
|
package datacenter |
||||
|
|
||||
|
import ( |
||||
|
"encoding/json" |
||||
|
"fmt" |
||||
|
"hr_server/overall/overallhandle" |
||||
|
"net/url" |
||||
|
"strings" |
||||
|
|
||||
|
"github.com/gin-gonic/gin" |
||||
|
) |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-18 15:37:05 |
||||
|
@ 功能: 通用地址 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (a *ApiMethod) GaindataCenter(c *gin.Context) { |
||||
|
var requestData DataInfo |
||||
|
c.ShouldBindJSON(&requestData) |
||||
|
if requestData.Url == "" { |
||||
|
overallhandle.Result(1, requestData, c, "未知访问地址") |
||||
|
return |
||||
|
} |
||||
|
// overallhandle.Result(1, requestData, c, "未知访问地址")
|
||||
|
// return
|
||||
|
if requestData.Where != "" { |
||||
|
if requestData.Method == "GET" { |
||||
|
var whereAry []string |
||||
|
whyOne := strings.Split(requestData.Where, "&") |
||||
|
if len(whyOne) > 0 { |
||||
|
for _, v := range whyOne { |
||||
|
whyTwo := strings.Split(v, "=") |
||||
|
if len(whyTwo) == 2 { |
||||
|
whereAry = append(whereAry, fmt.Sprintf("%v=%v", whyTwo[0], url.QueryEscape(whyTwo[1]))) |
||||
|
} else { |
||||
|
whereAry = append(whereAry, v) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
getUrl := requestData.Url |
||||
|
if len(whereAry) > 0 { |
||||
|
getUrl = fmt.Sprintf("%v?%v", requestData.Url, strings.Join(whereAry, "&")) |
||||
|
} |
||||
|
|
||||
|
// getUrl = url.QueryEscape(getUrl)
|
||||
|
// fmt.Printf("%T--------->%v\n", getUrl, getUrl)
|
||||
|
getData := overallhandle.CurlGet(getUrl) |
||||
|
var sendMap map[string]interface{} |
||||
|
json.Unmarshal(getData, &sendMap) |
||||
|
// fmt.Printf("%T--------->%v--------->%v\n", sendMap, sendMap, getUrl)
|
||||
|
// overallhandle.Result(0, sendMap, c)
|
||||
|
shenData := overallhandle.MapOut() |
||||
|
if code, ok := sendMap["code"]; ok { |
||||
|
|
||||
|
if codeIn, ok := code.(float64); ok { |
||||
|
if codeIn == 200 { |
||||
|
shenData["code"] = 0 |
||||
|
} else { |
||||
|
shenData["code"] = codeIn |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
if msg, ok := sendMap["msg"]; ok { |
||||
|
shenData["msg"] = msg |
||||
|
} |
||||
|
if data, ok := sendMap["data"]; ok { |
||||
|
shenData["data"] = data |
||||
|
} |
||||
|
overallhandle.ResultInterface(sendMap, c) |
||||
|
return |
||||
|
} else { |
||||
|
getData := overallhandle.CurlPostJosn(requestData.Url, []byte(requestData.Where)) |
||||
|
var sendMap map[string]interface{} |
||||
|
json.Unmarshal(getData, &sendMap) |
||||
|
overallhandle.ResultInterface(sendMap, c) |
||||
|
return |
||||
|
} |
||||
|
} else { |
||||
|
if requestData.Method == "GET" { |
||||
|
getUrl := fmt.Sprintf("%v", requestData.Url) |
||||
|
getData := overallhandle.CurlGet(getUrl) |
||||
|
var sendMap map[string]interface{} |
||||
|
json.Unmarshal(getData, &sendMap) |
||||
|
// overallhandle.Result(0, sendMap, c)
|
||||
|
shenData := overallhandle.MapOut() |
||||
|
if code, ok := sendMap["code"]; ok { |
||||
|
if codeIn, ok := code.(float64); ok { |
||||
|
if codeIn == 200 { |
||||
|
shenData["code"] = 0 |
||||
|
} else { |
||||
|
shenData["code"] = codeIn |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
if msg, ok := sendMap["msg"]; ok { |
||||
|
shenData["msg"] = msg |
||||
|
} |
||||
|
if data, ok := sendMap["data"]; ok { |
||||
|
shenData["data"] = data |
||||
|
} |
||||
|
overallhandle.ResultInterface(sendMap, c) |
||||
|
return |
||||
|
} else { |
||||
|
getData := overallhandle.CurlPostJosn(requestData.Url, []byte("")) |
||||
|
var sendMap map[string]interface{} |
||||
|
json.Unmarshal(getData, &sendMap) |
||||
|
shenData := overallhandle.MapOut() |
||||
|
if code, ok := sendMap["code"]; ok { |
||||
|
if codeIn, ok := code.(float64); ok { |
||||
|
if codeIn == 200 { |
||||
|
shenData["code"] = 0 |
||||
|
} else { |
||||
|
shenData["code"] = codeIn |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
if msg, ok := sendMap["msg"]; ok { |
||||
|
shenData["msg"] = msg |
||||
|
} |
||||
|
overallhandle.ResultInterface(sendMap, c) |
||||
|
return |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-19 14:05:46 |
||||
|
@ 功能: 数据中台POST提交数据 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (a *ApiMethod) PostSaveData(c *gin.Context) { |
||||
|
var requestData DataInfoPost |
||||
|
c.ShouldBindJSON(&requestData) |
||||
|
if requestData.Url == "" { |
||||
|
overallhandle.Result(1, requestData, c, "未知访问地址") |
||||
|
return |
||||
|
} |
||||
|
dataJson, err := json.Marshal(requestData.DataInfo) |
||||
|
shenData := overallhandle.MapOut() |
||||
|
if err != nil { |
||||
|
shenData["code"] = 10001 |
||||
|
shenData["msg"] = err |
||||
|
overallhandle.ResultInterface(shenData, c) |
||||
|
return |
||||
|
} |
||||
|
callBackBtye := overallhandle.CurlPostJosn(requestData.Url, dataJson) |
||||
|
var sendMap map[string]interface{} |
||||
|
err = json.Unmarshal(callBackBtye, &sendMap) |
||||
|
if err != nil { |
||||
|
shenData["code"] = 10001 |
||||
|
shenData["msg"] = err |
||||
|
overallhandle.ResultInterface(shenData, c) |
||||
|
return |
||||
|
} |
||||
|
if code, ok := sendMap["code"]; ok { |
||||
|
|
||||
|
if codeIn, ok := code.(float64); ok { |
||||
|
if codeIn == 200 { |
||||
|
shenData["code"] = 0 |
||||
|
} else { |
||||
|
shenData["code"] = codeIn |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
if msg, ok := sendMap["msg"]; ok { |
||||
|
shenData["msg"] = msg |
||||
|
} |
||||
|
if data, ok := sendMap["data"]; ok { |
||||
|
shenData["data"] = data |
||||
|
} |
||||
|
overallhandle.ResultInterface(shenData, c) |
||||
|
} |
||||
@ -0,0 +1,58 @@ |
|||||
|
package datacenter |
||||
|
|
||||
|
import ( |
||||
|
"fmt" |
||||
|
"hr_server/overall/overallhandle" |
||||
|
|
||||
|
"github.com/gin-gonic/gin" |
||||
|
) |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-12-24 11:43:02 |
||||
|
@ 功能: 获取数据表 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (a *ApiMethod) GainDataTable(c *gin.Context) { |
||||
|
var requestData DataBastType |
||||
|
err := c.ShouldBindJSON(&requestData) |
||||
|
if err != nil { |
||||
|
overallhandle.Result(100, err, c) |
||||
|
return |
||||
|
} |
||||
|
if requestData.Type == "" { |
||||
|
overallhandle.Result(1, err, c, "未知数据库类型!请先确实是什么数据库类型!") |
||||
|
return |
||||
|
} |
||||
|
if requestData.DataBaseName == "" { |
||||
|
overallhandle.Result(1, err, c, "请输入数据库名称!") |
||||
|
return |
||||
|
} |
||||
|
if requestData.Ip == "" { |
||||
|
overallhandle.Result(1, err, c, "请输入数据库地址!") |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
if requestData.UserName == "" { |
||||
|
overallhandle.Result(1, err, c, "请输入用户名!") |
||||
|
return |
||||
|
} |
||||
|
if requestData.Pwd == "" { |
||||
|
overallhandle.Result(1, err, c, "请输入密码!") |
||||
|
return |
||||
|
} |
||||
|
tableInfo, err := requestData.ObtainDataBaseAllTableMysql() |
||||
|
fmt.Printf("tableInfo:%v\n", tableInfo) |
||||
|
overallhandle.Result(0, tableInfo, c) |
||||
|
} |
||||
@ -0,0 +1,90 @@ |
|||||
|
package datacenter |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/overall/overallhandle" |
||||
|
"sync" |
||||
|
|
||||
|
"github.com/gin-gonic/gin" |
||||
|
) |
||||
|
|
||||
|
// 协程设置
|
||||
|
var syncSeting = sync.WaitGroup{} |
||||
|
|
||||
|
type ApiMethod struct{} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-04-18 15:28:20 |
||||
|
@ 功能: 数据中台入口 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (a *ApiMethod) Index(c *gin.Context) { |
||||
|
outputCont := overallhandle.MapOut() |
||||
|
outputCont["index"] = "数据中台入口" |
||||
|
overallhandle.Result(0, outputCont, c) |
||||
|
} |
||||
|
|
||||
|
// 接收参数
|
||||
|
type DataInfo struct { |
||||
|
Url string `json:"url"` |
||||
|
Method string `json:"methodType"` |
||||
|
Where string `json:"where"` |
||||
|
} |
||||
|
|
||||
|
// 接收POST请求
|
||||
|
type DataInfoPost struct { |
||||
|
Url string `json:"url"` |
||||
|
DataInfo interface{} `json:"dataInfo"` |
||||
|
} |
||||
|
|
||||
|
// 数据库链接参数
|
||||
|
type DataBastType struct { |
||||
|
Type string `json:"type"` //数据库类型
|
||||
|
DataBaseName string `json:"dataBaseName"` //数据库名称
|
||||
|
Ip string `json:"ip"` //数据库地址
|
||||
|
Port int64 `json:"port"` //数据库端口
|
||||
|
UserName string `json:"userName"` //数据库帐号
|
||||
|
Pwd string `json:"password"` //数据库密码
|
||||
|
} |
||||
|
type DatabaseConfig struct { |
||||
|
Name string |
||||
|
Host string |
||||
|
Port int64 |
||||
|
User string |
||||
|
Password string |
||||
|
} |
||||
|
|
||||
|
// 数据库表结构
|
||||
|
type Result struct { |
||||
|
Field string `json:"fieldes"` |
||||
|
Type string `json:"types"` |
||||
|
Attribute string `json:"attribute"` |
||||
|
Collation string `json:"collation"` |
||||
|
Null string `json:"nullVal"` |
||||
|
Key string `json:"key"` |
||||
|
Default string `json:"defaultVal"` |
||||
|
Extra string `json:"extra"` |
||||
|
Privileges string `json:"privileges"` |
||||
|
Comment string `json:"comment"` |
||||
|
Pattern string `json:"pattern"` |
||||
|
Classify string `json:"classify"` |
||||
|
Auxiliary string `json:"auxiliary"` |
||||
|
} |
||||
|
|
||||
|
// 输出数据表数据
|
||||
|
type DataBaseTableInfo struct { |
||||
|
TableName string `json:"tableName"` //数据表名称
|
||||
|
TableKey string `json:"tableKey"` //数据表标识
|
||||
|
Fields []Result `json:"fields"` //表字段
|
||||
|
} |
||||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,275 @@ |
|||||
|
package personnelapi |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/models" |
||||
|
"hr_server/models/hrmodels" |
||||
|
"hr_server/overall" |
||||
|
"hr_server/overall/overallhandle" |
||||
|
"sort" |
||||
|
"strconv" |
||||
|
|
||||
|
"github.com/gin-gonic/gin" |
||||
|
) |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-05-24 13:55:03 |
||||
|
@ 功能: 根据行政组织ID获取当前行政组织人员及子行政组织 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (s *StaffApi) GainSunOrgAndUser(c *gin.Context) { |
||||
|
var requestData overallhandle.ConstId |
||||
|
err := c.ShouldBindJSON(&requestData) |
||||
|
if err != nil { |
||||
|
requestData.Id = "309" |
||||
|
} |
||||
|
if requestData.Id == "" { |
||||
|
requestData.Id = "309" |
||||
|
} |
||||
|
var sendInfo OrgGainPeopel |
||||
|
orgIdInt, _ := strconv.ParseInt(requestData.Id, 10, 64) |
||||
|
synPro.Add(1) |
||||
|
go sendInfo.GainAllFatherOrg(orgIdInt) |
||||
|
synPro.Add(1) |
||||
|
go sendInfo.GainOrgPeopel(orgIdInt) |
||||
|
synPro.Add(1) |
||||
|
go sendInfo.GainOrgSunOrgList(orgIdInt) |
||||
|
synPro.Wait() |
||||
|
var sendData SendOrgGainPeopel |
||||
|
sendData.OrgList = sendInfo.OrgList |
||||
|
sendData.OrgUserList = append(sendData.OrgUserList, sendInfo.SunOrgList...) |
||||
|
sendData.OrgUserList = append(sendData.OrgUserList, sendInfo.UserList...) |
||||
|
overallhandle.Result(0, sendData, c) |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-05-24 14:33:28 |
||||
|
@ 功能: 获取当前行政组织直接子级行政组织 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (o *OrgGainPeopel) GainOrgSunOrgList(orgId int64) { |
||||
|
defer synPro.Done() |
||||
|
var orgList []models.AdministrativeOrganization |
||||
|
overall.CONSTANT_DB_HR.Model(&models.AdministrativeOrganization{}).Select("`id`,`name`").Where("`state` = 1 AND `superior` = ?", orgId).Find(&orgList) |
||||
|
if len(orgList) > 0 { |
||||
|
for _, v := range orgList { |
||||
|
var user UserOrgRole |
||||
|
user.Id = strconv.FormatInt(v.Id, 10) |
||||
|
user.Title = v.Name |
||||
|
user.Img = "" |
||||
|
user.IsPick = 2 |
||||
|
user.Types = 2 |
||||
|
o.SunOrgList = append(o.SunOrgList, user) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-05-24 14:23:46 |
||||
|
@ 功能: 获取当前行政组织下得人员信息 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (o *OrgGainPeopel) GainOrgPeopel(orgId int64) { |
||||
|
defer synPro.Done() |
||||
|
var prople []models.PersonArchives |
||||
|
err := overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Select("`key`,`number`,`name`,`icon`,`admin_org`,`icon_photo`").Where("`admin_org` = ? AND `emp_type` BETWEEN ? AND ? ", orgId, 1, 10).Find(&prople).Error |
||||
|
if err == nil && len(prople) > 0 { |
||||
|
for _, v := range prople { |
||||
|
var user UserOrgRole |
||||
|
user.Id = strconv.FormatInt(v.Key, 10) |
||||
|
user.Title = v.Name |
||||
|
user.Img = v.Icon |
||||
|
if v.IconPhoto != "" { |
||||
|
user.Img = v.IconPhoto |
||||
|
} |
||||
|
user.IsPick = 2 |
||||
|
user.Types = 1 |
||||
|
o.UserList = append(o.UserList, user) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-05-24 14:04:20 |
||||
|
@ 功能: 获取所有父级行政组织 |
||||
|
@ 参数 |
||||
|
|
||||
|
#orgId 行政组织ID |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (o *OrgGainPeopel) GainAllFatherOrg(orgId int64) { |
||||
|
defer synPro.Done() |
||||
|
var sunAry overallhandle.AllSunList[int64] |
||||
|
sunAry.GetAllParentOrg(orgId, 2) |
||||
|
sunAry.SunList = append(sunAry.SunList, orgId) |
||||
|
if len(sunAry.SunList) > 0 { |
||||
|
var orgList []hrmodels.OrgCont |
||||
|
err := overall.CONSTANT_DB_HR.Model(&hrmodels.OrgCont{}).Select("`id`,`name`,`level`").Where("`id` IN ?", sunAry.SunList).Find(&orgList).Error |
||||
|
if err == nil { |
||||
|
sort.Slice(orgList, func(i, j int) bool { |
||||
|
return orgList[i].Level < orgList[j].Level |
||||
|
}) |
||||
|
for _, v := range orgList { |
||||
|
var orgInfo OrgCrumb |
||||
|
orgInfo.Id = strconv.FormatInt(v.Id, 10) |
||||
|
orgInfo.Title = v.Name |
||||
|
o.OrgList = append(o.OrgList, orgInfo) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-05-27 08:33:09 |
||||
|
@ 功能: 搜索行政组织及人员 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (s *StaffApi) SearchOrgUser(c *gin.Context) { |
||||
|
var requestData overallhandle.NameOverall |
||||
|
err := c.ShouldBindJSON(&requestData) |
||||
|
var sendData SendOrgGainPeopel |
||||
|
if err != nil { |
||||
|
overallhandle.Result(0, sendData, c) |
||||
|
return |
||||
|
} |
||||
|
if requestData.Name == "" { |
||||
|
overallhandle.Result(0, sendData, c) |
||||
|
return |
||||
|
} |
||||
|
var sendInfo OrgGainPeopel |
||||
|
synPro.Add(1) |
||||
|
go sendInfo.SearchOrgCont(requestData.Name) |
||||
|
synPro.Add(1) |
||||
|
go sendInfo.SearchPeopleCont(requestData.Name) |
||||
|
synPro.Wait() |
||||
|
sendData.OrgUserList = append(sendData.OrgUserList, sendInfo.SunOrgList...) |
||||
|
sendData.OrgUserList = append(sendData.OrgUserList, sendInfo.UserList...) |
||||
|
overallhandle.Result(0, sendData, c) |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-05-27 08:51:49 |
||||
|
@ 功能: 搜索人员 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (o *OrgGainPeopel) SearchPeopleCont(name string) { |
||||
|
defer synPro.Done() |
||||
|
var prople []models.PersonArchives |
||||
|
err := overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Select("`key`,`number`,`name`,`icon`,`admin_org`,`icon_photo`").Where("(`name` Like ? OR `number` Like ?) AND `emp_type` BETWEEN ? AND ? ", "%"+name+"%", "%"+name+"%", 1, 10).Find(&prople).Error |
||||
|
if err == nil && len(prople) > 0 { |
||||
|
for _, v := range prople { |
||||
|
var user UserOrgRole |
||||
|
user.Id = strconv.FormatInt(v.Key, 10) |
||||
|
user.Title = v.Name |
||||
|
user.Img = v.Icon |
||||
|
if v.IconPhoto != "" { |
||||
|
user.Img = v.IconPhoto |
||||
|
} |
||||
|
user.IsPick = 2 |
||||
|
user.Types = 1 |
||||
|
o.UserList = append(o.UserList, user) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-05-27 08:40:51 |
||||
|
@ 功能: 搜索行政组织名称 |
||||
|
@ 参数 |
||||
|
|
||||
|
#name 行政组织名称 |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (o *OrgGainPeopel) SearchOrgCont(name string) { |
||||
|
defer synPro.Done() |
||||
|
var orgList []hrmodels.OrgCont |
||||
|
overall.CONSTANT_DB_HR.Model(&hrmodels.OrgCont{}).Select("`id`,`name`").Where("`state` = 1 AND level > 3 AND `name` LIKE ?", "%"+name+"%").Find(&orgList) |
||||
|
if len(orgList) > 0 { |
||||
|
for _, v := range orgList { |
||||
|
var user UserOrgRole |
||||
|
user.Id = strconv.FormatInt(v.Id, 10) |
||||
|
user.Title = v.Name |
||||
|
user.Img = "" |
||||
|
user.IsPick = 2 |
||||
|
user.Types = 2 |
||||
|
o.SunOrgList = append(o.SunOrgList, user) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,279 @@ |
|||||
|
package personnelapi |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/models" |
||||
|
"hr_server/overall" |
||||
|
"hr_server/overall/overallhandle" |
||||
|
"time" |
||||
|
|
||||
|
"github.com/gin-gonic/gin" |
||||
|
) |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-07-04 08:43:33 |
||||
|
@ 功能: 奖惩记录 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (s *StaffApi) RewPunList(c *gin.Context) { |
||||
|
var requestData RewPunType |
||||
|
c.ShouldBindJSON(&requestData) |
||||
|
// err := c.ShouldBindJSON(&requestData)
|
||||
|
// if err != nil {
|
||||
|
// overallhandle.Result(100, requestData.Id, c)
|
||||
|
// return
|
||||
|
// }
|
||||
|
if requestData.Id == "" { |
||||
|
overallhandle.Result(101, requestData.Id, c) |
||||
|
return |
||||
|
} |
||||
|
if requestData.Page < 0 { |
||||
|
requestData.Page = 1 |
||||
|
} |
||||
|
if requestData.PageSize < 0 { |
||||
|
requestData.PageSize = 10 |
||||
|
} |
||||
|
var list []SendRewPunInfo |
||||
|
gormDb := overall.CONSTANT_DB_HR.Model(&models.RewardsPenalties{}).Where("`state` = 1 AND `userkey` = ?", requestData.Id) |
||||
|
if requestData.State != 0 { |
||||
|
if requestData.State == 1 { |
||||
|
gormDb = gormDb.Where("`types` = ?", 1) |
||||
|
} else { |
||||
|
gormDb = gormDb.Where("`types` = ?", 2) |
||||
|
} |
||||
|
} |
||||
|
var total int64 |
||||
|
totalErr := gormDb.Count(&total).Error |
||||
|
if totalErr != nil { |
||||
|
total = 0 |
||||
|
} |
||||
|
gormDb = overallhandle.PageTurningSettings(gormDb, requestData.Page, requestData.PageSize) |
||||
|
err := gormDb.Order("`years` DESC").Order("`months` ASC").Order("`id` DESC").Find(&list).Error |
||||
|
if err != nil { |
||||
|
overallhandle.Result(107, requestData.Id, c) |
||||
|
return |
||||
|
} |
||||
|
for i, v := range list { |
||||
|
list[i].TimedataStr = overallhandle.UnixTimeToDay(v.TimeData, 14) |
||||
|
list[i].LevelName = overallhandle.RewPunLevel(v.Level) |
||||
|
list[i].RewPunClassName = overallhandle.RewPunLevelClass(v.RewPunClass) |
||||
|
} |
||||
|
overallhandle.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(list)), list, c) |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-07-04 09:24:59 |
||||
|
@ 功能: 绩效考核成绩 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (s *StaffApi) AssessmentRecords(c *gin.Context) { |
||||
|
var requestData RewPunType |
||||
|
c.ShouldBindJSON(&requestData) |
||||
|
if requestData.Id == "" { |
||||
|
overallhandle.Result(101, requestData.Id, c) |
||||
|
return |
||||
|
} |
||||
|
if requestData.Page < 0 { |
||||
|
requestData.Page = 1 |
||||
|
} |
||||
|
if requestData.PageSize < 0 { |
||||
|
requestData.PageSize = 10 |
||||
|
} |
||||
|
var list []SendMeritslog |
||||
|
gormDb := overall.CONSTANT_DB_HR.Model(&models.Meritslog{}).Where("`userkey` = ?", requestData.Id) |
||||
|
if requestData.State != 0 { |
||||
|
if requestData.State == 1 { |
||||
|
gormDb = gormDb.Where("`status` = ?", 1) |
||||
|
} else { |
||||
|
gormDb = gormDb.Where("`status` = ?", 2) |
||||
|
} |
||||
|
} |
||||
|
var total int64 |
||||
|
totalErr := gormDb.Count(&total).Error |
||||
|
if totalErr != nil { |
||||
|
total = 0 |
||||
|
} |
||||
|
gormDb = overallhandle.PageTurningSettings(gormDb, requestData.Page, requestData.PageSize) |
||||
|
err := gormDb.Order("`years` DESC").Order("`months` ASC").Order("`id` DESC").Find(&list).Error |
||||
|
if err != nil { |
||||
|
overallhandle.Result(107, requestData.Id, c) |
||||
|
return |
||||
|
} |
||||
|
for i, v := range list { |
||||
|
list[i].TimedataStr = overallhandle.UnixTimeToDay(v.TimeData, 14) |
||||
|
} |
||||
|
overallhandle.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(list)), list, c) |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-07-04 13:18:47 |
||||
|
@ 功能: 员工关系 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (s *StaffApi) PeopleEmploymentRelationship(c *gin.Context) { |
||||
|
var requestData overallhandle.ConstId |
||||
|
err := c.ShouldBindJSON(&requestData) |
||||
|
if err != nil { |
||||
|
overallhandle.Result(100, err, c) |
||||
|
return |
||||
|
} |
||||
|
if requestData.Id == "" { |
||||
|
overallhandle.Result(101, err, c) |
||||
|
return |
||||
|
} |
||||
|
var myInfo models.PersonnelContent |
||||
|
err = myInfo.GetCont(map[string]interface{}{"`key`": requestData.Id}, "`channel`", "`entrydate`", "`jobstartdate`") |
||||
|
if err != nil { |
||||
|
overallhandle.Result(107, err, c) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
var sendInfo SendSheHuiGuanxi |
||||
|
sendInfo.Channel = overallhandle.JoinJobChanelStr(myInfo.Channel) |
||||
|
sendInfo.Jobstartdate = overallhandle.UnixTimeToDay(myInfo.Jobstartdate, 14) |
||||
|
sendInfo.Entrydate = overallhandle.UnixTimeToDay(myInfo.Entrydate, 14) |
||||
|
|
||||
|
cruTime := time.Now().Unix() |
||||
|
sendInfo.SheHuiGongli, _ = overallhandle.CalculateYearDifference(myInfo.Jobstartdate, cruTime, 0) |
||||
|
sendInfo.JiTuanGongli, _ = overallhandle.CalculateYearDifference(myInfo.Entrydate, cruTime, 0) |
||||
|
overallhandle.Result(0, sendInfo, c) |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-07-04 15:20:34 |
||||
|
@ 功能: 职称列表 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (s *StaffApi) PeopleTitle(c *gin.Context) { |
||||
|
var requestData overallhandle.ConstId |
||||
|
err := c.ShouldBindJSON(&requestData) |
||||
|
if err != nil { |
||||
|
overallhandle.Result(100, err, c) |
||||
|
return |
||||
|
} |
||||
|
if requestData.Id == "" { |
||||
|
overallhandle.Result(101, err, c) |
||||
|
return |
||||
|
} |
||||
|
var list []SendAcademicTitle |
||||
|
err = overall.CONSTANT_DB_HR.Model(&models.AcademicTitle{}).Where("`userKey` = ?", requestData.Id).Order("`time` DESC").Order("`id` DESC").Find(&list).Error |
||||
|
if err != nil { |
||||
|
overallhandle.Result(107, err, c) |
||||
|
return |
||||
|
} |
||||
|
for i, v := range list { |
||||
|
list[i].TimeStr = overallhandle.UnixTimeToDay(v.Time, 14) |
||||
|
} |
||||
|
overallhandle.Result(0, list, c) |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-07-04 15:27:05 |
||||
|
@ 功能: 荣誉 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (s *StaffApi) PeopleHonor(c *gin.Context) { |
||||
|
var requestData HonorsType |
||||
|
c.ShouldBindJSON(&requestData) |
||||
|
if requestData.Id == "" { |
||||
|
overallhandle.Result(101, requestData.Id, c) |
||||
|
return |
||||
|
} |
||||
|
if requestData.Page < 0 { |
||||
|
requestData.Page = 1 |
||||
|
} |
||||
|
if requestData.PageSize < 0 { |
||||
|
requestData.PageSize = 10 |
||||
|
} |
||||
|
var list []SendCertificateHonors |
||||
|
gormDb := overall.CONSTANT_DB_HR.Model(&models.CertificateHonors{}).Where("`userkey` = ?", requestData.Id) |
||||
|
if requestData.State != 0 { |
||||
|
if requestData.State == 1 { |
||||
|
gormDb = gormDb.Where("`state` = ?", 1) |
||||
|
} else { |
||||
|
gormDb = gormDb.Where("`state` = ?", 2) |
||||
|
} |
||||
|
} |
||||
|
if requestData.Types != 0 { |
||||
|
gormDb = gormDb.Where("`types` = ?", requestData.Types) |
||||
|
} |
||||
|
var total int64 |
||||
|
totalErr := gormDb.Count(&total).Error |
||||
|
if totalErr != nil { |
||||
|
total = 0 |
||||
|
} |
||||
|
gormDb = overallhandle.PageTurningSettings(gormDb, requestData.Page, requestData.PageSize) |
||||
|
err := gormDb.Order("`years` DESC").Order("`months` ASC").Order("`id` DESC").Find(&list).Error |
||||
|
if err != nil { |
||||
|
overallhandle.Result(107, requestData.Id, c) |
||||
|
return |
||||
|
} |
||||
|
for i, v := range list { |
||||
|
if v.TimeData != 0 { |
||||
|
list[i].TimeDataStr = overallhandle.UnixTimeToDay(v.TimeData, 14) |
||||
|
} |
||||
|
if v.EndTime != 0 { |
||||
|
list[i].EndTimeStr = overallhandle.UnixTimeToDay(v.EndTime, 14) |
||||
|
} |
||||
|
} |
||||
|
overallhandle.ResultList(0, requestData.Page, requestData.PageSize, total, int64(len(list)), list, c) |
||||
|
} |
||||
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
@ -0,0 +1,365 @@ |
|||||
|
package workWechat |
||||
|
|
||||
|
import ( |
||||
|
"encoding/json" |
||||
|
"errors" |
||||
|
"fmt" |
||||
|
"hr_server/models" |
||||
|
"hr_server/overall" |
||||
|
"hr_server/overall/overallhandle" |
||||
|
"time" |
||||
|
) |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-07-02 11:23:32 |
||||
|
@ 功能: 获取统一企业微信Token |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func GainWechatTokenUnify() string { |
||||
|
md5Token := "WorkWechatUpdatePeopleInfo" |
||||
|
token, err := GainWechatToken("txl", md5Token, 1) |
||||
|
fmt.Printf("token-2-2->%v->%v\n", err, token) |
||||
|
if err != nil { |
||||
|
GainWechatTokenUnify() |
||||
|
} |
||||
|
return token |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-07-02 11:09:57 |
||||
|
@ 功能: 获取行政组织列表 |
||||
|
@ 参数 |
||||
|
|
||||
|
#orgId 行政组织Id |
||||
|
#token 企业 |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
#departmentAry 部门列表 |
||||
|
#newToekn 新token |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (w *WechatOrg) GainWechatOrgList() { |
||||
|
|
||||
|
sendWechatUrl := fmt.Sprintf("https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token=%v&id=%v", w.Token, w.OrgId) |
||||
|
if w.OrgId == 0 { |
||||
|
sendWechatUrl = fmt.Sprintf("https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token=%v", w.Token) |
||||
|
} |
||||
|
//获取企业微信取部门列表
|
||||
|
wechatCallBack := overallhandle.CurlGet(sendWechatUrl) |
||||
|
var deparmentsList WechatCallBackDepartment |
||||
|
err := json.Unmarshal(wechatCallBack, &deparmentsList) |
||||
|
if err != nil { |
||||
|
return |
||||
|
} |
||||
|
fmt.Printf("企业微信返回值:%v\n", string(wechatCallBack)) |
||||
|
if deparmentsList.Errcode != 0 { |
||||
|
// w.Token = GainWechatTokenUnify()
|
||||
|
// w.NewToekn = true
|
||||
|
// w.GainWechatOrgList()
|
||||
|
return |
||||
|
} |
||||
|
w.OrgList = deparmentsList.Department |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-07-02 13:10:15 |
||||
|
@ 功能: 处理人员信息 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (w *WechatOrg) GainOrgPeopleList() { |
||||
|
if len(w.OrgList) <= 0 { |
||||
|
overallhandle.WriteLog("e", "没有相应的行政组织!", w.OrgList) |
||||
|
return |
||||
|
} |
||||
|
var orgPeople WechatOrgPeole |
||||
|
orgPeople.Token = w.Token |
||||
|
for _, v := range w.OrgList { |
||||
|
synPro.Add(1) |
||||
|
go orgPeople.GainOrgPeopleList(v) |
||||
|
} |
||||
|
synPro.Wait() |
||||
|
if orgPeople.NewToekn { |
||||
|
w.Token = orgPeople.Token |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-07-02 13:17:41 |
||||
|
@ 功能: 获取企业微信行政组织下的人员信息 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (w *WechatOrgPeole) GainOrgPeopleList(org WechatDepartmentInfo) { |
||||
|
defer synPro.Done() |
||||
|
w.WechatOrgHandPeople(int64(org.Id)) |
||||
|
jsonStr, _ := json.Marshal(w.UserList) |
||||
|
fmt.Printf("人员1信息========》%v:%v\n", org.Id, string(jsonStr)) |
||||
|
if len(w.UserList) <= 0 { |
||||
|
overallhandle.WriteLog("e", "没有行111111人员!", w.UserList) |
||||
|
return |
||||
|
} |
||||
|
var peopleAry []interface{} |
||||
|
for _, v := range w.UserList { |
||||
|
// isWriteNum := true
|
||||
|
gonghao := "" |
||||
|
dangAn := "" |
||||
|
if len(v.Extattr.Attrs) > 0 { |
||||
|
for _, a := range v.Extattr.Attrs { |
||||
|
if a.Name == "工号" { |
||||
|
if a.Value == "" { |
||||
|
gonghao = a.Text.Value |
||||
|
} else { |
||||
|
gonghao = a.Value |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
if a.Web.Url != "" { |
||||
|
dangAn = a.Web.Url |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
attJson, _ := json.Marshal(v.Extattr.Attrs) |
||||
|
fmt.Printf("人员信息%v:%v---->%v---->%v---->%v\n", org.Id, v.Userid, gonghao, dangAn, string(attJson)) |
||||
|
//获取HR数据库中的员工信息
|
||||
|
var userCont models.PersonArchives |
||||
|
if gonghao != "" { |
||||
|
overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Select("`id`,`number`,`work_wechat`,`wechat`").Where("`number` = ?", gonghao).First(&userCont) |
||||
|
// isWriteNum = false
|
||||
|
} else { |
||||
|
if v.Userid != "" { |
||||
|
overall.CONSTANT_DB_HR.Model(&models.PersonArchives{}).Select("`id`,`number`,`work_wechat`,`wechat`").Where("`work_wechat` = ? OR `wechat` = ?", v.Userid, v.Userid).First(&userCont) |
||||
|
} |
||||
|
// isWriteNum = true
|
||||
|
} |
||||
|
if userCont.Id != 0 { |
||||
|
// fmt.Printf("@人员信息%v:%v---->%v---->%v\n", org.Id, v.Userid, gonghao, userCont)
|
||||
|
updateWechatUserCont := overallhandle.MapOut() |
||||
|
updateWechatUserCont["userid"] = v.Userid |
||||
|
//判断是否要更新当前人员信息
|
||||
|
|
||||
|
var attrsAry []interface{} //企业微信个人属性
|
||||
|
// for _, ev := range v.Extattr.Attrs {
|
||||
|
// if ev.Name == "档案" {
|
||||
|
dangAnUrl := fmt.Sprintf("http://hr.hxgk.group/#/?usernum=%v", userCont.Number) |
||||
|
var dangAnInfi UpdateMyWechatURL |
||||
|
dangAnInfi.Name = "档案" |
||||
|
dangAnInfi.Type = 1 |
||||
|
dangAnInfi.Web.Title = "详细信息" |
||||
|
dangAnInfi.Web.Url = dangAnUrl |
||||
|
attrsAry = append(attrsAry, dangAnInfi) |
||||
|
// }
|
||||
|
// if ev.Name == "工号" {
|
||||
|
var gonhaoInFo UpdateMyWechatText |
||||
|
gonhaoInFo.Name = "工号" |
||||
|
gonhaoInFo.Type = 0 |
||||
|
gonhaoInFo.Value = userCont.Number |
||||
|
gonhaoInFo.Text.Value = userCont.Number |
||||
|
attrsAry = append(attrsAry, gonhaoInFo) |
||||
|
// }
|
||||
|
// }
|
||||
|
// fmt.Printf("更新完毕!人员信息%v:%v---->%v---->%v\n", org.Id, v.Userid, gonghao, attrsAry)
|
||||
|
if len(attrsAry) > 0 { |
||||
|
extattr := overallhandle.MapOut() |
||||
|
extattr["attrs"] = attrsAry |
||||
|
updateWechatUserCont["extattr"] = extattr |
||||
|
peopleAry = append(peopleAry, updateWechatUserCont) |
||||
|
} |
||||
|
if dangAn == "" { |
||||
|
w.SendUserInfoToWorkWechat(updateWechatUserCont) |
||||
|
} else { |
||||
|
overallhandle.WriteLog("t", "企业微信人员已有档案信息,无需重新生成!", v.Extattr.Attrs) |
||||
|
} |
||||
|
|
||||
|
userSaveInfo := make(map[string]interface{}) |
||||
|
if userCont.Number == "" && gonghao != "" { |
||||
|
userSaveInfo["number"] = gonghao |
||||
|
} |
||||
|
if userCont.WorkWechat == "" && v.Userid != "" { |
||||
|
userSaveInfo["work_wechat"] = v.Userid |
||||
|
} |
||||
|
if userCont.Wechat == "" && v.Userid != "" { |
||||
|
userSaveInfo["wechat"] = v.Userid |
||||
|
} |
||||
|
if len(userSaveInfo) > 0 { |
||||
|
userSaveInfo["eite_time"] = time.Now().Unix() |
||||
|
var userNumInfo models.PersonArchives |
||||
|
userNumInfo.EiteCont(map[string]interface{}{"`id`": userCont.Id}, userSaveInfo) |
||||
|
} |
||||
|
} else { |
||||
|
usWechatJson, _ := json.Marshal(v) |
||||
|
overallhandle.WriteLog("e", "没有行人员!", string(usWechatJson)) |
||||
|
} |
||||
|
} |
||||
|
peopleJson, _ := json.Marshal(peopleAry) |
||||
|
fmt.Printf("更新完毕!人员信息%v---->%v\n", org, string(peopleJson)) |
||||
|
overallhandle.WriteLog("e", "更新完毕!END", org, string(peopleJson)) |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-07-02 15:33:28 |
||||
|
@ 功能: 发送信息修改通知 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (w *WechatOrgPeole) SendUserInfoToWorkWechat(userInfo map[string]interface{}) { |
||||
|
if _, ok := userInfo["userid"]; !ok { |
||||
|
err := errors.New("关键信息不全userid") |
||||
|
overallhandle.WriteLog("e", "1、更新企业微信人员信息", err, userInfo) |
||||
|
return |
||||
|
} |
||||
|
userJson, err := json.Marshal(userInfo) |
||||
|
if err != nil { |
||||
|
overallhandle.WriteLog("e", "1、更新企业微信人员信息", err, userJson) |
||||
|
return |
||||
|
} |
||||
|
overallhandle.WriteLog("i", "向企业微信发送人员信息", string(userJson)) |
||||
|
sendWechatUrl := fmt.Sprintf("https://qyapi.weixin.qq.com/cgi-bin/user/update?access_token=%v", w.Token) |
||||
|
wechatCallBack := overallhandle.CurlPostJosn(sendWechatUrl, userJson) |
||||
|
var orgPeopleList RevokeMsgSendCallBack |
||||
|
err = json.Unmarshal(wechatCallBack, &orgPeopleList) |
||||
|
if err != nil { |
||||
|
overallhandle.WriteLog("e", "2、更新企业微信人员信息出错,从新发起请求。", err, string(wechatCallBack)) |
||||
|
w.Token = GainWechatTokenUnify() |
||||
|
w.NewToekn = true |
||||
|
w.SendUserInfoToWorkWechat(userInfo) |
||||
|
return |
||||
|
} |
||||
|
if orgPeopleList.Errcode != 0 { |
||||
|
err = errors.New(orgPeopleList.Errmsg) |
||||
|
overallhandle.WriteLog("e", "3、更新企业微信人员信息发生错误!重新提交此数据!", orgPeopleList.Errcode, orgPeopleList.Errmsg) |
||||
|
w.Token = GainWechatTokenUnify() |
||||
|
w.NewToekn = true |
||||
|
w.SendUserInfoToWorkWechat(userInfo) |
||||
|
return |
||||
|
} |
||||
|
overallhandle.WriteLog("write", "更新企业微信人员信息完成!", userInfo) |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-07-02 13:32:50 |
||||
|
@ 功能: 获取企业微信行政组织下人员信息 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func (w *WechatOrgPeole) WechatOrgHandPeople(orgId int64) { |
||||
|
sendWechatUrl := fmt.Sprintf("https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token=%v&department_id=%v", w.Token, orgId) |
||||
|
fmt.Printf("sendWechatUrl--1->:%v\n", sendWechatUrl) |
||||
|
//获取企业微信取部门成员详情
|
||||
|
wechatCallBack := overallhandle.CurlGet(sendWechatUrl) |
||||
|
var orgPeopleList WechatCallBackPeople |
||||
|
err := json.Unmarshal(wechatCallBack, &orgPeopleList) |
||||
|
if err != nil { |
||||
|
w.Token = GainWechatTokenUnify() |
||||
|
w.NewToekn = true |
||||
|
w.WechatOrgHandPeople(orgId) |
||||
|
return |
||||
|
} |
||||
|
if orgPeopleList.Errcode != 0 { |
||||
|
w.Token = GainWechatTokenUnify() |
||||
|
w.NewToekn = true |
||||
|
w.WechatOrgHandPeople(orgId) |
||||
|
return |
||||
|
} |
||||
|
// fmt.Printf("sendWechatUrl:%v\n", sendWechatUrl)
|
||||
|
w.UserList = orgPeopleList.UserList |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-07-02 15:44:36 |
||||
|
@ 功能: 新版定时任务启动数据同步 |
||||
|
@ 参数 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 返回值 |
||||
|
|
||||
|
# |
||||
|
|
||||
|
@ 方法原型 |
||||
|
|
||||
|
# |
||||
|
*/ |
||||
|
func NewTimedTasksForOrgWechat(orgId int64, errmsg ...any) { |
||||
|
fmt.Printf("orgId-2-->%v\n", orgId) |
||||
|
token := GainWechatTokenUnify() |
||||
|
fmt.Printf("token--->%v\n", token) |
||||
|
var orgMap WechatOrg |
||||
|
orgMap.OrgId = orgId |
||||
|
orgMap.Token = token |
||||
|
orgMap.GainWechatOrgList() |
||||
|
if orgMap.NewToekn { |
||||
|
token = orgMap.Token |
||||
|
} |
||||
|
fmt.Printf("orgMap--->%v\n", orgMap) |
||||
|
orgMap.GainOrgPeopleList() |
||||
|
// sendMap := make(map[string]interface{})
|
||||
|
// sendMap["token"] = token
|
||||
|
// sendMap["orgMap"] = orgMap
|
||||
|
overallhandle.WriteLog("i", "行政组织:", orgId, "更新完成") |
||||
|
} |
||||
@ -1,161 +0,0 @@ |
|||||
# 开发日志 |
|
||||
|
|
||||
## 2024-01-29 |
|
||||
|
|
||||
### 数据库操作 |
|
||||
|
|
||||
#### 1、person_archives 人员主表 |
|
||||
|
|
||||
增加表字段 |
|
||||
|
|
||||
``` |
|
||||
ALTER TABLE `person_archives` ADD `work_section` bigint unsigned DEFAULT '0' COMMENT '工段'; |
|
||||
``` |
|
||||
|
|
||||
#### 2、personnel_content 人员副表 |
|
||||
|
|
||||
增加表字段 |
|
||||
|
|
||||
``` |
|
||||
ALTER TABLE `personnel_content` ADD `domicile_type` varchar(100) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '户籍类型'; |
|
||||
ALTER TABLE `personnel_content` ADD `idCardnoLongTerm` int unsigned NOT NULL DEFAULT '2' COMMENT '身份证是否长期有效(1:是;2:否)'; |
|
||||
ALTER TABLE `person_archives` ADD `mobileShortNumber` varchar(50) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '手机小号'; |
|
||||
ALTER TABLE `person_archives` ADD `channel` int unsigned NOT NULL DEFAULT '1' COMMENT '入职渠道(1:社会招聘;2:校园招聘;3:内部推荐)'; |
|
||||
ALTER TABLE `person_archives` ADD `bloodType` varchar(10) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '血型'; |
|
||||
``` |
|
||||
|
|
||||
#### 3、personnel_education 教育经历 |
|
||||
|
|
||||
增加字段 |
|
||||
|
|
||||
``` |
|
||||
ALTER TABLE `personnel_education` ADD `education_type` int unsigned NOT NULL DEFAULT '1' COMMENT '学历类型(1、全日制统招学历;2、成人高考学历;3、自学考试学历;4:开放大学学历;5:网络教育学历)'; |
|
||||
ALTER TABLE `personnel_education` ADD `collegeFaction` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '所属院系'; |
|
||||
ALTER TABLE `personnel_education` ADD `schoolType` int unsigned NOT NULL DEFAULT '0' COMMENT '院校类型(1、私立中学;2:公立中学;3:高职院校;4:民办专科院校;5:公办专科院校;6:民办本科院校;7:公办本科院校;8:”211“工程院校;9:”985“工程院校;10:双一流院校)' |
|
||||
``` |
|
||||
|
|
||||
#### 4、family_members 员工家属 |
|
||||
|
|
||||
增加字段 |
|
||||
|
|
||||
``` |
|
||||
ALTER TABLE `family_members` ADD `workUnitPost` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '工作单位及职务'; |
|
||||
ALTER TABLE `family_members` ADD `isSos` int unsigned NOT NULL DEFAULT '2' COMMENT '是否为紧急联系人(1、是;2:否)'; |
|
||||
``` |
|
||||
|
|
||||
#### 5、double_worker 双职工 |
|
||||
|
|
||||
添加字段 |
|
||||
|
|
||||
``` |
|
||||
ALTER TABLE `double_worker` ADD `workUnit` varchar(100) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '工段'; |
|
||||
ALTER TABLE `double_worker` ADD `workPosit` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '职位'; |
|
||||
ALTER TABLE `double_worker` ADD `levele` varchar(30) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '职等'; |
|
||||
``` |
|
||||
|
|
||||
#### 6、inside_work_history 集团内部工作经历 |
|
||||
|
|
||||
添加字段 |
|
||||
|
|
||||
``` |
|
||||
ALTER TABLE `inside_work_history` ADD `changeType` int unsigned NOT NULL DEFAULT '1' COMMENT '变动类型(1、新入职;2:平调;3:降职;4:升职)'; |
|
||||
ALTER TABLE `inside_work_history` ADD `changeReason` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '变动原因'; |
|
||||
ALTER TABLE `inside_work_history` ADD `superiorPosition` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '上级职位'; |
|
||||
ALTER TABLE `inside_work_history` ADD `superiorName` varchar(50) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '上级名称'; |
|
||||
ALTER TABLE `inside_work_history` ADD `subordinates` int unsigned NOT NULL DEFAULT '0' COMMENT '下属人数'; |
|
||||
``` |
|
||||
|
|
||||
#### 7、work_history 工作履历 |
|
||||
|
|
||||
添加字段 |
|
||||
|
|
||||
``` |
|
||||
ALTER TABLE `work_history` ADD `companyNature` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '公司性质'; |
|
||||
ALTER TABLE `work_history` ADD `industry` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '所属行业'; |
|
||||
``` |
|
||||
|
|
||||
#### 8、meritslog 绩效 |
|
||||
|
|
||||
添加字段 |
|
||||
|
|
||||
``` |
|
||||
ALTER TABLE `work_history` ADD `level` varchar(255) COLLATE utf8mb4_bin DEFAULT '' COMMENT '考核等级'; |
|
||||
``` |
|
||||
|
|
||||
#### 9、rewards_penalties 奖惩 |
|
||||
|
|
||||
添加字段 |
|
||||
|
|
||||
``` |
|
||||
ALTER TABLE rewards_penalties ADD level int unsigned NOT NULL DEFAULT '1' COMMENT '奖惩级别(1:部门级;2:公司级;3:县级;4:市级;5:省级;6:国家级)'; |
|
||||
ALTER TABLE rewards_penalties ADD rewPunClass int unsigned NOT NULL DEFAULT '1' COMMENT '奖惩类型(1:年终评优;2:表扬;3:嘉奖;4:记功;5:记大功;6:特别奖励;7:批评;8:警告;9:记过;10:记大过;11:降级;12:留用察看;13:开除)'; |
|
||||
``` |
|
||||
|
|
||||
#### 10、political_identity 政治属性 |
|
||||
|
|
||||
添加表 |
|
||||
|
|
||||
``` |
|
||||
CREATE TABLE `political_identity` ( |
|
||||
`userkey` bigint unsigned NOT NULL DEFAULT '0' COMMENT '员工唯一识别符', |
|
||||
`political_outlook` int unsigned NOT NULL DEFAULT '1' COMMENT '政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)', |
|
||||
`joinTime` bigint NOT NULL DEFAULT '0' COMMENT '加入时间', |
|
||||
`branch` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '所在党支部', |
|
||||
`position` varchar(100) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '党内职务', |
|
||||
`joiningParty` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '入党时所在单位', |
|
||||
`switchToClass` int unsigned NOT NULL DEFAULT '2' COMMENT '组织关系是否转入(1:是;2:否)', |
|
||||
`switchToTime` bigint NOT NULL DEFAULT '0' COMMENT '组织关系转入时间', |
|
||||
`time` bigint unsigned NOT NULL DEFAULT '0', |
|
||||
PRIMARY KEY (`userkey`), |
|
||||
UNIQUE KEY `userkey` (`userkey`) |
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='政治属性'; |
|
||||
``` |
|
||||
|
|
||||
#### 11、veterans 退役军人信息 |
|
||||
|
|
||||
添加表 |
|
||||
|
|
||||
``` |
|
||||
CREATE TABLE `veterans` ( |
|
||||
`userkey` bigint unsigned NOT NULL DEFAULT '0', |
|
||||
`isRetire` int unsigned NOT NULL DEFAULT '2' COMMENT '是否为退役军人(1:是;2:否)', |
|
||||
`retireNumber` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '退役证编号', |
|
||||
`joinTime` bigint NOT NULL DEFAULT '0' COMMENT '入伍时间', |
|
||||
`retireTime` bigint NOT NULL DEFAULT '0' COMMENT '退伍时间', |
|
||||
`armyUnits` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '参军单位', |
|
||||
`typesOfSoldiers` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '兵种', |
|
||||
`time` bigint unsigned NOT NULL DEFAULT '0', |
|
||||
PRIMARY KEY (`userkey`), |
|
||||
UNIQUE KEY `userkey` (`userkey`) |
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='老兵信息'; |
|
||||
``` |
|
||||
|
|
||||
#### 12、academictitle 职称 |
|
||||
|
|
||||
添加表 |
|
||||
|
|
||||
``` |
|
||||
CREATE TABLE `academictitle` ( |
|
||||
`id` bigint unsigned NOT NULL, |
|
||||
`types` varchar(255) COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '职称级别', |
|
||||
`series` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '职称系列', |
|
||||
`speciality` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '职称专业', |
|
||||
`number` varchar(255) COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '资格证书编号', |
|
||||
`time` bigint unsigned NOT NULL DEFAULT '0' COMMENT '生效时间', |
|
||||
`editTime` bigint unsigned NOT NULL DEFAULT '0', |
|
||||
`userKey` bigint unsigned NOT NULL DEFAULT '0' COMMENT '人员唯一识别符', |
|
||||
PRIMARY KEY (`id`), |
|
||||
UNIQUE KEY `id` (`id`), |
|
||||
KEY `userKey` (`userKey`) |
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='职称'; |
|
||||
``` |
|
||||
|
|
||||
#### 13、certificate_honors 证书 |
|
||||
|
|
||||
添加字段 |
|
||||
|
|
||||
``` |
|
||||
ALTER TABLE rewards_penalties ADD number varchar(255) COLLATE utf8mb4_bin DEFAULT '' COMMENT '证书编号''; |
|
||||
ALTER TABLE rewards_penalties ADD endTime int unsigned NOT NULL DEFAULT '1' COMMENT '奖惩级别(1:部门级;2:公司级;3:县级;4:市级;5:省级;6:国家级)'; |
|
||||
ALTER TABLE rewards_penalties ADD validPeriod int unsigned NOT NULL DEFAULT '1' COMMENT '奖惩级别(1:部门级;2:公司级;3:县级;4:市级;5:省级;6:国家级)'; |
|
||||
``` |
|
||||
Binary file not shown.
@ -0,0 +1,73 @@ |
|||||
|
package customerForm |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
/* |
||||
|
* |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-03-06 13:23:03 |
||||
|
@ 功能: 自定义表单分组 |
||||
|
*/ |
||||
|
type DiaoBanSetup struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"` |
||||
|
Appid int64 `json:"appid" gorm:"column:appid;type:bigint(20) unsigned;default:0;not null;comment:归属哪个app"` |
||||
|
Source string `json:"source" gorm:"column:source;type:varchar(255) unsigned;default:'';not null;comment:是否引用数据源(yes ; no)"` |
||||
|
Ip string `json:"ip" gorm:"column:ip;type:varchar(255) unsigned;default:'';not null;comment:数据源地址"` |
||||
|
DataBaseName string `json:"dataBaseName" gorm:"column:dataBaseName;type:varchar(255) unsigned;default:'';not null;comment:是否引用数据源(yes ; no)"` |
||||
|
SqlType string `json:"sqlType" gorm:"column:sqlType;type:varchar(255) unsigned;default:'';not null;comment:数据库类型"` |
||||
|
Port int `json:"port" gorm:"column:port;type:int(7) unsigned;default:50;not null;comment:端口"` |
||||
|
TableKey string `json:"tableKey" gorm:"column:tableKey;type:varchar(255);default:'';comment:数据表标识"` |
||||
|
TableNames string `json:"tableName" gorm:"column:tableName;type:varchar(255);default:'';comment:数据表名称"` |
||||
|
UserName string `json:"userName" gorm:"column:userName;type:varchar(255);default:'';comment:数据库用户名"` |
||||
|
Pwd string `json:"pwd" gorm:"column:pwd;type:varchar(255);default:'';comment:数据库密码"` |
||||
|
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
SourceId string `json:"sourceId" gorm:"column:sourceId;type:varchar(255);default:'';comment:所愿"` |
||||
|
} |
||||
|
|
||||
|
func (DiaoBanSetup *DiaoBanSetup) TableName() string { |
||||
|
return "diaoBanSetup" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *DiaoBanSetup) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *DiaoBanSetup) GetCont(whereMap interface{}, field ...string) (err error) { |
||||
|
gormDb := overall.CONSTANT_DB_CustomerForm.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 *DiaoBanSetup) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *DiaoBanSetup) ContMap(whereMap interface{}, field ...string) (countAry []DiaoBanSetup, err error) { |
||||
|
gormDb := overall.CONSTANT_DB_CustomerForm.Model(&cont) |
||||
|
if len(field) > 0 { |
||||
|
fieldStr := strings.Join(field, ",") |
||||
|
gormDb = gormDb.Select(fieldStr) |
||||
|
} |
||||
|
err = gormDb.Where(whereMap).Find(&countAry).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 删除内容
|
||||
|
func (cont *DiaoBanSetup) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,79 @@ |
|||||
|
package customerForm |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 工作流执行主体
|
||||
|
// 字典类型
|
||||
|
type HuanBanShenQing struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
||||
|
MastersKey int64 `json:"masters_key" gorm:"column:masters_key;type:bigint(20) unsigned;default:0;not null;comment:申请人"` |
||||
|
Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:申请人"` |
||||
|
CreaterTime int64 `json:"creater_time" gorm:"column:creater_time;type:bigint(20) unsigned;default:0;not null;comment:提交时间"` |
||||
|
EditTime int64 `json:"edit_time" gorm:"column:edit_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
||||
|
FlowId int64 `json:"flow_id" gorm:"column:flow_id;type:bigint(20) unsigned;default:0;not null;comment:流程识别标识"` |
||||
|
States int `json:"states" gorm:"column:states;type:int(11) unsigned;default:1;not null;comment:状态(1:启用,2:禁用;3:删除)"` |
||||
|
FlowIsOpen int `json:"flowIsOpen" gorm:"column:flowIsOpen;type:int(1) unsigned;default:3;not null;comment:是否开启工作流"` |
||||
|
Shen3pi1bian1hao4 string `json:"shen3pi1bian1hao4" gorm:"column:shen3pi1bian1hao4;type:varchar(255);default:'';comment:审批编号"` |
||||
|
Fu4jian4 string `json:"fu4jian4" gorm:"column:fu4jian4;type:longtext;comment:附件"` |
||||
|
Org string `json:"org" gorm:"column:org;type:mediumtext;default:'';comment:申请人部门"` |
||||
|
Shou3ji1hao4109293 string `json:"shou3ji1hao4109293" gorm:"column:shou3ji1hao4109293;type:mediumtext;default:'';comment:手机号"` |
||||
|
Dang1zhi2ri4qi1 int64 `json:"dang1zhi2ri4qi1" gorm:"column:dang1zhi2ri4qi1;type:bigint(20) unsigned;default:0;not null;comment:当值日期"` |
||||
|
Diao4huan4ren229452110 string `json:"diao4huan4ren229452110" gorm:"column:diao4huan4ren229452110;type:longtext;comment:调换人"` |
||||
|
Shou3ji1 string `json:"shou3ji1" gorm:"column:shou3ji1;type:varchar(255);default:'';comment:审批编号"` |
||||
|
Diao4huan4ri4qi1 int64 `json:"diao4huan4ri4qi1" gorm:"column:diao4huan4ri4qi1;type:bigint(20) unsigned;default:0;not null;comment:调换日期"` |
||||
|
Shen1qing3yuan2yin1 string `json:"shen1qing3yuan2yin1" gorm:"column:shen1qing3yuan2yin1;type:longtext;comment:申请原因"` |
||||
|
} |
||||
|
|
||||
|
func (HuanBanShenQing *HuanBanShenQing) TableName() string { |
||||
|
return "huanBanShenQing" |
||||
|
} |
||||
|
|
||||
|
// 写入内容
|
||||
|
func (cont *HuanBanShenQing) WriteCont() (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Create(&cont).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *HuanBanShenQing) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *HuanBanShenQing) GetCont(whereMap interface{}, field ...string) (err error) { |
||||
|
gormDb := overall.CONSTANT_DB_CustomerForm.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 *HuanBanShenQing) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *HuanBanShenQing) ContMap(whereMap interface{}, field ...string) (countAry []HuanBanShenQing, err error) { |
||||
|
gormDb := overall.CONSTANT_DB_CustomerForm.Model(&cont) |
||||
|
if len(field) > 0 { |
||||
|
fieldStr := strings.Join(field, ",") |
||||
|
gormDb = gormDb.Select(fieldStr) |
||||
|
} |
||||
|
err = gormDb.Where(whereMap).Find(&countAry).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 删除内容
|
||||
|
func (cont *HuanBanShenQing) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,97 @@ |
|||||
|
package customerForm |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 工作流执行主体
|
||||
|
// 字典类型
|
||||
|
type RunFlowTask struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
||||
|
FlowKey int64 `json:"flowKey" gorm:"column:flow_key;type:bigint(20) unsigned;default:0;not null;comment:工作流主体"` |
||||
|
Version string `json:"version" gorm:"column:version;type:varchar(255);default:'';comment:使用得版本"` |
||||
|
Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:状态:1、草稿;2:驳回;3:通过;4:归档;5:删除"` |
||||
|
FlowCont string `json:"flowcont" gorm:"column:flow_cont;type:longtext;comment:流程执行体"` |
||||
|
Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:流程发起人"` |
||||
|
CurrentStep int `json:"currentStep" gorm:"column:current_step;type:int(4) unsigned;default:1;not null;comment:当前节点"` |
||||
|
NextStep int `json:"nextStep" gorm:"column:next_step;type:int(4) unsigned;default:0;not null;comment:下一个节点。0:代表没有下一个节点。流程结束"` |
||||
|
NextExecutor string `json:"nextExecutor" gorm:"column:next_executor;type:mediumtext;default:'';comment:下一步执行人"` |
||||
|
Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:参与人"` |
||||
|
StartTime int64 `json:"startTime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
UpdateTime int64 `json:"update_time" gorm:"column:update_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
||||
|
VersionCont string `json:"versionCont" gorm:"column:version_cont;type:longtext;comment:版本流程内容"` |
||||
|
RunKey int64 `json:"runKey" gorm:"column:runKey;type:bigint(20) unsigned;default:0;not null;comment:当前执行识别符"` |
||||
|
Title string `json:"title" gorm:"column:title;type:varchar(255) unsigned;default:'';not null;comment:标题"` |
||||
|
TaskCreate int64 `json:"taskCreate" gorm:"column:taskCreate;type:bigint(20) unsigned;default:0;not null;comment:创建人"` |
||||
|
CreaterTime int64 `json:"creater_time" gorm:"column:creater_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
Types int `json:"types" gorm:"column:types;type:int(1) unsigned;default:1;not null;comment:类型(1:普通表单;2:流程表单)"` |
||||
|
VersionId int64 `json:"version_id" gorm:"column:version_id;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:审批中;4:归档;5:删除)"` |
||||
|
// MastersKey int64 `json:"masters_key" gorm:"column:masters_key;type:bigint(20) unsigned;default:0;not null;comment:主表标识"`
|
||||
|
TaskFlowKey int64 `json:"taskFlowKey" gorm:"column:taskFlowKey;type:bigint(20) unsigned;default:0;not null;comment:主表标识"` |
||||
|
FlowRunSing int64 `json:"flowRunSing" gorm:"column:flow_run_sing;type:bigint(20) unsigned;default:0;not null;comment:主表标识"` |
||||
|
MastesForm string `json:"mastesform" gorm:"column:mastesform;type:longtext;default:'';comment:表单结构"` |
||||
|
MastesFormJson string `json:"mastesformjson" gorm:"column:mastesformjson;type:longtext;default:'';comment:表单结构json"` |
||||
|
Visibility int `json:"visibility" gorm:"column:visibility;type:int(1) unsigned;default:1;not null;comment:1、所有人;2、自定义"` |
||||
|
AuthorizationRoles string `json:"authorizationRoles" gorm:"column:authorizationRoles;type:mediumtext;comment:授权角色"` |
||||
|
AuthorizedPersonnel string `json:"authorizedPersonnel" gorm:"column:authorizedPersonnel;type:mediumtext;comment:授权人员"` |
||||
|
AuthorizedOrg string `json:"authorizedOrg" gorm:"column:authorizedOrg;type:mediumtext;comment:授权行政组织"` |
||||
|
AuthorizedPosition string `json:"authorizedPosition" gorm:"column:authorizedPosition;type:mediumtext;comment:授权职务"` |
||||
|
Participant string `json:"participant" gorm:"column:participant;type:longtext;default:'';comment:表单结构json"` |
||||
|
TableKey int64 `json:"tableKey" gorm:"column:tableKey;type:bigint(20) unsigned;default:0;not null;comment:归属自定义表"` |
||||
|
AppKey int64 `json:"appKey" gorm:"column:appKey;type:bigint(20) unsigned;default:0;not null;comment:归属App(0:非app表单)"` |
||||
|
MakeCopy string `json:"makeCopy" gorm:"column:makeCopy;type:mediumtext;comment:抄送人"` |
||||
|
MastersKey int64 `json:"masters_key" gorm:"column:masters_key;type:bigint(20) unsigned;default:0;not null;comment:主表识别符"` |
||||
|
} |
||||
|
|
||||
|
func (RunFlowTask *RunFlowTask) TableName() string { |
||||
|
return "runFlowTask" |
||||
|
} |
||||
|
|
||||
|
// 写入内容
|
||||
|
func (cont *RunFlowTask) WriteCont() (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Create(&cont).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *RunFlowTask) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *RunFlowTask) GetCont(whereMap interface{}, field ...string) (err error) { |
||||
|
gormDb := overall.CONSTANT_DB_CustomerForm.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 *RunFlowTask) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *RunFlowTask) ContMap(whereMap interface{}, field ...string) (countAry []RunFlowTask, err error) { |
||||
|
gormDb := overall.CONSTANT_DB_CustomerForm.Model(&cont) |
||||
|
if len(field) > 0 { |
||||
|
fieldStr := strings.Join(field, ",") |
||||
|
gormDb = gormDb.Select(fieldStr) |
||||
|
} |
||||
|
err = gormDb.Where(whereMap).Find(&countAry).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 删除内容
|
||||
|
func (cont *RunFlowTask) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,77 @@ |
|||||
|
package customerForm |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 工作流执行主体
|
||||
|
// 字典类型
|
||||
|
type RunWorkflow struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
||||
|
FlowKey int64 `json:"flowKey" gorm:"column:flow_key;type:bigint(20) unsigned;default:0;not null;comment:工作流主体"` |
||||
|
Version string `json:"version" gorm:"column:version;type:varchar(255);default:'';comment:使用得版本"` |
||||
|
Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:状态:1、草稿;2:驳回;3:通过;4:归档;5:删除"` |
||||
|
FlowCont string `json:"flowcont" gorm:"column:flow_cont;type:longtext;comment:流程执行体"` |
||||
|
Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:流程发起人"` |
||||
|
CurrentStep int `json:"currentStep" gorm:"column:current_step;type:int(4) unsigned;default:1;not null;comment:当前节点"` |
||||
|
NextStep int `json:"nextStep" gorm:"column:next_step;type:int(4) unsigned;default:0;not null;comment:下一个节点。0:代表没有下一个节点。流程结束"` |
||||
|
NextExecutor string `json:"nextExecutor" gorm:"column:next_executor;type:mediumtext;default:'';comment:下一步执行人"` |
||||
|
Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:参与人"` |
||||
|
StartTime int64 `json:"startTime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
UpdateTime int64 `json:"update_time" gorm:"column:update_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
||||
|
VersionCont string `json:"versionCont" gorm:"column:version_cont;type:longtext;comment:版本流程内容"` |
||||
|
RunKey int64 `json:"runKey" gorm:"column:runKey;type:bigint(20) unsigned;default:0;not null;comment:当前执行识别符"` |
||||
|
MakeCopy string `json:"makeCopy" gorm:"column:makeCopy;type:mediumtext;comment:抄送人"` |
||||
|
} |
||||
|
|
||||
|
func (RunWorkflow *RunWorkflow) TableName() string { |
||||
|
return "runworkflow" |
||||
|
} |
||||
|
|
||||
|
// 写入内容
|
||||
|
func (cont *RunWorkflow) WriteCont() (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Create(&cont).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *RunWorkflow) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *RunWorkflow) GetCont(whereMap interface{}, field ...string) (err error) { |
||||
|
gormDb := overall.CONSTANT_DB_CustomerForm.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 *RunWorkflow) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *RunWorkflow) ContMap(whereMap interface{}, field ...string) (countAry []RunWorkflow, err error) { |
||||
|
gormDb := overall.CONSTANT_DB_CustomerForm.Model(&cont) |
||||
|
if len(field) > 0 { |
||||
|
fieldStr := strings.Join(field, ",") |
||||
|
gormDb = gormDb.Select(fieldStr) |
||||
|
} |
||||
|
err = gormDb.Where(whereMap).Find(&countAry).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 删除内容
|
||||
|
func (cont *RunWorkflow) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,78 @@ |
|||||
|
package customerForm |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 自定义表单任务表
|
||||
|
type TaskRecord struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:int(5) unsigned;not null;comment:Id;index"` |
||||
|
Title string `json:"title" gorm:"column:title;type:varchar(255) unsigned;default:'';not null;comment:标题"` |
||||
|
Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:创建人"` |
||||
|
CreaterTime int64 `json:"creater_time" gorm:"column:creater_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
EditTime int64 `json:"editTime" gorm:"column:edit_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
||||
|
Types int `json:"types" gorm:"column:types;type:int(1) unsigned;default:1;not null;comment:类型(1:普通表单;2:流程表单)"` |
||||
|
VersionId int64 `json:"version_id" gorm:"column:version_id;type:bigint(20) unsigned;default:0;not null;comment:来源于哪个表单"` |
||||
|
Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:状态(1:草稿,2:发表;3:审批中;4:归档;5:删除)"` |
||||
|
MastersKey int64 `json:"masters_key" gorm:"column:masters_key;type:bigint(20) unsigned;default:0;not null;comment:主表标识"` |
||||
|
FlowKey int64 `json:"flow_key" gorm:"column:flow_key;type:bigint(20) unsigned;default:0;not null;comment:主表标识"` |
||||
|
FlowRunSing int64 `json:"flowRunSing" gorm:"column:flow_run_sing;type:bigint(20) unsigned;default:0;not null;comment:主表标识"` |
||||
|
MastesForm string `json:"mastesform" gorm:"column:mastesform;type:longtext;default:'';comment:表单结构"` |
||||
|
MastesFormJson string `json:"mastesformjson" gorm:"column:mastesformjson;type:longtext;default:'';comment:表单结构json"` |
||||
|
Visibility int `json:"visibility" gorm:"column:visibility;type:int(1) unsigned;default:1;not null;comment:1、所有人;2、自定义"` |
||||
|
AuthorizationRoles string `json:"authorizationRoles" gorm:"column:authorizationRoles;type:mediumtext;comment:授权角色"` |
||||
|
AuthorizedPersonnel string `json:"authorizedPersonnel" gorm:"column:authorizedPersonnel;type:mediumtext;comment:授权人员"` |
||||
|
AuthorizedOrg string `json:"authorizedOrg" gorm:"column:authorizedOrg;type:mediumtext;comment:授权行政组织"` |
||||
|
AuthorizedPosition string `json:"authorizedPosition" gorm:"column:authorizedPosition;type:mediumtext;comment:授权职务"` |
||||
|
Participant string `json:"participant" gorm:"column:participant;type:longtext;default:'';comment:表单结构json"` |
||||
|
TableKey int64 `json:"tableKey" gorm:"column:tableKey;type:bigint(20) unsigned;default:0;not null;comment:归属自定义表"` |
||||
|
AppKey int64 `json:"appKey" gorm:"column:appKey;type:bigint(20) unsigned;default:0;not null;comment:归属App(0:非app表单)"` |
||||
|
RunFlowId int64 `json:"runFlowId" gorm:"column:runFlowId;type:bigint(20) unsigned;default:0;not null;comment:正在执行得流程"` |
||||
|
MsgId int64 `json:"msgId" gorm:"column:msgId;type:bigint(20) unsigned;default:0;not null;comment:发送消息得任务ID"` |
||||
|
} |
||||
|
|
||||
|
func (TaskRecord *TaskRecord) TableName() string { |
||||
|
return "taskrecord" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *TaskRecord) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *TaskRecord) GetCont(whereMap interface{}, field ...string) (err error) { |
||||
|
gormDb := overall.CONSTANT_DB_CustomerForm.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 *TaskRecord) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *TaskRecord) ContMap(whereMap interface{}, field ...string) (countAry []TaskRecord, err error) { |
||||
|
gormDb := overall.CONSTANT_DB_CustomerForm.Model(&cont) |
||||
|
if len(field) > 0 { |
||||
|
fieldStr := strings.Join(field, ",") |
||||
|
gormDb = gormDb.Select(fieldStr) |
||||
|
} |
||||
|
err = gormDb.Where(whereMap).Find(&countAry).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 删除内容
|
||||
|
func (cont *TaskRecord) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,76 @@ |
|||||
|
package customerForm |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 工作流执行主体
|
||||
|
// 字典类型
|
||||
|
type TaskRunRecord struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
||||
|
FlowKey int64 `json:"flowKey" gorm:"column:flow_key;type:bigint(20) unsigned;default:0;not null;comment:工作流主体"` |
||||
|
Version string `json:"version" gorm:"column:version;type:varchar(255);default:'';comment:使用得版本"` |
||||
|
Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:状态:1、草稿;2:驳回;3:通过;4:归档;5:删除"` |
||||
|
FlowCont string `json:"flowcont" gorm:"column:flow_cont;type:longtext;comment:流程执行体"` |
||||
|
Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:流程发起人"` |
||||
|
CurrentStep int `json:"currentStep" gorm:"column:current_step;type:int(4) unsigned;default:1;not null;comment:当前节点"` |
||||
|
NextStep int `json:"nextStep" gorm:"column:next_step;type:int(4) unsigned;default:0;not null;comment:下一个节点。0:代表没有下一个节点。流程结束"` |
||||
|
NextExecutor string `json:"nextExecutor" gorm:"column:next_executor;type:mediumtext;default:'';comment:下一步执行人"` |
||||
|
Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:参与人"` |
||||
|
StartTime int64 `json:"startTime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
UpdateTime int64 `json:"update_time" gorm:"column:update_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
||||
|
VersionCont string `json:"versionCont" gorm:"column:version_cont;type:longtext;comment:版本流程内容"` |
||||
|
RunKey int64 `json:"runKey" gorm:"column:runKey;type:bigint(20) unsigned;default:0;not null;comment:当前执行识别符"` |
||||
|
} |
||||
|
|
||||
|
func (TaskRunRecord *TaskRunRecord) TableName() string { |
||||
|
return "taskrunrecord" |
||||
|
} |
||||
|
|
||||
|
// 写入内容
|
||||
|
func (cont *TaskRunRecord) WriteCont() (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Create(&cont).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *TaskRunRecord) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *TaskRunRecord) GetCont(whereMap interface{}, field ...string) (err error) { |
||||
|
gormDb := overall.CONSTANT_DB_CustomerForm.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 *TaskRunRecord) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *TaskRunRecord) ContMap(whereMap interface{}, field ...string) (countAry []TaskRunRecord, err error) { |
||||
|
gormDb := overall.CONSTANT_DB_CustomerForm.Model(&cont) |
||||
|
if len(field) > 0 { |
||||
|
fieldStr := strings.Join(field, ",") |
||||
|
gormDb = gormDb.Select(fieldStr) |
||||
|
} |
||||
|
err = gormDb.Where(whereMap).Find(&countAry).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 删除内容
|
||||
|
func (cont *TaskRunRecord) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_CustomerForm.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,67 @@ |
|||||
|
package models |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 行政组织变更记录
|
||||
|
type OrgChangeRecord struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
||||
|
Userkey int64 `json:"userkey" gorm:"primaryKey;column:userkey;type:bigint(20) unsigned;not null;comment:员工唯一识别符;"` |
||||
|
CompanyCn string `json:"companycn" gorm:"column:companycn;type:varchar(255) ;comment:公司中文"` |
||||
|
CompanyId int64 `json:"companyid" gorm:"column:companyid;type:bigint(20) unsigned;default:0;not null;comment:公司id"` |
||||
|
FirstDepartment string `json:"firstDepartment" gorm:"column:firstDepartment;type:varchar(255) ;comment:一级部门中文"` |
||||
|
FirstDepartmentId int64 `json:"firstDepartmentid" gorm:"column:firstDepartmentid;type:bigint(20) unsigned;default:0;not null;comment:一级部门id"` |
||||
|
SecondaryDepartment string `json:"secondaryDepartment" gorm:"column:secondaryDepartment;type:varchar(255) ;comment:二级部门中文"` |
||||
|
SecondaryDepartmentId int64 `json:"secondaryDepartmentid" gorm:"column:secondaryDepartmentid;type:bigint(20) unsigned;default:0;not null;comment:二级部门id"` |
||||
|
WorkShop string `json:"workshop" gorm:"column:workshop;type:varchar(255) ;comment:公司中文"` |
||||
|
WorkShopid int64 `json:"workshopid" gorm:"column:workshopid;type:bigint(20) unsigned;default:0;not null;comment:工段ID"` |
||||
|
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
Notes string `json:"notes" gorm:"column:notes;type:mediumtext;comment:备注"` |
||||
|
} |
||||
|
|
||||
|
func (OrgChangeRecord *OrgChangeRecord) TableName() string { |
||||
|
return "orgChangeRecord" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *OrgChangeRecord) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *OrgChangeRecord) 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 *OrgChangeRecord) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *OrgChangeRecord) ContMap(whereMap interface{}, field ...string) (countAry []OrgChangeRecord, 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 *OrgChangeRecord) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
package models |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 行政组织变更记录
|
||||
|
type PerstatiSticsevaluators struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` |
||||
|
Userkey int64 `json:"userkey" gorm:"primaryKey;column:userkey;type:bigint(20) unsigned;not null;comment:员工唯一识别符;"` |
||||
|
TimeYear int64 `json:"timeYear" gorm:"column:timeYear;type:bigint(20) unsigned;default:0;not null;comment:考评年分"` |
||||
|
Levels int64 `json:"levels" gorm:"column:levels;type:int(1) unsigned;default:1;not null;comment:考评分类"` |
||||
|
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
||||
|
EvaluationItems string `json:"evaluationItems" gorm:"column:evaluationItems;type:varchar(255) ;comment:评估项"` |
||||
|
Comment string `json:"v" gorm:"column:comment;type:mediumtext;comment:领导评语"` |
||||
|
} |
||||
|
|
||||
|
func (PerstatiSticsevaluators *PerstatiSticsevaluators) TableName() string { |
||||
|
return "perstatisticsevaluators" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *PerstatiSticsevaluators) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *PerstatiSticsevaluators) 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 *PerstatiSticsevaluators) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *PerstatiSticsevaluators) ContMap(whereMap interface{}, field ...string) (countAry []PerstatiSticsevaluators, 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 *PerstatiSticsevaluators) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,53 @@ |
|||||
|
package models |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 班组
|
||||
|
type TalentInventory struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
||||
|
UserKey int64 `json:"userKey" gorm:"column:userKey;type:bigint(20) unsigned;default:0;not null;comment:归属人员key"` |
||||
|
UserTypes string `json:"userTypes" gorm:"column:userTypes;type:mediumtext;default null;comment:人员类型"` |
||||
|
CareerPlanning string `json:"careerPlanning" gorm:"column:careerPlanning;type:mediumtext;default null;comment:职业生涯规划"` |
||||
|
PersonalAssistance string `json:"personalAssistance" gorm:"column:personalAssistance;type:mediumtext;default null;comment:个人期望从组织获得的帮助"` |
||||
|
LastYearAssessmentLevel string `json:"lastYearAssessmentLevel" gorm:"column:lastYearAssessmentLevel;type:varchar(50) unsigned;default:'';not null;comment:上一年绩效成绩"` |
||||
|
Years int `json:"years" gorm:"column:years;type:int(5) unsigned;default:0;not null;comment:年份"` |
||||
|
Times int64 `json:"times" gorm:"column:times;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
||||
|
} |
||||
|
|
||||
|
func (TalentInventory *TalentInventory) TableName() string { |
||||
|
return "talentInventory" |
||||
|
} |
||||
|
|
||||
|
// 编辑班组内容
|
||||
|
func (TalentInventory *TalentInventory) EiteTalentInventoryCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_HR.Model(&TalentInventory).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取详细内容
|
||||
|
func (cont *TalentInventory) 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 *TalentInventory) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 删除内容
|
||||
|
func (cont *TalentInventory) DelCont(whereMap interface{}) (err error) { |
||||
|
|
||||
|
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,63 @@ |
|||||
|
package models |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
type UserOrg struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
||||
|
Userkey int64 `json:"userKey" gorm:"primaryKey;column:userKey;type:bigint(20) unsigned;not null;comment:员工唯一识别符;"` |
||||
|
Company int64 `json:"company" gorm:"primaryKey;column:company;type:bigint(20) unsigned;not null;comment:所属公司;"` |
||||
|
Orgid int64 `json:"orgid" gorm:"primaryKey;column:orgid;type:bigint(20) unsigned;not null;comment:行政组织ID;"` |
||||
|
Position int64 `json:"position" gorm:"primaryKey;column:position;type:bigint(20) unsigned;not null;comment:职位;"` |
||||
|
TeamsId int64 `json:"teamsId" gorm:"primaryKey;column:teamsId;type:bigint(20) unsigned;not null;comment:班组Id;"` |
||||
|
StartTime int64 `json:"startTime" gorm:"primaryKey;column:startTime;type:bigint(20) unsigned;not null;comment:任职开始时间;"` |
||||
|
AssignType int `json:"assignType" gorm:"column:assignType;type:int(1) unsigned;default:50;not null;comment:1:主职;2:兼职"` |
||||
|
Time int64 `json:"time" gorm:"primaryKey;column:time;type:bigint(20) unsigned;not null;comment:编辑时间;"` |
||||
|
} |
||||
|
|
||||
|
func (UserOrg *UserOrg) TableName() string { |
||||
|
return "userOrg" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *UserOrg) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *UserOrg) 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 *UserOrg) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *UserOrg) ContMap(whereMap interface{}, field ...string) (countAry []UserOrg, 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 *UserOrg) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,66 @@ |
|||||
|
package workgroup |
||||
|
|
||||
|
import ( |
||||
|
"hr_server/overall" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
// 排班记录
|
||||
|
type TeamsRules struct { |
||||
|
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;index"` |
||||
|
RuleTypeId int64 `json:"ruleTypeId" gorm:"column:ruleTypeId;type:bigint(20) unsigned;default:0;not null;comment:排班制度ID"` |
||||
|
RuleTypeName string `json:"ruleTypeName" gorm:"column:ruleTypeName;type:varchar(255);comment:制度名称"` |
||||
|
Cycle int `json:"cycle" gorm:"column:cycle;type:int(4) unsigned;default:1;not null;comment:周期类型"` |
||||
|
TeamsId int64 `json:"teamsId" gorm:"column:teamsId;type:bigint(20) unsigned;default:0;not null;comment:班组Id"` |
||||
|
TeamsName string `json:"teamsName" gorm:"column:teamsName;type:varchar(255);comment:班组姓名"` |
||||
|
CycleSort int64 `json:"cycleSort" gorm:"column:cycleSort;type:int(4) unsigned;default:1;not null;comment:周期排序"` |
||||
|
CycleName string `json:"cycleName" gorm:"column:cycleName;type:varchar(255);comment:周期名称"` |
||||
|
CycleWorkTime int64 `json:"cycleWorkTime" gorm:"column:cycleWorkTime;type:bigint(20) unsigned;default:0;not null;comment:工作时间段Id"` |
||||
|
CycleWorkName string `json:"cycleWorkName" gorm:"column:cycleWorkName;type:varchar(255);comment:工作时间段名称"` |
||||
|
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
||||
|
} |
||||
|
|
||||
|
func (TeamsRules *TeamsRules) TableName() string { |
||||
|
return "teams_rules" |
||||
|
} |
||||
|
|
||||
|
// 编辑内容
|
||||
|
func (cont *TeamsRules) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 获取内容
|
||||
|
func (cont *TeamsRules) 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 *TeamsRules) CountCont(whereMap interface{}) (countId int64) { |
||||
|
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// 读取全部信息
|
||||
|
func (cont *TeamsRules) ContMap(whereMap interface{}, field ...string) (countAry []TeamsRules, 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 *TeamsRules) DelCont(whereMap interface{}) (err error) { |
||||
|
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error |
||||
|
return |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
package overallhandle |
||||
|
|
||||
|
import "github.com/gin-gonic/gin" |
||||
|
|
||||
|
/** |
||||
|
@ 作者: 秦东 |
||||
|
@ 时间: 2024-03-08 13:38:51 |
||||
|
@ 功能: 人员操作记录 |
||||
|
@ 参数 |
||||
|
# |
||||
|
@ 返回值 |
||||
|
# |
||||
|
@ 方法原型 |
||||
|
# |
||||
|
*/ |
||||
|
func WritePeopleLog(c *gin.Context, class string, errmsg ...any) { |
||||
|
|
||||
|
} |
||||
Loading…
Reference in new issue