@Log(title = "物理删除业务类型定义", businessType = BusinessType.DELETE) @DeleteMapping("/{busiTypeId}") public R<Void> remove(@NotNull(message = "主键不能为空") @PathVariable Long busiTypeId,String busiTypeNew,String subBusiTypeNew) { TKnowledgeBusitypeVo vo = iTKnowledgeBusitypeService.queryById(String.valueOf(busiTypeId)); String busiType = ""; String subBusiType = ""; //一级 if("0".equals(vo.getParentBusiType())){ TKnowledgeBusitypeBo bo = new TKnowledgeBusitypeBo(); bo.setBusiType(vo.getBusiType()); if(UserConstants.NOT_UNIQUE.equals(iTKnowledgeBusitypeService.checkParentBusitypeUnique(bo))){ return R.fail("删除业务类型'" + bo.getBusiTypeName() + "'失败,存在同名业务类型小,不允许删除!"); } busiType = vo.getBusiType(); } //二级 else { busiType = vo.getParentBusiType(); subBusiType = vo.getBusiType(); } ITKnowledgebaseInnerService.updateByBusiType(busiType,subBusiType,busiTypeNew,subBusiTypeNew); ITKnowledgebaseLawService.updateByBusiType(busiType,subBusiType,busiTypeNew,subBusiTypeNew); ITKnowledgebaseCaseService.updateByBusiType(busiType,subBusiType,busiTypeNew,subBusiTypeNew); return toAjax(iTKnowledgeBusitypeService.remove(busiTypeId)); }
时间: 2024-04-19 07:29:44 浏览: 156
这段代码是一个删除操作的方法。根据提供的业务类型ID,首先查询出对应的业务类型信息。然后根据业务类型的级别(一级或二级),分别处理不同的逻辑。
如果是一级业务类型,检查是否存在同名的子业务类型,如果存在则返回删除失败的提示信息。如果不存在同名子业务类型,则将业务类型信息赋值给变量`busiType`。
如果是二级业务类型,将一级业务类型和二级业务类型分别赋值给变量`busiType`和`subBusiType`。
接下来,通过调用`ITKnowledgebaseInnerService`、`ITKnowledgebaseLawService`和`ITKnowledgebaseCaseService`的相应方法,更新这些表中与该业务类型相关的数据。
最后调用`iTKnowledgeBusitypeService.remove(busiTypeId)`方法删除该业务类型,并将结果返回。返回结果以R对象的形式表示,其中`toAjax()`方法将删除结果转换成Ajax响应格式。
相关问题
使用cheerio 将以下代码转换为json<html> <tbody> <!-- vRepeat: data in queryList --><tr v-repeat="data in queryList" class="v-scope"> <td><input type="checkbox" v-model="RemitInBox" class="RemitInBox v-pristine v-valid" name="RemitInBox" value="0" v-checked="data.CheckFlag" v-disabled="data.FndDrc!='01' || data.BusiState!='10'" id="List0_RemitIn" v-click="clickBox($index,data)"></td> <td><span v-show="data.FndDrc!='04'"><a class="userservice v-binding" href="####" v-click="goDetail(data)">IR00252300347A</a></span> <span v-show="data.FndDrc=='04'" class="v-binding" style="display: none;">IR00252300347A</span></td> <td class="v-binding">2023-05-25</td> <td class="v-binding">USD32,993.50</td> <td class="v-binding">1/FLOKSER KIMYA SANAYI VE TICARET 1...</td> <td class="v-binding">31980005000107125</td> <td><span v-show="data.FndDrc=='01'">入账</span> <span v-show="data.FndDrc=='04'" style="display: none;">退汇</span> <span v-show="!(data.FndDrc=='04'||data.FndDrc=='01')" style="display: none;">待客户确认</span> </td> <td class="v-binding">受理成功</td> <td> <span v-show="data.FndDrc=='01' && data.BusiState=='10'"> <a href="#" v-click="remitInPrint(data.BsnSrlNo)" class="userservice"> 打印 </a> </span> </td> </tr> </tbody> </html>
以下是使用Cheerio将代码转换为JSON的示例代码:
```javascript
const cheerio = require('cheerio');
const html = '<html>...</html>'; // 你提供的HTML代码
const $ = cheerio.load(html);
const queryList = [];
$('tr[v-repeat="data in queryList"]').each((i, el) => {
const $tds = $(el).find('td.v-binding');
const data = {
IRNo: $(el).find('a.userservice').text(),
Date: $tds.eq(0).text(),
Amount: $tds.eq(1).text(),
Account: $tds.eq(2).text(),
BusinessType: $tds.eq(3).text(),
BusinessState: $tds.eq(4).text(),
Print: $(el).find('a.userservice').attr('href')
};
queryList.push(data);
});
const result = { queryList };
const json = JSON.stringify(result);
console.log(json);
```
代码说明:
1. 使用Cheerio模块将HTML代码加载到`$`变量中。
2. 遍历所有的`tr`元素,并使用`find`方法查找包含数据的`td`元素。
3. 从每个`td`元素中提取相应的数据,并创建一个包含所有数据的对象。
4. 将每个对象添加到`queryList`数组中。
5. 将`queryList`数组包装在一个对象中,并将其转换为JSON字符串。
@Log(title = "用户数据源", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(userdatasourceService.deleteUserdatasourceByIds(ids)); }帮我详细分析这份代码的完整具体实现原理
这段代码是一个基于Spring框架开发的RESTful API接口。它使用了`@DeleteMapping`注解表示该接口支持HTTP的DELETE方法,路径为"/{ids}",其中"{ids}"是一个占位符,用于接收一个或多个ID作为参数。
该接口的具体实现原理如下:
1. 接收到一个数组类型的参数`ids`,用于指定需要删除的用户数据源的ID。
2. 调用`userdatasourceService.deleteUserdatasourceByIds(ids)`方法,该方法负责删除指定ID的用户数据源。
3. `toAjax()`方法将删除操作的结果封装成一个`AjaxResult`对象,通常用于在前端显示操作结果信息。
4. 最后,将封装好的`AjaxResult`对象作为接口的返回值返回给前端。
需要注意的是,代码中的`@Log`注解用于记录日志信息,其中"title"属性表示日志标题,"businessType"属性表示业务类型为删除操作。这些注解可能是自定义的注解,用于实现日志记录功能。具体实现细节可能需要查看注解的定义和相关配置。
阅读全文
相关推荐
















