|
@@ -10,28 +10,6 @@ import (
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
)
|
|
)
|
|
|
|
|
|
-// ReportApprove 报告审批表
|
|
|
|
-//type ReportApprove struct {
|
|
|
|
-// ReportApproveId int `orm:"column(report_approve_id);pk" description:"审批ID"`
|
|
|
|
-// ReportType int `description:"报告类型:1-中文研报;2-英文研报;3-智能研报"`
|
|
|
|
-// ReportId int `description:"报告ID"`
|
|
|
|
-// ReportTitle string `description:"报告标题"`
|
|
|
|
-// ClassifyFirstId int `description:"一级分类ID"`
|
|
|
|
-// ClassifySecondId int `description:"二级分类ID"`
|
|
|
|
-// ClassifyThirdId int `description:"三级分类ID"`
|
|
|
|
-// State int `description:"审批状态:1-待审批;2-已审批;3-已驳回;4-已撤回"`
|
|
|
|
-// FlowId int `description:"审批流ID"`
|
|
|
|
-// FlowVersion int `description:"审批流版本"`
|
|
|
|
-// StartNodeId int `description:"开始节点ID"`
|
|
|
|
-// CurrNodeId int `description:"当前节点ID"`
|
|
|
|
-// ApplyUserId int `description:"申请人ID"`
|
|
|
|
-// ApplyUserName string `description:"申请人姓名"`
|
|
|
|
-// ApproveRemark string `description:"审批备注"`
|
|
|
|
-// ApproveTime time.Time `description:"审批时间"`
|
|
|
|
-// CreateTime time.Time `description:"创建时间"`
|
|
|
|
-// ModifyTime time.Time `description:"修改时间"`
|
|
|
|
-//}
|
|
|
|
-
|
|
|
|
type ReportApprove struct {
|
|
type ReportApprove struct {
|
|
ReportApproveId int `gorm:"primaryKey;column:report_approve_id;type:int(10) unsigned;not null"` // 审批ID
|
|
ReportApproveId int `gorm:"primaryKey;column:report_approve_id;type:int(10) unsigned;not null"` // 审批ID
|
|
ReportType int `gorm:"column:report_type;type:tinyint(4) unsigned;not null;default:0"` // 报告类型:1-中文研报;2-英文研报;3-智能研报
|
|
ReportType int `gorm:"column:report_type;type:tinyint(4) unsigned;not null;default:0"` // 报告类型:1-中文研报;2-英文研报;3-智能研报
|
|
@@ -102,12 +80,6 @@ func (m *ReportApprove) PrimaryId() string {
|
|
}
|
|
}
|
|
|
|
|
|
func (m *ReportApprove) Create() (err error) {
|
|
func (m *ReportApprove) Create() (err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- //id, err := o.Insert(m)
|
|
|
|
- //if err != nil {
|
|
|
|
- // return
|
|
|
|
- //}
|
|
|
|
- //m.ReportApproveId = int(id)
|
|
|
|
err = global.DmSQL["rddp"].Create(m).Error
|
|
err = global.DmSQL["rddp"].Create(m).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -116,23 +88,17 @@ func (m *ReportApprove) CreateMulti(items []*ReportApprove) (err error) {
|
|
if len(items) == 0 {
|
|
if len(items) == 0 {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- //_, err = o.InsertMulti(len(items), items)
|
|
|
|
err = global.DmSQL["rddp"].CreateInBatches(items, utils.MultiAddNum).Error
|
|
err = global.DmSQL["rddp"].CreateInBatches(items, utils.MultiAddNum).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func (m *ReportApprove) Update(cols []string) (err error) {
|
|
func (m *ReportApprove) Update(cols []string) (err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- //_, err = o.Update(m, cols...)
|
|
|
|
err = global.DmSQL["rddp"].Select(cols).Updates(m).Error
|
|
err = global.DmSQL["rddp"].Select(cols).Updates(m).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func (m *ReportApprove) Del() (err error) {
|
|
func (m *ReportApprove) Del() (err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
sql := fmt.Sprintf(`DELETE FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.PrimaryId())
|
|
sql := fmt.Sprintf(`DELETE FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.PrimaryId())
|
|
- //_, err = o.Raw(sql, m.ReportApproveId).Exec()
|
|
|
|
err = global.DmSQL["rddp"].Exec(sql, m.ReportApproveId).Error
|
|
err = global.DmSQL["rddp"].Exec(sql, m.ReportApproveId).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -141,43 +107,34 @@ func (m *ReportApprove) MultiDel(menuIds []int) (err error) {
|
|
if len(menuIds) == 0 {
|
|
if len(menuIds) == 0 {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
sql := fmt.Sprintf(`DELETE FROM %s WHERE %s IN (%s)`, m.TableName(), m.PrimaryId(), utils.GetOrmInReplace(len(menuIds)))
|
|
sql := fmt.Sprintf(`DELETE FROM %s WHERE %s IN (%s)`, m.TableName(), m.PrimaryId(), utils.GetOrmInReplace(len(menuIds)))
|
|
- //_, err = o.Raw(sql, menuIds).Exec()
|
|
|
|
err = global.DmSQL["rddp"].Exec(sql, menuIds).Error
|
|
err = global.DmSQL["rddp"].Exec(sql, menuIds).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func (m *ReportApprove) GetItemById(id int) (item *ReportApprove, err error) {
|
|
func (m *ReportApprove) GetItemById(id int) (item *ReportApprove, err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
sql := fmt.Sprintf(`SELECT * FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.PrimaryId())
|
|
sql := fmt.Sprintf(`SELECT * FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.PrimaryId())
|
|
- //err = o.Raw(sql, id).QueryRow(&item)
|
|
|
|
err = global.DmSQL["rddp"].Raw(sql, id).First(&item).Error
|
|
err = global.DmSQL["rddp"].Raw(sql, id).First(&item).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func (m *ReportApprove) GetItemByCondition(condition string, pars []interface{}, orderRule string) (item *ReportApprove, err error) {
|
|
func (m *ReportApprove) GetItemByCondition(condition string, pars []interface{}, orderRule string) (item *ReportApprove, err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
order := ``
|
|
order := ``
|
|
if orderRule != "" {
|
|
if orderRule != "" {
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s %s LIMIT 1`, m.TableName(), condition, order)
|
|
sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s %s LIMIT 1`, m.TableName(), condition, order)
|
|
- //err = o.Raw(sql, pars).QueryRow(&item)
|
|
|
|
err = global.DmSQL["rddp"].Raw(sql, pars).First(&item).Error
|
|
err = global.DmSQL["rddp"].Raw(sql, pars).First(&item).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func (m *ReportApprove) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
|
|
func (m *ReportApprove) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
|
|
sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
|
|
- //err = o.Raw(sql, pars).QueryRow(&count)
|
|
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func (m *ReportApprove) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*ReportApprove, err error) {
|
|
func (m *ReportApprove) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*ReportApprove, err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -187,13 +144,11 @@ func (m *ReportApprove) GetItemsByCondition(condition string, pars []interface{}
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
|
|
- //_, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
func (m *ReportApprove) GetPageItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string, startSize, pageSize int) (items []*ReportApprove, err error) {
|
|
func (m *ReportApprove) GetPageItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string, startSize, pageSize int) (items []*ReportApprove, err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
fields := strings.Join(fieldArr, ",")
|
|
fields := strings.Join(fieldArr, ",")
|
|
if len(fieldArr) == 0 {
|
|
if len(fieldArr) == 0 {
|
|
fields = `*`
|
|
fields = `*`
|
|
@@ -203,7 +158,6 @@ func (m *ReportApprove) GetPageItemsByCondition(condition string, pars []interfa
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
|
|
sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
|
|
- //_, err = o.Raw(sql, pars...).QueryRows(&items)
|
|
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -318,20 +272,17 @@ type ReportApproveItemOrm struct {
|
|
|
|
|
|
// GetApprovingReportApproveCount 获取待处理的审批分页列表总数
|
|
// GetApprovingReportApproveCount 获取待处理的审批分页列表总数
|
|
func GetApprovingReportApproveCount(cond string, pars []interface{}) (count int, err error) {
|
|
func GetApprovingReportApproveCount(cond string, pars []interface{}) (count int, err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
base := fmt.Sprintf(`SELECT a.report_approve_record_id
|
|
base := fmt.Sprintf(`SELECT a.report_approve_record_id
|
|
FROM report_approve_record AS a
|
|
FROM report_approve_record AS a
|
|
JOIN report_approve AS b ON a.report_approve_id = b.report_approve_id AND a.node_id = b.curr_node_id
|
|
JOIN report_approve AS b ON a.report_approve_id = b.report_approve_id AND a.node_id = b.curr_node_id
|
|
WHERE 1 = 1 %s`, cond)
|
|
WHERE 1 = 1 %s`, cond)
|
|
sql := fmt.Sprintf(`SELECT COUNT(1) FROM (%s) t`, base)
|
|
sql := fmt.Sprintf(`SELECT COUNT(1) FROM (%s) t`, base)
|
|
- //err = o.Raw(sql, pars).QueryRow(&count)
|
|
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
// GetApprovingReportApprovePageList 获取待处理的审批列表-分页
|
|
// GetApprovingReportApprovePageList 获取待处理的审批列表-分页
|
|
func GetApprovingReportApprovePageList(cond string, pars []interface{}, orderRule string, startSize, pageSize int) (items []*ReportApproveItemOrm, err error) {
|
|
func GetApprovingReportApprovePageList(cond string, pars []interface{}, orderRule string, startSize, pageSize int) (items []*ReportApproveItemOrm, err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
order := `ORDER BY a.create_time DESC`
|
|
order := `ORDER BY a.create_time DESC`
|
|
if orderRule != "" {
|
|
if orderRule != "" {
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
@@ -341,7 +292,6 @@ func GetApprovingReportApprovePageList(cond string, pars []interface{}, orderRul
|
|
JOIN report_approve AS b ON a.report_approve_id = b.report_approve_id AND a.node_id = b.curr_node_id
|
|
JOIN report_approve AS b ON a.report_approve_id = b.report_approve_id AND a.node_id = b.curr_node_id
|
|
WHERE 1 = 1 %s %s
|
|
WHERE 1 = 1 %s %s
|
|
LIMIT ?,?`, cond, order)
|
|
LIMIT ?,?`, cond, order)
|
|
- //_, err = o.Raw(sql, pars...).QueryRows(&items)
|
|
|
|
pars = append(pars, startSize, pageSize)
|
|
pars = append(pars, startSize, pageSize)
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
@@ -349,20 +299,17 @@ func GetApprovingReportApprovePageList(cond string, pars []interface{}, orderRul
|
|
|
|
|
|
// GetApprovedReportApproveCount 获取已处理的审批分页列表总数
|
|
// GetApprovedReportApproveCount 获取已处理的审批分页列表总数
|
|
func GetApprovedReportApproveCount(cond string, pars []interface{}) (count int, err error) {
|
|
func GetApprovedReportApproveCount(cond string, pars []interface{}) (count int, err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
base := fmt.Sprintf(`SELECT a.report_approve_record_id
|
|
base := fmt.Sprintf(`SELECT a.report_approve_record_id
|
|
FROM report_approve_record AS a
|
|
FROM report_approve_record AS a
|
|
JOIN report_approve AS b ON a.report_approve_id = b.report_approve_id
|
|
JOIN report_approve AS b ON a.report_approve_id = b.report_approve_id
|
|
WHERE 1 = 1 %s`, cond)
|
|
WHERE 1 = 1 %s`, cond)
|
|
sql := fmt.Sprintf(`SELECT COUNT(1) FROM (%s) t`, base)
|
|
sql := fmt.Sprintf(`SELECT COUNT(1) FROM (%s) t`, base)
|
|
- //err = o.Raw(sql, pars).QueryRow(&count)
|
|
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
// GetApprovedReportApprovePageList 获取已处理的审批列表-分页
|
|
// GetApprovedReportApprovePageList 获取已处理的审批列表-分页
|
|
func GetApprovedReportApprovePageList(cond string, pars []interface{}, orderRule string, startSize, pageSize int) (items []*ReportApproveItemOrm, err error) {
|
|
func GetApprovedReportApprovePageList(cond string, pars []interface{}, orderRule string, startSize, pageSize int) (items []*ReportApproveItemOrm, err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
order := `ORDER BY a.create_time DESC`
|
|
order := `ORDER BY a.create_time DESC`
|
|
if orderRule != "" {
|
|
if orderRule != "" {
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
@@ -372,7 +319,6 @@ func GetApprovedReportApprovePageList(cond string, pars []interface{}, orderRule
|
|
JOIN report_approve AS b ON a.report_approve_id = b.report_approve_id
|
|
JOIN report_approve AS b ON a.report_approve_id = b.report_approve_id
|
|
WHERE 1 = 1 %s %s
|
|
WHERE 1 = 1 %s %s
|
|
LIMIT ?,?`, cond, order)
|
|
LIMIT ?,?`, cond, order)
|
|
- //_, err = o.Raw(sql, pars...).QueryRows(&items)
|
|
|
|
pars = append(pars, startSize, pageSize)
|
|
pars = append(pars, startSize, pageSize)
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
return
|
|
return
|
|
@@ -380,23 +326,19 @@ func GetApprovedReportApprovePageList(cond string, pars []interface{}, orderRule
|
|
|
|
|
|
// GetApplyReportApproveCount 获取我发起的审批分页列表总数
|
|
// GetApplyReportApproveCount 获取我发起的审批分页列表总数
|
|
func GetApplyReportApproveCount(cond string, pars []interface{}) (count int, err error) {
|
|
func GetApplyReportApproveCount(cond string, pars []interface{}) (count int, err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
base := fmt.Sprintf(`SELECT a.* FROM report_approve AS a WHERE 1 = 1 %s`, cond)
|
|
base := fmt.Sprintf(`SELECT a.* FROM report_approve AS a WHERE 1 = 1 %s`, cond)
|
|
sql := fmt.Sprintf(`SELECT COUNT(1) FROM (%s) t`, base)
|
|
sql := fmt.Sprintf(`SELECT COUNT(1) FROM (%s) t`, base)
|
|
- //err = o.Raw(sql, pars).QueryRow(&count)
|
|
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
// GetApplyReportApprovePageList 获取我发起的审批列表-分页
|
|
// GetApplyReportApprovePageList 获取我发起的审批列表-分页
|
|
func GetApplyReportApprovePageList(cond string, pars []interface{}, orderRule string, startSize, pageSize int) (items []*ReportApproveItemOrm, err error) {
|
|
func GetApplyReportApprovePageList(cond string, pars []interface{}, orderRule string, startSize, pageSize int) (items []*ReportApproveItemOrm, err error) {
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
order := `ORDER BY a.create_time DESC`
|
|
order := `ORDER BY a.create_time DESC`
|
|
if orderRule != "" {
|
|
if orderRule != "" {
|
|
order = ` ORDER BY ` + orderRule
|
|
order = ` ORDER BY ` + orderRule
|
|
}
|
|
}
|
|
sql := fmt.Sprintf(`SELECT a.* FROM report_approve AS a WHERE 1 = 1 %s %s LIMIT ?,?`, cond, order)
|
|
sql := fmt.Sprintf(`SELECT a.* FROM report_approve AS a WHERE 1 = 1 %s %s LIMIT ?,?`, cond, order)
|
|
- //_, err = o.Raw(sql, pars...).QueryRows(&items)
|
|
|
|
pars = append(pars, startSize)
|
|
pars = append(pars, startSize)
|
|
pars = append(pars, pageSize)
|
|
pars = append(pars, pageSize)
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
|
|
@@ -408,7 +350,6 @@ type ReportApproveDetail struct {
|
|
Report *ReportApproveDetailReport `description:"报告信息"`
|
|
Report *ReportApproveDetailReport `description:"报告信息"`
|
|
Approve *ReportApproveDetailItem `description:"审批信息"`
|
|
Approve *ReportApproveDetailItem `description:"审批信息"`
|
|
ApproveFlowNodes []*ReportApproveDetailNodes `description:"审批节点信息"`
|
|
ApproveFlowNodes []*ReportApproveDetailNodes `description:"审批节点信息"`
|
|
- //ApproveFlow *ReportApproveFlowItem `description:"审批流信息"`
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// ReportApproveDetailItem 审批详情-审批信息
|
|
// ReportApproveDetailItem 审批详情-审批信息
|
|
@@ -434,9 +375,6 @@ type ReportApproveDetailReport struct {
|
|
ReportCode string `description:"报告code"`
|
|
ReportCode string `description:"报告code"`
|
|
ReportClassify string `description:"报告分类"`
|
|
ReportClassify string `description:"报告分类"`
|
|
ReportLayout int8 `description:"报告布局,1:常规布局,2:智能布局。默认:1"`
|
|
ReportLayout int8 `description:"报告布局,1:常规布局,2:智能布局。默认:1"`
|
|
- //ClassifyFirstId int `description:"一级分类ID"`
|
|
|
|
- //ClassifySecondId int `description:"二级分类ID"`
|
|
|
|
- //Content string `description:"报告内容"`
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// CreateApproveAndRecord 新增审批和记录
|
|
// CreateApproveAndRecord 新增审批和记录
|
|
@@ -445,37 +383,6 @@ func (m *ReportApprove) CreateApproveAndRecord(approveItem *ReportApprove, recor
|
|
err = fmt.Errorf("approve is nil")
|
|
err = fmt.Errorf("approve is nil")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- //o := orm.NewOrmUsingDB("rddp")
|
|
|
|
- //tx, e := o.Begin()
|
|
|
|
- //if e != nil {
|
|
|
|
- // err = fmt.Errorf("orm begin err: %s", e.Error())
|
|
|
|
- // return
|
|
|
|
- //}
|
|
|
|
- //defer func() {
|
|
|
|
- // if err != nil {
|
|
|
|
- // _ = tx.Rollback()
|
|
|
|
- // return
|
|
|
|
- // }
|
|
|
|
- // _ = tx.Commit()
|
|
|
|
- //}()
|
|
|
|
- //
|
|
|
|
- //lastId, e := tx.Insert(approveItem)
|
|
|
|
- //if e != nil {
|
|
|
|
- // err = fmt.Errorf("insert approve err: %s", e.Error())
|
|
|
|
- // return
|
|
|
|
- //}
|
|
|
|
- //approveItem.ReportApproveId = int(lastId)
|
|
|
|
- //
|
|
|
|
- //if len(recordItems) > 0 {
|
|
|
|
- // for _, v := range recordItems {
|
|
|
|
- // v.ReportApproveId = approveItem.ReportApproveId
|
|
|
|
- // }
|
|
|
|
- // _, e = tx.InsertMulti(len(recordItems), recordItems)
|
|
|
|
- // if e != nil {
|
|
|
|
- // err = fmt.Errorf("insert records err: %s", e.Error())
|
|
|
|
- // return
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
|
|
|
|
tx := global.DmSQL["data"].Begin()
|
|
tx := global.DmSQL["data"].Begin()
|
|
defer func() {
|
|
defer func() {
|