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
package com.changhong.autoform.rest.table;
 
import com.changhong.autoform.constant.data.DataUrl;
import com.changhong.autoform.entity.TableStructure;
import com.changhong.autoform.entity.system.RestResult;
import com.changhong.autoform.entity.system.RestResultGenerator;
import com.changhong.autoform.service.table.TableService;
import com.iemsoft.framework.cloud.core.tools.JSONTool;
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 javax.annotation.Resource;
 
@RestController
@RequestMapping(method=RequestMethod.POST)
public class TableRest implements DataUrl{
 
    @Resource
    private TableService tableService;
    
    @RequestMapping(CREATE_TABLE)
    public RestResult<Integer> createTable(@RequestBody TableStructure tableStructure){
        return RestResultGenerator.ok(tableService.createTable(tableStructure));
    }
    
    @RequestMapping(UPDATE_TABLE)
    public RestResult<Integer> updateTable(@RequestBody TableStructure tableStructure){
        return RestResultGenerator.ok(tableService.updateTable(tableStructure));
    }
    public static void main(String... args){
        System.out.println(
                JSONTool.toObj("{\"creatUser\":\"王鑫鑫\",\"fields\":{\"C_Type\":\" longtext \",\"agent\":\" varchar(150) \",\"bankl\":\" varchar(150) \",\"单行文本24\":\" varchar(150) \",\"单行文本30\":\" varchar(150) \",\"EmployeePosition\":\" varchar(150) \",\"zracct\":\" varchar(150) \",\"EmployeeNumber\":\" varchar(150) \",\"payWay\":\" longtext \",\"OutstandingAmount\":\" varchar(30) \",\"ApplicationAmount\":\" varchar(30) \",\"Remark\":\" varchar(150) \",\"expendText\":\" varchar(150) \",\"creditItem\":\" varchar(150) \",\"number_LoanCode\":\" varchar(50) \",\"zrcvert\":\" varchar(150) \",\"debitItem\":\" varchar(150) \",\"zzjjhh\":\" varchar(150) \",\"loanDescription\":\" varchar(150) \",\"alreadyRepaid\":\" varchar(30) \",\"netMoney\":\" varchar(30) \",\"currency\":\" longtext \",\"department\":\" longtext \",\"LoanPeople\":\" longtext \"},\"flag\":\"create\",\"formDataNum\":0,\"formId\":\"0929709fab634dd79beae3b73709ec4b\",\"mapperID\":\"0929709fab634dd79beae3b73709ec4b\",\"tableName\":\"formdata_100000444_0929709fab634dd79beae3b73709ec4b\",\"tenantId\":\"100000444\"}", TableStructure.class)
        );
    }
}