|
|
|
@ -13,7 +13,7 @@ import (
|
|
|
|
|
var db = DbUtil.Engine
|
|
|
|
|
|
|
|
|
|
//记录操作日志
|
|
|
|
|
func ActionLog(ms []models.TBaseClass, actionCode string, actionPersonId string, actionIp string) error{
|
|
|
|
|
func ActionLog(ms []models.TBaseClass, actionCode string, actionPersonId string, actionIp string) error {
|
|
|
|
|
msLog := make([]models.TBaseClassLog, len(ms))
|
|
|
|
|
for i := range ms {
|
|
|
|
|
CommonUtil.CopyFields(ms[i], &msLog[i])
|
|
|
|
@ -24,9 +24,10 @@ func ActionLog(ms []models.TBaseClass, actionCode string, actionPersonId string,
|
|
|
|
|
msLog[i].ActionTime = time.Now()
|
|
|
|
|
}
|
|
|
|
|
//批量保存
|
|
|
|
|
_,err:=db.Insert(msLog)
|
|
|
|
|
_, err := db.Insert(msLog)
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//通过主键集合,查找对应的实体bean集合
|
|
|
|
|
func GetByIds(ids []string) ([]models.TBaseClass, error) {
|
|
|
|
|
ms := make([]models.TBaseClass, 0)
|
|
|
|
@ -54,21 +55,7 @@ func CheckClassNumValid(schoolId string, stageId string, rxnf int32, startBh int
|
|
|
|
|
|
|
|
|
|
//批量增加
|
|
|
|
|
func AddBaseClass(ms []models.TBaseClass) (int64, error) {
|
|
|
|
|
//声明事务
|
|
|
|
|
session := db.NewSession()
|
|
|
|
|
defer session.Close()
|
|
|
|
|
session.Begin()
|
|
|
|
|
//遍历每一个model
|
|
|
|
|
for i := range ms {
|
|
|
|
|
_, err := session.Insert(ms[i])
|
|
|
|
|
if err != nil {
|
|
|
|
|
session.Rollback()
|
|
|
|
|
return 0, err
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//提交事务
|
|
|
|
|
err := session.Commit()
|
|
|
|
|
return int64(len(ms)), err
|
|
|
|
|
return db.Insert(ms)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//修改
|
|
|
|
|