jl_service.go 684 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * @description: 计量业务相关
  3. * @Author: CP
  4. * @Date: 2021-12-25 14:37:01
  5. * @FilePath: \construction_management\services\jl_service.go
  6. */
  7. package services
  8. import (
  9. "go.mod/dao"
  10. "go.mod/datasource"
  11. )
  12. type JlService struct {
  13. dao *dao.ProjectDao
  14. }
  15. // 创建项目用户service
  16. func NewJlService() *JlService {
  17. return &JlService{
  18. dao: dao.NewProjectDao(datasource.InstanceDbMaster()),
  19. }
  20. }
  21. // 是否有项目
  22. func (s *JlService) IsCode(code string) map[string]interface{} {
  23. exist := 0
  24. if code != "" {
  25. projectData := s.dao.GetListByCode(code)
  26. if len(projectData) != 0 {
  27. exist = 1
  28. }
  29. }
  30. data := map[string]interface{}{
  31. "exist": exist,
  32. }
  33. return data
  34. }