修改研究实习项目和乡村政府项目业务层

This commit is contained in:
2025-10-30 10:16:57 +08:00
parent ea9c2ba288
commit 019c99238b
10 changed files with 199 additions and 10 deletions

View File

@@ -4,11 +4,14 @@
package socialServiceGovernmentProgram
import (
"fmt"
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/logic/socialServiceGovernmentProgram"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/model"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/types"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/rest/httpx"
)
@@ -19,8 +22,23 @@ func CreateSocialServiceGovernmentProgramHandler(cfg *config.Config) http.Handle
httpx.ErrorCtx(r.Context(), w, err)
return
}
mysqlCfg := cfg.MySQL
dsn := fmt.Sprintf(
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
mysqlCfg.Username,
mysqlCfg.Password,
mysqlCfg.Host,
mysqlCfg.Port,
mysqlCfg.Database,
mysqlCfg.Charset,
)
fmt.Println("接收到articlePost请求")
l := socialServiceGovernmentProgram.NewCreateSocialServiceGovernmentProgramLogic(r.Context(), svcCtx)
conn := sqlx.NewSqlConn("mysql", dsn)
socialGovernmentProgramModel := model.NewSocialServiceGovernmentprogramModel(conn)
l := socialServiceGovernmentProgram.NewCreateSocialServiceGovernmentProgramLogic(r.Context(), cfg, socialGovernmentProgramModel)
resp, err := l.CreateSocialServiceGovernmentProgram(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)

View File

@@ -4,11 +4,14 @@
package socialServiceGovernmentProgram
import (
"fmt"
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/logic/socialServiceGovernmentProgram"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/model"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/types"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/rest/httpx"
)
@@ -19,8 +22,23 @@ func DeleteSocialServiceGovernmentProgramHandler(cfg *config.Config) http.Handle
httpx.ErrorCtx(r.Context(), w, err)
return
}
mysqlCfg := cfg.MySQL
dsn := fmt.Sprintf(
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
mysqlCfg.Username,
mysqlCfg.Password,
mysqlCfg.Host,
mysqlCfg.Port,
mysqlCfg.Database,
mysqlCfg.Charset,
)
fmt.Println("接收到articlePost请求")
l := socialServiceGovernmentProgram.NewDeleteSocialServiceGovernmentProgramLogic(r.Context(), svcCtx)
conn := sqlx.NewSqlConn("mysql", dsn)
socialGovernmentProgramModel := model.NewSocialServiceGovernmentprogramModel(conn)
l := socialServiceGovernmentProgram.NewDeleteSocialServiceGovernmentProgramLogic(r.Context(), cfg, socialGovernmentProgramModel)
resp, err := l.DeleteSocialServiceGovernmentProgram(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)

View File

@@ -4,10 +4,14 @@
package socialServiceGovernmentProgram
import (
"fmt"
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/logic/socialServiceGovernmentProgram"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/model"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/types"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/rest/httpx"
)
@@ -19,7 +23,23 @@ func GetSocialServiceGovernmentProgramHandler(cfg *config.Config) http.HandlerFu
return
}
l := socialServiceGovernmentProgram.NewGetSocialServiceGovernmentProgramLogic(r.Context(), svcCtx)
mysqlCfg := cfg.MySQL
dsn := fmt.Sprintf(
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
mysqlCfg.Username,
mysqlCfg.Password,
mysqlCfg.Host,
mysqlCfg.Port,
mysqlCfg.Database,
mysqlCfg.Charset,
)
fmt.Println("接收到articlePost请求")
conn := sqlx.NewSqlConn("mysql", dsn)
socialGovernmentProgramModel := model.NewSocialServiceGovernmentprogramModel(conn)
l := socialServiceGovernmentProgram.NewGetSocialServiceGovernmentProgramLogic(r.Context(), cfg, socialGovernmentProgramModel)
resp, err := l.GetSocialServiceGovernmentProgram(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)

View File

@@ -4,11 +4,14 @@
package socialServiceGovernmentProgram
import (
"fmt"
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/logic/socialServiceGovernmentProgram"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/model"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/types"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/rest/httpx"
)
@@ -20,7 +23,23 @@ func ListSocialServiceGovernmentProgramHandler(cfg *config.Config) http.HandlerF
return
}
l := socialServiceGovernmentProgram.NewListSocialServiceGovernmentProgramLogic(r.Context(), svcCtx)
mysqlCfg := cfg.MySQL
dsn := fmt.Sprintf(
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
mysqlCfg.Username,
mysqlCfg.Password,
mysqlCfg.Host,
mysqlCfg.Port,
mysqlCfg.Database,
mysqlCfg.Charset,
)
fmt.Println("接收到articlePost请求")
conn := sqlx.NewSqlConn("mysql", dsn)
socialGovernmentProgramModel := model.NewSocialServiceGovernmentprogramModel(conn)
l := socialServiceGovernmentProgram.NewListSocialServiceGovernmentProgramLogic(r.Context(), cfg, socialGovernmentProgramModel)
resp, err := l.ListSocialServiceGovernmentProgram(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)

View File

@@ -4,11 +4,14 @@
package socialServiceGovernmentProgram
import (
"fmt"
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/logic/socialServiceGovernmentProgram"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/model"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_governmentprogram/internal/types"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/rest/httpx"
)
@@ -20,7 +23,23 @@ func UpdateSocialServiceGovernmentProgramHandler(cfg *config.Config) http.Handle
return
}
l := socialServiceGovernmentProgram.NewUpdateSocialServiceGovernmentProgramLogic(r.Context(), svcCtx)
mysqlCfg := cfg.MySQL
dsn := fmt.Sprintf(
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
mysqlCfg.Username,
mysqlCfg.Password,
mysqlCfg.Host,
mysqlCfg.Port,
mysqlCfg.Database,
mysqlCfg.Charset,
)
fmt.Println("接收到articlePost请求")
conn := sqlx.NewSqlConn("mysql", dsn)
socialGovernmentProgramModel := model.NewSocialServiceGovernmentprogramModel(conn)
l := socialServiceGovernmentProgram.NewUpdateSocialServiceGovernmentProgramLogic(r.Context(), cfg, socialGovernmentProgramModel)
resp, err := l.UpdateSocialServiceGovernmentProgram(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)

View File

@@ -4,11 +4,14 @@
package socialServiceInternship
import (
"fmt"
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/logic/socialServiceInternship"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/model"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/types"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/rest/httpx"
)
@@ -20,7 +23,23 @@ func CreateSocialServiceInternshipHandler(cfg *config.Config) http.HandlerFunc {
return
}
l := socialServiceInternship.NewCreateSocialServiceInternshipLogic(r.Context(), svcCtx)
mysqlCfg := cfg.MySQL
dsn := fmt.Sprintf(
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
mysqlCfg.Username,
mysqlCfg.Password,
mysqlCfg.Host,
mysqlCfg.Port,
mysqlCfg.Database,
mysqlCfg.Charset,
)
fmt.Println("接收到articlePost请求")
conn := sqlx.NewSqlConn("mysql", dsn)
socialInternshipModel := model.NewSocialServiceInternshipModel(conn)
l := socialServiceInternship.NewCreateSocialServiceInternshipLogic(r.Context(), cfg, socialInternshipModel)
resp, err := l.CreateSocialServiceInternship(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)

View File

@@ -4,11 +4,14 @@
package socialServiceInternship
import (
"fmt"
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/logic/socialServiceInternship"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/model"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/types"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/rest/httpx"
)
@@ -20,7 +23,23 @@ func DeleteSocialServiceInternshipHandler(cfg *config.Config) http.HandlerFunc {
return
}
l := socialServiceInternship.NewDeleteSocialServiceInternshipLogic(r.Context(), svcCtx)
mysqlCfg := cfg.MySQL
dsn := fmt.Sprintf(
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
mysqlCfg.Username,
mysqlCfg.Password,
mysqlCfg.Host,
mysqlCfg.Port,
mysqlCfg.Database,
mysqlCfg.Charset,
)
fmt.Println("接收到articlePost请求")
conn := sqlx.NewSqlConn("mysql", dsn)
socialInternshipModel := model.NewSocialServiceInternshipModel(conn)
l := socialServiceInternship.NewDeleteSocialServiceInternshipLogic(r.Context(), cfg, socialInternshipModel)
resp, err := l.DeleteSocialServiceInternship(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)

View File

@@ -4,11 +4,14 @@
package socialServiceInternship
import (
"fmt"
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/logic/socialServiceInternship"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/model"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/types"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/rest/httpx"
)
@@ -20,7 +23,23 @@ func GetSocialServiceInternshipHandler(cfg *config.Config) http.HandlerFunc {
return
}
l := socialServiceInternship.NewGetSocialServiceInternshipLogic(r.Context(), svcCtx)
mysqlCfg := cfg.MySQL
dsn := fmt.Sprintf(
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
mysqlCfg.Username,
mysqlCfg.Password,
mysqlCfg.Host,
mysqlCfg.Port,
mysqlCfg.Database,
mysqlCfg.Charset,
)
fmt.Println("接收到articlePost请求")
conn := sqlx.NewSqlConn("mysql", dsn)
socialInternshipModel := model.NewSocialServiceInternshipModel(conn)
l := socialServiceInternship.NewGetSocialServiceInternshipLogic(r.Context(), cfg, socialInternshipModel)
resp, err := l.GetSocialServiceInternship(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)

View File

@@ -4,11 +4,14 @@
package socialServiceInternship
import (
"fmt"
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/logic/socialServiceInternship"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/model"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/types"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/rest/httpx"
)
@@ -20,7 +23,23 @@ func ListSocialServiceInternshipHandler(cfg *config.Config) http.HandlerFunc {
return
}
l := socialServiceInternship.NewListSocialServiceInternshipLogic(r.Context(), svcCtx)
mysqlCfg := cfg.MySQL
dsn := fmt.Sprintf(
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
mysqlCfg.Username,
mysqlCfg.Password,
mysqlCfg.Host,
mysqlCfg.Port,
mysqlCfg.Database,
mysqlCfg.Charset,
)
fmt.Println("接收到articlePost请求")
conn := sqlx.NewSqlConn("mysql", dsn)
socialInternshipModel := model.NewSocialServiceInternshipModel(conn)
l := socialServiceInternship.NewListSocialServiceInternshipLogic(r.Context(), cfg, socialInternshipModel)
resp, err := l.ListSocialServiceInternship(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)

View File

@@ -4,11 +4,14 @@
package socialServiceInternship
import (
"fmt"
"net/http"
"github.com/JACKYMYPERSON/hldrCenter/config"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/logic/socialServiceInternship"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/model"
"github.com/JACKYMYPERSON/hldrCenter/internal/social_service_internship/internal/types"
"github.com/zeromicro/go-zero/core/stores/sqlx"
"github.com/zeromicro/go-zero/rest/httpx"
)
@@ -20,7 +23,23 @@ func UpdateSocialServiceInternshipHandler(cfg *config.Config) http.HandlerFunc {
return
}
l := socialServiceInternship.NewUpdateSocialServiceInternshipLogic(r.Context(), svcCtx)
mysqlCfg := cfg.MySQL
dsn := fmt.Sprintf(
"%s:%s@tcp(%s:%d)/%s?charset=%s&parseTime=true&loc=Local",
mysqlCfg.Username,
mysqlCfg.Password,
mysqlCfg.Host,
mysqlCfg.Port,
mysqlCfg.Database,
mysqlCfg.Charset,
)
fmt.Println("接收到articlePost请求")
conn := sqlx.NewSqlConn("mysql", dsn)
socialInternshipModel := model.NewSocialServiceInternshipModel(conn)
l := socialServiceInternship.NewUpdateSocialServiceInternshipLogic(r.Context(), cfg, socialInternshipModel)
resp, err := l.UpdateSocialServiceInternship(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)