开发删除功能。新增QQ群链接

pull/1/head
wangziyangyang 2020-03-13 13:23:36 +08:00
parent 87fba19ae9
commit 758ea95563
7 changed files with 94 additions and 17 deletions

View File

@ -57,5 +57,6 @@
* 每张表的分页查询参数严格按照一张表对应一个请求参数对象进行开发如系统用户分页查询参数com.songpeng.sparchetype.system.request.SysUserPageReq
# 总结
Q群87652870 欢迎想一起开发的小伙伴。。本人前端太弱,都是自己乱摸索。还请有一个前端选手能一起弄
## QQ Group
[![QQ](https://img.shields.io/badge/QQ-87652870-green.svg?logo=tencent%20qq&logoColor=red)](https://jq.qq.com/?_wv=1027&k=55NGCxl)
[![MES-智能制造/MES-Sprongboot](https://gitee.com/wangziyangyang/MES-Sprongboot/widgets/widget_card.svg?colors=393222,ebdfc1,fffae5,d8ca9f,393222,a28b40)](https://gitee.com/wangziyangyang/MES-Sprongboot)

View File

@ -76,12 +76,12 @@ public class TableNameDataController extends BaseController {
/**
*
*
*
* @param request
* @return
*/
@ApiOperation("主数据表头修改")
@ApiOperation("主数据通用修改和新增")
@PostMapping("/add-or-update")
@ResponseBody
public Result addOrUpdate(HttpServletRequest request) throws Exception {
@ -94,4 +94,20 @@ public class TableNameDataController extends BaseController {
}
return Result.success();
}
/**
*
*
* @param commonDto
* @return Result
*/
@ApiOperation("通用删除接口")
@ApiImplicitParams({@ApiImplicitParam(name = "commonDto", value = "通用数据传输", defaultValue = "表信息")})
@PostMapping("delete")
@ResponseBody
public Result deleteCommon(CommonDto commonDto) throws Exception {
tableNameDataService.commonDelete(commonDto);
return Result.success();
}
}

View File

@ -45,4 +45,11 @@ public interface QueryTableNameDataMapper extends BaseMapper<SpTableManagerItem>
* @param commonDto
*/
void commonUpdate(CommonDto commonDto);
/**
*
*
* @param commonDto
*/
void commonDelete( CommonDto commonDto);
}

View File

@ -39,16 +39,28 @@ public interface TableNameDataService {
String buildCol(String tableNameId) throws Exception;
/**
*
*
*
* @param request
* @param request
* @param user
* @throws Exception
*/
void commonSave(HttpServletRequest request, SysUser user) throws Exception;
/**
*
*
* @param request
* @param request
* @param user
* @throws Exception
*/
void commonUpdate(HttpServletRequest request, SysUser user);
void commonUpdate(HttpServletRequest request, SysUser user) throws Exception;
/**
*
*
* @param request
* @throws Exception
*/
void commonDelete(CommonDto commonDto) throws Exception;
}

View File

@ -83,9 +83,22 @@ public class TableNameDataServiceImpl implements TableNameDataService {
}
/**
*
*
*
* @param request
* @param commonDto
* @throws Exception
*/
@Override
public void commonDelete(CommonDto commonDto) throws Exception {
queryTableNameDataMapper.commonDelete(commonDto);
}
/**
*
*
* @param request
* @param user
* @throws Exception
*/
@Override
public void commonSave(HttpServletRequest request, SysUser user) throws Exception {
@ -122,14 +135,33 @@ public class TableNameDataServiceImpl implements TableNameDataService {
/**
*
*
* @param request
* @param request
* @param user
* @throws Exception
*/
@Override
public void commonUpdate(HttpServletRequest request, SysUser user) {
public void commonUpdate(HttpServletRequest request, SysUser user) throws Exception {
//拿到列
String col = "";
//拿到对应的值
CommonDto commonDto = new CommonDto();
String jsTableName = request.getParameter("jsTableName");
String id = request.getParameter("id");
String jsTableNameId = request.getParameter("jsTableNameId");
//拼接修改的SQL语句
//拿到对应的修改列和值
StringBuilder valueBuilder = new StringBuilder();
List<SpTableManagerItem> spTableManagerItems = iSpTableManagerItemService.queryItemBytableNameId(jsTableNameId);
for (SpTableManagerItem spTableManagerItem : spTableManagerItems) {
String values = spTableManagerItem.getField() + "=" + "'" + request.getParameter(spTableManagerItem.getField()) + "',";
valueBuilder.append(values);
}
String updateUsername = "update_username=" + "'" + user.getUsername() + "',";
String updateTime = "update_time=" + "SYSDATE()";
valueBuilder.append(updateUsername).append(updateTime);
commonDto.setTableName(jsTableName);
commonDto.setCol(valueBuilder.toString());
commonDto.setId(id);
//执行mapper
queryTableNameDataMapper.commonUpdate(commonDto);
}
}

View File

@ -20,7 +20,16 @@
</insert>
<update id="commonUpdate">
UPDATE ${tableName}
SET ${col}
<where>
id = #{id}
</where>
</update>
<delete id="commonDelete">
delete from ${tableName}
<where>
id = #{id}
</where>
</delete>
</mapper>

View File

@ -214,7 +214,7 @@
if (obj.event === 'delete') {
layer.confirm('确认要删除吗?', function (index) {
spUtil.ajax({
url: '${request.contextPath}/basedata/common/delete/by/tableNameId',
url: '${request.contextPath}/basedata/common/delete',
async: false,
type: 'POST',
// 是否显示 loading