地理分布,国外分布,国内分布,识别特征
This commit is contained in:
parent
484cc1684c
commit
718f4f171e
79
api/v1/businesses/characteristic.go
Normal file
79
api/v1/businesses/characteristic.go
Normal file
@ -0,0 +1,79 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成api操作代码。
|
||||
// 生成日期:2025-08-08 15:18:02
|
||||
// 生成路径: api/v1/businesses/characteristic.go
|
||||
// 生成人:gfast
|
||||
// desc:识别特征相关参数
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package businesses
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
commonApi "github.com/tiger1103/gfast/v3/api/v1/common"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model"
|
||||
)
|
||||
|
||||
// CharacteristicSearchReq 分页请求参数
|
||||
type CharacteristicSearchReq struct {
|
||||
g.Meta `path:"/list" tags:"识别特征" method:"get" summary:"识别特征列表"`
|
||||
commonApi.Author
|
||||
model.CharacteristicSearchReq
|
||||
}
|
||||
|
||||
// CharacteristicSearchRes 列表返回结果
|
||||
type CharacteristicSearchRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
*model.CharacteristicSearchRes
|
||||
}
|
||||
|
||||
// CharacteristicAddReq 添加操作请求参数
|
||||
type CharacteristicAddReq struct {
|
||||
g.Meta `path:"/add" tags:"识别特征" method:"post" summary:"识别特征添加"`
|
||||
commonApi.Author
|
||||
*model.CharacteristicAddReq
|
||||
}
|
||||
|
||||
// CharacteristicAddRes 添加操作返回结果
|
||||
type CharacteristicAddRes struct {
|
||||
commonApi.EmptyRes
|
||||
}
|
||||
|
||||
// CharacteristicEditReq 修改操作请求参数
|
||||
type CharacteristicEditReq struct {
|
||||
g.Meta `path:"/edit" tags:"识别特征" method:"put" summary:"识别特征修改"`
|
||||
commonApi.Author
|
||||
*model.CharacteristicEditReq
|
||||
}
|
||||
|
||||
// CharacteristicEditRes 修改操作返回结果
|
||||
type CharacteristicEditRes struct {
|
||||
commonApi.EmptyRes
|
||||
}
|
||||
|
||||
// CharacteristicGetReq 获取一条数据请求
|
||||
type CharacteristicGetReq struct {
|
||||
g.Meta `path:"/get" tags:"识别特征" method:"get" summary:"获取识别特征信息"`
|
||||
commonApi.Author
|
||||
Id int `p:"id" v:"required#主键必须"` //通过主键获取
|
||||
}
|
||||
|
||||
// CharacteristicGetRes 获取一条数据结果
|
||||
type CharacteristicGetRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
*model.CharacteristicInfoRes
|
||||
}
|
||||
|
||||
// CharacteristicDeleteReq 删除数据请求
|
||||
type CharacteristicDeleteReq struct {
|
||||
g.Meta `path:"/delete" tags:"识别特征" method:"delete" summary:"删除识别特征"`
|
||||
commonApi.Author
|
||||
Ids []int `p:"ids" v:"required#主键必须"` //通过主键删除
|
||||
Version []int `p:"version"`
|
||||
}
|
||||
|
||||
// CharacteristicDeleteRes 删除数据返回
|
||||
type CharacteristicDeleteRes struct {
|
||||
commonApi.EmptyRes
|
||||
}
|
79
api/v1/businesses/domestiDistribuion.go
Normal file
79
api/v1/businesses/domestiDistribuion.go
Normal file
@ -0,0 +1,79 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成api操作代码。
|
||||
// 生成日期:2025-08-08 15:02:58
|
||||
// 生成路径: api/v1/businesses/domesti_distribuion.go
|
||||
// 生成人:gfast
|
||||
// desc:国内分布相关参数
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package businesses
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
commonApi "github.com/tiger1103/gfast/v3/api/v1/common"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model"
|
||||
)
|
||||
|
||||
// DomestiDistribuionSearchReq 分页请求参数
|
||||
type DomestiDistribuionSearchReq struct {
|
||||
g.Meta `path:"/list" tags:"国内分布" method:"get" summary:"国内分布列表"`
|
||||
commonApi.Author
|
||||
model.DomestiDistribuionSearchReq
|
||||
}
|
||||
|
||||
// DomestiDistribuionSearchRes 列表返回结果
|
||||
type DomestiDistribuionSearchRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
*model.DomestiDistribuionSearchRes
|
||||
}
|
||||
|
||||
// DomestiDistribuionAddReq 添加操作请求参数
|
||||
type DomestiDistribuionAddReq struct {
|
||||
g.Meta `path:"/add" tags:"国内分布" method:"post" summary:"国内分布添加"`
|
||||
commonApi.Author
|
||||
*model.DomestiDistribuionAddReq
|
||||
}
|
||||
|
||||
// DomestiDistribuionAddRes 添加操作返回结果
|
||||
type DomestiDistribuionAddRes struct {
|
||||
commonApi.EmptyRes
|
||||
}
|
||||
|
||||
// DomestiDistribuionEditReq 修改操作请求参数
|
||||
type DomestiDistribuionEditReq struct {
|
||||
g.Meta `path:"/edit" tags:"国内分布" method:"put" summary:"国内分布修改"`
|
||||
commonApi.Author
|
||||
*model.DomestiDistribuionEditReq
|
||||
}
|
||||
|
||||
// DomestiDistribuionEditRes 修改操作返回结果
|
||||
type DomestiDistribuionEditRes struct {
|
||||
commonApi.EmptyRes
|
||||
}
|
||||
|
||||
// DomestiDistribuionGetReq 获取一条数据请求
|
||||
type DomestiDistribuionGetReq struct {
|
||||
g.Meta `path:"/get" tags:"国内分布" method:"get" summary:"获取国内分布信息"`
|
||||
commonApi.Author
|
||||
Id int `p:"id" v:"required#主键必须"` //通过主键获取
|
||||
}
|
||||
|
||||
// DomestiDistribuionGetRes 获取一条数据结果
|
||||
type DomestiDistribuionGetRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
*model.DomestiDistribuionInfoRes
|
||||
}
|
||||
|
||||
// DomestiDistribuionDeleteReq 删除数据请求
|
||||
type DomestiDistribuionDeleteReq struct {
|
||||
g.Meta `path:"/delete" tags:"国内分布" method:"delete" summary:"删除国内分布"`
|
||||
commonApi.Author
|
||||
Ids []int `p:"ids" v:"required#主键必须"` //通过主键删除
|
||||
Version []int `p:"version"`
|
||||
}
|
||||
|
||||
// DomestiDistribuionDeleteRes 删除数据返回
|
||||
type DomestiDistribuionDeleteRes struct {
|
||||
commonApi.EmptyRes
|
||||
}
|
79
api/v1/businesses/foreignDistribuion.go
Normal file
79
api/v1/businesses/foreignDistribuion.go
Normal file
@ -0,0 +1,79 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成api操作代码。
|
||||
// 生成日期:2025-08-08 14:59:47
|
||||
// 生成路径: api/v1/businesses/foreign_distribution.go
|
||||
// 生成人:gfast
|
||||
// desc:国外分布相关参数
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package businesses
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
commonApi "github.com/tiger1103/gfast/v3/api/v1/common"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model"
|
||||
)
|
||||
|
||||
// ForeignDistributionSearchReq 分页请求参数
|
||||
type ForeignDistributionSearchReq struct {
|
||||
g.Meta `path:"/list" tags:"国外分布" method:"get" summary:"国外分布列表"`
|
||||
commonApi.Author
|
||||
model.ForeignDistributionSearchReq
|
||||
}
|
||||
|
||||
// ForeignDistributionSearchRes 列表返回结果
|
||||
type ForeignDistributionSearchRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
*model.ForeignDistributionSearchRes
|
||||
}
|
||||
|
||||
// ForeignDistributionAddReq 添加操作请求参数
|
||||
type ForeignDistributionAddReq struct {
|
||||
g.Meta `path:"/add" tags:"国外分布" method:"post" summary:"国外分布添加"`
|
||||
commonApi.Author
|
||||
*model.ForeignDistributionAddReq
|
||||
}
|
||||
|
||||
// ForeignDistributionAddRes 添加操作返回结果
|
||||
type ForeignDistributionAddRes struct {
|
||||
commonApi.EmptyRes
|
||||
}
|
||||
|
||||
// ForeignDistributionEditReq 修改操作请求参数
|
||||
type ForeignDistributionEditReq struct {
|
||||
g.Meta `path:"/edit" tags:"国外分布" method:"put" summary:"国外分布修改"`
|
||||
commonApi.Author
|
||||
*model.ForeignDistributionEditReq
|
||||
}
|
||||
|
||||
// ForeignDistributionEditRes 修改操作返回结果
|
||||
type ForeignDistributionEditRes struct {
|
||||
commonApi.EmptyRes
|
||||
}
|
||||
|
||||
// ForeignDistributionGetReq 获取一条数据请求
|
||||
type ForeignDistributionGetReq struct {
|
||||
g.Meta `path:"/get" tags:"国外分布" method:"get" summary:"获取国外分布信息"`
|
||||
commonApi.Author
|
||||
Id int `p:"id" v:"required#主键必须"` //通过主键获取
|
||||
}
|
||||
|
||||
// ForeignDistributionGetRes 获取一条数据结果
|
||||
type ForeignDistributionGetRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
*model.ForeignDistributionInfoRes
|
||||
}
|
||||
|
||||
// ForeignDistributionDeleteReq 删除数据请求
|
||||
type ForeignDistributionDeleteReq struct {
|
||||
g.Meta `path:"/delete" tags:"国外分布" method:"delete" summary:"删除国外分布"`
|
||||
commonApi.Author
|
||||
Ids []int `p:"ids" v:"required#主键必须"` //通过主键删除
|
||||
Version []int `p:"version"`
|
||||
}
|
||||
|
||||
// ForeignDistributionDeleteRes 删除数据返回
|
||||
type ForeignDistributionDeleteRes struct {
|
||||
commonApi.EmptyRes
|
||||
}
|
79
api/v1/businesses/geography.go
Normal file
79
api/v1/businesses/geography.go
Normal file
@ -0,0 +1,79 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成api操作代码。
|
||||
// 生成日期:2025-08-08 11:21:24
|
||||
// 生成路径: api/v1/businesses/geography.go
|
||||
// 生成人:gfast
|
||||
// desc:地理分布相关参数
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package businesses
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
commonApi "github.com/tiger1103/gfast/v3/api/v1/common"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model"
|
||||
)
|
||||
|
||||
// GeographySearchReq 分页请求参数
|
||||
type GeographySearchReq struct {
|
||||
g.Meta `path:"/list" tags:"地理分布" method:"get" summary:"地理分布列表"`
|
||||
commonApi.Author
|
||||
model.GeographySearchReq
|
||||
}
|
||||
|
||||
// GeographySearchRes 列表返回结果
|
||||
type GeographySearchRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
*model.GeographySearchRes
|
||||
}
|
||||
|
||||
// GeographyAddReq 添加操作请求参数
|
||||
type GeographyAddReq struct {
|
||||
g.Meta `path:"/add" tags:"地理分布" method:"post" summary:"地理分布添加"`
|
||||
commonApi.Author
|
||||
*model.GeographyAddReq
|
||||
}
|
||||
|
||||
// GeographyAddRes 添加操作返回结果
|
||||
type GeographyAddRes struct {
|
||||
commonApi.EmptyRes
|
||||
}
|
||||
|
||||
// GeographyEditReq 修改操作请求参数
|
||||
type GeographyEditReq struct {
|
||||
g.Meta `path:"/edit" tags:"地理分布" method:"put" summary:"地理分布修改"`
|
||||
commonApi.Author
|
||||
*model.GeographyEditReq
|
||||
}
|
||||
|
||||
// GeographyEditRes 修改操作返回结果
|
||||
type GeographyEditRes struct {
|
||||
commonApi.EmptyRes
|
||||
}
|
||||
|
||||
// GeographyGetReq 获取一条数据请求
|
||||
type GeographyGetReq struct {
|
||||
g.Meta `path:"/get" tags:"地理分布" method:"get" summary:"获取地理分布信息"`
|
||||
commonApi.Author
|
||||
Id int `p:"id" v:"required#主键必须"` //通过主键获取
|
||||
}
|
||||
|
||||
// GeographyGetRes 获取一条数据结果
|
||||
type GeographyGetRes struct {
|
||||
g.Meta `mime:"application/json"`
|
||||
*model.GeographyInfoRes
|
||||
}
|
||||
|
||||
// GeographyDeleteReq 删除数据请求
|
||||
type GeographyDeleteReq struct {
|
||||
g.Meta `path:"/delete" tags:"地理分布" method:"delete" summary:"删除地理分布"`
|
||||
commonApi.Author
|
||||
Ids []int `p:"ids" v:"required#主键必须"` //通过主键删除
|
||||
Version []int `p:"version"`
|
||||
}
|
||||
|
||||
// GeographyDeleteRes 删除数据返回
|
||||
type GeographyDeleteRes struct {
|
||||
commonApi.EmptyRes
|
||||
}
|
83
internal/app/businesses/controller/characteristic.go
Normal file
83
internal/app/businesses/controller/characteristic.go
Normal file
@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2025-08-08 15:18:02
|
||||
// 生成路径: internal/app/businesses/controller/characteristic.go
|
||||
// 生成人:gfast
|
||||
// desc:识别特征
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/businesses"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/common"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/service"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/lock"
|
||||
systemController "github.com/tiger1103/gfast/v3/internal/app/system/controller"
|
||||
)
|
||||
|
||||
type characteristicController struct {
|
||||
systemController.BaseController
|
||||
}
|
||||
|
||||
var Characteristic = new(characteristicController)
|
||||
|
||||
// List 列表
|
||||
func (c *characteristicController) List(ctx context.Context, req *businesses.CharacteristicSearchReq) (res *businesses.CharacteristicSearchRes, err error) {
|
||||
res = new(businesses.CharacteristicSearchRes)
|
||||
res.CharacteristicSearchRes, err = service.Characteristic().List(ctx, &req.CharacteristicSearchReq)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取识别特征
|
||||
func (c *characteristicController) Get(ctx context.Context, req *businesses.CharacteristicGetReq) (res *businesses.CharacteristicGetRes, err error) {
|
||||
res = new(businesses.CharacteristicGetRes)
|
||||
res.CharacteristicInfoRes, err = service.Characteristic().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加识别特征
|
||||
func (c *characteristicController) Add(ctx context.Context, req *businesses.CharacteristicAddReq) (res *businesses.CharacteristicAddRes, err error) {
|
||||
err = service.Characteristic().Add(ctx, req.CharacteristicAddReq)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改识别特征
|
||||
func (c *characteristicController) Edit(ctx context.Context, req *businesses.CharacteristicEditReq) (res *businesses.CharacteristicEditRes, err error) {
|
||||
newVersion, err := lock.TryOptimisticLock(ctx, dao.Characteristic.Ctx(ctx), "id", req.Id, req.Version)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Version = newVersion
|
||||
err = service.Characteristic().Edit(ctx, req.CharacteristicEditReq)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除识别特征
|
||||
func (c *characteristicController) Delete(ctx context.Context, req *businesses.CharacteristicDeleteReq) (res *businesses.CharacteristicDeleteRes, err error) {
|
||||
for i, id := range req.Ids {
|
||||
_, err = lock.TryOptimisticLock(ctx, dao.Characteristic.Ctx(ctx), "id", id, req.Version[i])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
err = service.Characteristic().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
func (c *characteristicController) Audit(ctx context.Context, req *common.AuditReq) (res *g.Map, err error) {
|
||||
err = common.Audit.Audit(ctx, dao.Characteristic.Ctx(ctx), req, func(ctx context.Context, req *common.AuditReq) error {
|
||||
return common.Audit.SaveAudit(dao.Characteristic.Ctx(ctx), req)
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &g.Map{
|
||||
"msg": "审核成功",
|
||||
"newVersion": req.Version,
|
||||
}, nil
|
||||
}
|
83
internal/app/businesses/controller/domestiDistribuion.go
Normal file
83
internal/app/businesses/controller/domestiDistribuion.go
Normal file
@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2025-08-08 15:02:58
|
||||
// 生成路径: internal/app/businesses/controller/domesti_distribuion.go
|
||||
// 生成人:gfast
|
||||
// desc:国内分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/businesses"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/common"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/service"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/lock"
|
||||
systemController "github.com/tiger1103/gfast/v3/internal/app/system/controller"
|
||||
)
|
||||
|
||||
type domestiDistribuionController struct {
|
||||
systemController.BaseController
|
||||
}
|
||||
|
||||
var DomestiDistribuion = new(domestiDistribuionController)
|
||||
|
||||
// List 列表
|
||||
func (c *domestiDistribuionController) List(ctx context.Context, req *businesses.DomestiDistribuionSearchReq) (res *businesses.DomestiDistribuionSearchRes, err error) {
|
||||
res = new(businesses.DomestiDistribuionSearchRes)
|
||||
res.DomestiDistribuionSearchRes, err = service.DomestiDistribuion().List(ctx, &req.DomestiDistribuionSearchReq)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取国内分布
|
||||
func (c *domestiDistribuionController) Get(ctx context.Context, req *businesses.DomestiDistribuionGetReq) (res *businesses.DomestiDistribuionGetRes, err error) {
|
||||
res = new(businesses.DomestiDistribuionGetRes)
|
||||
res.DomestiDistribuionInfoRes, err = service.DomestiDistribuion().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加国内分布
|
||||
func (c *domestiDistribuionController) Add(ctx context.Context, req *businesses.DomestiDistribuionAddReq) (res *businesses.DomestiDistribuionAddRes, err error) {
|
||||
err = service.DomestiDistribuion().Add(ctx, req.DomestiDistribuionAddReq)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改国内分布
|
||||
func (c *domestiDistribuionController) Edit(ctx context.Context, req *businesses.DomestiDistribuionEditReq) (res *businesses.DomestiDistribuionEditRes, err error) {
|
||||
newVersion, err := lock.TryOptimisticLock(ctx, dao.DomestiDistribuion.Ctx(ctx), "id", req.Id, req.Version)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Version = newVersion
|
||||
err = service.DomestiDistribuion().Edit(ctx, req.DomestiDistribuionEditReq)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除国内分布
|
||||
func (c *domestiDistribuionController) Delete(ctx context.Context, req *businesses.DomestiDistribuionDeleteReq) (res *businesses.DomestiDistribuionDeleteRes, err error) {
|
||||
for i, id := range req.Ids {
|
||||
_, err = lock.TryOptimisticLock(ctx, dao.DomestiDistribuion.Ctx(ctx), "id", id, req.Version[i])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
err = service.DomestiDistribuion().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
func (c *domestiDistribuionController) Audit(ctx context.Context, req *common.AuditReq) (res *g.Map, err error) {
|
||||
err = common.Audit.Audit(ctx, dao.DomestiDistribuion.Ctx(ctx), req, func(ctx context.Context, req *common.AuditReq) error {
|
||||
return common.Audit.SaveAudit(dao.DomestiDistribuion.Ctx(ctx), req)
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &g.Map{
|
||||
"msg": "审核成功",
|
||||
"newVersion": req.Version,
|
||||
}, nil
|
||||
}
|
84
internal/app/businesses/controller/foreignDistribuion.go
Normal file
84
internal/app/businesses/controller/foreignDistribuion.go
Normal file
@ -0,0 +1,84 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2025-08-08 15:00:02
|
||||
// 生成路径: internal/app/businesses/controller/foreign_distribution.go
|
||||
// 生成人:gfast
|
||||
// desc:国外分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/businesses"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/common"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/service"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/lock"
|
||||
systemController "github.com/tiger1103/gfast/v3/internal/app/system/controller"
|
||||
)
|
||||
|
||||
type foreignDistributionController struct {
|
||||
systemController.BaseController
|
||||
}
|
||||
|
||||
var ForeignDistribution = new(foreignDistributionController)
|
||||
|
||||
// List 列表
|
||||
func (c *foreignDistributionController) List(ctx context.Context, req *businesses.ForeignDistributionSearchReq) (res *businesses.ForeignDistributionSearchRes, err error) {
|
||||
res = new(businesses.ForeignDistributionSearchRes)
|
||||
res.ForeignDistributionSearchRes, err = service.ForeignDistribution().List(ctx, &req.ForeignDistributionSearchReq)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取国外分布
|
||||
func (c *foreignDistributionController) Get(ctx context.Context, req *businesses.ForeignDistributionGetReq) (res *businesses.ForeignDistributionGetRes, err error) {
|
||||
res = new(businesses.ForeignDistributionGetRes)
|
||||
res.ForeignDistributionInfoRes, err = service.ForeignDistribution().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加国外分布
|
||||
func (c *foreignDistributionController) Add(ctx context.Context, req *businesses.ForeignDistributionAddReq) (res *businesses.ForeignDistributionAddRes, err error) {
|
||||
err = service.ForeignDistribution().Add(ctx, req.ForeignDistributionAddReq)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改国外分布
|
||||
func (c *foreignDistributionController) Edit(ctx context.Context, req *businesses.ForeignDistributionEditReq) (res *businesses.ForeignDistributionEditRes, err error) {
|
||||
newVersion, err := lock.TryOptimisticLock(ctx, dao.ForeignDistribution.Ctx(ctx), "id", req.Id, req.Version)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Version = newVersion
|
||||
err = service.ForeignDistribution().Edit(ctx, req.ForeignDistributionEditReq)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除国外分布
|
||||
func (c *foreignDistributionController) Delete(ctx context.Context, req *businesses.ForeignDistributionDeleteReq) (res *businesses.ForeignDistributionDeleteRes, err error) {
|
||||
for i, id := range req.Ids {
|
||||
_, err = lock.TryOptimisticLock(ctx, dao.ForeignDistribution.Ctx(ctx), "id", id, req.Version[i])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
err = service.ForeignDistribution().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *foreignDistributionController) Audit(ctx context.Context, req *common.AuditReq) (res *g.Map, err error) {
|
||||
err = common.Audit.Audit(ctx, dao.ForeignDistribution.Ctx(ctx), req, func(ctx context.Context, req *common.AuditReq) error {
|
||||
return common.Audit.SaveAudit(dao.ForeignDistribution.Ctx(ctx), req)
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &g.Map{
|
||||
"msg": "审核成功",
|
||||
"newVersion": req.Version,
|
||||
}, nil
|
||||
}
|
83
internal/app/businesses/controller/geography.go
Normal file
83
internal/app/businesses/controller/geography.go
Normal file
@ -0,0 +1,83 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成controller操作代码。
|
||||
// 生成日期:2025-08-08 11:21:24
|
||||
// 生成路径: internal/app/businesses/controller/geography.go
|
||||
// 生成人:gfast
|
||||
// desc:地理分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/tiger1103/gfast/v3/api/v1/businesses"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/common"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/service"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/lock"
|
||||
systemController "github.com/tiger1103/gfast/v3/internal/app/system/controller"
|
||||
)
|
||||
|
||||
type geographyController struct {
|
||||
systemController.BaseController
|
||||
}
|
||||
|
||||
var Geography = new(geographyController)
|
||||
|
||||
// List 列表
|
||||
func (c *geographyController) List(ctx context.Context, req *businesses.GeographySearchReq) (res *businesses.GeographySearchRes, err error) {
|
||||
res = new(businesses.GeographySearchRes)
|
||||
res.GeographySearchRes, err = service.Geography().List(ctx, &req.GeographySearchReq)
|
||||
return
|
||||
}
|
||||
|
||||
// Get 获取地理分布
|
||||
func (c *geographyController) Get(ctx context.Context, req *businesses.GeographyGetReq) (res *businesses.GeographyGetRes, err error) {
|
||||
res = new(businesses.GeographyGetRes)
|
||||
res.GeographyInfoRes, err = service.Geography().GetById(ctx, req.Id)
|
||||
return
|
||||
}
|
||||
|
||||
// Add 添加地理分布
|
||||
func (c *geographyController) Add(ctx context.Context, req *businesses.GeographyAddReq) (res *businesses.GeographyAddRes, err error) {
|
||||
err = service.Geography().Add(ctx, req.GeographyAddReq)
|
||||
return
|
||||
}
|
||||
|
||||
// Edit 修改地理分布
|
||||
func (c *geographyController) Edit(ctx context.Context, req *businesses.GeographyEditReq) (res *businesses.GeographyEditRes, err error) {
|
||||
newVersion, err := lock.TryOptimisticLock(ctx, dao.Geography.Ctx(ctx), "id", req.Id, req.Version)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Version = newVersion
|
||||
err = service.Geography().Edit(ctx, req.GeographyEditReq)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete 删除地理分布
|
||||
func (c *geographyController) Delete(ctx context.Context, req *businesses.GeographyDeleteReq) (res *businesses.GeographyDeleteRes, err error) {
|
||||
for i, id := range req.Ids {
|
||||
_, err = lock.TryOptimisticLock(ctx, dao.Geography.Ctx(ctx), "id", id, req.Version[i])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
err = service.Geography().Delete(ctx, req.Ids)
|
||||
return
|
||||
}
|
||||
func (c *geographyController) Audit(ctx context.Context, req *common.AuditReq) (res *g.Map, err error) {
|
||||
err = common.Audit.Audit(ctx, dao.Geography.Ctx(ctx), req, func(ctx context.Context, req *common.AuditReq) error {
|
||||
return common.Audit.SaveAudit(dao.Geography.Ctx(ctx), req)
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &g.Map{
|
||||
"msg": "审核成功",
|
||||
"newVersion": req.Version,
|
||||
}, nil
|
||||
}
|
29
internal/app/businesses/dao/characteristic.go
Normal file
29
internal/app/businesses/dao/characteristic.go
Normal file
@ -0,0 +1,29 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成dao操作代码。
|
||||
// 生成日期:2025-08-08 15:18:02
|
||||
// 生成路径: internal/app/businesses/dao/characteristic.go
|
||||
// 生成人:gfast
|
||||
// desc:识别特征
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/dao/internal"
|
||||
)
|
||||
|
||||
// characteristicDao is the manager for logic model data accessing and custom defined data operations functions management.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type characteristicDao struct {
|
||||
*internal.CharacteristicDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Characteristic is globally public accessible object for table tools_gen_table operations.
|
||||
Characteristic = characteristicDao{
|
||||
internal.NewCharacteristicDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
29
internal/app/businesses/dao/domestiDistribuion.go
Normal file
29
internal/app/businesses/dao/domestiDistribuion.go
Normal file
@ -0,0 +1,29 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成dao操作代码。
|
||||
// 生成日期:2025-08-08 15:02:58
|
||||
// 生成路径: internal/app/businesses/dao/domesti_distribuion.go
|
||||
// 生成人:gfast
|
||||
// desc:国内分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/dao/internal"
|
||||
)
|
||||
|
||||
// domestiDistribuionDao is the manager for logic model data accessing and custom defined data operations functions management.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type domestiDistribuionDao struct {
|
||||
*internal.DomestiDistribuionDao
|
||||
}
|
||||
|
||||
var (
|
||||
// DomestiDistribuion is globally public accessible object for table tools_gen_table operations.
|
||||
DomestiDistribuion = domestiDistribuionDao{
|
||||
internal.NewDomestiDistribuionDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
29
internal/app/businesses/dao/foreignDistribuion.go
Normal file
29
internal/app/businesses/dao/foreignDistribuion.go
Normal file
@ -0,0 +1,29 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成dao操作代码。
|
||||
// 生成日期:2025-08-08 15:00:02
|
||||
// 生成路径: internal/app/businesses/dao/foreign_distribution.go
|
||||
// 生成人:gfast
|
||||
// desc:国外分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/dao/internal"
|
||||
)
|
||||
|
||||
// foreignDistributionDao is the manager for logic model data accessing and custom defined data operations functions management.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type foreignDistributionDao struct {
|
||||
*internal.ForeignDistributionDao
|
||||
}
|
||||
|
||||
var (
|
||||
// ForeignDistribution is globally public accessible object for table tools_gen_table operations.
|
||||
ForeignDistribution = foreignDistributionDao{
|
||||
internal.NewForeignDistributionDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
29
internal/app/businesses/dao/geography.go
Normal file
29
internal/app/businesses/dao/geography.go
Normal file
@ -0,0 +1,29 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成dao操作代码。
|
||||
// 生成日期:2025-08-08 11:21:24
|
||||
// 生成路径: internal/app/businesses/dao/geography.go
|
||||
// 生成人:gfast
|
||||
// desc:地理分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/dao/internal"
|
||||
)
|
||||
|
||||
// geographyDao is the manager for logic model data accessing and custom defined data operations functions management.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type geographyDao struct {
|
||||
*internal.GeographyDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Geography is globally public accessible object for table tools_gen_table operations.
|
||||
Geography = geographyDao{
|
||||
internal.NewGeographyDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
107
internal/app/businesses/dao/internal/characteristic.go
Normal file
107
internal/app/businesses/dao/internal/characteristic.go
Normal file
@ -0,0 +1,107 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成dao internal操作代码。
|
||||
// 生成日期:2025-08-08 15:18:02
|
||||
// 生成路径: internal/app/businesses/dao/internal/characteristic.go
|
||||
// 生成人:gfast
|
||||
// desc:识别特征
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// CharacteristicDao is the manager for logic model data accessing and custom defined data operations functions management.
|
||||
type CharacteristicDao struct {
|
||||
table string // Table is the underlying table name of the DAO.
|
||||
group string // Group is the database configuration group name of current DAO.
|
||||
columns CharacteristicColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// CharacteristicColumns defines and stores column names for table characteristic.
|
||||
type CharacteristicColumns struct {
|
||||
Id string //
|
||||
SpeciesCode string // 物种编码
|
||||
FormCharacteristic string // 形态学特征
|
||||
BiologyCharacteristic string // 分子生物学特征
|
||||
SourcesData string // 数据来源
|
||||
CreateUser string // 数据采集人
|
||||
CreateDate string // 数据采集日期
|
||||
AuditUser string // 数据核查人
|
||||
AuditDate string // 数据核查日期
|
||||
AuditStatus string //
|
||||
AuditView string //
|
||||
Remark string //
|
||||
Version string //
|
||||
CreatedAt string //
|
||||
UpdatedAt string //
|
||||
DeletedAt string //
|
||||
}
|
||||
|
||||
var characteristicColumns = CharacteristicColumns{
|
||||
Id: "id",
|
||||
SpeciesCode: "species_code",
|
||||
FormCharacteristic: "form_characteristic",
|
||||
BiologyCharacteristic: "biology_characteristic",
|
||||
SourcesData: "sources_data",
|
||||
CreateUser: "create_user",
|
||||
CreateDate: "create_date",
|
||||
AuditUser: "audit_user",
|
||||
AuditDate: "audit_date",
|
||||
AuditStatus: "audit_status",
|
||||
AuditView: "audit_view",
|
||||
Remark: "remark",
|
||||
Version: "version",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewCharacteristicDao creates and returns a new DAO object for table data access.
|
||||
func NewCharacteristicDao() *CharacteristicDao {
|
||||
return &CharacteristicDao{
|
||||
group: "default",
|
||||
table: "characteristic",
|
||||
columns: characteristicColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *CharacteristicDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *CharacteristicDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *CharacteristicDao) Columns() CharacteristicColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *CharacteristicDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *CharacteristicDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *CharacteristicDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
111
internal/app/businesses/dao/internal/domestiDistribuion.go
Normal file
111
internal/app/businesses/dao/internal/domestiDistribuion.go
Normal file
@ -0,0 +1,111 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成dao internal操作代码。
|
||||
// 生成日期:2025-08-08 15:02:58
|
||||
// 生成路径: internal/app/businesses/dao/internal/domesti_distribuion.go
|
||||
// 生成人:gfast
|
||||
// desc:国内分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// DomestiDistribuionDao is the manager for logic model data accessing and custom defined data operations functions management.
|
||||
type DomestiDistribuionDao struct {
|
||||
table string // Table is the underlying table name of the DAO.
|
||||
group string // Group is the database configuration group name of current DAO.
|
||||
columns DomestiDistribuionColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// DomestiDistribuionColumns defines and stores column names for table domesti_distribuion.
|
||||
type DomestiDistribuionColumns struct {
|
||||
Id string //
|
||||
SpeciesCode string // 物种编码
|
||||
Province string // 所属省区
|
||||
City string // 所属地级州市
|
||||
County string // 所属区县
|
||||
Year string // 发现年份
|
||||
SourcesData string // 数据来源
|
||||
CreateUser string // 数据采集人
|
||||
CreateDate string // 数据采集日期
|
||||
AuditUser string // 数据核查人
|
||||
AuditDate string // 数据核查日期
|
||||
AuditStatus string //
|
||||
AuditView string //
|
||||
Remark string //
|
||||
Version string //
|
||||
CreatedAt string //
|
||||
UpdatedAt string //
|
||||
DeletedAt string //
|
||||
}
|
||||
|
||||
var domestiDistribuionColumns = DomestiDistribuionColumns{
|
||||
Id: "id",
|
||||
SpeciesCode: "species_code",
|
||||
Province: "province",
|
||||
City: "city",
|
||||
County: "county",
|
||||
Year: "year",
|
||||
SourcesData: "sources_data",
|
||||
CreateUser: "create_user",
|
||||
CreateDate: "create_date",
|
||||
AuditUser: "audit_user",
|
||||
AuditDate: "audit_date",
|
||||
AuditStatus: "audit_status",
|
||||
AuditView: "audit_view",
|
||||
Remark: "remark",
|
||||
Version: "version",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewDomestiDistribuionDao creates and returns a new DAO object for table data access.
|
||||
func NewDomestiDistribuionDao() *DomestiDistribuionDao {
|
||||
return &DomestiDistribuionDao{
|
||||
group: "default",
|
||||
table: "domesti_distribuion",
|
||||
columns: domestiDistribuionColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *DomestiDistribuionDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *DomestiDistribuionDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *DomestiDistribuionDao) Columns() DomestiDistribuionColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *DomestiDistribuionDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *DomestiDistribuionDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *DomestiDistribuionDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
111
internal/app/businesses/dao/internal/foreignDistribuion.go
Normal file
111
internal/app/businesses/dao/internal/foreignDistribuion.go
Normal file
@ -0,0 +1,111 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成dao internal操作代码。
|
||||
// 生成日期:2025-08-08 15:00:02
|
||||
// 生成路径: internal/app/businesses/dao/internal/foreign_distribution.go
|
||||
// 生成人:gfast
|
||||
// desc:国外分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// ForeignDistributionDao is the manager for logic model data accessing and custom defined data operations functions management.
|
||||
type ForeignDistributionDao struct {
|
||||
table string // Table is the underlying table name of the DAO.
|
||||
group string // Group is the database configuration group name of current DAO.
|
||||
columns ForeignDistributionColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// ForeignDistributionColumns defines and stores column names for table foreign_distribution.
|
||||
type ForeignDistributionColumns struct {
|
||||
Id string //
|
||||
SpeciesCode string // 物种编码
|
||||
Continent string // 所属大洲
|
||||
Region string // 所属国家/地区
|
||||
BelongState string // 所属州
|
||||
Year string // 发现/报道年份
|
||||
References string // 参考文献
|
||||
CreateUser string // 数据采集人
|
||||
CreateDate string // 数据采集日期
|
||||
AuditUser string // 数据核查人
|
||||
AuditDate string // 数据核查日期
|
||||
AuditStatus string //
|
||||
AuditView string //
|
||||
Remark string //
|
||||
Version string //
|
||||
CreatedAt string //
|
||||
UpdatedAt string //
|
||||
DeletedAt string //
|
||||
}
|
||||
|
||||
var foreignDistributionColumns = ForeignDistributionColumns{
|
||||
Id: "id",
|
||||
SpeciesCode: "species_code",
|
||||
Continent: "continent",
|
||||
Region: "region",
|
||||
BelongState: "belong_state",
|
||||
Year: "year",
|
||||
References: "references",
|
||||
CreateUser: "create_user",
|
||||
CreateDate: "create_date",
|
||||
AuditUser: "audit_user",
|
||||
AuditDate: "audit_date",
|
||||
AuditStatus: "audit_status",
|
||||
AuditView: "audit_view",
|
||||
Remark: "remark",
|
||||
Version: "version",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewForeignDistributionDao creates and returns a new DAO object for table data access.
|
||||
func NewForeignDistributionDao() *ForeignDistributionDao {
|
||||
return &ForeignDistributionDao{
|
||||
group: "default",
|
||||
table: "foreign_distribution",
|
||||
columns: foreignDistributionColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *ForeignDistributionDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *ForeignDistributionDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *ForeignDistributionDao) Columns() ForeignDistributionColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *ForeignDistributionDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *ForeignDistributionDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *ForeignDistributionDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
109
internal/app/businesses/dao/internal/geography.go
Normal file
109
internal/app/businesses/dao/internal/geography.go
Normal file
@ -0,0 +1,109 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成dao internal操作代码。
|
||||
// 生成日期:2025-08-08 11:21:24
|
||||
// 生成路径: internal/app/businesses/dao/internal/geography.go
|
||||
// 生成人:gfast
|
||||
// desc:地理分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// GeographyDao is the manager for logic model data accessing and custom defined data operations functions management.
|
||||
type GeographyDao struct {
|
||||
table string // Table is the underlying table name of the DAO.
|
||||
group string // Group is the database configuration group name of current DAO.
|
||||
columns GeographyColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// GeographyColumns defines and stores column names for table geography.
|
||||
type GeographyColumns struct {
|
||||
Id string //
|
||||
SpeciesCode string // 物种编码
|
||||
DistributionInfo string // 地理分布描述
|
||||
OriginInfo string // 原产地描述
|
||||
AbroadInfo string // 国外分布描述
|
||||
DomesticInfo string // 国内分布描述
|
||||
CreateUser string // 数据采集人
|
||||
CreateDate string // 数据采集日期
|
||||
AuditUser string // 数据核查人
|
||||
AuditDate string // 数据核查日期
|
||||
AuditStatus string // 核查状态
|
||||
AuditView string // 核查意见
|
||||
Remark string // 备注
|
||||
Version string //
|
||||
CreatedAt string //
|
||||
UpdatedAt string //
|
||||
DeletedAt string //
|
||||
}
|
||||
|
||||
var geographyColumns = GeographyColumns{
|
||||
Id: "id",
|
||||
SpeciesCode: "species_code",
|
||||
DistributionInfo: "distribution_info",
|
||||
OriginInfo: "origin_info",
|
||||
AbroadInfo: "abroad_info",
|
||||
DomesticInfo: "domestic_info",
|
||||
CreateUser: "create_user",
|
||||
CreateDate: "create_date",
|
||||
AuditUser: "audit_user",
|
||||
AuditDate: "audit_date",
|
||||
AuditStatus: "audit_status",
|
||||
AuditView: "audit_view",
|
||||
Remark: "remark",
|
||||
Version: "version",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewGeographyDao creates and returns a new DAO object for table data access.
|
||||
func NewGeographyDao() *GeographyDao {
|
||||
return &GeographyDao{
|
||||
group: "default",
|
||||
table: "geography",
|
||||
columns: geographyColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *GeographyDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *GeographyDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *GeographyDao) Columns() GeographyColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *GeographyDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *GeographyDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *GeographyDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
202
internal/app/businesses/logic/characteristic.go
Normal file
202
internal/app/businesses/logic/characteristic.go
Normal file
@ -0,0 +1,202 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成logic操作代码。
|
||||
// 生成日期:2025-08-08 15:18:02
|
||||
// 生成路径: internal/app/businesses/logic/characteristic.go
|
||||
// 生成人:gfast
|
||||
// desc:识别特征
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model/do"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/service"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/consts"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
)
|
||||
|
||||
func init() {
|
||||
service.RegisterCharacteristic(NewICharacteristic())
|
||||
}
|
||||
|
||||
func NewICharacteristic() service.ICharacteristic {
|
||||
return &sCharacteristic{}
|
||||
}
|
||||
|
||||
type sCharacteristic struct{}
|
||||
|
||||
func (s *sCharacteristic) List(ctx context.Context, req *model.CharacteristicSearchReq) (listRes *model.CharacteristicSearchRes, err error) {
|
||||
listRes = new(model.CharacteristicSearchRes)
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
m := dao.Characteristic.Ctx(ctx).WithAll()
|
||||
if req.Id != "" {
|
||||
m = m.Where(dao.Characteristic.Columns().Id+" = ?", req.Id)
|
||||
}
|
||||
if req.SpeciesCode != "" {
|
||||
m = m.Where(dao.Characteristic.Columns().SpeciesCode+" like ?", "%"+req.SpeciesCode+"%")
|
||||
}
|
||||
if req.FormCharacteristic != "" {
|
||||
m = m.Where(dao.Characteristic.Columns().FormCharacteristic+" like ?", "%"+req.FormCharacteristic+"%")
|
||||
}
|
||||
if req.BiologyCharacteristic != "" {
|
||||
m = m.Where(dao.Characteristic.Columns().BiologyCharacteristic+" like ?", "%"+req.BiologyCharacteristic+"%")
|
||||
}
|
||||
if req.SourcesData != "" {
|
||||
m = m.Where(dao.Characteristic.Columns().SourcesData+" like ?", "%"+req.SourcesData+"%")
|
||||
}
|
||||
if req.CreateUser != "" {
|
||||
m = m.Where(dao.Characteristic.Columns().CreateUser+" = ?", gconv.Int(req.CreateUser))
|
||||
}
|
||||
if req.AuditUser != "" {
|
||||
m = m.Where(dao.Characteristic.Columns().AuditUser+" = ?", gconv.Int(req.AuditUser))
|
||||
}
|
||||
if req.AuditStatus != "" {
|
||||
m = m.Where(dao.Characteristic.Columns().AuditStatus+" = ?", gconv.Int(req.AuditStatus))
|
||||
}
|
||||
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.CharacteristicListRes
|
||||
err = m.Page(req.PageNum, req.PageSize).Order(order).Scan(&res)
|
||||
liberr.ErrIsNil(ctx, err, "获取数据失败")
|
||||
listRes.List = make([]*model.CharacteristicListRes, len(res))
|
||||
for k, v := range res {
|
||||
listRes.List[k] = &model.CharacteristicListRes{
|
||||
Id: v.Id,
|
||||
SpeciesCode: v.SpeciesCode,
|
||||
FormCharacteristic: v.FormCharacteristic,
|
||||
BiologyCharacteristic: v.BiologyCharacteristic,
|
||||
SourcesData: v.SourcesData,
|
||||
CreateUser: v.CreateUser,
|
||||
CreateDate: v.CreateDate,
|
||||
AuditUser: v.AuditUser,
|
||||
AuditDate: v.AuditDate,
|
||||
AuditStatus: v.AuditStatus,
|
||||
AuditView: v.AuditView,
|
||||
Remark: v.Remark,
|
||||
Version: v.Version,
|
||||
CreatedAt: v.CreatedAt,
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sCharacteristic) GetById(ctx context.Context, id int) (res *model.CharacteristicInfoRes, err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
err = dao.Characteristic.Ctx(ctx).WithAll().Where(dao.Characteristic.Columns().Id, id).Scan(&res)
|
||||
liberr.ErrIsNil(ctx, err, "获取信息失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sCharacteristic) Add(ctx context.Context, req *model.CharacteristicAddReq) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
speciesNameCount, err := dao.SpeciesName.Ctx(ctx).Where(dao.SpeciesName.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
}
|
||||
if speciesNameCount == 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码不存在"), "物种编码不存在")
|
||||
return
|
||||
}
|
||||
//查重
|
||||
count, err := dao.Characteristic.Ctx(ctx).Where(dao.Characteristic.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
|
||||
}
|
||||
if count > 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("请勿重复添加"), "请勿重复添加")
|
||||
return
|
||||
}
|
||||
_, err = dao.Characteristic.Ctx(ctx).Insert(do.Characteristic{
|
||||
Id: req.Id,
|
||||
SpeciesCode: req.SpeciesCode,
|
||||
FormCharacteristic: req.FormCharacteristic,
|
||||
BiologyCharacteristic: req.BiologyCharacteristic,
|
||||
SourcesData: req.SourcesData,
|
||||
CreateUser: req.CreateUser,
|
||||
CreateDate: req.CreateDate,
|
||||
//AuditUser: req.AuditUser,
|
||||
//AuditDate: req.AuditDate,
|
||||
AuditStatus: req.AuditStatus,
|
||||
//AuditView: req.AuditView,
|
||||
Remark: req.Remark,
|
||||
//Version: req.Version,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "添加失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sCharacteristic) Edit(ctx context.Context, req *model.CharacteristicEditReq) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
speciesNameCount, err := dao.SpeciesName.Ctx(ctx).Where(dao.SpeciesName.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "物种编码不存在")
|
||||
return
|
||||
}
|
||||
if speciesNameCount == 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码不存在"), "物种编码不存在")
|
||||
return
|
||||
}
|
||||
count, err := dao.Characteristic.Ctx(ctx).
|
||||
Where(dao.Characteristic.Columns().SpeciesCode+" = ?", req.SpeciesCode).
|
||||
WhereNot(dao.Characteristic.Columns().Id, req.Id). // 排除当前记录
|
||||
Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
}
|
||||
if count > 0 {
|
||||
// 使用非nil错误触发错误处理
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码已存在"), "请勿重复添加")
|
||||
return
|
||||
}
|
||||
_, err = dao.Characteristic.Ctx(ctx).WherePri(req.Id).Update(do.Characteristic{
|
||||
SpeciesCode: req.SpeciesCode,
|
||||
FormCharacteristic: req.FormCharacteristic,
|
||||
BiologyCharacteristic: req.BiologyCharacteristic,
|
||||
SourcesData: req.SourcesData,
|
||||
CreateUser: req.CreateUser,
|
||||
CreateDate: req.CreateDate,
|
||||
//AuditUser: req.AuditUser,
|
||||
//AuditDate: req.AuditDate,
|
||||
AuditStatus: req.AuditStatus,
|
||||
//AuditView: req.AuditView,
|
||||
Remark: req.Remark,
|
||||
Version: req.Version,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "修改失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sCharacteristic) Delete(ctx context.Context, ids []int) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
_, err = dao.Characteristic.Ctx(ctx).Delete(dao.Characteristic.Columns().Id+" in (?)", ids)
|
||||
liberr.ErrIsNil(ctx, err, "删除失败")
|
||||
})
|
||||
return
|
||||
}
|
@ -2,6 +2,7 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
@ -173,6 +174,27 @@ func (s *sClassifyStatuse) GetBySpeciesCode(ctx context.Context, id int) (res *m
|
||||
|
||||
func (s *sClassifyStatuse) Add(ctx context.Context, req *model.ClassifyStatuseAddReq) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
//查询是否存在
|
||||
speciesNameCount, err := dao.SpeciesName.Ctx(ctx).Where(dao.SpeciesName.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
}
|
||||
if speciesNameCount == 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码不存在"), "物种编码不存在")
|
||||
return
|
||||
}
|
||||
//查重
|
||||
count, err := dao.ClassifyStatuse.Ctx(ctx).Where(dao.ClassifyStatuse.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
|
||||
}
|
||||
if count > 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("请勿重复添加"), "请勿重复添加")
|
||||
return
|
||||
}
|
||||
_, err = dao.ClassifyStatuse.Ctx(ctx).Insert(do.ClassifyStatuse{
|
||||
Id: req.Id,
|
||||
Jie: req.Jie,
|
||||
@ -204,7 +226,30 @@ func (s *sClassifyStatuse) Add(ctx context.Context, req *model.ClassifyStatuseAd
|
||||
|
||||
func (s *sClassifyStatuse) Edit(ctx context.Context, req *model.ClassifyStatuseEditReq) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
_, err = dao.ClassifyStatuse.Ctx(ctx).WherePri(req.Id).Update(do.ClassifyStatuse{
|
||||
// 查询物种编码是否存在
|
||||
speciesNameCount, err := dao.SpeciesName.Ctx(ctx).Where(dao.SpeciesName.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "物种编码不存在")
|
||||
return
|
||||
}
|
||||
if speciesNameCount == 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码不存在"), "物种编码不存在")
|
||||
return
|
||||
}
|
||||
count, err := dao.ClassifyStatuse.Ctx(ctx).
|
||||
Where(dao.ClassifyStatuse.Columns().SpeciesCode+" = ?", req.SpeciesCode).
|
||||
WhereNot(dao.ClassifyStatuse.Columns().Id, req.Id). // 排除当前记录
|
||||
Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
}
|
||||
if count > 0 {
|
||||
// 使用非nil错误触发错误处理
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码已存在"), "请勿重复添加")
|
||||
return
|
||||
}
|
||||
_, err = dao.ClassifyStatuse.Ctx(ctx).Where(dao.ClassifyStatuse.Columns().Id+" = ?", req.Id).Update(do.ClassifyStatuse{
|
||||
Jie: req.Jie,
|
||||
Kingdom: req.Kingdom,
|
||||
SpeciesCode: req.SpeciesCode,
|
||||
@ -226,6 +271,7 @@ func (s *sClassifyStatuse) Edit(ctx context.Context, req *model.ClassifyStatuseE
|
||||
CreateDate: req.CreateDate,
|
||||
Remark: req.Remark,
|
||||
Version: req.Version,
|
||||
AuditStatus: req.AuditStatus,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "修改失败")
|
||||
})
|
||||
|
211
internal/app/businesses/logic/domestiDistribuion.go
Normal file
211
internal/app/businesses/logic/domestiDistribuion.go
Normal file
@ -0,0 +1,211 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成logic操作代码。
|
||||
// 生成日期:2025-08-08 15:02:58
|
||||
// 生成路径: internal/app/businesses/logic/domesti_distribuion.go
|
||||
// 生成人:gfast
|
||||
// desc:国内分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model/do"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/service"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/consts"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
)
|
||||
|
||||
func init() {
|
||||
service.RegisterDomestiDistribuion(NewIDomestiDistribuion())
|
||||
}
|
||||
|
||||
func NewIDomestiDistribuion() service.IDomestiDistribuion {
|
||||
return &sDomestiDistribuion{}
|
||||
}
|
||||
|
||||
type sDomestiDistribuion struct{}
|
||||
|
||||
func (s *sDomestiDistribuion) List(ctx context.Context, req *model.DomestiDistribuionSearchReq) (listRes *model.DomestiDistribuionSearchRes, err error) {
|
||||
listRes = new(model.DomestiDistribuionSearchRes)
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
m := dao.DomestiDistribuion.Ctx(ctx).WithAll()
|
||||
if req.Id != "" {
|
||||
m = m.Where(dao.DomestiDistribuion.Columns().Id+" = ?", req.Id)
|
||||
}
|
||||
if req.SpeciesCode != "" {
|
||||
m = m.Where(dao.DomestiDistribuion.Columns().SpeciesCode+" like ?", "%"+req.SpeciesCode+"%")
|
||||
}
|
||||
if req.Province != "" {
|
||||
m = m.Where(dao.DomestiDistribuion.Columns().Province+" like ?", "%"+req.Province+"%")
|
||||
}
|
||||
if req.City != "" {
|
||||
m = m.Where(dao.DomestiDistribuion.Columns().City+" like ?", "%"+req.City+"%")
|
||||
}
|
||||
if req.County != "" {
|
||||
m = m.Where(dao.DomestiDistribuion.Columns().County+" like ?", "%"+req.County+"%")
|
||||
}
|
||||
if req.Year != "" {
|
||||
m = m.Where(dao.DomestiDistribuion.Columns().Year+" like ?", "%"+req.Year+"%")
|
||||
}
|
||||
if req.SourcesData != "" {
|
||||
m = m.Where(dao.DomestiDistribuion.Columns().SourcesData+" like ?", "%"+req.SourcesData+"%")
|
||||
}
|
||||
if req.CreateUser != "" {
|
||||
m = m.Where(dao.DomestiDistribuion.Columns().CreateUser+" = ?", gconv.Int(req.CreateUser))
|
||||
}
|
||||
if req.AuditStatus != "" {
|
||||
m = m.Where(dao.DomestiDistribuion.Columns().AuditStatus+" = ?", gconv.Int(req.AuditStatus))
|
||||
}
|
||||
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.DomestiDistribuionListRes
|
||||
err = m.Page(req.PageNum, req.PageSize).Order(order).Scan(&res)
|
||||
liberr.ErrIsNil(ctx, err, "获取数据失败")
|
||||
listRes.List = make([]*model.DomestiDistribuionListRes, len(res))
|
||||
for k, v := range res {
|
||||
listRes.List[k] = &model.DomestiDistribuionListRes{
|
||||
Id: v.Id,
|
||||
SpeciesCode: v.SpeciesCode,
|
||||
Province: v.Province,
|
||||
City: v.City,
|
||||
County: v.County,
|
||||
Year: v.Year,
|
||||
SourcesData: v.SourcesData,
|
||||
CreateUser: v.CreateUser,
|
||||
CreateDate: v.CreateDate,
|
||||
AuditUser: v.AuditUser,
|
||||
AuditDate: v.AuditDate,
|
||||
AuditStatus: v.AuditStatus,
|
||||
AuditView: v.AuditView,
|
||||
Remark: v.Remark,
|
||||
Version: v.Version,
|
||||
CreatedAt: v.CreatedAt,
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sDomestiDistribuion) GetById(ctx context.Context, id int) (res *model.DomestiDistribuionInfoRes, err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
err = dao.DomestiDistribuion.Ctx(ctx).WithAll().Where(dao.DomestiDistribuion.Columns().Id, id).Scan(&res)
|
||||
liberr.ErrIsNil(ctx, err, "获取信息失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sDomestiDistribuion) Add(ctx context.Context, req *model.DomestiDistribuionAddReq) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
speciesNameCount, err := dao.SpeciesName.Ctx(ctx).Where(dao.SpeciesName.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
}
|
||||
if speciesNameCount == 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码不存在"), "物种编码不存在")
|
||||
return
|
||||
}
|
||||
//查重
|
||||
count, err := dao.DomestiDistribuion.Ctx(ctx).Where(dao.DomestiDistribuion.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
|
||||
}
|
||||
if count > 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("请勿重复添加"), "请勿重复添加")
|
||||
return
|
||||
}
|
||||
_, err = dao.DomestiDistribuion.Ctx(ctx).Insert(do.DomestiDistribuion{
|
||||
Id: req.Id,
|
||||
SpeciesCode: req.SpeciesCode,
|
||||
Province: req.Province,
|
||||
City: req.City,
|
||||
County: req.County,
|
||||
Year: req.Year,
|
||||
SourcesData: req.SourcesData,
|
||||
CreateUser: req.CreateUser,
|
||||
CreateDate: req.CreateDate,
|
||||
//AuditUser: req.AuditUser,
|
||||
//AuditDate: req.AuditDate,
|
||||
AuditStatus: req.AuditStatus,
|
||||
//AuditView: req.AuditView,
|
||||
Remark: req.Remark,
|
||||
//Version: req.Version,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "添加失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sDomestiDistribuion) Edit(ctx context.Context, req *model.DomestiDistribuionEditReq) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
speciesNameCount, err := dao.SpeciesName.Ctx(ctx).Where(dao.SpeciesName.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "物种编码不存在")
|
||||
return
|
||||
}
|
||||
if speciesNameCount == 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码不存在"), "物种编码不存在")
|
||||
return
|
||||
}
|
||||
count, err := dao.DomestiDistribuion.Ctx(ctx).
|
||||
Where(dao.DomestiDistribuion.Columns().SpeciesCode+" = ?", req.SpeciesCode).
|
||||
WhereNot(dao.DomestiDistribuion.Columns().Id, req.Id). // 排除当前记录
|
||||
Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
}
|
||||
if count > 0 {
|
||||
// 使用非nil错误触发错误处理
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码已存在"), "请勿重复添加")
|
||||
return
|
||||
}
|
||||
_, err = dao.DomestiDistribuion.Ctx(ctx).WherePri(req.Id).Update(do.DomestiDistribuion{
|
||||
SpeciesCode: req.SpeciesCode,
|
||||
Province: req.Province,
|
||||
City: req.City,
|
||||
County: req.County,
|
||||
Year: req.Year,
|
||||
SourcesData: req.SourcesData,
|
||||
CreateUser: req.CreateUser,
|
||||
CreateDate: req.CreateDate,
|
||||
//AuditUser: req.AuditUser,
|
||||
//AuditDate: req.AuditDate,
|
||||
AuditStatus: req.AuditStatus,
|
||||
//AuditView: req.AuditView,
|
||||
Remark: req.Remark,
|
||||
Version: req.Version,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "修改失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sDomestiDistribuion) Delete(ctx context.Context, ids []int) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
_, err = dao.DomestiDistribuion.Ctx(ctx).Delete(dao.DomestiDistribuion.Columns().Id+" in (?)", ids)
|
||||
liberr.ErrIsNil(ctx, err, "删除失败")
|
||||
})
|
||||
return
|
||||
}
|
211
internal/app/businesses/logic/foreignDistribuion.go
Normal file
211
internal/app/businesses/logic/foreignDistribuion.go
Normal file
@ -0,0 +1,211 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成logic操作代码。
|
||||
// 生成日期:2025-08-08 15:00:02
|
||||
// 生成路径: internal/app/businesses/logic/foreign_distribution.go
|
||||
// 生成人:gfast
|
||||
// desc:国外分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model/do"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/service"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/consts"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
)
|
||||
|
||||
func init() {
|
||||
service.RegisterForeignDistribution(NewIForeignDistribution())
|
||||
}
|
||||
|
||||
func NewIForeignDistribution() service.IForeignDistribution {
|
||||
return &sForeignDistribution{}
|
||||
}
|
||||
|
||||
type sForeignDistribution struct{}
|
||||
|
||||
func (s *sForeignDistribution) List(ctx context.Context, req *model.ForeignDistributionSearchReq) (listRes *model.ForeignDistributionSearchRes, err error) {
|
||||
listRes = new(model.ForeignDistributionSearchRes)
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
m := dao.ForeignDistribution.Ctx(ctx).WithAll()
|
||||
if req.Id != "" {
|
||||
m = m.Where(dao.ForeignDistribution.Columns().Id+" = ?", req.Id)
|
||||
}
|
||||
if req.SpeciesCode != "" {
|
||||
m = m.Where(dao.ForeignDistribution.Columns().SpeciesCode+" like ?", "%"+req.SpeciesCode+"%")
|
||||
}
|
||||
if req.Continent != "" {
|
||||
m = m.Where(dao.ForeignDistribution.Columns().Continent+" like ?", "%"+req.Continent+"%")
|
||||
}
|
||||
if req.Region != "" {
|
||||
m = m.Where(dao.ForeignDistribution.Columns().Region+" like ?", "%"+req.Region+"%")
|
||||
}
|
||||
if req.BelongState != "" {
|
||||
m = m.Where(dao.ForeignDistribution.Columns().BelongState+" like ?", "%"+req.BelongState+"%")
|
||||
}
|
||||
if req.Year != "" {
|
||||
m = m.Where(dao.ForeignDistribution.Columns().Year+" like ?", "%"+req.Year+"%")
|
||||
}
|
||||
if req.References != "" {
|
||||
m = m.Where("`references` like ?", "%"+req.References+"%")
|
||||
}
|
||||
if req.CreateUser != "" {
|
||||
m = m.Where(dao.ForeignDistribution.Columns().CreateUser+" = ?", gconv.Int(req.CreateUser))
|
||||
}
|
||||
if req.AuditStatus != "" {
|
||||
m = m.Where(dao.ForeignDistribution.Columns().AuditStatus+" = ?", gconv.Int(req.AuditStatus))
|
||||
}
|
||||
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.ForeignDistributionListRes
|
||||
err = m.Page(req.PageNum, req.PageSize).Order(order).Scan(&res)
|
||||
liberr.ErrIsNil(ctx, err, "获取数据失败")
|
||||
listRes.List = make([]*model.ForeignDistributionListRes, len(res))
|
||||
for k, v := range res {
|
||||
listRes.List[k] = &model.ForeignDistributionListRes{
|
||||
Id: v.Id,
|
||||
SpeciesCode: v.SpeciesCode,
|
||||
Continent: v.Continent,
|
||||
Region: v.Region,
|
||||
BelongState: v.BelongState,
|
||||
Year: v.Year,
|
||||
References: v.References,
|
||||
CreateUser: v.CreateUser,
|
||||
CreateDate: v.CreateDate,
|
||||
AuditUser: v.AuditUser,
|
||||
AuditDate: v.AuditDate,
|
||||
AuditStatus: v.AuditStatus,
|
||||
AuditView: v.AuditView,
|
||||
Remark: v.Remark,
|
||||
Version: v.Version,
|
||||
CreatedAt: v.CreatedAt,
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sForeignDistribution) GetById(ctx context.Context, id int) (res *model.ForeignDistributionInfoRes, err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
err = dao.ForeignDistribution.Ctx(ctx).WithAll().Where(dao.ForeignDistribution.Columns().Id, id).Scan(&res)
|
||||
liberr.ErrIsNil(ctx, err, "获取信息失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sForeignDistribution) Add(ctx context.Context, req *model.ForeignDistributionAddReq) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
speciesNameCount, err := dao.SpeciesName.Ctx(ctx).Where(dao.SpeciesName.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
}
|
||||
if speciesNameCount == 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码不存在"), "物种编码不存在")
|
||||
return
|
||||
}
|
||||
//查重
|
||||
count, err := dao.ForeignDistribution.Ctx(ctx).Where(dao.ForeignDistribution.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
|
||||
}
|
||||
if count > 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("请勿重复添加"), "请勿重复添加")
|
||||
return
|
||||
}
|
||||
_, err = dao.ForeignDistribution.Ctx(ctx).Insert(do.ForeignDistribution{
|
||||
Id: req.Id,
|
||||
SpeciesCode: req.SpeciesCode,
|
||||
Continent: req.Continent,
|
||||
Region: req.Region,
|
||||
BelongState: req.BelongState,
|
||||
Year: req.Year,
|
||||
References: req.References,
|
||||
CreateUser: req.CreateUser,
|
||||
CreateDate: req.CreateDate,
|
||||
//AuditUser: req.AuditUser,
|
||||
//AuditDate: req.AuditDate,
|
||||
AuditStatus: req.AuditStatus,
|
||||
//AuditView: req.AuditView,
|
||||
Remark: req.Remark,
|
||||
//Version: req.Version,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "添加失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sForeignDistribution) Edit(ctx context.Context, req *model.ForeignDistributionEditReq) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
speciesNameCount, err := dao.SpeciesName.Ctx(ctx).Where(dao.SpeciesName.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "物种编码不存在")
|
||||
return
|
||||
}
|
||||
if speciesNameCount == 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码不存在"), "物种编码不存在")
|
||||
return
|
||||
}
|
||||
count, err := dao.ForeignDistribution.Ctx(ctx).
|
||||
Where(dao.ForeignDistribution.Columns().SpeciesCode+" = ?", req.SpeciesCode).
|
||||
WhereNot(dao.ForeignDistribution.Columns().Id, req.Id). // 排除当前记录
|
||||
Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
}
|
||||
if count > 0 {
|
||||
// 使用非nil错误触发错误处理
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码已存在"), "请勿重复添加")
|
||||
return
|
||||
}
|
||||
_, err = dao.ForeignDistribution.Ctx(ctx).WherePri(req.Id).Update(do.ForeignDistribution{
|
||||
SpeciesCode: req.SpeciesCode,
|
||||
Continent: req.Continent,
|
||||
Region: req.Region,
|
||||
BelongState: req.BelongState,
|
||||
Year: req.Year,
|
||||
References: req.References,
|
||||
CreateUser: req.CreateUser,
|
||||
CreateDate: req.CreateDate,
|
||||
//AuditUser: req.AuditUser,
|
||||
//AuditDate: req.AuditDate,
|
||||
AuditStatus: req.AuditStatus,
|
||||
//AuditView: req.AuditView,
|
||||
Remark: req.Remark,
|
||||
Version: req.Version,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "修改失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sForeignDistribution) Delete(ctx context.Context, ids []int) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
_, err = dao.ForeignDistribution.Ctx(ctx).Delete(dao.ForeignDistribution.Columns().Id+" in (?)", ids)
|
||||
liberr.ErrIsNil(ctx, err, "删除失败")
|
||||
})
|
||||
return
|
||||
}
|
212
internal/app/businesses/logic/geography.go
Normal file
212
internal/app/businesses/logic/geography.go
Normal file
@ -0,0 +1,212 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/dao"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model/do"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/service"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/system/consts"
|
||||
"github.com/tiger1103/gfast/v3/library/liberr"
|
||||
)
|
||||
|
||||
func init() {
|
||||
service.RegisterGeography(NewIGeography())
|
||||
}
|
||||
|
||||
func NewIGeography() service.IGeography {
|
||||
return &sGeography{}
|
||||
}
|
||||
|
||||
type sGeography struct{}
|
||||
|
||||
func (s *sGeography) List(ctx context.Context, req *model.GeographySearchReq) (listRes *model.GeographySearchRes, err error) {
|
||||
listRes = new(model.GeographySearchRes)
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
m := dao.Geography.Ctx(ctx).WithAll()
|
||||
if req.Id != "" {
|
||||
m = m.Where(dao.Geography.Columns().Id+" = ?", req.Id)
|
||||
}
|
||||
if req.SpeciesCode != "" {
|
||||
m = m.Where(dao.Geography.Columns().SpeciesCode+" like ?", "%"+req.SpeciesCode+"%")
|
||||
}
|
||||
if req.CreateUser != "" {
|
||||
m = m.Where(dao.Geography.Columns().CreateUser+" = ?", gconv.Int(req.CreateUser))
|
||||
}
|
||||
if req.CreateDate != nil {
|
||||
start := req.CreateDate[0]
|
||||
end := req.CreateDate[1]
|
||||
if start != nil && end != nil {
|
||||
m = m.Where(
|
||||
dao.Geography.Columns().CreateDate+" >= ? AND "+
|
||||
dao.Geography.Columns().CreateDate+" <= ?",
|
||||
start,
|
||||
end,
|
||||
)
|
||||
}
|
||||
}
|
||||
if req.AuditUser != "" {
|
||||
m = m.Where(dao.Geography.Columns().AuditUser+" = ?", gconv.Int(req.AuditUser))
|
||||
}
|
||||
if req.AuditDate != nil {
|
||||
start := req.AuditDate[0]
|
||||
end := req.AuditDate[1]
|
||||
if start != nil && end != nil {
|
||||
m = m.Where(
|
||||
dao.Geography.Columns().AuditDate+" >= ? AND "+
|
||||
dao.Geography.Columns().AuditDate+" <= ?",
|
||||
start,
|
||||
end,
|
||||
)
|
||||
}
|
||||
}
|
||||
if req.AuditStatus != "" {
|
||||
m = m.Where(dao.Geography.Columns().AuditStatus+" = ?", gconv.Int(req.AuditStatus))
|
||||
}
|
||||
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.GeographyListRes
|
||||
err = m.Page(req.PageNum, req.PageSize).Order(order).Scan(&res)
|
||||
liberr.ErrIsNil(ctx, err, "获取数据失败")
|
||||
listRes.List = make([]*model.GeographyListRes, len(res))
|
||||
for k, v := range res {
|
||||
listRes.List[k] = &model.GeographyListRes{
|
||||
Id: v.Id,
|
||||
SpeciesCode: v.SpeciesCode,
|
||||
DistributionInfo: v.DistributionInfo,
|
||||
OriginInfo: v.OriginInfo,
|
||||
AbroadInfo: v.AbroadInfo,
|
||||
DomesticInfo: v.DomesticInfo,
|
||||
CreateUser: v.CreateUser,
|
||||
CreateDate: v.CreateDate,
|
||||
AuditUser: v.AuditUser,
|
||||
AuditDate: v.AuditDate,
|
||||
AuditStatus: v.AuditStatus,
|
||||
AuditView: v.AuditView,
|
||||
Remark: v.Remark,
|
||||
Version: v.Version,
|
||||
CreatedAt: v.CreatedAt,
|
||||
}
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sGeography) GetById(ctx context.Context, id int) (res *model.GeographyInfoRes, err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
err = dao.Geography.Ctx(ctx).WithAll().Where(dao.Geography.Columns().Id, id).Scan(&res)
|
||||
liberr.ErrIsNil(ctx, err, "获取信息失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sGeography) Add(ctx context.Context, req *model.GeographyAddReq) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
//查询是否存在
|
||||
speciesNameCount, err := dao.SpeciesName.Ctx(ctx).Where(dao.SpeciesName.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
}
|
||||
if speciesNameCount == 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码不存在"), "物种编码不存在")
|
||||
return
|
||||
}
|
||||
//查重
|
||||
count, err := dao.Geography.Ctx(ctx).Where(dao.Geography.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
|
||||
}
|
||||
if count > 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("请勿重复添加"), "请勿重复添加")
|
||||
return
|
||||
}
|
||||
_, err = dao.Geography.Ctx(ctx).Insert(do.Geography{
|
||||
Id: req.Id,
|
||||
SpeciesCode: req.SpeciesCode,
|
||||
DistributionInfo: req.DistributionInfo,
|
||||
OriginInfo: req.OriginInfo,
|
||||
AbroadInfo: req.AbroadInfo,
|
||||
DomesticInfo: req.DomesticInfo,
|
||||
CreateUser: req.CreateUser,
|
||||
CreateDate: req.CreateDate,
|
||||
//AuditUser: req.AuditUser,
|
||||
//AuditDate: req.AuditDate,
|
||||
AuditStatus: req.AuditStatus,
|
||||
//AuditView: req.AuditView,
|
||||
Remark: req.Remark,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "添加失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sGeography) Edit(ctx context.Context, req *model.GeographyEditReq) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
// 查询物种编码是否存在
|
||||
speciesNameCount, err := dao.SpeciesName.Ctx(ctx).Where(dao.SpeciesName.Columns().SpeciesCode+" = ?", req.SpeciesCode).Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "物种编码不存在")
|
||||
return
|
||||
}
|
||||
if speciesNameCount == 0 {
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码不存在"), "物种编码不存在")
|
||||
return
|
||||
}
|
||||
count, err := dao.Geography.Ctx(ctx).
|
||||
Where(dao.Geography.Columns().SpeciesCode+" = ?", req.SpeciesCode).
|
||||
WhereNot(dao.Geography.Columns().Id, req.Id). // 排除当前记录
|
||||
Count()
|
||||
if err != nil {
|
||||
liberr.ErrIsNil(ctx, err, "获取物种编码失败")
|
||||
return
|
||||
}
|
||||
if count > 0 {
|
||||
// 使用非nil错误触发错误处理
|
||||
liberr.ErrIsNil(ctx, errors.New("物种编码已存在"), "请勿重复添加")
|
||||
return
|
||||
}
|
||||
_, err = dao.Geography.Ctx(ctx).Where(dao.Geography.Columns().Id+" = ?", req.Id).Update(do.Geography{
|
||||
SpeciesCode: req.SpeciesCode,
|
||||
DistributionInfo: req.DistributionInfo,
|
||||
OriginInfo: req.OriginInfo,
|
||||
AbroadInfo: req.AbroadInfo,
|
||||
DomesticInfo: req.DomesticInfo,
|
||||
CreateUser: req.CreateUser,
|
||||
CreateDate: req.CreateDate,
|
||||
//AuditUser: req.AuditUser,
|
||||
//AuditDate: req.AuditDate,
|
||||
AuditStatus: req.AuditStatus,
|
||||
//AuditView: req.AuditView,
|
||||
Remark: req.Remark,
|
||||
Version: req.Version,
|
||||
})
|
||||
liberr.ErrIsNil(ctx, err, "修改失败")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *sGeography) Delete(ctx context.Context, ids []int) (err error) {
|
||||
err = g.Try(ctx, func(ctx context.Context) {
|
||||
_, err = dao.Geography.Ctx(ctx).Delete(dao.Geography.Columns().Id+" in (?)", ids)
|
||||
liberr.ErrIsNil(ctx, err, "删除失败")
|
||||
})
|
||||
return
|
||||
}
|
107
internal/app/businesses/model/characteristic.go
Normal file
107
internal/app/businesses/model/characteristic.go
Normal file
@ -0,0 +1,107 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成model操作代码。
|
||||
// 生成日期:2025-08-08 15:18:02
|
||||
// 生成路径: internal/app/businesses/model/characteristic.go
|
||||
// 生成人:gfast
|
||||
// desc:识别特征
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
comModel "github.com/tiger1103/gfast/v3/internal/app/common/model"
|
||||
)
|
||||
|
||||
// CharacteristicInfoRes is the golang structure for table characteristic.
|
||||
type CharacteristicInfoRes struct {
|
||||
gmeta.Meta `orm:"table:characteristic"`
|
||||
Id int `orm:"id,primary" json:"id" dc:""` //
|
||||
SpeciesCode string `orm:"species_code" json:"speciesCode" dc:"物种编码"` // 物种编码
|
||||
FormCharacteristic string `orm:"form_characteristic" json:"formCharacteristic" dc:"形态学特征"` // 形态学特征
|
||||
BiologyCharacteristic string `orm:"biology_characteristic" json:"biologyCharacteristic" dc:"分子生物学特征"` // 分子生物学特征
|
||||
SourcesData string `orm:"sources_data" json:"sourcesData" dc:"数据来源"` // 数据来源
|
||||
CreateUser int `orm:"create_user" json:"createUser" dc:"数据采集人"` // 数据采集人
|
||||
CreateDate *gtime.Time `orm:"create_date" json:"createDate" dc:"数据采集日期"` // 数据采集日期
|
||||
AuditUser int `orm:"audit_user" json:"auditUser" dc:"数据核查人"` // 数据核查人
|
||||
AuditDate *gtime.Time `orm:"audit_date" json:"auditDate" dc:"数据核查日期"` // 数据核查日期
|
||||
AuditStatus int `orm:"audit_status" json:"auditStatus" dc:""` //
|
||||
AuditView string `orm:"audit_view" json:"auditView" dc:""` //
|
||||
Remark string `orm:"remark" json:"remark" dc:""` //
|
||||
Version int `orm:"version" json:"version" dc:""` //
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt" dc:""` //
|
||||
UpdatedAt *gtime.Time `orm:"updated_at" json:"updatedAt" dc:""` //
|
||||
DeletedAt *gtime.Time `orm:"deleted_at" json:"deletedAt" dc:""` //
|
||||
}
|
||||
|
||||
type CharacteristicListRes struct {
|
||||
Id int `json:"id" dc:""`
|
||||
SpeciesCode string `json:"speciesCode" dc:"物种编码"`
|
||||
FormCharacteristic string `json:"formCharacteristic" dc:"形态学特征"`
|
||||
BiologyCharacteristic string `json:"biologyCharacteristic" dc:"分子生物学特征"`
|
||||
SourcesData string `json:"sourcesData" dc:"数据来源"`
|
||||
CreateUser int `json:"createUser" dc:"数据采集人"`
|
||||
CreateDate *gtime.Time `json:"createDate" dc:"数据采集日期"`
|
||||
AuditUser int `json:"auditUser" dc:"数据核查人"`
|
||||
AuditDate *gtime.Time `json:"auditDate" dc:"数据核查日期"`
|
||||
AuditStatus int `json:"auditStatus" dc:""`
|
||||
AuditView string `json:"auditView" dc:""`
|
||||
Remark string `json:"remark" dc:""`
|
||||
Version int `json:"version" dc:""`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:""`
|
||||
}
|
||||
|
||||
// CharacteristicSearchReq 分页请求参数
|
||||
type CharacteristicSearchReq struct {
|
||||
comModel.PageReq
|
||||
Id string `p:"id" dc:""` //
|
||||
SpeciesCode string `p:"speciesCode" dc:"物种编码"` //物种编码
|
||||
FormCharacteristic string `p:"formCharacteristic" dc:"形态学特征"` //形态学特征
|
||||
BiologyCharacteristic string `p:"biologyCharacteristic" dc:"分子生物学特征"` //分子生物学特征
|
||||
SourcesData string `p:"sourcesData" dc:"数据来源"` //数据来源
|
||||
CreateUser string `p:"createUser" v:"createUser@integer#数据采集人需为整数" dc:"数据采集人"` //数据采集人
|
||||
AuditUser string `p:"auditUser" v:"auditUser@integer#数据核查人需为整数" dc:"数据核查人"` //数据核查人
|
||||
AuditStatus string `p:"auditStatus" v:"auditStatus@integer#需为整数" dc:""` //
|
||||
}
|
||||
|
||||
// CharacteristicSearchRes 列表返回结果
|
||||
type CharacteristicSearchRes struct {
|
||||
comModel.ListRes
|
||||
List []*CharacteristicListRes `json:"list"`
|
||||
}
|
||||
|
||||
// CharacteristicAddReq 添加操作请求参数
|
||||
type CharacteristicAddReq struct {
|
||||
Id int `p:"id" dc:""`
|
||||
SpeciesCode string `p:"speciesCode" dc:"物种编码"`
|
||||
FormCharacteristic string `p:"formCharacteristic" dc:"形态学特征"`
|
||||
BiologyCharacteristic string `p:"biologyCharacteristic" dc:"分子生物学特征"`
|
||||
SourcesData string `p:"sourcesData" dc:"数据来源"`
|
||||
CreateUser int `p:"createUser" dc:"数据采集人"`
|
||||
CreateDate *gtime.Time `p:"createDate" dc:"数据采集日期"`
|
||||
//AuditUser int `p:"auditUser" dc:"数据核查人"`
|
||||
//AuditDate *gtime.Time `p:"auditDate" dc:"数据核查日期"`
|
||||
AuditStatus int `p:"auditStatus" dc:""`
|
||||
//AuditView string `p:"auditView" dc:""`
|
||||
Remark string `p:"remark" dc:""`
|
||||
//Version int `p:"version" dc:""`
|
||||
}
|
||||
|
||||
// CharacteristicEditReq 修改操作请求参数
|
||||
type CharacteristicEditReq struct {
|
||||
Id int `p:"id" v:"required#主键ID不能为空" dc:""`
|
||||
SpeciesCode string `p:"speciesCode" dc:"物种编码"`
|
||||
FormCharacteristic string `p:"formCharacteristic" dc:"形态学特征"`
|
||||
BiologyCharacteristic string `p:"biologyCharacteristic" dc:"分子生物学特征"`
|
||||
SourcesData string `p:"sourcesData" dc:"数据来源"`
|
||||
CreateUser int `p:"createUser" dc:"数据采集人"`
|
||||
CreateDate *gtime.Time `p:"createDate" dc:"数据采集日期"`
|
||||
//AuditUser int `p:"auditUser" dc:"数据核查人"`
|
||||
//AuditDate *gtime.Time `p:"auditDate" dc:"数据核查日期"`
|
||||
AuditStatus int `p:"auditStatus" v:"required#不能为空" dc:""`
|
||||
//AuditView string `p:"auditView" dc:""`
|
||||
Remark string `p:"remark" dc:""`
|
||||
Version int `p:"version" dc:""`
|
||||
}
|
@ -144,9 +144,8 @@ type ClassifyStatuseAddReq struct {
|
||||
|
||||
// ClassifyStatuseEditReq 修改操作请求参数
|
||||
type ClassifyStatuseEditReq struct {
|
||||
Id int `p:"id" v:"required#主键ID不能为空" dc:""`
|
||||
SpeciesCode string `p:"speciesCode" dc:"物种编码"` //物种编码
|
||||
|
||||
Id int `p:"id" v:"required#主键ID不能为空" dc:""`
|
||||
SpeciesCode string `p:"speciesCode" dc:"物种编码"` //物种编码
|
||||
Jie string `p:"jie" dc:"界"`
|
||||
Kingdom string `p:"kingdom" dc:"Kingdom"`
|
||||
Men string `p:"men" dc:"门"`
|
||||
@ -167,7 +166,7 @@ type ClassifyStatuseEditReq struct {
|
||||
CreateDate *gtime.Time `p:"createDate" dc:"数据采集日期"`
|
||||
//AuditUser int `p:"auditUser" dc:"数据核查人"`
|
||||
//AuditDate *gtime.Time `p:"auditDate" dc:"数据核查日期"`
|
||||
//AuditStatus int `p:"auditStatus" v:"required#核查不能为空" dc:"核查"`
|
||||
AuditStatus int `p:"auditStatus" v:"required#核查不能为空" dc:"核查"`
|
||||
//AuditView string `p:"auditView" dc:"核查意见"`
|
||||
Remark string `p:"remark" dc:"备注"`
|
||||
Version int `p:"version" dc:"版本"`
|
||||
|
36
internal/app/businesses/model/do/characteristic.go
Normal file
36
internal/app/businesses/model/do/characteristic.go
Normal file
@ -0,0 +1,36 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成model entity操作代码。
|
||||
// 生成日期:2025-08-08 15:18:02
|
||||
// 生成路径: internal/app/businesses/model/entity/characteristic.go
|
||||
// 生成人:gfast
|
||||
// desc:识别特征
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package do
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
)
|
||||
|
||||
// Characteristic is the golang structure for table characteristic.
|
||||
type Characteristic struct {
|
||||
gmeta.Meta `orm:"table:characteristic, do:true"`
|
||||
Id interface{} `orm:"id,primary" json:"id"` //
|
||||
SpeciesCode interface{} `orm:"species_code" json:"speciesCode"` // 物种编码
|
||||
FormCharacteristic interface{} `orm:"form_characteristic" json:"formCharacteristic"` // 形态学特征
|
||||
BiologyCharacteristic interface{} `orm:"biology_characteristic" json:"biologyCharacteristic"` // 分子生物学特征
|
||||
SourcesData interface{} `orm:"sources_data" json:"sourcesData"` // 数据来源
|
||||
CreateUser interface{} `orm:"create_user" json:"createUser"` // 数据采集人
|
||||
CreateDate *gtime.Time `orm:"create_date" json:"createDate"` // 数据采集日期
|
||||
AuditUser interface{} `orm:"audit_user" json:"auditUser"` // 数据核查人
|
||||
AuditDate *gtime.Time `orm:"audit_date" json:"auditDate"` // 数据核查日期
|
||||
AuditStatus interface{} `orm:"audit_status" json:"auditStatus"` //
|
||||
AuditView interface{} `orm:"audit_view" json:"auditView"` //
|
||||
Remark interface{} `orm:"remark" json:"remark"` //
|
||||
Version interface{} `orm:"version" json:"version"` //
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt"` //
|
||||
UpdatedAt *gtime.Time `orm:"updated_at" json:"updatedAt"` //
|
||||
DeletedAt *gtime.Time `orm:"deleted_at" json:"deletedAt"` //
|
||||
}
|
38
internal/app/businesses/model/do/domestiDistribuion.go
Normal file
38
internal/app/businesses/model/do/domestiDistribuion.go
Normal file
@ -0,0 +1,38 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成model entity操作代码。
|
||||
// 生成日期:2025-08-08 15:02:58
|
||||
// 生成路径: internal/app/businesses/model/entity/domesti_distribuion.go
|
||||
// 生成人:gfast
|
||||
// desc:国内分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package do
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
)
|
||||
|
||||
// DomestiDistribuion is the golang structure for table domesti_distribuion.
|
||||
type DomestiDistribuion struct {
|
||||
gmeta.Meta `orm:"table:domesti_distribuion, do:true"`
|
||||
Id interface{} `orm:"id,primary" json:"id"` //
|
||||
SpeciesCode interface{} `orm:"species_code" json:"speciesCode"` // 物种编码
|
||||
Province interface{} `orm:"province" json:"province"` // 所属省区
|
||||
City interface{} `orm:"city" json:"city"` // 所属地级州市
|
||||
County interface{} `orm:"county" json:"county"` // 所属区县
|
||||
Year interface{} `orm:"year" json:"year"` // 发现年份
|
||||
SourcesData interface{} `orm:"sources_data" json:"sourcesData"` // 数据来源
|
||||
CreateUser interface{} `orm:"create_user" json:"createUser"` // 数据采集人
|
||||
CreateDate *gtime.Time `orm:"create_date" json:"createDate"` // 数据采集日期
|
||||
AuditUser interface{} `orm:"audit_user" json:"auditUser"` // 数据核查人
|
||||
AuditDate *gtime.Time `orm:"audit_date" json:"auditDate"` // 数据核查日期
|
||||
AuditStatus interface{} `orm:"audit_status" json:"auditStatus"` //
|
||||
AuditView interface{} `orm:"audit_view" json:"auditView"` //
|
||||
Remark interface{} `orm:"remark" json:"remark"` //
|
||||
Version interface{} `orm:"version" json:"version"` //
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt"` //
|
||||
UpdatedAt *gtime.Time `orm:"updated_at" json:"updatedAt"` //
|
||||
DeletedAt *gtime.Time `orm:"deleted_at" json:"deletedAt"` //
|
||||
}
|
38
internal/app/businesses/model/do/foreignDistribuion.go
Normal file
38
internal/app/businesses/model/do/foreignDistribuion.go
Normal file
@ -0,0 +1,38 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成model entity操作代码。
|
||||
// 生成日期:2025-08-08 15:00:02
|
||||
// 生成路径: internal/app/businesses/model/entity/foreign_distribution.go
|
||||
// 生成人:gfast
|
||||
// desc:国外分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package do
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
)
|
||||
|
||||
// ForeignDistribution is the golang structure for table foreign_distribution.
|
||||
type ForeignDistribution struct {
|
||||
gmeta.Meta `orm:"table:foreign_distribution, do:true"`
|
||||
Id interface{} `orm:"id,primary" json:"id"` //
|
||||
SpeciesCode interface{} `orm:"species_code" json:"speciesCode"` // 物种编码
|
||||
Continent interface{} `orm:"continent" json:"continent"` // 所属大洲
|
||||
Region interface{} `orm:"region" json:"region"` // 所属国家/地区
|
||||
BelongState interface{} `orm:"belong_state" json:"belongState"` // 所属州
|
||||
Year interface{} `orm:"year" json:"year"` // 发现/报道年份
|
||||
References interface{} `orm:"references" json:"references"` // 参考文献
|
||||
CreateUser interface{} `orm:"create_user" json:"createUser"` // 数据采集人
|
||||
CreateDate *gtime.Time `orm:"create_date" json:"createDate"` // 数据采集日期
|
||||
AuditUser interface{} `orm:"audit_user" json:"auditUser"` // 数据核查人
|
||||
AuditDate *gtime.Time `orm:"audit_date" json:"auditDate"` // 数据核查日期
|
||||
AuditStatus interface{} `orm:"audit_status" json:"auditStatus"` //
|
||||
AuditView interface{} `orm:"audit_view" json:"auditView"` //
|
||||
Remark interface{} `orm:"remark" json:"remark"` //
|
||||
Version interface{} `orm:"version" json:"version"` //
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt"` //
|
||||
UpdatedAt *gtime.Time `orm:"updated_at" json:"updatedAt"` //
|
||||
DeletedAt *gtime.Time `orm:"deleted_at" json:"deletedAt"` //
|
||||
}
|
37
internal/app/businesses/model/do/geography.go
Normal file
37
internal/app/businesses/model/do/geography.go
Normal file
@ -0,0 +1,37 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成model entity操作代码。
|
||||
// 生成日期:2025-08-08 11:21:24
|
||||
// 生成路径: internal/app/businesses/model/entity/geography.go
|
||||
// 生成人:gfast
|
||||
// desc:地理分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package do
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
)
|
||||
|
||||
// Geography is the golang structure for table geography.
|
||||
type Geography struct {
|
||||
gmeta.Meta `orm:"table:geography, do:true"`
|
||||
Id interface{} `orm:"id,primary" json:"id"` //
|
||||
SpeciesCode interface{} `orm:"species_code" json:"speciesCode"` // 物种编码
|
||||
DistributionInfo interface{} `orm:"distribution_info" json:"distributionInfo"` // 地理分布描述
|
||||
OriginInfo interface{} `orm:"origin_info" json:"originInfo"` // 原产地描述
|
||||
AbroadInfo interface{} `orm:"abroad_info" json:"abroadInfo"` // 国外分布描述
|
||||
DomesticInfo interface{} `orm:"domestic_info" json:"domesticInfo"` // 国内分布描述
|
||||
CreateUser interface{} `orm:"create_user" json:"createUser"` // 数据采集人
|
||||
CreateDate *gtime.Time `orm:"create_date" json:"createDate"` // 数据采集日期
|
||||
AuditUser interface{} `orm:"audit_user" json:"auditUser"` // 数据核查人
|
||||
AuditDate *gtime.Time `orm:"audit_date" json:"auditDate"` // 数据核查日期
|
||||
AuditStatus interface{} `orm:"audit_status" json:"auditStatus"` // 核查状态
|
||||
AuditView interface{} `orm:"audit_view" json:"auditView"` // 核查意见
|
||||
Remark interface{} `orm:"remark" json:"remark"` // 备注
|
||||
Version interface{} `orm:"version" json:"version"` //
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt"` //
|
||||
UpdatedAt *gtime.Time `orm:"updated_at" json:"updatedAt"` //
|
||||
DeletedAt *gtime.Time `orm:"deleted_at" json:"deletedAt"` //
|
||||
}
|
116
internal/app/businesses/model/domestiDistribuion.go
Normal file
116
internal/app/businesses/model/domestiDistribuion.go
Normal file
@ -0,0 +1,116 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成model操作代码。
|
||||
// 生成日期:2025-08-08 15:02:58
|
||||
// 生成路径: internal/app/businesses/model/domesti_distribuion.go
|
||||
// 生成人:gfast
|
||||
// desc:国内分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
comModel "github.com/tiger1103/gfast/v3/internal/app/common/model"
|
||||
)
|
||||
|
||||
// DomestiDistribuionInfoRes is the golang structure for table domesti_distribuion.
|
||||
type DomestiDistribuionInfoRes struct {
|
||||
gmeta.Meta `orm:"table:domesti_distribuion"`
|
||||
Id int `orm:"id,primary" json:"id" dc:""` //
|
||||
SpeciesCode string `orm:"species_code" json:"speciesCode" dc:"物种编码"` // 物种编码
|
||||
Province string `orm:"province" json:"province" dc:"所属省区"` // 所属省区
|
||||
City string `orm:"city" json:"city" dc:"所属地级州市"` // 所属地级州市
|
||||
County string `orm:"county" json:"county" dc:"所属区县"` // 所属区县
|
||||
Year string `orm:"year" json:"year" dc:"发现年份"` // 发现年份
|
||||
SourcesData string `orm:"sources_data" json:"sourcesData" dc:"数据来源"` // 数据来源
|
||||
CreateUser int `orm:"create_user" json:"createUser" dc:"数据采集人"` // 数据采集人
|
||||
CreateDate *gtime.Time `orm:"create_date" json:"createDate" dc:"数据采集日期"` // 数据采集日期
|
||||
AuditUser int `orm:"audit_user" json:"auditUser" dc:"数据核查人"` // 数据核查人
|
||||
AuditDate *gtime.Time `orm:"audit_date" json:"auditDate" dc:"数据核查日期"` // 数据核查日期
|
||||
AuditStatus int `orm:"audit_status" json:"auditStatus" dc:""` //
|
||||
AuditView string `orm:"audit_view" json:"auditView" dc:""` //
|
||||
Remark string `orm:"remark" json:"remark" dc:""` //
|
||||
Version int `orm:"version" json:"version" dc:""` //
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt" dc:""` //
|
||||
UpdatedAt *gtime.Time `orm:"updated_at" json:"updatedAt" dc:""` //
|
||||
DeletedAt *gtime.Time `orm:"deleted_at" json:"deletedAt" dc:""` //
|
||||
}
|
||||
|
||||
type DomestiDistribuionListRes struct {
|
||||
Id int `json:"id" dc:""`
|
||||
SpeciesCode string `json:"speciesCode" dc:"物种编码"`
|
||||
Province string `json:"province" dc:"所属省区"`
|
||||
City string `json:"city" dc:"所属地级州市"`
|
||||
County string `json:"county" dc:"所属区县"`
|
||||
Year string `json:"year" dc:"发现年份"`
|
||||
SourcesData string `json:"sourcesData" dc:"数据来源"`
|
||||
CreateUser int `json:"createUser" dc:"数据采集人"`
|
||||
CreateDate *gtime.Time `json:"createDate" dc:"数据采集日期"`
|
||||
AuditUser int `json:"auditUser" dc:"数据核查人"`
|
||||
AuditDate *gtime.Time `json:"auditDate" dc:"数据核查日期"`
|
||||
AuditStatus int `json:"auditStatus" dc:""`
|
||||
AuditView string `json:"auditView" dc:""`
|
||||
Remark string `json:"remark" dc:""`
|
||||
Version int `json:"version" dc:""`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:""`
|
||||
}
|
||||
|
||||
// DomestiDistribuionSearchReq 分页请求参数
|
||||
type DomestiDistribuionSearchReq struct {
|
||||
comModel.PageReq
|
||||
Id string `p:"id" dc:""` //
|
||||
SpeciesCode string `p:"speciesCode" dc:"物种编码"` //物种编码
|
||||
Province string `p:"province" dc:"所属省区"` //所属省区
|
||||
City string `p:"city" dc:"所属地级州市"` //所属地级州市
|
||||
County string `p:"county" dc:"所属区县"` //所属区县
|
||||
Year string `p:"year" dc:"发现年份"` //发现年份
|
||||
SourcesData string `p:"sourcesData" dc:"数据来源"` //数据来源
|
||||
CreateUser string `p:"createUser" v:"createUser@integer#数据采集人需为整数" dc:"数据采集人"` //数据采集人
|
||||
AuditStatus string `p:"auditStatus" v:"auditStatus@integer#需为整数" dc:""` //
|
||||
}
|
||||
|
||||
// DomestiDistribuionSearchRes 列表返回结果
|
||||
type DomestiDistribuionSearchRes struct {
|
||||
comModel.ListRes
|
||||
List []*DomestiDistribuionListRes `json:"list"`
|
||||
}
|
||||
|
||||
// DomestiDistribuionAddReq 添加操作请求参数
|
||||
type DomestiDistribuionAddReq struct {
|
||||
Id int `p:"id" dc:""`
|
||||
SpeciesCode string `p:"speciesCode" dc:"物种编码"`
|
||||
Province string `p:"province" dc:"所属省区"`
|
||||
City string `p:"city" dc:"所属地级州市"`
|
||||
County string `p:"county" dc:"所属区县"`
|
||||
Year string `p:"year" dc:"发现年份"`
|
||||
SourcesData string `p:"sourcesData" dc:"数据来源"`
|
||||
CreateUser int `p:"createUser" dc:"数据采集人"`
|
||||
CreateDate *gtime.Time `p:"createDate" dc:"数据采集日期"`
|
||||
//AuditUser int `p:"auditUser" dc:"数据核查人"`
|
||||
//AuditDate *gtime.Time `p:"auditDate" dc:"数据核查日期"`
|
||||
AuditStatus int `p:"auditStatus" dc:""`
|
||||
//AuditView string `p:"auditView" dc:""`
|
||||
Remark string `p:"remark" dc:""`
|
||||
//Version int `p:"version" dc:""`
|
||||
}
|
||||
|
||||
// DomestiDistribuionEditReq 修改操作请求参数
|
||||
type DomestiDistribuionEditReq struct {
|
||||
Id int `p:"id" v:"required#主键ID不能为空" dc:""`
|
||||
SpeciesCode string `p:"speciesCode" dc:"物种编码"`
|
||||
Province string `p:"province" dc:"所属省区"`
|
||||
City string `p:"city" dc:"所属地级州市"`
|
||||
County string `p:"county" dc:"所属区县"`
|
||||
Year string `p:"year" dc:"发现年份"`
|
||||
SourcesData string `p:"sourcesData" dc:"数据来源"`
|
||||
CreateUser int `p:"createUser" dc:"数据采集人"`
|
||||
CreateDate *gtime.Time `p:"createDate" dc:"数据采集日期"`
|
||||
//AuditUser int `p:"auditUser" dc:"数据核查人"`
|
||||
//AuditDate *gtime.Time `p:"auditDate" dc:"数据核查日期"`
|
||||
AuditStatus int `p:"auditStatus" v:"required#不能为空" dc:""`
|
||||
//AuditView string `p:"auditView" dc:""`
|
||||
Remark string `p:"remark" dc:""`
|
||||
Version int `p:"version" dc:""`
|
||||
}
|
36
internal/app/businesses/model/entity/characteristic.go
Normal file
36
internal/app/businesses/model/entity/characteristic.go
Normal file
@ -0,0 +1,36 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成model entity操作代码。
|
||||
// 生成日期:2025-08-08 15:18:02
|
||||
// 生成路径: internal/app/businesses/model/entity/characteristic.go
|
||||
// 生成人:gfast
|
||||
// desc:识别特征
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
)
|
||||
|
||||
// Characteristic is the golang structure for table characteristic.
|
||||
type Characteristic struct {
|
||||
gmeta.Meta `orm:"table:characteristic"`
|
||||
Id int `orm:"id,primary" json:"id"` //
|
||||
SpeciesCode string `orm:"species_code" json:"speciesCode"` // 物种编码
|
||||
FormCharacteristic string `orm:"form_characteristic" json:"formCharacteristic"` // 形态学特征
|
||||
BiologyCharacteristic string `orm:"biology_characteristic" json:"biologyCharacteristic"` // 分子生物学特征
|
||||
SourcesData string `orm:"sources_data" json:"sourcesData"` // 数据来源
|
||||
CreateUser int `orm:"create_user" json:"createUser"` // 数据采集人
|
||||
CreateDate *gtime.Time `orm:"create_date" json:"createDate"` // 数据采集日期
|
||||
AuditUser int `orm:"audit_user" json:"auditUser"` // 数据核查人
|
||||
AuditDate *gtime.Time `orm:"audit_date" json:"auditDate"` // 数据核查日期
|
||||
AuditStatus int `orm:"audit_status" json:"auditStatus"` //
|
||||
AuditView string `orm:"audit_view" json:"auditView"` //
|
||||
Remark string `orm:"remark" json:"remark"` //
|
||||
Version int `orm:"version" json:"version"` //
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt"` //
|
||||
UpdatedAt *gtime.Time `orm:"updated_at" json:"updatedAt"` //
|
||||
DeletedAt *gtime.Time `orm:"deleted_at" json:"deletedAt"` //
|
||||
}
|
38
internal/app/businesses/model/entity/domestiDistribuion.go
Normal file
38
internal/app/businesses/model/entity/domestiDistribuion.go
Normal file
@ -0,0 +1,38 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成model entity操作代码。
|
||||
// 生成日期:2025-08-08 15:02:58
|
||||
// 生成路径: internal/app/businesses/model/entity/domesti_distribuion.go
|
||||
// 生成人:gfast
|
||||
// desc:国内分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
)
|
||||
|
||||
// DomestiDistribuion is the golang structure for table domesti_distribuion.
|
||||
type DomestiDistribuion struct {
|
||||
gmeta.Meta `orm:"table:domesti_distribuion"`
|
||||
Id int `orm:"id,primary" json:"id"` //
|
||||
SpeciesCode string `orm:"species_code" json:"speciesCode"` // 物种编码
|
||||
Province string `orm:"province" json:"province"` // 所属省区
|
||||
City string `orm:"city" json:"city"` // 所属地级州市
|
||||
County string `orm:"county" json:"county"` // 所属区县
|
||||
Year string `orm:"year" json:"year"` // 发现年份
|
||||
SourcesData string `orm:"sources_data" json:"sourcesData"` // 数据来源
|
||||
CreateUser int `orm:"create_user" json:"createUser"` // 数据采集人
|
||||
CreateDate *gtime.Time `orm:"create_date" json:"createDate"` // 数据采集日期
|
||||
AuditUser int `orm:"audit_user" json:"auditUser"` // 数据核查人
|
||||
AuditDate *gtime.Time `orm:"audit_date" json:"auditDate"` // 数据核查日期
|
||||
AuditStatus int `orm:"audit_status" json:"auditStatus"` //
|
||||
AuditView string `orm:"audit_view" json:"auditView"` //
|
||||
Remark string `orm:"remark" json:"remark"` //
|
||||
Version int `orm:"version" json:"version"` //
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt"` //
|
||||
UpdatedAt *gtime.Time `orm:"updated_at" json:"updatedAt"` //
|
||||
DeletedAt *gtime.Time `orm:"deleted_at" json:"deletedAt"` //
|
||||
}
|
38
internal/app/businesses/model/entity/foreignDistribuion.go
Normal file
38
internal/app/businesses/model/entity/foreignDistribuion.go
Normal file
@ -0,0 +1,38 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成model entity操作代码。
|
||||
// 生成日期:2025-08-08 15:05:26
|
||||
// 生成路径: internal/app/businesses/model/entity/foreign_distribution.go
|
||||
// 生成人:gfast
|
||||
// desc:国外分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
)
|
||||
|
||||
// ForeignDistribution is the golang structure for table foreign_distribution.
|
||||
type ForeignDistribution struct {
|
||||
gmeta.Meta `orm:"table:foreign_distribution"`
|
||||
Id int `orm:"id,primary" json:"id"` //
|
||||
SpeciesCode string `orm:"species_code" json:"speciesCode"` // 物种编码
|
||||
Continent string `orm:"continent" json:"continent"` // 所属大洲
|
||||
Region string `orm:"region" json:"region"` // 所属国家/地区
|
||||
BelongState string `orm:"belong_state" json:"belongState"` // 所属州
|
||||
Year string `orm:"year" json:"year"` // 发现/报道年份
|
||||
References string `orm:"references" json:"references"` // 参考文献
|
||||
CreateUser int `orm:"create_user" json:"createUser"` // 数据采集人
|
||||
CreateDate *gtime.Time `orm:"create_date" json:"createDate"` // 数据采集日期
|
||||
AuditUser int `orm:"audit_user" json:"auditUser"` // 数据核查人
|
||||
AuditDate *gtime.Time `orm:"audit_date" json:"auditDate"` // 数据核查日期
|
||||
AuditStatus int `orm:"audit_status" json:"auditStatus"` //
|
||||
AuditView string `orm:"audit_view" json:"auditView"` //
|
||||
Remark string `orm:"remark" json:"remark"` //
|
||||
Version int `orm:"version" json:"version"` //
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt"` //
|
||||
UpdatedAt *gtime.Time `orm:"updated_at" json:"updatedAt"` //
|
||||
DeletedAt *gtime.Time `orm:"deleted_at" json:"deletedAt"` //
|
||||
}
|
37
internal/app/businesses/model/entity/geography.go
Normal file
37
internal/app/businesses/model/entity/geography.go
Normal file
@ -0,0 +1,37 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成model entity操作代码。
|
||||
// 生成日期:2025-08-08 11:21:24
|
||||
// 生成路径: internal/app/businesses/model/entity/geography.go
|
||||
// 生成人:gfast
|
||||
// desc:地理分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
)
|
||||
|
||||
// Geography is the golang structure for table geography.
|
||||
type Geography struct {
|
||||
gmeta.Meta `orm:"table:geography"`
|
||||
Id int `orm:"id,primary" json:"id"` //
|
||||
SpeciesCode string `orm:"species_code" json:"speciesCode"` // 物种编码
|
||||
DistributionInfo string `orm:"distribution_info" json:"distributionInfo"` // 地理分布描述
|
||||
OriginInfo string `orm:"origin_info" json:"originInfo"` // 原产地描述
|
||||
AbroadInfo string `orm:"abroad_info" json:"abroadInfo"` // 国外分布描述
|
||||
DomesticInfo string `orm:"domestic_info" json:"domesticInfo"` // 国内分布描述
|
||||
CreateUser int `orm:"create_user" json:"createUser"` // 数据采集人
|
||||
CreateDate *gtime.Time `orm:"create_date" json:"createDate"` // 数据采集日期
|
||||
AuditUser int `orm:"audit_user" json:"auditUser"` // 数据核查人
|
||||
AuditDate *gtime.Time `orm:"audit_date" json:"auditDate"` // 数据核查日期
|
||||
AuditStatus int `orm:"audit_status" json:"auditStatus"` // 核查状态
|
||||
AuditView string `orm:"audit_view" json:"auditView"` // 核查意见
|
||||
Remark string `orm:"remark" json:"remark"` // 备注
|
||||
Version int `orm:"version" json:"version"` //
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt"` //
|
||||
UpdatedAt *gtime.Time `orm:"updated_at" json:"updatedAt"` //
|
||||
DeletedAt *gtime.Time `orm:"deleted_at" json:"deletedAt"` //
|
||||
}
|
116
internal/app/businesses/model/foreignDistribuion.go
Normal file
116
internal/app/businesses/model/foreignDistribuion.go
Normal file
@ -0,0 +1,116 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成model操作代码。
|
||||
// 生成日期:2025-08-08 15:05:26
|
||||
// 生成路径: internal/app/businesses/model/foreign_distribution.go
|
||||
// 生成人:gfast
|
||||
// desc:国外分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
comModel "github.com/tiger1103/gfast/v3/internal/app/common/model"
|
||||
)
|
||||
|
||||
// ForeignDistributionInfoRes is the golang structure for table foreign_distribution.
|
||||
type ForeignDistributionInfoRes struct {
|
||||
gmeta.Meta `orm:"table:foreign_distribution"`
|
||||
Id int `orm:"id,primary" json:"id" dc:""` //
|
||||
SpeciesCode string `orm:"species_code" json:"speciesCode" dc:"物种编码"` // 物种编码
|
||||
Continent string `orm:"continent" json:"continent" dc:"所属大洲"` // 所属大洲
|
||||
Region string `orm:"region" json:"region" dc:"所属国家/地区"` // 所属国家/地区
|
||||
BelongState string `orm:"belong_state" json:"belongState" dc:"所属州"` // 所属州
|
||||
Year string `orm:"year" json:"year" dc:"发现/报道年份"` // 发现/报道年份
|
||||
References string `orm:"references" json:"references" dc:"参考文献"` // 参考文献
|
||||
CreateUser int `orm:"create_user" json:"createUser" dc:"数据采集人"` // 数据采集人
|
||||
CreateDate *gtime.Time `orm:"create_date" json:"createDate" dc:"数据采集日期"` // 数据采集日期
|
||||
AuditUser int `orm:"audit_user" json:"auditUser" dc:"数据核查人"` // 数据核查人
|
||||
AuditDate *gtime.Time `orm:"audit_date" json:"auditDate" dc:"数据核查日期"` // 数据核查日期
|
||||
AuditStatus int `orm:"audit_status" json:"auditStatus" dc:""` //
|
||||
AuditView string `orm:"audit_view" json:"auditView" dc:""` //
|
||||
Remark string `orm:"remark" json:"remark" dc:""` //
|
||||
Version int `orm:"version" json:"version" dc:""` //
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt" dc:""` //
|
||||
UpdatedAt *gtime.Time `orm:"updated_at" json:"updatedAt" dc:""` //
|
||||
DeletedAt *gtime.Time `orm:"deleted_at" json:"deletedAt" dc:""` //
|
||||
}
|
||||
|
||||
type ForeignDistributionListRes struct {
|
||||
Id int `json:"id" dc:""`
|
||||
SpeciesCode string `json:"speciesCode" dc:"物种编码"`
|
||||
Continent string `json:"continent" dc:"所属大洲"`
|
||||
Region string `json:"region" dc:"所属国家/地区"`
|
||||
BelongState string `json:"belongState" dc:"所属州"`
|
||||
Year string `json:"year" dc:"发现/报道年份"`
|
||||
References string `json:"references" dc:"参考文献"`
|
||||
CreateUser int `json:"createUser" dc:"数据采集人"`
|
||||
CreateDate *gtime.Time `json:"createDate" dc:"数据采集日期"`
|
||||
AuditUser int `json:"auditUser" dc:"数据核查人"`
|
||||
AuditDate *gtime.Time `json:"auditDate" dc:"数据核查日期"`
|
||||
AuditStatus int `json:"auditStatus" dc:""`
|
||||
AuditView string `json:"auditView" dc:""`
|
||||
Remark string `json:"remark" dc:""`
|
||||
Version int `json:"version" dc:""`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:""`
|
||||
}
|
||||
|
||||
// ForeignDistributionSearchReq 分页请求参数
|
||||
type ForeignDistributionSearchReq struct {
|
||||
comModel.PageReq
|
||||
Id string `p:"id" dc:""` //
|
||||
SpeciesCode string `p:"speciesCode" dc:"物种编码"` //物种编码
|
||||
Continent string `p:"continent" dc:"所属大洲"` //所属大洲
|
||||
Region string `p:"region" dc:"所属国家/地区"` //所属国家/地区
|
||||
BelongState string `p:"belongState" dc:"所属州"` //所属州
|
||||
Year string `p:"year" dc:"发现/报道年份"` //发现/报道年份
|
||||
References string `p:"references" dc:"参考文献"` //参考文献
|
||||
CreateUser string `p:"createUser" v:"createUser@integer#数据采集人需为整数" dc:"数据采集人"` //数据采集人
|
||||
AuditStatus string `p:"auditStatus" v:"auditStatus@integer#需为整数" dc:""` //
|
||||
}
|
||||
|
||||
// ForeignDistributionSearchRes 列表返回结果
|
||||
type ForeignDistributionSearchRes struct {
|
||||
comModel.ListRes
|
||||
List []*ForeignDistributionListRes `json:"list"`
|
||||
}
|
||||
|
||||
// ForeignDistributionAddReq 添加操作请求参数
|
||||
type ForeignDistributionAddReq struct {
|
||||
Id int `p:"id" dc:""`
|
||||
SpeciesCode string `p:"speciesCode" v:"required#物种编码不能为空" dc:"物种编码"`
|
||||
Continent string `p:"continent" dc:"所属大洲"`
|
||||
Region string `p:"region" dc:"所属国家/地区"`
|
||||
BelongState string `p:"belongState" dc:"所属州"`
|
||||
Year string `p:"year" dc:"发现/报道年份"`
|
||||
References string `p:"references" dc:"参考文献"`
|
||||
CreateUser int `p:"createUser" dc:"数据采集人"`
|
||||
CreateDate *gtime.Time `p:"createDate" dc:"数据采集日期"`
|
||||
//AuditUser int `p:"auditUser" dc:"数据核查人"`
|
||||
//AuditDate *gtime.Time `p:"auditDate" dc:"数据核查日期"`
|
||||
AuditStatus int `p:"auditStatus" dc:""`
|
||||
//AuditView string `p:"auditView" dc:""`
|
||||
Remark string `p:"remark" dc:""`
|
||||
//Version int `p:"version" dc:""`
|
||||
}
|
||||
|
||||
// ForeignDistributionEditReq 修改操作请求参数
|
||||
type ForeignDistributionEditReq struct {
|
||||
Id int `p:"id" v:"required#主键ID不能为空" dc:""`
|
||||
SpeciesCode string `p:"speciesCode" v:"required#物种编码不能为空" dc:"物种编码"`
|
||||
Continent string `p:"continent" dc:"所属大洲"`
|
||||
Region string `p:"region" dc:"所属国家/地区"`
|
||||
BelongState string `p:"belongState" dc:"所属州"`
|
||||
Year string `p:"year" dc:"发现/报道年份"`
|
||||
References string `p:"references" dc:"参考文献"`
|
||||
CreateUser int `p:"createUser" dc:"数据采集人"`
|
||||
CreateDate *gtime.Time `p:"createDate" dc:"数据采集日期"`
|
||||
//AuditUser int `p:"auditUser" dc:"数据核查人"`
|
||||
//AuditDate *gtime.Time `p:"auditDate" dc:"数据核查日期"`
|
||||
AuditStatus int `p:"auditStatus" v:"required#不能为空" dc:""`
|
||||
//AuditView string `p:"auditView" dc:""`
|
||||
Remark string `p:"remark" dc:""`
|
||||
Version int `p:"version" dc:""`
|
||||
}
|
110
internal/app/businesses/model/geography.go
Normal file
110
internal/app/businesses/model/geography.go
Normal file
@ -0,0 +1,110 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成model操作代码。
|
||||
// 生成日期:2025-08-08 11:21:24
|
||||
// 生成路径: internal/app/businesses/model/geography.go
|
||||
// 生成人:gfast
|
||||
// desc:地理分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"github.com/gogf/gf/v2/util/gmeta"
|
||||
comModel "github.com/tiger1103/gfast/v3/internal/app/common/model"
|
||||
)
|
||||
|
||||
// GeographyInfoRes is the golang structure for table geography.
|
||||
type GeographyInfoRes struct {
|
||||
gmeta.Meta `orm:"table:geography"`
|
||||
Id int `orm:"id,primary" json:"id" dc:""` //
|
||||
SpeciesCode string `orm:"species_code" json:"speciesCode" dc:"物种编码"` // 物种编码
|
||||
DistributionInfo string `orm:"distribution_info" json:"distributionInfo" dc:"地理分布描述"` // 地理分布描述
|
||||
OriginInfo string `orm:"origin_info" json:"originInfo" dc:"原产地描述"` // 原产地描述
|
||||
AbroadInfo string `orm:"abroad_info" json:"abroadInfo" dc:"国外分布描述"` // 国外分布描述
|
||||
DomesticInfo string `orm:"domestic_info" json:"domesticInfo" dc:"国内分布描述"` // 国内分布描述
|
||||
CreateUser int `orm:"create_user" json:"createUser" dc:"数据采集人"` // 数据采集人
|
||||
CreateDate *gtime.Time `orm:"create_date" json:"createDate" dc:"数据采集日期"` // 数据采集日期
|
||||
AuditUser int `orm:"audit_user" json:"auditUser" dc:"数据核查人"` // 数据核查人
|
||||
AuditDate *gtime.Time `orm:"audit_date" json:"auditDate" dc:"数据核查日期"` // 数据核查日期
|
||||
AuditStatus int `orm:"audit_status" json:"auditStatus" dc:"核查状态"` // 核查状态
|
||||
AuditView string `orm:"audit_view" json:"auditView" dc:"核查意见"` // 核查意见
|
||||
Remark string `orm:"remark" json:"remark" dc:"备注"` // 备注
|
||||
Version int `orm:"version" json:"version" dc:""` //
|
||||
CreatedAt *gtime.Time `orm:"created_at" json:"createdAt" dc:""` //
|
||||
UpdatedAt *gtime.Time `orm:"updated_at" json:"updatedAt" dc:""` //
|
||||
DeletedAt *gtime.Time `orm:"deleted_at" json:"deletedAt" dc:""` //
|
||||
}
|
||||
|
||||
type GeographyListRes struct {
|
||||
Id int `json:"id" dc:""`
|
||||
SpeciesCode string `json:"speciesCode" dc:"物种编码"`
|
||||
DistributionInfo string `json:"distributionInfo" dc:"地理分布描述"`
|
||||
OriginInfo string `json:"originInfo" dc:"原产地描述"`
|
||||
AbroadInfo string `json:"abroadInfo" dc:"国外分布描述"`
|
||||
DomesticInfo string `json:"domesticInfo" dc:"国内分布描述"`
|
||||
CreateUser int `json:"createUser" dc:"数据采集人"`
|
||||
CreateDate *gtime.Time `json:"createDate" dc:"数据采集日期"`
|
||||
AuditUser int `json:"auditUser" dc:"数据核查人"`
|
||||
AuditDate *gtime.Time `json:"auditDate" dc:"数据核查日期"`
|
||||
AuditStatus int `json:"auditStatus" dc:"核查状态"`
|
||||
AuditView string `json:"auditView" dc:"核查意见"`
|
||||
Remark string `json:"remark" dc:"备注"`
|
||||
Version int `json:"version" dc:""`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:""`
|
||||
}
|
||||
|
||||
// GeographySearchReq 分页请求参数
|
||||
type GeographySearchReq struct {
|
||||
comModel.PageReq
|
||||
Id string `p:"id" dc:""` //
|
||||
SpeciesCode string `p:"speciesCode" dc:"物种编码"` //物种编码
|
||||
CreateUser string `p:"createUser" v:"createUser@integer#数据采集人需为整数" dc:"数据采集人"` //数据采集人
|
||||
CreateDate []*gtime.Time `p:"createDate" dc:"数据采集日期"` //数据采集日期
|
||||
AuditUser string `p:"auditUser" v:"auditUser@integer#数据核查人需为整数" dc:"数据核查人"` //数据核查人
|
||||
AuditDate []*gtime.Time `p:"auditDate" dc:"数据核查日期"` //数据核查日期
|
||||
AuditStatus string `p:"auditStatus" v:"auditStatus@integer#核查状态需为整数" dc:"核查状态"` //核查状态
|
||||
}
|
||||
|
||||
// GeographySearchRes 列表返回结果
|
||||
type GeographySearchRes struct {
|
||||
comModel.ListRes
|
||||
List []*GeographyListRes `json:"list"`
|
||||
}
|
||||
|
||||
// GeographyAddReq 添加操作请求参数
|
||||
type GeographyAddReq struct {
|
||||
Id int `p:"id" dc:""`
|
||||
SpeciesCode string `p:"speciesCode" v:"required#物种编码不能为空" dc:"物种编码"`
|
||||
DistributionInfo string `p:"distributionInfo" dc:"地理分布描述"`
|
||||
OriginInfo string `p:"originInfo" dc:"原产地描述"`
|
||||
AbroadInfo string `p:"abroadInfo" dc:"国外分布描述"`
|
||||
DomesticInfo string `p:"domesticInfo" dc:"国内分布描述"`
|
||||
CreateUser int `p:"createUser" dc:"数据采集人"`
|
||||
CreateDate *gtime.Time `p:"createDate" dc:"数据采集日期"`
|
||||
//AuditUser int `p:"auditUser" dc:"数据核查人"`
|
||||
//AuditDate *gtime.Time `p:"auditDate" dc:"数据核查日期"`
|
||||
AuditStatus int `p:"auditStatus" dc:"核查状态"`
|
||||
//AuditView string `p:"auditView" dc:"核查意见"`
|
||||
Remark string `p:"remark" dc:"备注"`
|
||||
//Version int `p:"version" dc:""`
|
||||
}
|
||||
|
||||
// GeographyEditReq 修改操作请求参数
|
||||
type GeographyEditReq struct {
|
||||
Id int `p:"id" v:"required#主键ID不能为空" dc:""`
|
||||
SpeciesCode string `p:"speciesCode" v:"required#物种编码不能为空" dc:"物种编码"`
|
||||
DistributionInfo string `p:"distributionInfo" dc:"地理分布描述"`
|
||||
OriginInfo string `p:"originInfo" dc:"原产地描述"`
|
||||
AbroadInfo string `p:"abroadInfo" dc:"国外分布描述"`
|
||||
DomesticInfo string `p:"domesticInfo" dc:"国内分布描述"`
|
||||
CreateUser int `p:"createUser" dc:"数据采集人"`
|
||||
CreateDate *gtime.Time `p:"createDate" dc:"数据采集日期"`
|
||||
//AuditUser int `p:"auditUser" dc:"数据核查人"`
|
||||
//AuditDate *gtime.Time `p:"auditDate" dc:"数据核查日期"`
|
||||
AuditStatus int `p:"auditStatus" v:"required#核查状态不能为空" dc:"核查状态"`
|
||||
//AuditView string `p:"auditView" dc:"核查意见"`
|
||||
Remark string `p:"remark" dc:"备注"`
|
||||
Version int `p:"version" dc:""`
|
||||
}
|
25
internal/app/businesses/router/characteristic.go
Normal file
25
internal/app/businesses/router/characteristic.go
Normal file
@ -0,0 +1,25 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成router操作代码。
|
||||
// 生成日期:2025-08-08 15:18:02
|
||||
// 生成路径: internal/app/businesses/router/characteristic.go
|
||||
// 生成人:gfast
|
||||
// desc:识别特征
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package router
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/controller"
|
||||
)
|
||||
|
||||
func (router *Router) BindCharacteristicController(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
group.Group("/characteristic", func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
controller.Characteristic,
|
||||
)
|
||||
})
|
||||
}
|
25
internal/app/businesses/router/domestiDistribuion.go
Normal file
25
internal/app/businesses/router/domestiDistribuion.go
Normal file
@ -0,0 +1,25 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成router操作代码。
|
||||
// 生成日期:2025-08-08 15:02:58
|
||||
// 生成路径: internal/app/businesses/router/domesti_distribuion.go
|
||||
// 生成人:gfast
|
||||
// desc:国内分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package router
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/controller"
|
||||
)
|
||||
|
||||
func (router *Router) BindDomestiDistribuionController(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
group.Group("/domestiDistribuion", func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
controller.DomestiDistribuion,
|
||||
)
|
||||
})
|
||||
}
|
25
internal/app/businesses/router/foreignDistribuion.go
Normal file
25
internal/app/businesses/router/foreignDistribuion.go
Normal file
@ -0,0 +1,25 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成router操作代码。
|
||||
// 生成日期:2025-08-08 15:00:02
|
||||
// 生成路径: internal/app/businesses/router/foreign_distribution.go
|
||||
// 生成人:gfast
|
||||
// desc:国外分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package router
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/controller"
|
||||
)
|
||||
|
||||
func (router *Router) BindForeignDistributionController(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
group.Group("/foreignDistribution", func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
controller.ForeignDistribution,
|
||||
)
|
||||
})
|
||||
}
|
25
internal/app/businesses/router/geography.go
Normal file
25
internal/app/businesses/router/geography.go
Normal file
@ -0,0 +1,25 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成router操作代码。
|
||||
// 生成日期:2025-08-08 11:21:24
|
||||
// 生成路径: internal/app/businesses/router/geography.go
|
||||
// 生成人:gfast
|
||||
// desc:地理分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package router
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/controller"
|
||||
)
|
||||
|
||||
func (router *Router) BindGeographyController(ctx context.Context, group *ghttp.RouterGroup) {
|
||||
group.Group("/geography", func(group *ghttp.RouterGroup) {
|
||||
group.Bind(
|
||||
controller.Geography,
|
||||
)
|
||||
})
|
||||
}
|
37
internal/app/businesses/service/characteristic.go
Normal file
37
internal/app/businesses/service/characteristic.go
Normal file
@ -0,0 +1,37 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成service操作代码。
|
||||
// 生成日期:2025-08-08 15:18:02
|
||||
// 生成路径: internal/app/businesses/service/characteristic.go
|
||||
// 生成人:gfast
|
||||
// desc:识别特征
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model"
|
||||
)
|
||||
|
||||
type ICharacteristic interface {
|
||||
List(ctx context.Context, req *model.CharacteristicSearchReq) (res *model.CharacteristicSearchRes, err error)
|
||||
GetById(ctx context.Context, Id int) (res *model.CharacteristicInfoRes, err error)
|
||||
Add(ctx context.Context, req *model.CharacteristicAddReq) (err error)
|
||||
Edit(ctx context.Context, req *model.CharacteristicEditReq) (err error)
|
||||
Delete(ctx context.Context, Id []int) (err error)
|
||||
}
|
||||
|
||||
var localCharacteristic ICharacteristic
|
||||
|
||||
func Characteristic() ICharacteristic {
|
||||
if localCharacteristic == nil {
|
||||
panic("implement not found for interface ICharacteristic, forgot register?")
|
||||
}
|
||||
return localCharacteristic
|
||||
}
|
||||
|
||||
func RegisterCharacteristic(i ICharacteristic) {
|
||||
localCharacteristic = i
|
||||
}
|
36
internal/app/businesses/service/domestiDistribuion.go
Normal file
36
internal/app/businesses/service/domestiDistribuion.go
Normal file
@ -0,0 +1,36 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成service操作代码。
|
||||
// 生成日期:2025-08-08 15:02:58
|
||||
// 生成路径: internal/app/businesses/service/domesti_distribuion.go
|
||||
// 生成人:gfast
|
||||
// desc:国内分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model"
|
||||
)
|
||||
|
||||
type IDomestiDistribuion interface {
|
||||
List(ctx context.Context, req *model.DomestiDistribuionSearchReq) (res *model.DomestiDistribuionSearchRes, err error)
|
||||
GetById(ctx context.Context, Id int) (res *model.DomestiDistribuionInfoRes, err error)
|
||||
Add(ctx context.Context, req *model.DomestiDistribuionAddReq) (err error)
|
||||
Edit(ctx context.Context, req *model.DomestiDistribuionEditReq) (err error)
|
||||
Delete(ctx context.Context, Id []int) (err error)
|
||||
}
|
||||
|
||||
var localDomestiDistribuion IDomestiDistribuion
|
||||
|
||||
func DomestiDistribuion() IDomestiDistribuion {
|
||||
if localDomestiDistribuion == nil {
|
||||
panic("implement not found for interface IDomestiDistribuion, forgot register?")
|
||||
}
|
||||
return localDomestiDistribuion
|
||||
}
|
||||
|
||||
func RegisterDomestiDistribuion(i IDomestiDistribuion) {
|
||||
localDomestiDistribuion = i
|
||||
}
|
37
internal/app/businesses/service/foreignDistribuion.go
Normal file
37
internal/app/businesses/service/foreignDistribuion.go
Normal file
@ -0,0 +1,37 @@
|
||||
// ==========================================================================
|
||||
// GFast自动生成service操作代码。
|
||||
// 生成日期:2025-08-08 15:00:02
|
||||
// 生成路径: internal/app/businesses/service/foreign_distribution.go
|
||||
// 生成人:gfast
|
||||
// desc:国外分布
|
||||
// company:云南奇讯科技有限公司
|
||||
// ==========================================================================
|
||||
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model"
|
||||
)
|
||||
|
||||
type IForeignDistribution interface {
|
||||
List(ctx context.Context, req *model.ForeignDistributionSearchReq) (res *model.ForeignDistributionSearchRes, err error)
|
||||
GetById(ctx context.Context, Id int) (res *model.ForeignDistributionInfoRes, err error)
|
||||
Add(ctx context.Context, req *model.ForeignDistributionAddReq) (err error)
|
||||
Edit(ctx context.Context, req *model.ForeignDistributionEditReq) (err error)
|
||||
Delete(ctx context.Context, Id []int) (err error)
|
||||
}
|
||||
|
||||
var localForeignDistribution IForeignDistribution
|
||||
|
||||
func ForeignDistribution() IForeignDistribution {
|
||||
if localForeignDistribution == nil {
|
||||
panic("implement not found for interface IForeignDistribution, forgot register?")
|
||||
}
|
||||
return localForeignDistribution
|
||||
}
|
||||
|
||||
func RegisterForeignDistribution(i IForeignDistribution) {
|
||||
localForeignDistribution = i
|
||||
}
|
28
internal/app/businesses/service/geography.go
Normal file
28
internal/app/businesses/service/geography.go
Normal file
@ -0,0 +1,28 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/tiger1103/gfast/v3/internal/app/businesses/model"
|
||||
)
|
||||
|
||||
type IGeography interface {
|
||||
List(ctx context.Context, req *model.GeographySearchReq) (res *model.GeographySearchRes, err error)
|
||||
GetById(ctx context.Context, Id int) (res *model.GeographyInfoRes, err error)
|
||||
Add(ctx context.Context, req *model.GeographyAddReq) (err error)
|
||||
Edit(ctx context.Context, req *model.GeographyEditReq) (err error)
|
||||
Delete(ctx context.Context, Id []int) (err error)
|
||||
}
|
||||
|
||||
var localGeography IGeography
|
||||
|
||||
func Geography() IGeography {
|
||||
if localGeography == nil {
|
||||
panic("implement not found for interface IGeography, forgot register?")
|
||||
}
|
||||
return localGeography
|
||||
}
|
||||
|
||||
func RegisterGeography(i IGeography) {
|
||||
localGeography = i
|
||||
}
|
@ -74,7 +74,7 @@ func (s *sToolsGenTable) List(ctx context.Context, req *system.ToolsGenTableSear
|
||||
if req.PageSize == 0 {
|
||||
req.PageSize = consts.PageSize
|
||||
}
|
||||
err = m.Page(req.PageNum, req.PageSize).Order(dao.ToolsGenTable.Columns().TableId + " asc").Scan(&res.List)
|
||||
err = m.Page(req.PageNum, req.PageSize).Order(dao.ToolsGenTable.Columns().TableId + " desc").Scan(&res.List)
|
||||
liberr.ErrIsNil(ctx, err, "获取数据失败")
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user