【新增】代码编写

This commit is contained in:
nmy 2023-12-04 19:39:14 +08:00
parent 61ff731d15
commit 652f6857fa
4 changed files with 18 additions and 1 deletions

View File

@ -102,6 +102,15 @@ public class TypeInfoController extends BaseController
return toAjax(typeInfoService.deleteTypeInfoByTypeIds(typeIds));
}
/**
* 删除设备类型
*/
@DeleteMapping("/remove/{typeId}")
public AjaxResult remove(@PathVariable Long typeId)
{
return toAjax(typeInfoService.deleteTypeInfoByTypeId(typeId));
}
/**
* 获取设备类型树结构
* @return

View File

@ -58,4 +58,6 @@ public interface TypeInfoMapper
* @return 结果
*/
public int deleteTypeInfoByTypeIds(Long[] typeIds);
int selectCountByTypeId(Long typeId);
}

View File

@ -101,6 +101,9 @@ public class TypeInfoServiceImpl implements ITypeInfoService
@Override
public int deleteTypeInfoByTypeId(Long typeId)
{
if(typeInfoMapper.selectCountByTypeId(typeId)>0){
return 0;
}
return typeInfoMapper.deleteTypeInfoByTypeId(typeId);
}

View File

@ -38,7 +38,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectTypeInfoVo"/>
where type_id = #{typeId}
</select>
<select id="selectCountByTypeId" resultType="java.lang.Integer">
select COUNT(*) from ma_type_info where parent_id = #{typeId}
</select>
<insert id="insertTypeInfo" parameterType="com.bonus.zlpt.common.core.domain.equip.TypeInfo">
insert into ma_type_info
<trim prefix="(" suffix=")" suffixOverrides=",">