设备分类
This commit is contained in:
@@ -0,0 +1,109 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.deviceclassify;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.deviceclassify.vo.DeviceClassifyPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.deviceclassify.vo.DeviceClassifyRespVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.deviceclassify.vo.DeviceClassifySaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.deviceclassify.DeviceClassifyDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.deviceclassify.DeviceClassifyService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 设备分类")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/farm/device-classify")
|
||||||
|
@Validated
|
||||||
|
public class DeviceClassifyController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DeviceClassifyService deviceClassifyService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建设备分类")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:device-classify:create')")
|
||||||
|
public CommonResult<Long> createDeviceClassify(@Valid @RequestBody DeviceClassifySaveReqVO createReqVO) {
|
||||||
|
return success(deviceClassifyService.createDeviceClassify(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新设备分类")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:device-classify:update')")
|
||||||
|
public CommonResult<Boolean> updateDeviceClassify(@Valid @RequestBody DeviceClassifySaveReqVO updateReqVO) {
|
||||||
|
deviceClassifyService.updateDeviceClassify(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除设备分类")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:device-classify:delete')")
|
||||||
|
public CommonResult<Boolean> deleteDeviceClassify(@RequestParam("id") Long id) {
|
||||||
|
deviceClassifyService.deleteDeviceClassify(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除设备分类")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:device-classify:delete')")
|
||||||
|
public CommonResult<Boolean> deleteDeviceClassifyList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
deviceClassifyService.deleteDeviceClassifyListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得设备分类")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:device-classify:query')")
|
||||||
|
public CommonResult<DeviceClassifyRespVO> getDeviceClassify(@RequestParam("id") Long id) {
|
||||||
|
DeviceClassifyDO deviceClassify = deviceClassifyService.getDeviceClassify(id);
|
||||||
|
return success(BeanUtils.toBean(deviceClassify, DeviceClassifyRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得设备分类分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:device-classify:query')")
|
||||||
|
public CommonResult<PageResult<DeviceClassifyRespVO>> getDeviceClassifyPage(@Valid DeviceClassifyPageReqVO pageReqVO) {
|
||||||
|
PageResult<DeviceClassifyDO> pageResult = deviceClassifyService.getDeviceClassifyPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, DeviceClassifyRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@Operation(summary = "获得设备分类分页")
|
||||||
|
public CommonResult<List<DeviceClassifyRespVO>> getDeviceClassifyList() {
|
||||||
|
List<DeviceClassifyDO> pageResult = deviceClassifyService.getDeviceClassifyList();
|
||||||
|
return success(BeanUtils.toBean(pageResult, DeviceClassifyRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出设备分类 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:device-classify:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportDeviceClassifyExcel(@Valid DeviceClassifyPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<DeviceClassifyDO> list = deviceClassifyService.getDeviceClassifyPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "设备分类.xls", "数据", DeviceClassifyRespVO.class,
|
||||||
|
BeanUtils.toBean(list, DeviceClassifyRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.deviceclassify.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 设备分类分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class DeviceClassifyPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "父id", example = "8103")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "名称", example = "赵六")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "图片")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
@Schema(description = "描述", example = "你说的对")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
private String tenantId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.deviceclassify.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import cn.idev.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 设备分类 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class DeviceClassifyRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16263")
|
||||||
|
@ExcelProperty("主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "父id", example = "8103")
|
||||||
|
@ExcelProperty("父id")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "名称", example = "赵六")
|
||||||
|
@ExcelProperty("名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "图片")
|
||||||
|
@ExcelProperty("图片")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
@Schema(description = "描述", example = "你说的对")
|
||||||
|
@ExcelProperty("描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.deviceclassify.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 设备分类新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class DeviceClassifySaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16263")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "父id", example = "8103")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "名称", example = "赵六")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "图片")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
@Schema(description = "描述", example = "你说的对")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.dal.dataobject.deviceclassify;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备分类 DO
|
||||||
|
*
|
||||||
|
* @author 超级管理
|
||||||
|
*/
|
||||||
|
@TableName("farm_device_classify")
|
||||||
|
@KeySequence("farm_device_classify_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DeviceClassifyDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 父id
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private String tenantId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.dal.mysql.deviceclassify;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.deviceclassify.vo.DeviceClassifyPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.deviceclassify.DeviceClassifyDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备分类 Mapper
|
||||||
|
*
|
||||||
|
* @author 超级管理
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface DeviceClassifyMapper extends BaseMapperX<DeviceClassifyDO> {
|
||||||
|
|
||||||
|
default PageResult<DeviceClassifyDO> selectPage(DeviceClassifyPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<DeviceClassifyDO>()
|
||||||
|
.eqIfPresent(DeviceClassifyDO::getParentId, reqVO.getParentId())
|
||||||
|
.likeIfPresent(DeviceClassifyDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(DeviceClassifyDO::getImage, reqVO.getImage())
|
||||||
|
.eqIfPresent(DeviceClassifyDO::getDescription, reqVO.getDescription())
|
||||||
|
.eqIfPresent(DeviceClassifyDO::getTenantId, reqVO.getTenantId())
|
||||||
|
.betweenIfPresent(DeviceClassifyDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.orderByDesc(DeviceClassifyDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
void deleteByClassifyId(Long id);
|
||||||
|
}
|
||||||
@@ -131,5 +131,5 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode DUPLICATE_SPECIES_NAMES_ERROR = new ErrorCode(1_050_041_000, "气象灾害名称重复");
|
ErrorCode DUPLICATE_SPECIES_NAMES_ERROR = new ErrorCode(1_050_041_000, "气象灾害名称重复");
|
||||||
ErrorCode NOT_EXIST = new ErrorCode(1_050_042_000, "节点不存在或已被删除");
|
ErrorCode NOT_EXIST = new ErrorCode(1_050_042_000, "节点不存在或已被删除");
|
||||||
|
|
||||||
|
ErrorCode DEVICE_CLASSIFY_NOT_EXISTS = new ErrorCode(1_050_045_000, "设备分类不存在或已被删除");
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.service.deviceclassify;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.deviceclassify.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.deviceclassify.DeviceClassifyDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备分类 Service 接口
|
||||||
|
*
|
||||||
|
* @author 超级管理
|
||||||
|
*/
|
||||||
|
public interface DeviceClassifyService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建设备分类
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createDeviceClassify(@Valid DeviceClassifySaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备分类
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateDeviceClassify(@Valid DeviceClassifySaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备分类
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteDeviceClassify(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除设备分类
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteDeviceClassifyListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得设备分类
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 设备分类
|
||||||
|
*/
|
||||||
|
DeviceClassifyDO getDeviceClassify(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得设备分类分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 设备分类分页
|
||||||
|
*/
|
||||||
|
PageResult<DeviceClassifyDO> getDeviceClassifyPage(DeviceClassifyPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
List<DeviceClassifyDO> getDeviceClassifyList();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.service.deviceclassify;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.deviceclassify.vo.DeviceClassifyPageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.deviceclassify.vo.DeviceClassifySaveReqVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.deviceclassify.DeviceClassifyDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.mysql.deviceclassify.DeviceClassifyMapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||||
|
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.DEVICE_CLASSIFY_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备分类 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 超级管理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class DeviceClassifyServiceImpl implements DeviceClassifyService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DeviceClassifyMapper deviceClassifyMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createDeviceClassify(DeviceClassifySaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
DeviceClassifyDO deviceClassify = BeanUtils.toBean(createReqVO, DeviceClassifyDO.class);
|
||||||
|
deviceClassify.setTenantId(getLoginUser().getTenantId().toString());
|
||||||
|
deviceClassifyMapper.insert(deviceClassify);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return deviceClassify.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDeviceClassify(DeviceClassifySaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateDeviceClassifyExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
DeviceClassifyDO updateObj = BeanUtils.toBean(updateReqVO, DeviceClassifyDO.class);
|
||||||
|
deviceClassifyMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteDeviceClassify(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateDeviceClassifyExists(id);
|
||||||
|
// 删除
|
||||||
|
deviceClassifyMapper.deleteByClassifyId(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteDeviceClassifyListByIds(List<Long> ids) {
|
||||||
|
// 删除
|
||||||
|
deviceClassifyMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateDeviceClassifyExists(Long id) {
|
||||||
|
if (deviceClassifyMapper.selectById(id) == null) {
|
||||||
|
throw exception(DEVICE_CLASSIFY_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceClassifyDO getDeviceClassify(Long id) {
|
||||||
|
return deviceClassifyMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<DeviceClassifyDO> getDeviceClassifyPage(DeviceClassifyPageReqVO pageReqVO) {
|
||||||
|
pageReqVO.setTenantId(getLoginUser().getTenantId().toString());
|
||||||
|
return deviceClassifyMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceClassifyDO> getDeviceClassifyList() {
|
||||||
|
return deviceClassifyMapper.selectList(new LambdaQueryWrapperX<DeviceClassifyDO>().eq(DeviceClassifyDO::getTenantId, getLoginUser().getTenantId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="cn.iocoder.yudao.module.farm.dal.mysql.deviceclassify.DeviceClassifyMapper">
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
<delete id="deleteByClassifyId" parameterType="Long">
|
||||||
|
delete
|
||||||
|
from farm_device_classify
|
||||||
|
where id = #{id}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user