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);
|
}
|
}
|