package cn.autoform.test;
|
|
import java.util.Map;
|
import java.util.concurrent.TimeoutException;
|
|
import javax.annotation.Resource;
|
|
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.ui.ModelMap;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import com.alibaba.fastjson.TypeReference;
|
import com.codingapi.tx.annotation.TxTransaction;
|
|
import cn.autoform.fw.exception.RestResult;
|
import cn.autoform.util.tool.JSONTool;
|
import cn.autoform.web.client.util.HttpClientTool;
|
import cn.autoform.web.mapper.datamanagement.DataManagementMapper;
|
|
@RestController
|
public class TestController {
|
|
@Resource
|
private DataManagementMapper dataManagementMapper;
|
|
@PostMapping("/test")
|
@TxTransaction(isStart = true)
|
@Transactional
|
public String test() throws TimeoutException {
|
String sql =
|
// "/*!mycat:sql=select tenantid from FORMDATAMANAGER WHERE TENANTID = '13' */\n" +
|
"INSERT INTO `formdatamanager`(\n" +
|
" `TENANTID` ,\n" +
|
" `FORMID` ,\n" +
|
" `FORMDATANUM` ,\n" +
|
" `FORMDATATABLE` ,\n" +
|
" `SUBFORMFLG` ,\n" +
|
" `SUBFORMFIELDKEY` ,\n" +
|
" `DATAROWNUM` ,\n" +
|
" `DELETEFLG` ,\n" +
|
" `CREATEUSER` ,\n" +
|
" `CREATEDATETIME` ,\n" +
|
" `UPDATEUSER` ,\n" +
|
" `UPDATEDATETIME`\n" +
|
")\n" +
|
"VALUES\n" +
|
" (\n" +
|
" '13' ,\n" +
|
" 'e8c6645bf3c6e54b572ae1661b742f79' ,\n" +
|
" '0' ,\n" +
|
" 'formdata_13_552404F91C6F4F59B38900866BC54A50' ,\n" +
|
" '0' ,\n" +
|
" '' ,\n" +
|
" '0' ,\n" +
|
" '0' ,\n" +
|
" 'WangYX' ,\n" +
|
" '2017-09-26 16:01:48' ,\n" +
|
" 'WangYX' ,\n" +
|
" '2018-01-10 15:01:38'\n" +
|
" );";
|
System.out.println(sql);
|
dataManagementMapper.excuteFormDataInsert(sql);
|
HttpClientTool<Map<String, Object>> hc = new HttpClientTool("http://localhost:9119/save");
|
hc.setBodyInfos(new ModelMap());
|
Map<String, Object> result = hc.sendPost(
|
j->JSONTool.toObj(j, new TypeReference<Map<String, Object>>(){}));
|
throw new NullPointerException();
|
// return "1";
|
}
|
|
}
|