notice_setting_controller.go
2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package controllers
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/application/noticeSetting/service"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/log"
)
type NoticeSettingController struct {
baseController
}
func (controller *NoticeSettingController) UpdateNoticeSetting() {
noticeSettingService := service.NewNoticeSettingService(nil)
updateNoticeSettingCommand := &command.UpdateNoticeSettingCommand{}
err := controller.Unmarshal(updateNoticeSettingCommand)
if err != nil {
log.Logger.Debug(err.Error())
}
Id, _ := controller.GetInt64(":settingId")
updateNoticeSettingCommand.NoticeSettingId = Id
updateNoticeSettingCommand.CompanyId = controller.GetCompanyId()
data, err := noticeSettingService.UpdateNoticeSetting(updateNoticeSettingCommand)
controller.Response(data, err)
}
func (controller *NoticeSettingController) GetNoticeSetting() {
noticeSettingService := service.NewNoticeSettingService(nil)
getNoticeSettingQuery := &query.GetNoticeSettingQuery{}
Id, _ := controller.GetInt64(":settingId")
getNoticeSettingQuery.NoticeSettingId = Id
data, err := noticeSettingService.GetNoticeSetting(getNoticeSettingQuery)
controller.Response(data, err)
}
func (controller *NoticeSettingController) ListNoticeSetting() {
noticeSettingService := service.NewNoticeSettingService(nil)
listNoticeSettingQuery := &query.ListNoticeSettingQuery{}
err := controller.Unmarshal(listNoticeSettingQuery)
if err != nil {
log.Logger.Debug(err.Error())
}
listNoticeSettingQuery.CompanyId = controller.GetCompanyId()
count, listdata, err := noticeSettingService.ListNoticeSetting(listNoticeSettingQuery)
data := map[string]interface{}{
"list": listdata,
"count": count,
}
controller.Response(data, err)
}
func (controller *NoticeSettingController) AddNoticeSetting() {
noticeSettingService := service.NewNoticeSettingService(nil)
addNoticeSettingCommand := &command.AddNoticeSettingCommand{}
err := controller.Unmarshal(addNoticeSettingCommand)
if err != nil {
log.Logger.Debug(err.Error())
}
data, err := noticeSettingService.AddNoticeSetting(addNoticeSettingCommand)
controller.Response(data, err)
}
func (controller *NoticeSettingController) NoticeSettingProfile() {
data := map[string]interface{}{
"moduleList": domain.GetNoticeModuleList(),
"moduleActionList": domain.GetNoticeModuleActionList(),
"paramList": domain.GetNoticeSettingParamList(""),
}
controller.Response(data, nil)
}