设备租用
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
yudao-ui-admin CI / build (14.x) (push) Has been cancelled
yudao-ui-admin CI / build (16.x) (push) Has been cancelled
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled
yudao-ui-admin CI / build (14.x) (push) Has been cancelled
yudao-ui-admin CI / build (16.x) (push) Has been cancelled
This commit is contained in:
parent
f67a6add90
commit
73eb39be6f
@ -0,0 +1,96 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.equipmentrent;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipmentrent.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.equipmentrent.EquipmentrentDO;
|
||||
import cn.iocoder.yudao.module.system.service.equipmentrent.EquipmentrentService;
|
||||
|
||||
@Tag(name = "管理后台 - 设备租用")
|
||||
@RestController
|
||||
@RequestMapping("/system/equipmentrent")
|
||||
@Validated
|
||||
public class EquipmentrentController {
|
||||
|
||||
@Resource
|
||||
private EquipmentrentService equipmentrentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建设备租用")
|
||||
public CommonResult<Long> createEquipmentrent(@Valid @RequestBody EquipmentrentSaveReqVO createReqVO) {
|
||||
return success(equipmentrentService.createEquipmentrent(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新设备租用")
|
||||
public CommonResult<Boolean> updateEquipmentrent(@Valid @RequestBody EquipmentrentSaveReqVO updateReqVO) {
|
||||
equipmentrentService.updateEquipmentrent(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除设备租用")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteEquipmentrent(@RequestParam("id") Long id) {
|
||||
equipmentrentService.deleteEquipmentrent(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deleteEquipmentrentList(@RequestParam("ids") List<Long> ids) {
|
||||
equipmentrentService.deleteEquipmentrentListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得设备租用")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<EquipmentrentRespVO> getEquipmentrent(@RequestParam("id") Long id) {
|
||||
EquipmentrentDO equipmentrent = equipmentrentService.getEquipmentrent(id);
|
||||
return success(BeanUtils.toBean(equipmentrent, EquipmentrentRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得设备租用分页")
|
||||
public CommonResult<PageResult<EquipmentrentRespVO>> getEquipmentrentPage(@Valid EquipmentrentPageReqVO pageReqVO) {
|
||||
PageResult<EquipmentrentDO> pageResult = equipmentrentService.getEquipmentrentPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, EquipmentrentRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出设备租用 Excel")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportEquipmentrentExcel(@Valid EquipmentrentPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<EquipmentrentDO> list = equipmentrentService.getEquipmentrentPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "设备租用.xls", "数据", EquipmentrentRespVO.class,
|
||||
BeanUtils.toBean(list, EquipmentrentRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.equipmentrent.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
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 EquipmentrentPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "租用机构ID", example = "31837")
|
||||
private Long lesseeorgid;
|
||||
|
||||
@Schema(description = "租用机构名称", example = "张三")
|
||||
private String lesseeorgname;
|
||||
|
||||
@Schema(description = "设备ID", example = "22844")
|
||||
private Long equipmentid;
|
||||
|
||||
@Schema(description = "设备名称", example = "张三")
|
||||
private String equipmentname;
|
||||
|
||||
@Schema(description = "设备类型", example = "2")
|
||||
private String equipmenttype;
|
||||
|
||||
@Schema(description = "租用开始时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] rentstarttime;
|
||||
|
||||
@Schema(description = "租用结束时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] rentendtime;
|
||||
|
||||
@Schema(description = "实际归还时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] actualreturntime;
|
||||
|
||||
@Schema(description = "租用状态(1租用中 2已归还 3超期未还)", example = "1")
|
||||
private Integer rentstatus;
|
||||
|
||||
@Schema(description = "联系人")
|
||||
private String contactperson;
|
||||
|
||||
@Schema(description = "联系电话")
|
||||
private String contactphone;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createdtime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] updatedtime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.equipmentrent.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 com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 设备租用 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EquipmentrentRespVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32388")
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "租用机构ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31837")
|
||||
@ExcelProperty("租用机构ID")
|
||||
private Long lesseeorgid;
|
||||
|
||||
@Schema(description = "租用机构名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@ExcelProperty("租用机构名称")
|
||||
private String lesseeorgname;
|
||||
|
||||
@Schema(description = "设备ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22844")
|
||||
@ExcelProperty("设备ID")
|
||||
private Long equipmentid;
|
||||
|
||||
@Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@ExcelProperty("设备名称")
|
||||
private String equipmentname;
|
||||
|
||||
@Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("设备类型")
|
||||
private String equipmenttype;
|
||||
|
||||
@Schema(description = "租用开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("租用开始时间")
|
||||
private LocalDateTime rentstarttime;
|
||||
|
||||
@Schema(description = "租用结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("租用结束时间")
|
||||
private LocalDateTime rentendtime;
|
||||
|
||||
@Schema(description = "实际归还时间")
|
||||
@ExcelProperty("实际归还时间")
|
||||
private LocalDateTime actualreturntime;
|
||||
|
||||
@Schema(description = "租用状态(1租用中 2已归还 3超期未还)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("租用状态(1租用中 2已归还 3超期未还)")
|
||||
private Integer rentstatus;
|
||||
|
||||
@Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("联系人")
|
||||
private String contactperson;
|
||||
|
||||
@Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("联系电话")
|
||||
private String contactphone;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createdtime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@ExcelProperty("更新时间")
|
||||
private LocalDateTime updatedtime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.equipmentrent.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 设备租用新增/修改 Request VO")
|
||||
@Data
|
||||
public class EquipmentrentSaveReqVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32388")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "租用机构ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31837")
|
||||
@NotNull(message = "租用机构ID不能为空")
|
||||
private Long lesseeorgid;
|
||||
|
||||
@Schema(description = "租用机构名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotEmpty(message = "租用机构名称不能为空")
|
||||
private String lesseeorgname;
|
||||
|
||||
@Schema(description = "设备ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "22844")
|
||||
@NotNull(message = "设备ID不能为空")
|
||||
private Long equipmentid;
|
||||
|
||||
@Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||
@NotEmpty(message = "设备名称不能为空")
|
||||
private String equipmentname;
|
||||
|
||||
@Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "设备类型不能为空")
|
||||
private String equipmenttype;
|
||||
|
||||
@Schema(description = "租用开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "租用开始时间不能为空")
|
||||
private LocalDateTime rentstarttime;
|
||||
|
||||
@Schema(description = "租用结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "租用结束时间不能为空")
|
||||
private LocalDateTime rentendtime;
|
||||
|
||||
@Schema(description = "实际归还时间")
|
||||
private LocalDateTime actualreturntime;
|
||||
|
||||
@Schema(description = "租用状态(1租用中 2已归还 3超期未还)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "租用状态(1租用中 2已归还 3超期未还)不能为空")
|
||||
private Integer rentstatus;
|
||||
|
||||
@Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "联系人不能为空")
|
||||
private String contactperson;
|
||||
|
||||
@Schema(description = "联系电话", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "联系电话不能为空")
|
||||
private String contactphone;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createdtime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
private LocalDateTime updatedtime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.equipmentrent;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
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("tb_equipmentrent")
|
||||
@KeySequence("tb_equipmentrent_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EquipmentrentDO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 租用机构ID
|
||||
*/
|
||||
@TableField("lesseeorgid")
|
||||
private Long lesseeorgid;
|
||||
/**
|
||||
* 租用机构名称
|
||||
*/
|
||||
@TableField("lesseeorgname")
|
||||
private String lesseeorgname;
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
@TableField("equipmentid")
|
||||
private Long equipmentid;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@TableField("equipmentname")
|
||||
private String equipmentname;
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
@TableField("equipmenttype")
|
||||
private String equipmenttype;
|
||||
/**
|
||||
* 租用开始时间
|
||||
*/
|
||||
@TableField("rentstarttime")
|
||||
private LocalDateTime rentstarttime;
|
||||
/**
|
||||
* 租用结束时间
|
||||
*/
|
||||
@TableField("rentendtime")
|
||||
private LocalDateTime rentendtime;
|
||||
/**
|
||||
* 实际归还时间
|
||||
*/
|
||||
@TableField("actualreturntime")
|
||||
private LocalDateTime actualreturntime;
|
||||
/**
|
||||
* 租用状态(1租用中 2已归还 3超期未还)
|
||||
*/
|
||||
@TableField("rentstatus")
|
||||
private Integer rentstatus;
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@TableField("contactperson")
|
||||
private String contactperson;
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
private String contactphone;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("createdtime")
|
||||
private LocalDateTime createdtime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("updatedtime")
|
||||
private LocalDateTime updatedtime;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.system.dal.mysql.equipmentrent;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.equipmentrent.EquipmentrentDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipmentrent.vo.*;
|
||||
|
||||
/**
|
||||
* 设备租用 Mapper
|
||||
*
|
||||
* @author 艾康菲
|
||||
*/
|
||||
@Mapper
|
||||
public interface EquipmentrentMapper extends BaseMapperX<EquipmentrentDO> {
|
||||
|
||||
default PageResult<EquipmentrentDO> selectPage(EquipmentrentPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<EquipmentrentDO>()
|
||||
.eqIfPresent(EquipmentrentDO::getLesseeorgid, reqVO.getLesseeorgid())
|
||||
.likeIfPresent(EquipmentrentDO::getLesseeorgname, reqVO.getLesseeorgname())
|
||||
.eqIfPresent(EquipmentrentDO::getEquipmentid, reqVO.getEquipmentid())
|
||||
.likeIfPresent(EquipmentrentDO::getEquipmentname, reqVO.getEquipmentname())
|
||||
.eqIfPresent(EquipmentrentDO::getEquipmenttype, reqVO.getEquipmenttype())
|
||||
.betweenIfPresent(EquipmentrentDO::getRentstarttime, reqVO.getRentstarttime())
|
||||
.betweenIfPresent(EquipmentrentDO::getRentendtime, reqVO.getRentendtime())
|
||||
.betweenIfPresent(EquipmentrentDO::getActualreturntime, reqVO.getActualreturntime())
|
||||
.eqIfPresent(EquipmentrentDO::getRentstatus, reqVO.getRentstatus())
|
||||
.eqIfPresent(EquipmentrentDO::getContactperson, reqVO.getContactperson())
|
||||
.eqIfPresent(EquipmentrentDO::getContactphone, reqVO.getContactphone())
|
||||
.betweenIfPresent(EquipmentrentDO::getCreatedtime, reqVO.getCreatedtime())
|
||||
.betweenIfPresent(EquipmentrentDO::getUpdatedtime, reqVO.getUpdatedtime())
|
||||
.orderByDesc(EquipmentrentDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.system.service.equipmentrent;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipmentrent.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.equipmentrent.EquipmentrentDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* 设备租用 Service 接口
|
||||
*
|
||||
* @author 艾康菲
|
||||
*/
|
||||
public interface EquipmentrentService {
|
||||
|
||||
/**
|
||||
* 创建设备租用
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createEquipmentrent(@Valid EquipmentrentSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新设备租用
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateEquipmentrent(@Valid EquipmentrentSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除设备租用
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteEquipmentrent(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除设备租用
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteEquipmentrentListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得设备租用
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 设备租用
|
||||
*/
|
||||
EquipmentrentDO getEquipmentrent(Long id);
|
||||
|
||||
/**
|
||||
* 获得设备租用分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 设备租用分页
|
||||
*/
|
||||
PageResult<EquipmentrentDO> getEquipmentrentPage(EquipmentrentPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package cn.iocoder.yudao.module.system.service.equipmentrent;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipmentrent.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.equipmentrent.EquipmentrentDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.equipmentrent.EquipmentrentMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 设备租用 Service 实现类
|
||||
*
|
||||
* @author 艾康菲
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class EquipmentrentServiceImpl implements EquipmentrentService {
|
||||
|
||||
@Resource
|
||||
private EquipmentrentMapper equipmentrentMapper;
|
||||
|
||||
@Override
|
||||
public Long createEquipmentrent(EquipmentrentSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
EquipmentrentDO equipmentrent = BeanUtils.toBean(createReqVO, EquipmentrentDO.class);
|
||||
equipmentrentMapper.insert(equipmentrent);
|
||||
// 返回
|
||||
return equipmentrent.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEquipmentrent(EquipmentrentSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateEquipmentrentExists(updateReqVO.getId());
|
||||
// 更新
|
||||
EquipmentrentDO updateObj = BeanUtils.toBean(updateReqVO, EquipmentrentDO.class);
|
||||
equipmentrentMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteEquipmentrent(Long id) {
|
||||
// 校验存在
|
||||
validateEquipmentrentExists(id);
|
||||
// 删除
|
||||
equipmentrentMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteEquipmentrentListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateEquipmentrentExists(ids);
|
||||
// 删除
|
||||
equipmentrentMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateEquipmentrentExists(List<Long> ids) {
|
||||
List<EquipmentrentDO> list = equipmentrentMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
}
|
||||
}
|
||||
|
||||
private void validateEquipmentrentExists(Long id) {
|
||||
if (equipmentrentMapper.selectById(id) == null) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EquipmentrentDO getEquipmentrent(Long id) {
|
||||
return equipmentrentMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<EquipmentrentDO> getEquipmentrentPage(EquipmentrentPageReqVO pageReqVO) {
|
||||
return equipmentrentMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
<?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.system.dal.mysql.equipmentrent.EquipmentrentMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@ -309,6 +309,7 @@ yudao:
|
||||
- tb_ecgconfig #忽略心电工作站配置表
|
||||
- tb_hrv #忽略精神压力患者表
|
||||
- tb_hrvdata #忽略精神压力数据表
|
||||
- tb_equipmentrent #忽略设备租赁表
|
||||
ignore-caches:
|
||||
- user_role_ids
|
||||
- permission_menu_ids
|
||||
|
||||
Loading…
Reference in New Issue
Block a user