1234567891011121314151617181920212223242526272829303132333435 |
- package service
- import (
- "github.com/pkg/errors"
- "gorm.io/gorm"
- "kpt.notice/apiserver/config"
- "kpt.notice/apiserver/dao"
- "kpt.notice/apiserver/model"
- )
- var svc *Service
- type Service struct {
- DB *gorm.DB
- Con *config.Config
- }
- func New(c *config.Config) (s *Service) {
- dao := dao.New(c)
- s = &Service{
- DB: dao.DB,
- Con: c,
- }
- svc = s
- JobInit()
- return
- }
- func (svc *Service) QuerySysPastureUrl(con *model.SysPastureUrl) (result model.SysPastureUrl, err error) {
- if err = svc.DB.Table("sys_pasture_url").Where(con).First(&result).Error; err != nil {
- err = errors.Wrap(err, "service.QueryDB")
- }
- return
- }
|