zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
commit | author | age
a18bfa 1 package cn.autoform.web.controller.templatecategoryedit;
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.bean.TemplateCategoryOutput;
12 import cn.autoform.bean.TemplateManagerOutput;
13 import cn.autoform.bean.page.PageResult;
14 import cn.autoform.db.entity.TemplateCategoryEntity;
15 import cn.autoform.db.entity.TenantEntity;
16 import cn.autoform.fw.exception.RestResult;
17 import cn.autoform.fw.utility.RestResultGenerator;
18 import cn.autoform.web.service.formbase.FormBaseService;
19 import cn.autoform.web.service.templatecategoryedit.TemplateCategoryEditService;
20
21 /**
22  * 模板分类编辑Controller
23  * @author lt-zwy
24  *
25  */
26 @RestController
27 public class TemplateCategoryEditController {
28     
29     @Autowired
30     private TemplateCategoryEditService templateCategoryEditService = null;
31     
32     /**
33      * 根据参数查询模板分类信息
34      * 
35      * @param tenantID 租户id
36      * @param businessCategoryID 业务分类id
37      * @param templateCategoryID 模板分类id
38      * @param pageNum 分頁頁數
39      * @return 模板分类信息
40      */
41     @RequestMapping(value = "${requset.templateCategoryEdit01}", method = RequestMethod.POST)
42     public RestResult<List<PageResult<TemplateCategoryOutput>>> getTemplateListService(@RequestBody TenantEntity tenant) {
43         //System.out.println(tenant);
44         List<PageResult<TemplateCategoryOutput>> list = templateCategoryEditService.queryTemplateList(tenant.getTenantID(),
45                 tenant.getBusinessCategoryID(), tenant.getSelectFor(),tenant.getPageNum(),tenant.getPageSize(),tenant.getSelectName());
46         return RestResultGenerator.genSuccessResult(list);
47     }
48     /**
49      * 新增模板分类
50      * @param templateCategoryEntity
51      * @return
52      */
53     @RequestMapping(value = "${requset.templateCategoryEdit02}", method = RequestMethod.POST)
54     public RestResult<Object> createTemplateCategoryService(@RequestBody TemplateCategoryEntity templateCategoryEntity) {
55         int nRs = templateCategoryEditService.createTemplateCategoryInfo(templateCategoryEntity);
56         return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
57     }
58     
59     /**
60      * 编辑模板分类
61      * @param templateCategoryEntity
62      * @return
63      */
64     @RequestMapping(value = "${requset.templateCategoryEdit03}", method = RequestMethod.POST)
65     public RestResult<Object> saveTemplateCategoryService(@RequestBody TemplateCategoryEntity templateCategoryEntity) {
66         int nRs = templateCategoryEditService.updateTemlateCategoryInfo(templateCategoryEntity);
67         return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
68     }
69     
70     @Autowired
71     private FormBaseService formBaseService = null;
72     
73     /**
74      * 新增模板
75      * @param templateManagerEntity
76      * @return
77      */
78     @RequestMapping(value = "${requset.templateCategoryEdit04}", method = RequestMethod.POST)
79     public RestResult<Object> createTemplateService(@RequestBody TemplateManagerOutput templateManagerOutput) {
80         //向formBase表中添加一条数据
81         int nRs = templateCategoryEditService.createTemplateInfo(templateManagerOutput);
82 //        FormBaseEntity formBase = new FormBaseEntity();
83 //        formBase.setFormID(templateManagerOutput.getFormID());
84 //        formBase.setCreateUser(templateManagerOutput.getCreateUser());
85 //        formBase.setUpdateUser(templateManagerOutput.getCreateUser());
86 //        formBase.setDeleteFlg("0");
87 //        formBase.setDesignMode("2");
88 //        formBase.setTemplateID(templateManagerOutput.getTemplateID());
89 //        formBase.setValidationRuleGroupID(templateManagerOutput.getBusinessCategoryID());
90 //        formBase.set
91 //        formBaseService.addFormBase(formBase);
92         return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
93     }
94     
95     /**
96      * 编辑模板
97      * @param templateManagerEntity
98      * @return
99      */
100     @RequestMapping(value = "${requset.templateCategoryEdit05}", method = RequestMethod.POST)
101     public RestResult<Object> saveTemplateService(@RequestBody TemplateManagerOutput templateManagerEntity) {
102         int nRs = templateCategoryEditService.updateTemplateInfo(templateManagerEntity);
103         return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
104     }
105     
106     /**
107      * 删除模板分类标签及下属模板
108      * @param templateCategoryOutput
109      * @return
110      */
111     @RequestMapping(value = "${requset.templateCategoryEdit06}", method = RequestMethod.POST)
112     public RestResult<Object> deleteTemplateCategory(@RequestBody TemplateCategoryOutput templateCategoryOutput) {
113         int nRs = templateCategoryEditService.deleteTemplateCategory(templateCategoryOutput);
114         return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
115     }
116     
117     /**
118      * 删除模板分类标签下的模板
119      * @param TemplateManagerOutput
120      * return 
121      */
122     @RequestMapping(value = "${requset.templateCategoryEdit08}",method = RequestMethod.POST)
123     public RestResult<Object> deleteTemplate(@RequestBody TemplateManagerOutput templateManagerOutput){
124         int nRs = templateCategoryEditService.deleteTemplate(templateManagerOutput);
125         return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
126     }
127     
128     
129     /**
130      * 从该模板创建时,验证当前模板是否已启用,已经停用的模板不可以创建表单
131      * @param tenantID
132      * @param templateID
133      * @return
134      */
135     @RequestMapping(value = "${requset.templateCategoryEdit07}", method = RequestMethod.GET)
136     public RestResult<Object> checkTemplateEnable(String tenantID, String templateID) {
137         int nRs = templateCategoryEditService.checkTemplateEnable(tenantID, templateID);
138         return RestResultGenerator.genSuccessResult(String.valueOf(nRs));
139     }
140 }