zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
package cn.autoform.web.controller.formevent;
 
import java.util.List;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
import cn.autoform.db.entity.CodeMasterEntity;
import cn.autoform.db.entity.FormEventEntity;
import cn.autoform.db.entity.FormFieldEntity;
import cn.autoform.fw.exception.RestResult;
import cn.autoform.fw.utility.RestResultGenerator;
import cn.autoform.web.service.formevent.FormEventService;
 
@RestController
public class FormEventController<T> {
 
    @Autowired
    private FormEventService formEventService= null;
    
    /**
     * 获取表单事件
     * @param tenantID
     * @param formID
     * @return
     */
    @RequestMapping(value = "${requset.formevent01}", method = RequestMethod.GET)
    public RestResult<List<FormEventEntity>> getFormEventListService(String tenantID,String formID) {
        List<FormEventEntity> rsList = formEventService.getFormEventList(tenantID, formID);
        return RestResultGenerator.genSuccessResult(rsList);
    }
    
    /**
     * 获取表单可以添加事件的 
     * @param tenantID
     * @param formID
     * @return
     */
    @RequestMapping(value = "${requset.formevent02}", method = RequestMethod.GET)
    public RestResult<List<FormFieldEntity>> getFieldListwithTypeService(String tenantID,String formID) {
        List<FormFieldEntity> rsList = formEventService.getFieldListwithType(tenantID, formID);
        return RestResultGenerator.genSuccessResult(rsList);
    }
    
    /**
     * 
     * @param formID
     * @param fieldName
     * @param tenantID
     * @param event
     * @param fieldType
     * @param eventmethod
     * @param createUser
     * @return
     */
    @RequestMapping(value = "${requset.formevent03}", method = RequestMethod.POST)
    public RestResult<String> createFormEventService(@RequestBody FormEventEntity formEventEntity) {
        int nRs = formEventService.createFormEvent(formEventEntity);
        return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
    }
    
    /**
     * 
     * @param formID
     * @param fieldName
     * @param tenantID
     * @param event
     * @return
     */
    @RequestMapping(value = "${requset.formevent04}", method = RequestMethod.GET)
    public RestResult<String> deleteFormEventService(String formID,String fieldName, String tenantID, String event) {
        int nRs = formEventService.deleteFormEvent(formID, fieldName, tenantID, event);
        return RestResultGenerator.genSuccessResult(String.valueOf(nRs)); 
    }
    
    /**
     * 
     * @param tenantID
     * @param formID
     * @param columnOrderNum
     * @return
     */
    @RequestMapping(value = "${requset.formevent05}", method = RequestMethod.GET)
    public RestResult<List<CodeMasterEntity>> getFieldEventService(String tenantID,String formID,String columnOrderNum) {
        List<CodeMasterEntity> rsList = formEventService.getFieldEventList(tenantID, formID, columnOrderNum);
        return RestResultGenerator.genSuccessResult(rsList);
    }
    
    /**
     * 获取字段事件列表
     * @param tenantID
     * @param formID
     * @param fieldName
     * @return
     */
    @RequestMapping(value = "${requset.formevent06}", method = RequestMethod.GET)
    public RestResult<List<FormEventEntity>> getEventListService(String tenantID,String formID, String fieldName) {
        List<FormEventEntity> rsList = formEventService.getEventList(tenantID, formID, fieldName);
        return RestResultGenerator.genSuccessResult(rsList);
    }
}