开发删除功能。新增QQ群链接
parent
87fba19ae9
commit
758ea95563
|
@ -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)
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -45,4 +45,11 @@ public interface QueryTableNameDataMapper extends BaseMapper<SpTableManagerItem>
|
|||
* @param commonDto 通用数据传输
|
||||
*/
|
||||
void commonUpdate(CommonDto commonDto);
|
||||
|
||||
/**
|
||||
* 通用删除服务
|
||||
*
|
||||
* @param commonDto 通用数据传输
|
||||
*/
|
||||
void commonDelete( CommonDto commonDto);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue