diff --git a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/controller/SpTableManagerController.java b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/controller/SpTableManagerController.java index 12719d9..ea6c35b 100644 --- a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/controller/SpTableManagerController.java +++ b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/controller/SpTableManagerController.java @@ -27,9 +27,9 @@ import org.springframework.web.bind.annotation.*; import java.util.List; /** - *

- * 前端控制器 - *

+ * + * 主数据表头控制器 + * * * @author WangZiYang * @since 2020-03-06 @@ -112,9 +112,9 @@ public class SpTableManagerController extends BaseController { } /** - * 主数据表头修改 + * 主数据表头修改+表字段明细修改 * - * @param record 平台表对象 + * @param record 平台表对象,表明细集合 * @return 执行结果 */ @ApiOperation("主数据表头修改") @@ -142,6 +142,20 @@ public class SpTableManagerController extends BaseController { return Result.success(record.getId()); } - + /** + * 级联删除主表头+明细 + * + * @param req 请求参数 + * @return Result 执行结果 + */ + @ApiOperation("级联删除主表头+明细") + @ApiImplicitParams({@ApiImplicitParam(name = "req", value = "表信息", defaultValue = "表信息")}) + @PostMapping("delete/by/tableNameId") + @ResponseBody + public Result deleteByTableNameId(SpTableManager req) throws Exception { + iSpTableManagerService.removeById(req.getId()); + iSpTableManagerItemService.deleteItemBytableNameId(req.getId()); + return Result.success(); + } } diff --git a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/controller/SpTableManagerItemController.java b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/controller/SpTableManagerItemController.java index b102aca..2cd149c 100644 --- a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/controller/SpTableManagerItemController.java +++ b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/controller/SpTableManagerItemController.java @@ -18,9 +18,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import java.util.List; /** - *

- * 前端控制器 - *

+ * 基础主数据,表明细控制器 * * @author WangZiYang * @since 2020-03-06 diff --git a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/mapper/SpTableManagerItemMapper.java b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/mapper/SpTableManagerItemMapper.java index 91ebc0c..e16e4a0 100644 --- a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/mapper/SpTableManagerItemMapper.java +++ b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/mapper/SpTableManagerItemMapper.java @@ -7,9 +7,9 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - *

- * Mapper 接口 - *

+ * + * 主数据表明细Mapper 接口 + * * * @author WangZiYang * @since 2020-03-06 diff --git a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/mapper/SpTableManagerMapper.java b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/mapper/SpTableManagerMapper.java index ae278fd..dd30a61 100644 --- a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/mapper/SpTableManagerMapper.java +++ b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/mapper/SpTableManagerMapper.java @@ -7,9 +7,7 @@ import com.songpeng.sparchetype.basedata.entity.SpTableManagerItem; import java.util.List; /** - *

- * Mapper 接口 - *

+ * 主数据表头Mapper 接口 * * @author WangZiYang * @since 2020-03-06 diff --git a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/ISpTableManagerItemService.java b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/ISpTableManagerItemService.java index 445a952..4244dbc 100644 --- a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/ISpTableManagerItemService.java +++ b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/ISpTableManagerItemService.java @@ -7,7 +7,7 @@ import java.util.List; /** *

- * 服务类 + * 主数据表明细服务类 *

* * @author WangZiYang diff --git a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/ISpTableManagerService.java b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/ISpTableManagerService.java index 4001950..05771ab 100644 --- a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/ISpTableManagerService.java +++ b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/ISpTableManagerService.java @@ -8,7 +8,7 @@ import java.util.List; /** *

- * 服务类 + * 主数据表头服务类 *

* * @author WangZiYang diff --git a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/impl/SpTableManagerItemServiceImpl.java b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/impl/SpTableManagerItemServiceImpl.java index c3f9f51..b0f6105 100644 --- a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/impl/SpTableManagerItemServiceImpl.java +++ b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/impl/SpTableManagerItemServiceImpl.java @@ -11,7 +11,7 @@ import java.util.List; /** *

- * 服务实现类 + * 主数据表明细服务实现类 *

* * @author WangZiYang diff --git a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/impl/SpTableManagerServiceImpl.java b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/impl/SpTableManagerServiceImpl.java index 29727dc..2394dbb 100644 --- a/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/impl/SpTableManagerServiceImpl.java +++ b/sparchetype/src/main/java/com/songpeng/sparchetype/basedata/service/impl/SpTableManagerServiceImpl.java @@ -14,7 +14,7 @@ import java.util.List; /** *

- * 服务实现类 + * 主数据表头服务实现类 *

* * @author WangZiYang diff --git a/sparchetype/src/main/resources/templates/basedata/manager/list.ftl b/sparchetype/src/main/resources/templates/basedata/manager/list.ftl index 83f8dda..a1cbe3a 100644 --- a/sparchetype/src/main/resources/templates/basedata/manager/list.ftl +++ b/sparchetype/src/main/resources/templates/basedata/manager/list.ftl @@ -70,18 +70,18 @@ }, { field: 'tableDesc', title: '业务描述', width: 130 }, { - field: 'createUsername', title: '创建用户', width: 130 + field: 'createUsername', title: '创建用户', width: 130 }, { - field: 'createTime', title: '创建时间', width: 160 + field: 'createTime', title: '创建时间', width: 160 }, { - field: 'updateUsername', title: '更改用户', width: 130 + field: 'updateUsername', title: '更改用户', width: 130 }, { - field: 'updateTime', title: '更改时间', width: 160 + field: 'updateTime', title: '更改时间', width: 160 + }, { + field: 'isDeleted', title: '状态', width: 90, templet: function (records) { + return spConfig.isDeletedDict[records.isDeleted]; + } }, { - field: 'isDeleted', title: '状态', width: 90, templet: function (records) { - return spConfig.isDeletedDict[records.isDeleted]; - } - }, { fixed: 'right', field: 'operate', title: '操作', @@ -163,12 +163,28 @@ content: '${request.contextPath}/basedata/manager/add-or-update-ui' }); } - // 删除 if (obj.event === 'delete') { layer.confirm('确认要删除吗?', function (index) { - obj.del(); - layer.close(index); + spUtil.ajax({ + url: '${request.contextPath}/basedata/manager/delete/by/tableNameId', + async: false, + type: 'POST', + // 是否显示 loading + showLoading: true, + // 是否序列化参数 + serializable: false, + // 参数 + data: { + id : data.id + }, + success: function (data) { + tableIns.reload(); + layer.close(index); + }, + error: function () { + } + }); }); } });