commit | author | age
|
a18bfa
|
1 |
package cn.autoform.web.controller.formresource; |
Z |
2 |
|
|
3 |
import java.util.List; |
|
4 |
|
|
5 |
import org.springframework.beans.factory.annotation.Autowired; |
|
6 |
import org.springframework.web.bind.annotation.RequestBody; |
|
7 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
8 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
9 |
import org.springframework.web.bind.annotation.RestController; |
|
10 |
|
|
11 |
import cn.autoform.db.entity.FormresourceEntity; |
|
12 |
import cn.autoform.fw.exception.RestResult; |
|
13 |
import cn.autoform.fw.utility.RestResultGenerator; |
|
14 |
import cn.autoform.web.service.formresource.FormResourceService; |
|
15 |
|
|
16 |
@RestController |
|
17 |
public class FormResourceController { |
|
18 |
|
|
19 |
@Autowired |
|
20 |
private FormResourceService formResourceService = null; |
|
21 |
|
|
22 |
/** |
|
23 |
* |
|
24 |
* @param tenantID |
|
25 |
* @param formID |
|
26 |
* @return |
|
27 |
*/ |
|
28 |
@RequestMapping(value = "${requset.formresource01}", method = RequestMethod.GET) |
|
29 |
public RestResult<List<FormresourceEntity>> getFormresourceListService(String tenantID,String formID) { |
|
30 |
List<FormresourceEntity> rsList = formResourceService.getFormresourceList(tenantID, formID); |
|
31 |
|
|
32 |
return RestResultGenerator.genSuccessResult(rsList); |
|
33 |
} |
|
34 |
|
|
35 |
/** |
|
36 |
* |
|
37 |
* @param formID |
|
38 |
* @param tenantID |
|
39 |
* @param resourceFilepath |
|
40 |
* @param createUser |
|
41 |
* @return |
|
42 |
*/ |
|
43 |
@RequestMapping(value = "${requset.formresource02}", method = RequestMethod.POST) |
|
44 |
public RestResult<String> createFormresourceService(@RequestBody FormresourceEntity formresourceEntity) { |
|
45 |
int nRs = formResourceService.createFormresource(formresourceEntity); |
|
46 |
|
|
47 |
return RestResultGenerator.genSuccessResult(String.valueOf(nRs)); |
|
48 |
} |
|
49 |
|
|
50 |
/** |
|
51 |
* |
|
52 |
* @param formID |
|
53 |
* @param tenantID |
|
54 |
* @param resourceFilepath |
|
55 |
* @return |
|
56 |
*/ |
|
57 |
@RequestMapping(value = "${requset.formresource03}", method = RequestMethod.GET) |
|
58 |
public RestResult<String> deleteFormresourceService(String formID, String tenantID, String resourceFileID) { |
|
59 |
int nRs = formResourceService.deleteFormresource(formID, tenantID, resourceFileID); |
|
60 |
|
|
61 |
return RestResultGenerator.genSuccessResult(String.valueOf(nRs)); |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* |
|
66 |
* @param tenantID |
|
67 |
* @param formID |
|
68 |
* @return |
|
69 |
*/ |
|
70 |
@RequestMapping(value = "${requset.formresource04}", method = RequestMethod.GET) |
|
71 |
public RestResult<String> getFormresourcePathService(String tenantID,String formID) { |
|
72 |
List<FormresourceEntity> rsList = formResourceService.getFormresourcePath(tenantID, formID); |
|
73 |
String result = ""; |
|
74 |
|
|
75 |
if(!rsList.isEmpty()) { |
|
76 |
result = rsList.get(0).getResourceFilepath(); |
|
77 |
} |
|
78 |
|
|
79 |
return RestResultGenerator.genSuccessResult(result); |
|
80 |
} |
|
81 |
} |