开发动态插入单行数据

pull/1/head
wangziyangyang 2020-03-12 15:34:16 +08:00
parent a44198057d
commit 7c13304a7f
2 changed files with 5 additions and 10 deletions

View File

@ -20,7 +20,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -32,7 +31,7 @@ import java.util.Map;
*/ */
@Controller @Controller
@RequestMapping("basedata/common") @RequestMapping("basedata/common")
public class TableNameDataController extends BaseController { public class TableNameDataController extends BaseController {
/** /**
* service * service
*/ */
@ -87,13 +86,11 @@ public class TableNameDataController extends BaseController {
@ResponseBody @ResponseBody
public Result addOrUpdate(HttpServletRequest request) throws Exception { public Result addOrUpdate(HttpServletRequest request) throws Exception {
String id = request.getParameter("id"); String id = request.getParameter("id");
SysUser user =getSysUser(); SysUser user = getSysUser();
if (StringUtils.isNotEmpty(id)) { if (StringUtils.isNotEmpty(id)) {
//TODO 修改当前数据 tableNameDataService.commonUpdate(request, user);
tableNameDataService.commonUpdate(request,user);
} else { } else {
//TODO 新增当前表数据 tableNameDataService.commonSave(request, user);
tableNameDataService.commonSave(request,user);
} }
return Result.success(); return Result.success();
} }

View File

@ -69,8 +69,7 @@ public class TableNameDataServiceImpl implements TableNameDataService {
*/ */
@Override @Override
public String buildCol(String tableNameId) throws Exception { public String buildCol(String tableNameId) throws Exception {
if(StringUtils.isEmpty(tableNameId)) if (StringUtils.isEmpty(tableNameId)) {
{
throw new Exception("表关联ID不能为空"); throw new Exception("表关联ID不能为空");
} }
List<SpTableManagerItem> spTableManagerItems = iSpTableManagerItemService.queryItemBytableNameId(tableNameId); List<SpTableManagerItem> spTableManagerItems = iSpTableManagerItemService.queryItemBytableNameId(tableNameId);
@ -91,7 +90,6 @@ public class TableNameDataServiceImpl implements TableNameDataService {
@Override @Override
public void commonSave(HttpServletRequest request, SysUser user) throws Exception { public void commonSave(HttpServletRequest request, SysUser user) throws Exception {
CommonDto commonDto = new CommonDto(); CommonDto commonDto = new CommonDto();
//拼接插入的SQL语句 //拼接插入的SQL语句
String jsTableName = request.getParameter("jsTableName"); String jsTableName = request.getParameter("jsTableName");
String jsTableNameId = request.getParameter("jsTableNameId"); String jsTableNameId = request.getParameter("jsTableNameId");