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
package cn.autoform.web.controller.formresource;
 
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.FormresourceEntity;
import cn.autoform.fw.exception.RestResult;
import cn.autoform.fw.utility.RestResultGenerator;
import cn.autoform.web.service.formresource.FormResourceService;
 
@RestController
public class FormResourceController {
 
    @Autowired
    private FormResourceService formResourceService = null;
    
    /**
     * 
     * @param tenantID
     * @param formID
     * @return
     */
    @RequestMapping(value = "${requset.formresource01}", method = RequestMethod.GET)
    public RestResult<List<FormresourceEntity>> getFormresourceListService(String tenantID,String formID) {
        List<FormresourceEntity> rsList = formResourceService.getFormresourceList(tenantID, formID);
        
        return RestResultGenerator.genSuccessResult(rsList);
    }
    
    /**
     * 
     * @param formID
     * @param tenantID
     * @param resourceFilepath
     * @param createUser
     * @return
     */
    @RequestMapping(value = "${requset.formresource02}", method = RequestMethod.POST)
    public RestResult<String> createFormresourceService(@RequestBody FormresourceEntity formresourceEntity) {
        int nRs = formResourceService.createFormresource(formresourceEntity);
        
        return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
    }
    
    /**
     * 
     * @param formID
     * @param tenantID
     * @param resourceFilepath
     * @return
     */
    @RequestMapping(value = "${requset.formresource03}", method = RequestMethod.GET)
    public RestResult<String> deleteFormresourceService(String formID, String tenantID, String resourceFileID) {
        int nRs = formResourceService.deleteFormresource(formID, tenantID, resourceFileID);
        
        return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
    }
    
    /**
     * 
     * @param tenantID
     * @param formID
     * @return
     */
    @RequestMapping(value = "${requset.formresource04}", method = RequestMethod.GET)
    public RestResult<String> getFormresourcePathService(String tenantID,String formID) {
        List<FormresourceEntity> rsList = formResourceService.getFormresourcePath(tenantID, formID);
        String result = "";
        
        if(!rsList.isEmpty()) {
            result = rsList.get(0).getResourceFilepath();
        }
        
        return RestResultGenerator.genSuccessResult(result);
    }
}