feat(ai): 新增产品题库问题删除功能
产品题库需要批量删除
- 在控制器中添加 productQuestionDelete 接口用于批量删除
- 更新 ControllerEndpoint 注解的消息提示文本
- 在服务层接口和服务实现类中添加删除方法
- 前端页面增加删除按钮并配置权限控制
- 实现前端表格选择删除和确认弹窗逻辑
- 添加删除请求的 AJAX 处理函数
| | |
| | | } |
| | | |
| | | @PostMapping(value = "stateUpdate/{type}/{ids}") |
| | | @ControllerEndpoint(operation = "更新", exceptionMessage = "更新失败") |
| | | @ControllerEndpoint(operation = "更新", exceptionMessage = "操作失败") |
| | | public FebsResponse stateUpdate(@PathVariable("ids") String ids, @PathVariable("type") Integer type) { |
| | | return aiProductQuestionService.stateUpdate(ids, type); |
| | | } |
| | | |
| | | @PostMapping(value = "productQuestionDelete/{ids}") |
| | | @ControllerEndpoint(operation = "删除", exceptionMessage = "操作失败") |
| | | public FebsResponse productQuestionDelete(@PathVariable("ids") String ids) { |
| | | return aiProductQuestionService.productQuestionDelete(ids); |
| | | } |
| | | |
| | | @GetMapping("delete/{id}") |
| | | @ControllerEndpoint(operation = "删除", exceptionMessage = "操作失败") |
| | | public FebsResponse delete( |
| | |
| | | |
| | | FebsResponse delete(String id); |
| | | |
| | | FebsResponse productQuestionDelete(String ids); |
| | | |
| | | List<AiProductQuestion> questionTree(String companyId); |
| | | |
| | | List<AiProductQuestion> productQuestionTree(LambdaQueryWrapper<AiProductQuestion> aiProductQuestionLambdaQueryWrapper); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse productQuestionDelete(String ids) { |
| | | if (StrUtil.isEmpty(ids)) { |
| | | throw new FebsException("参数错误"); |
| | | } |
| | | List<String> idList = StrUtil.split(ids, ','); |
| | | this.update(null, |
| | | Wrappers.lambdaUpdate(AiProductQuestion.class) |
| | | .set(AiProductQuestion::getState, 2) |
| | | .set(AiProductQuestion::getUpdatedTime, new Date()) |
| | | .in(AiProductQuestion::getId, idList)); |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public List<AiProductQuestion> questionTree(String companyId) { |
| | | LambdaQueryWrapper<AiProductQuestion> query = Wrappers.lambdaQuery(AiProductQuestion.class); |
| | | if (StrUtil.isNotEmpty(companyId)){ |
| | |
| | | <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain" shiro:hasPermission="productQuestionList:aiAdd" lay-event="productQuestionAiAdd">AI新增</button> |
| | | <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain" shiro:hasPermission="productQuestionList:aiAdd" lay-event="productQuestionStateOpen">启用</button> |
| | | <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain" shiro:hasPermission="productQuestionList:aiAdd" lay-event="productQuestionStateClose">禁用</button> |
| | | <button class="layui-btn layui-btn-sm layui-btn-primary febs-button-green-plain" shiro:hasPermission="productQuestionList:aiAdd" lay-event="productQuestionDelete">删除</button> |
| | | </div> |
| | | </script> |
| | | |
| | |
| | | productQuestionStateUpdate(ids.join(','), 0); |
| | | }); |
| | | } |
| | | if (layEvent === 'productQuestionDelete') { |
| | | |
| | | var checkData = table.checkStatus('productQuestionTable').data; |
| | | if (checkData.length <= 0) { |
| | | febs.alert.warn('请选择'); |
| | | return; |
| | | } |
| | | febs.modal.confirm('删除', '确定?', function () { |
| | | var ids = []; |
| | | layui.each(checkData, function (key, item) { |
| | | ids.push(item.id) |
| | | }); |
| | | productQuestionDelete(ids.join(',')); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | function productQuestionDelete(ids) { |
| | | febs.post(ctx + 'admin/productQuestion/productQuestionDelete/'+ ids, null, function () { |
| | | febs.alert.success('操作成功'); |
| | | }); |
| | | } |
| | | |
| | | function initProductQuestionTable() { |
| | | tableIns = febs.table.init({ |
| | | elem: $view.find('table'), |