This commit is contained in:
2025-07-07 20:11:59 +08:00
parent ab0fdbc447
commit 06e3aa2eb3
2009 changed files with 193082 additions and 0 deletions

View File

@ -0,0 +1,6 @@
package logic
import _ "github.com/tiger1103/gfast/v3/internal/app/test/logic/testContactInfo"
import _ "github.com/tiger1103/gfast/v3/internal/app/test/logic/testFollowInfo"
import _ "github.com/tiger1103/gfast/v3/internal/app/test/logic/testOwnerInfo"
import _ "github.com/tiger1103/gfast/v3/internal/app/test/logic/testProjectInfo"

View File

@ -0,0 +1,140 @@
// ==========================================================================
// GFast自动生成logic操作代码。
// 生成日期2023-09-01 17:36:18
// 生成路径: internal/app/test/logic/test_contact_info.go
// 生成人yqq
// desc:业主方联系人关联
// company:云南奇讯科技有限公司
// ==========================================================================
package logic
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv"
"github.com/tiger1103/gfast/v3/api/v1/test"
"github.com/tiger1103/gfast/v3/internal/app/system/consts"
ct "github.com/tiger1103/gfast/v3/internal/app/system/logic/context"
"github.com/tiger1103/gfast/v3/internal/app/test/dao"
"github.com/tiger1103/gfast/v3/internal/app/test/model"
"github.com/tiger1103/gfast/v3/internal/app/test/model/do"
"github.com/tiger1103/gfast/v3/internal/app/test/service"
"github.com/tiger1103/gfast/v3/library/liberr"
)
func init() {
service.RegisterTestContactInfo(New())
}
func New() *sTestContactInfo {
return &sTestContactInfo{}
}
type sTestContactInfo struct{}
func (s *sTestContactInfo) List(ctx context.Context, req *test.TestContactInfoSearchReq) (listRes *test.TestContactInfoSearchRes, err error) {
listRes = new(test.TestContactInfoSearchRes)
err = g.Try(ctx, func(ctx context.Context) {
m := dao.TestContactInfo.Ctx(ctx).WithAll()
if req.Id != "" {
m = m.Where(dao.TestContactInfo.Columns().Id+" = ?", req.Id)
}
//1、判断当前用户是否查看所有数据如果不是获取到手机号来查询数据
user := ct.New().GetLoginUser(ctx)
if user.IsData == "2" {
m = m.Where(dao.TestContactInfo.Columns().Creator+" = ?", user.Mobile)
}
if req.OwenerId != "" {
m = m.Where(dao.TestContactInfo.Columns().OwenerId+" = ?", gconv.Uint(req.OwenerId))
}
if req.ContactName != "" {
m = m.Where(dao.TestContactInfo.Columns().ContactName+" like ?", "%"+req.ContactName+"%")
}
if req.ContactPost != "" {
m = m.Where(dao.TestContactInfo.Columns().ContactPost+" like ?", "%"+req.ContactPost+"%")
}
if req.ContactPhone != "" {
m = m.Where(dao.TestContactInfo.Columns().ContactPhone+" = ?", req.ContactPhone)
}
listRes.Total, err = m.Count()
liberr.ErrIsNil(ctx, err, "获取总行数失败")
if req.PageNum == 0 {
req.PageNum = 1
}
listRes.CurrentPage = req.PageNum
if req.PageSize == 0 {
req.PageSize = consts.PageSize
}
order := "id asc"
if req.OrderBy != "" {
order = req.OrderBy
}
var res []*model.TestContactInfoInfoRes
err = m.Fields(test.TestContactInfoSearchRes{}).Page(req.PageNum, req.PageSize).Order(order).Scan(&res)
liberr.ErrIsNil(ctx, err, "获取数据失败")
listRes.List = make([]*model.TestContactInfoListRes, len(res))
for k, v := range res {
listRes.List[k] = &model.TestContactInfoListRes{
Id: v.Id,
OwenerId: v.OwenerId,
LinkedOwenerId: v.LinkedOwenerId,
ContactName: v.ContactName,
ContactPost: v.ContactPost,
ContactPhone: v.ContactPhone,
Creator: v.Creator,
}
}
})
return
}
func (s *sTestContactInfo) GetById(ctx context.Context, id uint) (res *model.TestContactInfoInfoRes, err error) {
err = g.Try(ctx, func(ctx context.Context) {
err = dao.TestContactInfo.Ctx(ctx).WithAll().Where(dao.TestContactInfo.Columns().Id, id).Scan(&res)
liberr.ErrIsNil(ctx, err, "获取信息失败")
})
return
}
func (s *sTestContactInfo) Add(ctx context.Context, req *test.TestContactInfoAddReq) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
if req.WxOrPc == "1" {
req.Creator = ct.New().GetLoginUser(ctx).Mobile
}
_, err = dao.TestContactInfo.Ctx(ctx).Insert(do.TestContactInfo{
OwenerId: req.OwenerId,
ContactName: req.ContactName,
ContactPost: req.ContactPost,
ContactPhone: req.ContactPhone,
Creator: req.Creator,
})
liberr.ErrIsNil(ctx, err, "添加失败")
})
return
}
func (s *sTestContactInfo) Edit(ctx context.Context, req *test.TestContactInfoEditReq) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
if req.WxOrPc == "1" {
req.Creator = ct.New().GetLoginUser(ctx).Mobile
}
_, err = dao.TestContactInfo.Ctx(ctx).WherePri(req.Id).Update(do.TestContactInfo{
OwenerId: req.OwenerId,
ContactName: req.ContactName,
ContactPost: req.ContactPost,
ContactPhone: req.ContactPhone,
Creator: req.Creator,
})
liberr.ErrIsNil(ctx, err, "修改失败")
})
return
}
func (s *sTestContactInfo) Delete(ctx context.Context, ids []uint) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
_, err = dao.TestContactInfo.Ctx(ctx).Delete(dao.TestContactInfo.Columns().Id+" in (?)", ids)
liberr.ErrIsNil(ctx, err, "删除失败")
})
return
}

View File

@ -0,0 +1,171 @@
// ==========================================================================
// GFast自动生成logic操作代码。
// 生成日期2023-09-01 16:38:07
// 生成路径: internal/app/test/logic/test_follow_info.go
// 生成人yqq
// desc:跟进信息
// company:云南奇讯科技有限公司
// ==========================================================================
package logic
import (
"context"
"fmt"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv"
"github.com/tiger1103/gfast/v3/api/v1/test"
"github.com/tiger1103/gfast/v3/internal/app/system/consts"
ct "github.com/tiger1103/gfast/v3/internal/app/system/logic/context"
"github.com/tiger1103/gfast/v3/internal/app/test/dao"
"github.com/tiger1103/gfast/v3/internal/app/test/model"
"github.com/tiger1103/gfast/v3/internal/app/test/model/do"
"github.com/tiger1103/gfast/v3/internal/app/test/service"
"github.com/tiger1103/gfast/v3/library/liberr"
)
func init() {
fmt.Println("注册逻辑层服务")
service.RegisterTestFollowInfo(New())
}
func New() *sTestFollowInfo {
return &sTestFollowInfo{}
}
type sTestFollowInfo struct{}
func (s *sTestFollowInfo) List(ctx context.Context, req *test.TestFollowInfoSearchReq) (listRes *test.TestFollowInfoSearchRes, err error) {
listRes = new(test.TestFollowInfoSearchRes)
err = g.Try(ctx, func(ctx context.Context) {
m := dao.TestFollowInfo.Ctx(ctx).WithAll()
//1、判断当前用户是否查看所有数据如果不是获取到手机号来查询数据
user := ct.New().GetLoginUser(ctx)
if user.IsData == "2" {
m = m.Where(dao.TestFollowInfo.Columns().Creator+" = ?", user.Mobile)
}
if req.Id != "" {
m = m.Where(dao.TestFollowInfo.Columns().Id+" = ?", req.Id)
}
if req.ProjectId != "" {
m = m.Where(dao.TestFollowInfo.Columns().ProjectId+" = ?", gconv.Int(req.ProjectId))
}
if req.FollowName != "" {
m = m.Where(dao.TestFollowInfo.Columns().FollowName+" like ?", "%"+req.FollowName+"%")
}
if req.OwnerId != "" {
m = m.Where(dao.TestFollowInfo.Columns().OwnerId+" = ?", gconv.Uint(req.OwnerId))
}
if req.ContactName != "" {
m = m.Where(dao.TestFollowInfo.Columns().ContactName+" like ?", "%"+req.ContactName+"%")
}
if req.ConPostName != "" {
m = m.Where(dao.TestFollowInfo.Columns().ConPostName+" like ?", "%"+req.ConPostName+"%")
}
if req.ContactPhone != "" {
m = m.Where(dao.TestFollowInfo.Columns().ContactPhone+" = ?", req.ContactPhone)
}
if req.FollowInfo != "" {
m = m.Where(dao.TestFollowInfo.Columns().FollowInfo+" = ?", req.FollowInfo)
}
if req.FollowFile != "" {
m = m.Where(dao.TestFollowInfo.Columns().FollowFile+" = ?", req.FollowFile)
}
if len(req.DateRange) != 0 {
m = m.Where(dao.TestFollowInfo.Columns().CreatedAt+" >=? AND "+dao.TestFollowInfo.Columns().CreatedAt+" <=?", req.DateRange[0], req.DateRange[1])
}
listRes.Total, err = m.Count()
liberr.ErrIsNil(ctx, err, "获取总行数失败")
if req.PageNum == 0 {
req.PageNum = 1
}
listRes.CurrentPage = req.PageNum
if req.PageSize == 0 {
req.PageSize = consts.PageSize
}
order := "id asc"
if req.OrderBy != "" {
order = req.OrderBy
}
var res []*model.TestFollowInfoInfoRes
err = m.Fields(test.TestFollowInfoSearchRes{}).Page(req.PageNum, req.PageSize).Order(order).Scan(&res)
liberr.ErrIsNil(ctx, err, "获取数据失败")
listRes.List = make([]*model.TestFollowInfoListRes, len(res))
for k, v := range res {
listRes.List[k] = &model.TestFollowInfoListRes{
Id: v.Id,
ProjectId: v.ProjectId,
LinkedProjectId: v.LinkedProjectId,
FollowName: v.FollowName,
OwnerId: v.OwnerId,
LinkedOwnerId: v.LinkedOwnerId,
ContactName: v.ContactName,
ConPostName: v.ConPostName,
ContactPhone: v.ContactPhone,
FollowInfo: v.FollowInfo,
FollowFile: v.FollowFile,
CreatedAt: v.CreatedAt,
Creator: v.Creator,
}
}
})
return
}
func (s *sTestFollowInfo) GetById(ctx context.Context, id uint) (res *model.TestFollowInfoInfoRes, err error) {
err = g.Try(ctx, func(ctx context.Context) {
err = dao.TestFollowInfo.Ctx(ctx).WithAll().Where(dao.TestFollowInfo.Columns().Id, id).Scan(&res)
liberr.ErrIsNil(ctx, err, "获取信息失败")
})
return
}
func (s *sTestFollowInfo) Add(ctx context.Context, req *test.TestFollowInfoAddReq) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
if req.WxOrPc == "1" {
req.Creator = ct.New().GetLoginUser(ctx).Mobile
}
_, err = dao.TestFollowInfo.Ctx(ctx).Insert(do.TestFollowInfo{
ProjectId: req.ProjectId,
FollowName: req.FollowName,
OwnerId: req.OwnerId,
ContactName: req.ContactName,
ConPostName: req.ConPostName,
ContactPhone: req.ContactPhone,
FollowInfo: req.FollowInfo,
FollowFile: req.FollowFile,
Creator: req.Creator,
})
liberr.ErrIsNil(ctx, err, "添加失败")
})
return
}
func (s *sTestFollowInfo) Edit(ctx context.Context, req *test.TestFollowInfoEditReq) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
if req.WxOrPc == "1" {
req.Creator = ct.New().GetLoginUser(ctx).Mobile
}
_, err = dao.TestFollowInfo.Ctx(ctx).WherePri(req.Id).Update(do.TestFollowInfo{
ProjectId: req.ProjectId,
FollowName: req.FollowName,
OwnerId: req.OwnerId,
ContactName: req.ContactName,
ConPostName: req.ConPostName,
ContactPhone: req.ContactPhone,
FollowInfo: req.FollowInfo,
FollowFile: req.FollowFile,
Creator: req.Creator,
})
liberr.ErrIsNil(ctx, err, "修改失败")
})
return
}
func (s *sTestFollowInfo) Delete(ctx context.Context, ids []uint) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
_, err = dao.TestFollowInfo.Ctx(ctx).Delete(dao.TestFollowInfo.Columns().Id+" in (?)", ids)
liberr.ErrIsNil(ctx, err, "删除失败")
})
return
}

View File

@ -0,0 +1,156 @@
// ==========================================================================
// GFast自动生成logic操作代码。
// 生成日期2023-09-01 17:51:42
// 生成路径: internal/app/test/logic/test_owner_info.go
// 生成人yqq
// desc:业主方基本情况
// company:云南奇讯科技有限公司
// ==========================================================================
package logic
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv"
"github.com/tiger1103/gfast/v3/api/v1/test"
"github.com/tiger1103/gfast/v3/internal/app/system/consts"
ct "github.com/tiger1103/gfast/v3/internal/app/system/logic/context"
"github.com/tiger1103/gfast/v3/internal/app/test/dao"
"github.com/tiger1103/gfast/v3/internal/app/test/model"
"github.com/tiger1103/gfast/v3/internal/app/test/model/do"
"github.com/tiger1103/gfast/v3/internal/app/test/service"
"github.com/tiger1103/gfast/v3/library/liberr"
)
func init() {
service.RegisterTestOwnerInfo(New())
}
func New() *sTestOwnerInfo {
return &sTestOwnerInfo{}
}
type sTestOwnerInfo struct{}
func (s *sTestOwnerInfo) List(ctx context.Context, req *test.TestOwnerInfoSearchReq) (listRes *test.TestOwnerInfoSearchRes, err error) {
listRes = new(test.TestOwnerInfoSearchRes)
err = g.Try(ctx, func(ctx context.Context) {
m := dao.TestOwnerInfo.Ctx(ctx).WithAll()
//1、判断当前用户是否查看所有数据如果不是获取到手机号来查询数据
user := ct.New().GetLoginUser(ctx)
if user.IsData == "2" {
m = m.Where(dao.TestOwnerInfo.Columns().Creator+" = ?", user.Mobile)
}
if req.Id != "" {
m = m.Where(dao.TestOwnerInfo.Columns().Id+" = ?", req.Id)
}
if req.CompanyName != "" {
m = m.Where(dao.TestOwnerInfo.Columns().CompanyName+" like ?", "%"+req.CompanyName+"%")
}
if req.CompanyAddress != "" {
m = m.Where(dao.TestOwnerInfo.Columns().CompanyAddress+" = ?", req.CompanyAddress)
}
if req.RegistrationType != "" {
m = m.Where(dao.TestOwnerInfo.Columns().RegistrationType+" = ?", req.RegistrationType)
}
if req.RegisteredCapital != "" {
m = m.Where(dao.TestOwnerInfo.Columns().RegisteredCapital+" = ?", gconv.Int(req.RegisteredCapital))
}
if req.Legaler != "" {
m = m.Where(dao.TestOwnerInfo.Columns().Legaler+" like ?", "%"+req.Legaler+"%")
}
if req.LegalerPhone != "" {
m = m.Where(dao.TestOwnerInfo.Columns().LegalerPhone+" = ?", req.LegalerPhone)
}
if len(req.DateRange) != 0 {
m = m.Where(dao.TestOwnerInfo.Columns().CreatedAt+" >=? AND "+dao.TestOwnerInfo.Columns().CreatedAt+" <=?", req.DateRange[0], req.DateRange[1])
}
listRes.Total, err = m.Count()
liberr.ErrIsNil(ctx, err, "获取总行数失败")
if req.PageNum == 0 {
req.PageNum = 1
}
listRes.CurrentPage = req.PageNum
if req.PageSize == 0 {
req.PageSize = consts.PageSize
}
order := "id asc"
if req.OrderBy != "" {
order = req.OrderBy
}
var res []*model.TestOwnerInfoInfoRes
err = m.Fields(test.TestOwnerInfoSearchRes{}).Page(req.PageNum, req.PageSize).Order(order).Scan(&res)
liberr.ErrIsNil(ctx, err, "获取数据失败")
listRes.List = make([]*model.TestOwnerInfoListRes, len(res))
for k, v := range res {
listRes.List[k] = &model.TestOwnerInfoListRes{
Id: v.Id,
CompanyName: v.CompanyName,
CompanyAddress: v.CompanyAddress,
RegistrationType: v.RegistrationType,
RegisteredCapital: v.RegisteredCapital,
Legaler: v.Legaler,
LegalerPhone: v.LegalerPhone,
Children: v.Children,
CreatedAt: v.CreatedAt,
Creator: v.Creator,
}
}
})
return
}
func (s *sTestOwnerInfo) GetById(ctx context.Context, id uint) (res *model.TestOwnerInfoInfoRes, err error) {
err = g.Try(ctx, func(ctx context.Context) {
err = dao.TestOwnerInfo.Ctx(ctx).WithAll().Where(dao.TestOwnerInfo.Columns().Id, id).Scan(&res)
liberr.ErrIsNil(ctx, err, "获取信息失败")
})
return
}
func (s *sTestOwnerInfo) Add(ctx context.Context, req *test.TestOwnerInfoAddReq) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
if req.WxOrPc == "1" {
req.Creator = ct.New().GetLoginUser(ctx).Mobile
}
_, err = dao.TestOwnerInfo.Ctx(ctx).Insert(do.TestOwnerInfo{
CompanyName: req.CompanyName,
CompanyAddress: req.CompanyAddress,
RegistrationType: req.RegistrationType,
RegisteredCapital: req.RegisteredCapital,
Legaler: req.Legaler,
LegalerPhone: req.LegalerPhone,
Creator: req.Creator,
})
liberr.ErrIsNil(ctx, err, "添加失败")
})
return
}
func (s *sTestOwnerInfo) Edit(ctx context.Context, req *test.TestOwnerInfoEditReq) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
if req.WxOrPc == "1" {
req.Creator = ct.New().GetLoginUser(ctx).Mobile
}
_, err = dao.TestOwnerInfo.Ctx(ctx).WherePri(req.Id).Update(do.TestOwnerInfo{
CompanyName: req.CompanyName,
CompanyAddress: req.CompanyAddress,
RegistrationType: req.RegistrationType,
RegisteredCapital: req.RegisteredCapital,
Legaler: req.Legaler,
LegalerPhone: req.LegalerPhone,
Creator: req.Creator,
})
liberr.ErrIsNil(ctx, err, "修改失败")
})
return
}
func (s *sTestOwnerInfo) Delete(ctx context.Context, ids []uint) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
_, err = dao.TestOwnerInfo.Ctx(ctx).Delete(dao.TestOwnerInfo.Columns().Id+" in (?)", ids)
liberr.ErrIsNil(ctx, err, "删除失败")
})
return
}

View File

@ -0,0 +1,165 @@
// ==========================================================================
// GFast自动生成logic操作代码。
// 生成日期2023-09-01 16:15:09
// 生成路径: internal/app/test/logic/test_project_info.go
// 生成人yqq
// desc:项目备案信息
// company:云南奇讯科技有限公司
// ==========================================================================
package logic
import (
"context"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/util/gconv"
"github.com/tiger1103/gfast/v3/api/v1/test"
"github.com/tiger1103/gfast/v3/internal/app/system/consts"
ct "github.com/tiger1103/gfast/v3/internal/app/system/logic/context"
"github.com/tiger1103/gfast/v3/internal/app/test/dao"
"github.com/tiger1103/gfast/v3/internal/app/test/model"
"github.com/tiger1103/gfast/v3/internal/app/test/model/do"
"github.com/tiger1103/gfast/v3/internal/app/test/service"
"github.com/tiger1103/gfast/v3/library/liberr"
)
func init() {
service.RegisterTestProjectInfo(New())
}
func New() *sTestProjectInfo {
return &sTestProjectInfo{}
}
type sTestProjectInfo struct{}
func (s *sTestProjectInfo) List(ctx context.Context, req *test.TestProjectInfoSearchReq) (listRes *test.TestProjectInfoSearchRes, err error) {
listRes = new(test.TestProjectInfoSearchRes)
err = g.Try(ctx, func(ctx context.Context) {
m := dao.TestProjectInfo.Ctx(ctx).WithAll()
//1、判断当前用户是否查看所有数据如果不是获取到手机号来查询数据
user := ct.New().GetLoginUser(ctx)
if user.IsData == "2" {
m = m.Where(dao.TestProjectInfo.Columns().Creator+" = ?", user.Mobile)
}
if req.ProjectAddress != "" {
m = m.Where(dao.TestProjectInfo.Columns().ProjectAddress+" = ?", req.ProjectAddress)
}
if req.ProjectLeader != "" {
m = m.Where(dao.TestProjectInfo.Columns().ProjectLeader+" = ?", req.ProjectLeader)
}
if req.OwnerId != "" {
m = m.Where(dao.TestProjectInfo.Columns().OwnerId+" = ?", gconv.Int(req.OwnerId))
}
if req.ProjectType != "" {
m = m.Where(dao.TestProjectInfo.Columns().ProjectType+" = ?", req.ProjectType)
}
if req.ProjectInfo != "" {
m = m.Where(dao.TestProjectInfo.Columns().ProjectInfo+" = ?", req.ProjectInfo)
}
if req.ProjectState != "" {
m = m.Where(dao.TestProjectInfo.Columns().ProjectState+" = ?", gconv.Int(req.ProjectState))
}
if req.ProjectName != "" {
m = m.Where(dao.TestProjectInfo.Columns().ProjectName+" like ?", "%"+req.ProjectName+"%")
}
if req.ResourceName != "" {
m = m.Where(dao.TestProjectInfo.Columns().ResourceName+" like ?", "%"+req.ResourceName+"%")
}
if len(req.DateRange) != 0 {
m = m.Where(dao.TestProjectInfo.Columns().CreatedAt+" >=? AND "+dao.TestProjectInfo.Columns().CreatedAt+" <=?", req.DateRange[0], req.DateRange[1])
}
listRes.Total, err = m.Count()
liberr.ErrIsNil(ctx, err, "获取总行数失败")
if req.PageNum == 0 {
req.PageNum = 1
}
listRes.CurrentPage = req.PageNum
if req.PageSize == 0 {
req.PageSize = consts.PageSize
}
order := "id asc"
if req.OrderBy != "" {
order = req.OrderBy
}
var res []*model.TestProjectInfoInfoRes
err = m.Fields(test.TestProjectInfoSearchRes{}).Page(req.PageNum, req.PageSize).Order(order).Scan(&res)
liberr.ErrIsNil(ctx, err, "获取数据失败")
listRes.List = make([]*model.TestProjectInfoListRes, len(res))
for k, v := range res {
listRes.List[k] = &model.TestProjectInfoListRes{
Id: v.Id,
ProjectName: v.ProjectName,
ProjectAddress: v.ProjectAddress,
ProjectLeader: v.ProjectLeader,
ResourceName: v.ResourceName,
OwnerId: v.OwnerId,
LinkedOwnerId: v.LinkedOwnerId,
ProjectType: v.ProjectType,
ProjectInfo: v.ProjectInfo,
ProjectState: v.ProjectState,
CreatedAt: v.CreatedAt,
Creator: v.Creator,
}
}
})
return
}
func (s *sTestProjectInfo) GetById(ctx context.Context, id uint) (res *model.TestProjectInfoInfoRes, err error) {
err = g.Try(ctx, func(ctx context.Context) {
err = dao.TestProjectInfo.Ctx(ctx).WithAll().Where(dao.TestProjectInfo.Columns().Id, id).Scan(&res)
liberr.ErrIsNil(ctx, err, "获取信息失败")
})
return
}
func (s *sTestProjectInfo) Add(ctx context.Context, req *test.TestProjectInfoAddReq) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
if req.WxOrPc == "1" {
req.Creator = ct.New().GetLoginUser(ctx).Mobile
}
_, err = dao.TestProjectInfo.Ctx(ctx).Insert(do.TestProjectInfo{
ProjectName: req.ProjectName,
ProjectAddress: req.ProjectAddress,
ProjectLeader: req.ProjectLeader,
ResourceName: req.ResourceName,
OwnerId: req.OwnerId,
ProjectType: req.ProjectType,
ProjectInfo: req.ProjectInfo,
ProjectState: req.ProjectState,
Creator: req.Creator,
})
liberr.ErrIsNil(ctx, err, "添加失败")
})
return
}
func (s *sTestProjectInfo) Edit(ctx context.Context, req *test.TestProjectInfoEditReq) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
if req.WxOrPc == "1" {
req.Creator = ct.New().GetLoginUser(ctx).Mobile
}
_, err = dao.TestProjectInfo.Ctx(ctx).WherePri(req.Id).Update(do.TestProjectInfo{
ProjectName: req.ProjectName,
ProjectAddress: req.ProjectAddress,
ProjectLeader: req.ProjectLeader,
ResourceName: req.ResourceName,
OwnerId: req.OwnerId,
ProjectType: req.ProjectType,
ProjectInfo: req.ProjectInfo,
ProjectState: req.ProjectState,
Creator: req.Creator,
})
liberr.ErrIsNil(ctx, err, "修改失败")
})
return
}
func (s *sTestProjectInfo) Delete(ctx context.Context, ids []uint) (err error) {
err = g.Try(ctx, func(ctx context.Context) {
_, err = dao.TestProjectInfo.Ctx(ctx).Delete(dao.TestProjectInfo.Columns().Id+" in (?)", ids)
liberr.ErrIsNil(ctx, err, "删除失败")
})
return
}