package cn.autoform.web.controller.templatecategoryedit;
|
|
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.bean.TemplateCategoryOutput;
|
import cn.autoform.bean.TemplateManagerOutput;
|
import cn.autoform.bean.page.PageResult;
|
import cn.autoform.db.entity.TemplateCategoryEntity;
|
import cn.autoform.db.entity.TenantEntity;
|
import cn.autoform.fw.exception.RestResult;
|
import cn.autoform.fw.utility.RestResultGenerator;
|
import cn.autoform.web.service.formbase.FormBaseService;
|
import cn.autoform.web.service.templatecategoryedit.TemplateCategoryEditService;
|
|
/**
|
* 模板分类编辑Controller
|
* @author lt-zwy
|
*
|
*/
|
@RestController
|
public class TemplateCategoryEditController {
|
|
@Autowired
|
private TemplateCategoryEditService templateCategoryEditService = null;
|
|
/**
|
* 根据参数查询模板分类信息
|
*
|
* @param tenantID 租户id
|
* @param businessCategoryID 业务分类id
|
* @param templateCategoryID 模板分类id
|
* @param pageNum 分頁頁數
|
* @return 模板分类信息
|
*/
|
@RequestMapping(value = "${requset.templateCategoryEdit01}", method = RequestMethod.POST)
|
public RestResult<List<PageResult<TemplateCategoryOutput>>> getTemplateListService(@RequestBody TenantEntity tenant) {
|
//System.out.println(tenant);
|
List<PageResult<TemplateCategoryOutput>> list = templateCategoryEditService.queryTemplateList(tenant.getTenantID(),
|
tenant.getBusinessCategoryID(), tenant.getSelectFor(),tenant.getPageNum(),tenant.getPageSize(),tenant.getSelectName());
|
return RestResultGenerator.genSuccessResult(list);
|
}
|
/**
|
* 新增模板分类
|
* @param templateCategoryEntity
|
* @return
|
*/
|
@RequestMapping(value = "${requset.templateCategoryEdit02}", method = RequestMethod.POST)
|
public RestResult<Object> createTemplateCategoryService(@RequestBody TemplateCategoryEntity templateCategoryEntity) {
|
int nRs = templateCategoryEditService.createTemplateCategoryInfo(templateCategoryEntity);
|
return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
|
}
|
|
/**
|
* 编辑模板分类
|
* @param templateCategoryEntity
|
* @return
|
*/
|
@RequestMapping(value = "${requset.templateCategoryEdit03}", method = RequestMethod.POST)
|
public RestResult<Object> saveTemplateCategoryService(@RequestBody TemplateCategoryEntity templateCategoryEntity) {
|
int nRs = templateCategoryEditService.updateTemlateCategoryInfo(templateCategoryEntity);
|
return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
|
}
|
|
@Autowired
|
private FormBaseService formBaseService = null;
|
|
/**
|
* 新增模板
|
* @param templateManagerEntity
|
* @return
|
*/
|
@RequestMapping(value = "${requset.templateCategoryEdit04}", method = RequestMethod.POST)
|
public RestResult<Object> createTemplateService(@RequestBody TemplateManagerOutput templateManagerOutput) {
|
//向formBase表中添加一条数据
|
int nRs = templateCategoryEditService.createTemplateInfo(templateManagerOutput);
|
// FormBaseEntity formBase = new FormBaseEntity();
|
// formBase.setFormID(templateManagerOutput.getFormID());
|
// formBase.setCreateUser(templateManagerOutput.getCreateUser());
|
// formBase.setUpdateUser(templateManagerOutput.getCreateUser());
|
// formBase.setDeleteFlg("0");
|
// formBase.setDesignMode("2");
|
// formBase.setTemplateID(templateManagerOutput.getTemplateID());
|
// formBase.setValidationRuleGroupID(templateManagerOutput.getBusinessCategoryID());
|
// formBase.set
|
// formBaseService.addFormBase(formBase);
|
return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
|
}
|
|
/**
|
* 编辑模板
|
* @param templateManagerEntity
|
* @return
|
*/
|
@RequestMapping(value = "${requset.templateCategoryEdit05}", method = RequestMethod.POST)
|
public RestResult<Object> saveTemplateService(@RequestBody TemplateManagerOutput templateManagerEntity) {
|
int nRs = templateCategoryEditService.updateTemplateInfo(templateManagerEntity);
|
return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
|
}
|
|
/**
|
* 删除模板分类标签及下属模板
|
* @param templateCategoryOutput
|
* @return
|
*/
|
@RequestMapping(value = "${requset.templateCategoryEdit06}", method = RequestMethod.POST)
|
public RestResult<Object> deleteTemplateCategory(@RequestBody TemplateCategoryOutput templateCategoryOutput) {
|
int nRs = templateCategoryEditService.deleteTemplateCategory(templateCategoryOutput);
|
return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
|
}
|
|
/**
|
* 删除模板分类标签下的模板
|
* @param TemplateManagerOutput
|
* return
|
*/
|
@RequestMapping(value = "${requset.templateCategoryEdit08}",method = RequestMethod.POST)
|
public RestResult<Object> deleteTemplate(@RequestBody TemplateManagerOutput templateManagerOutput){
|
int nRs = templateCategoryEditService.deleteTemplate(templateManagerOutput);
|
return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
|
}
|
|
|
/**
|
* 从该模板创建时,验证当前模板是否已启用,已经停用的模板不可以创建表单
|
* @param tenantID
|
* @param templateID
|
* @return
|
*/
|
@RequestMapping(value = "${requset.templateCategoryEdit07}", method = RequestMethod.GET)
|
public RestResult<Object> checkTemplateEnable(String tenantID, String templateID) {
|
int nRs = templateCategoryEditService.checkTemplateEnable(tenantID, templateID);
|
return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
|
}
|
}
|