机械台账管理接口
This commit is contained in:
@ -0,0 +1,105 @@
|
||||
package org.dromara.mechanical.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.mechanical.domain.vo.BusMechanicalrewritingVo;
|
||||
import org.dromara.mechanical.domain.bo.BusMechanicalrewritingBo;
|
||||
import org.dromara.mechanical.service.IBusMechanicalrewritingService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 机械台账
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/mechanical/mechanicalrewriting")
|
||||
public class BusMechanicalrewritingController extends BaseController {
|
||||
|
||||
private final IBusMechanicalrewritingService busMechanicalrewritingService;
|
||||
|
||||
/**
|
||||
* 查询机械台账列表
|
||||
*/
|
||||
@SaCheckPermission("mechanical:mechanicalrewriting:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BusMechanicalrewritingVo> list(BusMechanicalrewritingBo bo, PageQuery pageQuery) {
|
||||
return busMechanicalrewritingService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出机械台账列表
|
||||
*/
|
||||
@SaCheckPermission("mechanical:mechanicalrewriting:export")
|
||||
@Log(title = "机械台账", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(BusMechanicalrewritingBo bo, HttpServletResponse response) {
|
||||
List<BusMechanicalrewritingVo> list = busMechanicalrewritingService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "机械台账", BusMechanicalrewritingVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机械台账详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("mechanical:mechanicalrewriting:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<BusMechanicalrewritingVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(busMechanicalrewritingService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增机械台账
|
||||
*/
|
||||
@SaCheckPermission("mechanical:mechanicalrewriting:add")
|
||||
@Log(title = "机械台账", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BusMechanicalrewritingBo bo) {
|
||||
return toAjax(busMechanicalrewritingService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改机械台账
|
||||
*/
|
||||
@SaCheckPermission("mechanical:mechanicalrewriting:edit")
|
||||
@Log(title = "机械台账", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BusMechanicalrewritingBo bo) {
|
||||
return toAjax(busMechanicalrewritingService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除机械台账
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("mechanical:mechanicalrewriting:remove")
|
||||
@Log(title = "机械台账", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(busMechanicalrewritingService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package org.dromara.mechanical.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.mechanical.domain.vo.BusMechanicaltypeVo;
|
||||
import org.dromara.mechanical.domain.bo.BusMechanicaltypeBo;
|
||||
import org.dromara.mechanical.service.IBusMechanicaltypeService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/mechanical/mechanicaltype")
|
||||
public class BusMechanicaltypeController extends BaseController {
|
||||
|
||||
private final IBusMechanicaltypeService busMechanicaltypeService;
|
||||
|
||||
/**
|
||||
* 查询设备类型列表
|
||||
*/
|
||||
@SaCheckPermission("mechanical:mechanicaltype:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BusMechanicaltypeVo> list(BusMechanicaltypeBo bo, PageQuery pageQuery) {
|
||||
return busMechanicaltypeService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备类型列表
|
||||
*/
|
||||
// @SaCheckPermission("mechanical:mechanicaltype:getTree")
|
||||
@GetMapping("/getTree")
|
||||
public R<List<BusMechanicaltypeVo>> getTree(BusMechanicaltypeBo bo) {
|
||||
return R.ok(busMechanicaltypeService.getTree(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备类型列表
|
||||
*/
|
||||
@SaCheckPermission("mechanical:mechanicaltype:export")
|
||||
@Log(title = "设备类型", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(BusMechanicaltypeBo bo, HttpServletResponse response) {
|
||||
List<BusMechanicaltypeVo> list = busMechanicaltypeService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "设备类型", BusMechanicaltypeVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备类型详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("mechanical:mechanicaltype:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<BusMechanicaltypeVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(busMechanicaltypeService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备类型
|
||||
*/
|
||||
@SaCheckPermission("mechanical:mechanicaltype:add")
|
||||
@Log(title = "设备类型", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BusMechanicaltypeBo bo) {
|
||||
return toAjax(busMechanicaltypeService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备类型
|
||||
*/
|
||||
@SaCheckPermission("mechanical:mechanicaltype:edit")
|
||||
@Log(title = "设备类型", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BusMechanicaltypeBo bo) {
|
||||
return toAjax(busMechanicaltypeService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备类型
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("mechanical:mechanicaltype:remove")
|
||||
@Log(title = "设备类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(busMechanicaltypeService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package org.dromara.mechanical.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 机械台账对象 bus_mechanicalrewriting
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("bus_mechanicalrewriting")
|
||||
public class BusMechanicalrewriting extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String devicename;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
private String devicePath;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String deviceNumber;
|
||||
|
||||
/**
|
||||
* 入场日期
|
||||
*/
|
||||
private LocalDate entryTime;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 生产能力
|
||||
*/
|
||||
private String production;
|
||||
|
||||
/**
|
||||
* 车牌号码
|
||||
*/
|
||||
private String plateNumber;
|
||||
|
||||
/**
|
||||
* 设备管理员
|
||||
*/
|
||||
private String deviceKeeper;
|
||||
|
||||
/**
|
||||
* 车辆行驶证
|
||||
*/
|
||||
private String drivingLicence;
|
||||
|
||||
/**
|
||||
* 新旧程度
|
||||
*/
|
||||
private String degree;
|
||||
|
||||
/**
|
||||
* 车辆容量
|
||||
*/
|
||||
private String vehicleCapacity;
|
||||
|
||||
/**
|
||||
* 车辆净重
|
||||
*/
|
||||
private String suttle;
|
||||
|
||||
/**
|
||||
* 铭牌
|
||||
*/
|
||||
private String nameplate;
|
||||
|
||||
private Long nameplateId;
|
||||
|
||||
/**
|
||||
* 合格证书
|
||||
*/
|
||||
private String qualification;
|
||||
|
||||
private Long qualificationId;
|
||||
|
||||
/**
|
||||
* 设备照片
|
||||
*/
|
||||
private String equipmentPhoto;
|
||||
|
||||
private Long equipmentPhotoId;
|
||||
|
||||
/**
|
||||
* 检验报告
|
||||
*/
|
||||
private String verificationReport;
|
||||
|
||||
private Long verificationReportId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package org.dromara.mechanical.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 设备类型对象 bus_mechanicaltype
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("bus_mechanicaltype")
|
||||
public class BusMechanicaltype extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 父编码
|
||||
*/
|
||||
private String pcode;
|
||||
|
||||
/**
|
||||
* 大
|
||||
*/
|
||||
private String largeclass;
|
||||
|
||||
/**
|
||||
* 中
|
||||
*/
|
||||
private String middleclass;
|
||||
|
||||
/**
|
||||
* 子类
|
||||
*/
|
||||
private String subclass;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 全名
|
||||
*/
|
||||
private String fullName;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
package org.dromara.mechanical.domain.bo;
|
||||
|
||||
import org.dromara.mechanical.domain.BusMechanicalrewriting;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 机械台账业务对象 bus_mechanicalrewriting
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = BusMechanicalrewriting.class, reverseConvertGenerate = false)
|
||||
public class BusMechanicalrewritingBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 自增ID
|
||||
*/
|
||||
@NotNull(message = "自增ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
@NotNull(message = "项目ID不能为空", groups = {AddGroup.class, EditGroup.class })
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
@NotBlank(message = "班组名称不能为空",groups = {AddGroup.class, EditGroup.class})
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@NotBlank(message = "设备名称不能为空",groups = {AddGroup.class, EditGroup.class})
|
||||
private String devicename;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
@NotBlank(message = "设备类型不能为空",groups = {AddGroup.class, EditGroup.class})
|
||||
private String deviceType;
|
||||
|
||||
|
||||
private String devicePath;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@NotBlank(message = "设备编号不能为空",groups = {AddGroup.class, EditGroup.class})
|
||||
private String deviceNumber;
|
||||
|
||||
/**
|
||||
* 入场日期
|
||||
*/
|
||||
@NotNull(message = "入场日期不能为空",groups = {AddGroup.class, EditGroup.class})
|
||||
private LocalDate entryTime;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@NotBlank(message = "规格型号不能为空",groups = {AddGroup.class, EditGroup.class})
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 生产能力
|
||||
*/
|
||||
@NotBlank(message = "生产能力不能为空",groups = {AddGroup.class, EditGroup.class})
|
||||
private String production;
|
||||
|
||||
/**
|
||||
* 车牌号码
|
||||
*/
|
||||
private String plateNumber;
|
||||
|
||||
/**
|
||||
* 设备管理员
|
||||
*/
|
||||
private String deviceKeeper;
|
||||
|
||||
/**
|
||||
* 车辆行驶证
|
||||
*/
|
||||
private String drivingLicence;
|
||||
|
||||
/**
|
||||
* 新旧程度
|
||||
*/
|
||||
@NotBlank(message = "设备编号不能为空",groups = {AddGroup.class, EditGroup.class})
|
||||
private String degree;
|
||||
|
||||
/**
|
||||
* 车辆容量
|
||||
*/
|
||||
private String vehicleCapacity;
|
||||
|
||||
/**
|
||||
* 车辆净重
|
||||
*/
|
||||
private String suttle;
|
||||
|
||||
/**
|
||||
* 铭牌
|
||||
*/
|
||||
private String nameplate;
|
||||
|
||||
private Long nameplateId;
|
||||
|
||||
/**
|
||||
* 合格证书
|
||||
*/
|
||||
private String qualification;
|
||||
|
||||
private Long qualificationId;
|
||||
|
||||
/**
|
||||
* 设备照片
|
||||
*/
|
||||
private String equipmentPhoto;
|
||||
|
||||
private Long equipmentPhotoId;
|
||||
|
||||
/**
|
||||
* 检验报告
|
||||
*/
|
||||
private String verificationReport;
|
||||
|
||||
private Long verificationReportId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package org.dromara.mechanical.domain.bo;
|
||||
|
||||
import org.dromara.mechanical.domain.BusMechanicaltype;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 设备类型业务对象 bus_mechanicaltype
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = BusMechanicaltype.class, reverseConvertGenerate = false)
|
||||
public class BusMechanicaltypeBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 自增ID
|
||||
*/
|
||||
@NotNull(message = "自增ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@NotBlank(message = "编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 父编码
|
||||
*/
|
||||
@NotBlank(message = "父编码不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String pcode;
|
||||
|
||||
/**
|
||||
* 大
|
||||
*/
|
||||
private String largeclass;
|
||||
|
||||
/**
|
||||
* 中
|
||||
*/
|
||||
private String middleclass;
|
||||
|
||||
/**
|
||||
* 子类
|
||||
*/
|
||||
private String subclass;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 全名
|
||||
*/
|
||||
private String fullName;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,165 @@
|
||||
package org.dromara.mechanical.domain.vo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.mechanical.domain.BusMechanicalrewriting;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 机械台账视图对象 bus_mechanicalrewriting
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = BusMechanicalrewriting.class)
|
||||
public class BusMechanicalrewritingVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增ID
|
||||
*/
|
||||
@ExcelProperty(value = "自增ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目ID
|
||||
*/
|
||||
@ExcelProperty(value = "项目ID")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
@ExcelProperty(value = "班组名称")
|
||||
private String teamName;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备名称")
|
||||
private String devicename;
|
||||
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
@ExcelProperty(value = "设备类型")
|
||||
private String deviceType;
|
||||
|
||||
private String devicePath;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@ExcelProperty(value = "设备编号")
|
||||
private String deviceNumber;
|
||||
|
||||
/**
|
||||
* 入场日期
|
||||
*/
|
||||
@ExcelProperty(value = "入场日期")
|
||||
private LocalDate entryTime;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
*/
|
||||
@ExcelProperty(value = "规格型号")
|
||||
private String specification;
|
||||
|
||||
/**
|
||||
* 生产能力
|
||||
*/
|
||||
@ExcelProperty(value = "生产能力")
|
||||
private String production;
|
||||
|
||||
/**
|
||||
* 车牌号码
|
||||
*/
|
||||
@ExcelProperty(value = "车牌号码")
|
||||
private String plateNumber;
|
||||
|
||||
/**
|
||||
* 设备管理员
|
||||
*/
|
||||
@ExcelProperty(value = "设备管理员")
|
||||
private String deviceKeeper;
|
||||
|
||||
/**
|
||||
* 车辆行驶证
|
||||
*/
|
||||
@ExcelProperty(value = "车辆行驶证")
|
||||
private String drivingLicence;
|
||||
|
||||
/**
|
||||
* 新旧程度
|
||||
*/
|
||||
@ExcelProperty(value = "新旧程度")
|
||||
private String degree;
|
||||
|
||||
/**
|
||||
* 车辆容量
|
||||
*/
|
||||
@ExcelProperty(value = "车辆容量")
|
||||
private String vehicleCapacity;
|
||||
|
||||
/**
|
||||
* 车辆净重
|
||||
*/
|
||||
@ExcelProperty(value = "车辆净重")
|
||||
private String suttle;
|
||||
|
||||
/**
|
||||
* 铭牌
|
||||
*/
|
||||
@ExcelProperty(value = "铭牌")
|
||||
private String nameplate;
|
||||
|
||||
private Long nameplateId;
|
||||
|
||||
/**
|
||||
* 合格证书
|
||||
*/
|
||||
@ExcelProperty(value = "合格证书")
|
||||
private String qualification;
|
||||
|
||||
private Long qualificationId;
|
||||
|
||||
/**
|
||||
* 设备照片
|
||||
*/
|
||||
@ExcelProperty(value = "设备照片")
|
||||
private String equipmentPhoto;
|
||||
|
||||
private Long equipmentPhotoId;
|
||||
|
||||
/**
|
||||
* 检验报告
|
||||
*/
|
||||
@ExcelProperty(value = "检验报告")
|
||||
private String verificationReport;
|
||||
|
||||
private Long verificationReportId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package org.dromara.mechanical.domain.vo;
|
||||
|
||||
import org.dromara.mechanical.domain.BusMechanicaltype;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 设备类型视图对象 bus_mechanicaltype
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = BusMechanicaltype.class)
|
||||
public class BusMechanicaltypeVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增ID
|
||||
*/
|
||||
@ExcelProperty(value = "自增ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@ExcelProperty(value = "编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 父编码
|
||||
*/
|
||||
@ExcelProperty(value = "父编码")
|
||||
private String pcode;
|
||||
|
||||
/**
|
||||
* 大
|
||||
*/
|
||||
@ExcelProperty(value = "大")
|
||||
private String largeclass;
|
||||
|
||||
/**
|
||||
* 中
|
||||
*/
|
||||
@ExcelProperty(value = "中")
|
||||
private String middleclass;
|
||||
|
||||
/**
|
||||
* 子类
|
||||
*/
|
||||
@ExcelProperty(value = "子类")
|
||||
private String subclass;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 全名
|
||||
*/
|
||||
@ExcelProperty(value = "全名")
|
||||
private String fullName;
|
||||
|
||||
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
private List<BusMechanicaltypeVo> children = new ArrayList<>();
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.mechanical.mapper;
|
||||
|
||||
import org.dromara.mechanical.domain.BusMechanicalrewriting;
|
||||
import org.dromara.mechanical.domain.vo.BusMechanicalrewritingVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 机械台账Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
public interface BusMechanicalrewritingMapper extends BaseMapperPlus<BusMechanicalrewriting, BusMechanicalrewritingVo> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.mechanical.mapper;
|
||||
|
||||
import org.dromara.mechanical.domain.BusMechanicaltype;
|
||||
import org.dromara.mechanical.domain.vo.BusMechanicaltypeVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 设备类型Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
public interface BusMechanicaltypeMapper extends BaseMapperPlus<BusMechanicaltype, BusMechanicaltypeVo> {
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package org.dromara.mechanical.service;
|
||||
|
||||
import org.dromara.mechanical.domain.vo.BusMechanicalrewritingVo;
|
||||
import org.dromara.mechanical.domain.bo.BusMechanicalrewritingBo;
|
||||
import org.dromara.mechanical.domain.BusMechanicalrewriting;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 机械台账Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
public interface IBusMechanicalrewritingService extends IService<BusMechanicalrewriting>{
|
||||
|
||||
/**
|
||||
* 查询机械台账
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 机械台账
|
||||
*/
|
||||
BusMechanicalrewritingVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询机械台账列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 机械台账分页列表
|
||||
*/
|
||||
TableDataInfo<BusMechanicalrewritingVo> queryPageList(BusMechanicalrewritingBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的机械台账列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 机械台账列表
|
||||
*/
|
||||
List<BusMechanicalrewritingVo> queryList(BusMechanicalrewritingBo bo);
|
||||
|
||||
/**
|
||||
* 新增机械台账
|
||||
*
|
||||
* @param bo 机械台账
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(BusMechanicalrewritingBo bo);
|
||||
|
||||
/**
|
||||
* 修改机械台账
|
||||
*
|
||||
* @param bo 机械台账
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(BusMechanicalrewritingBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除机械台账信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package org.dromara.mechanical.service;
|
||||
|
||||
import org.dromara.mechanical.domain.vo.BusMechanicaltypeVo;
|
||||
import org.dromara.mechanical.domain.bo.BusMechanicaltypeBo;
|
||||
import org.dromara.mechanical.domain.BusMechanicaltype;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备类型Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
public interface IBusMechanicaltypeService extends IService<BusMechanicaltype>{
|
||||
|
||||
/**
|
||||
* 查询设备类型
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备类型
|
||||
*/
|
||||
BusMechanicaltypeVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询设备类型列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备类型分页列表
|
||||
*/
|
||||
TableDataInfo<BusMechanicaltypeVo> queryPageList(BusMechanicaltypeBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备类型列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备类型列表
|
||||
*/
|
||||
List<BusMechanicaltypeVo> queryList(BusMechanicaltypeBo bo);
|
||||
|
||||
/**
|
||||
* 新增设备类型
|
||||
*
|
||||
* @param bo 设备类型
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(BusMechanicaltypeBo bo);
|
||||
|
||||
/**
|
||||
* 修改设备类型
|
||||
*
|
||||
* @param bo 设备类型
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(BusMechanicaltypeBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备类型信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
List<BusMechanicaltypeVo> getTree(BusMechanicaltypeBo bo);
|
||||
}
|
@ -0,0 +1,187 @@
|
||||
package org.dromara.mechanical.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.mechanical.domain.bo.BusMechanicalrewritingBo;
|
||||
import org.dromara.mechanical.domain.vo.BusMechanicalrewritingVo;
|
||||
import org.dromara.mechanical.domain.BusMechanicalrewriting;
|
||||
import org.dromara.mechanical.mapper.BusMechanicalrewritingMapper;
|
||||
import org.dromara.mechanical.service.IBusMechanicalrewritingService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 机械台账Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BusMechanicalrewritingServiceImpl extends ServiceImpl<BusMechanicalrewritingMapper, BusMechanicalrewriting> implements IBusMechanicalrewritingService {
|
||||
|
||||
private final BusMechanicalrewritingMapper baseMapper;
|
||||
private final ISysOssService sysOssService;
|
||||
|
||||
/**
|
||||
* 查询机械台账
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 机械台账
|
||||
*/
|
||||
@Override
|
||||
public BusMechanicalrewritingVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询机械台账列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 机械台账分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<BusMechanicalrewritingVo> queryPageList(BusMechanicalrewritingBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<BusMechanicalrewriting> lqw = buildQueryWrapper(bo);
|
||||
Page<BusMechanicalrewritingVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的机械台账列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 机械台账列表
|
||||
*/
|
||||
@Override
|
||||
public List<BusMechanicalrewritingVo> queryList(BusMechanicalrewritingBo bo) {
|
||||
LambdaQueryWrapper<BusMechanicalrewriting> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<BusMechanicalrewriting> buildQueryWrapper(BusMechanicalrewritingBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<BusMechanicalrewriting> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByDesc(BusMechanicalrewriting::getId);
|
||||
lqw.eq(bo.getProjectId() != null, BusMechanicalrewriting::getProjectId, bo.getProjectId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getTeamName()), BusMechanicalrewriting::getTeamName, bo.getTeamName());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDevicename()), BusMechanicalrewriting::getDevicename, bo.getDevicename());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceType()), BusMechanicalrewriting::getDeviceType, bo.getDeviceType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceNumber()), BusMechanicalrewriting::getDeviceNumber, bo.getDeviceNumber());
|
||||
lqw.eq(bo.getEntryTime() != null, BusMechanicalrewriting::getEntryTime, bo.getEntryTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSpecification()), BusMechanicalrewriting::getSpecification, bo.getSpecification());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getProduction()), BusMechanicalrewriting::getProduction, bo.getProduction());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getPlateNumber()), BusMechanicalrewriting::getPlateNumber, bo.getPlateNumber());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceKeeper()), BusMechanicalrewriting::getDeviceKeeper, bo.getDeviceKeeper());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDrivingLicence()), BusMechanicalrewriting::getDrivingLicence, bo.getDrivingLicence());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDegree()), BusMechanicalrewriting::getDegree, bo.getDegree());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getVehicleCapacity()), BusMechanicalrewriting::getVehicleCapacity, bo.getVehicleCapacity());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getSuttle()), BusMechanicalrewriting::getSuttle, bo.getSuttle());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getNameplate()), BusMechanicalrewriting::getNameplate, bo.getNameplate());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getQualification()), BusMechanicalrewriting::getQualification, bo.getQualification());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getEquipmentPhoto()), BusMechanicalrewriting::getEquipmentPhoto, bo.getEquipmentPhoto());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getVerificationReport()), BusMechanicalrewriting::getVerificationReport, bo.getVerificationReport());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增机械台账
|
||||
*
|
||||
* @param bo 机械台账
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BusMechanicalrewritingBo bo) {
|
||||
if (bo.getNameplateId() == null) {
|
||||
throw new ServiceException("请上传铭牌");
|
||||
}
|
||||
if (bo.getQualificationId() == null) {
|
||||
throw new ServiceException("请上传合格证书");
|
||||
}
|
||||
if (bo.getEquipmentPhotoId() == null) {
|
||||
throw new ServiceException("请上传设备照片");
|
||||
}
|
||||
if (bo.getVerificationReportId() != null) {
|
||||
SysOssVo ossVo3 = sysOssService.getById(bo.getVerificationReportId());
|
||||
bo.setVerificationReport(ossVo3.getUrl());
|
||||
}
|
||||
SysOssVo ossVo = sysOssService.getById(bo.getNameplateId());
|
||||
bo.setNameplate(ossVo.getUrl());
|
||||
SysOssVo ossVo1 = sysOssService.getById(bo.getQualificationId());
|
||||
bo.setQualification(ossVo1.getUrl());
|
||||
SysOssVo ossVo2 = sysOssService.getById(bo.getEquipmentPhotoId());
|
||||
bo.setEquipmentPhoto(ossVo2.getUrl());
|
||||
BusMechanicalrewriting add = MapstructUtils.convert(bo, BusMechanicalrewriting.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改机械台账
|
||||
*
|
||||
* @param bo 机械台账
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(BusMechanicalrewritingBo bo) {
|
||||
if (bo.getNameplateId() != null) {
|
||||
SysOssVo ossVo = sysOssService.getById(bo.getNameplateId());
|
||||
bo.setNameplate(ossVo.getUrl());
|
||||
}
|
||||
if (bo.getQualificationId() != null) {
|
||||
SysOssVo ossVo1 = sysOssService.getById(bo.getQualificationId());
|
||||
bo.setQualification(ossVo1.getUrl());
|
||||
}
|
||||
if (bo.getEquipmentPhotoId() != null) {
|
||||
SysOssVo ossVo2 = sysOssService.getById(bo.getEquipmentPhotoId());
|
||||
bo.setEquipmentPhoto(ossVo2.getUrl());
|
||||
}
|
||||
if (bo.getVerificationReportId() != null) {
|
||||
SysOssVo ossVo3 = sysOssService.getById(bo.getVerificationReportId());
|
||||
bo.setVerificationReport(ossVo3.getUrl());
|
||||
}
|
||||
BusMechanicalrewriting update = MapstructUtils.convert(bo, BusMechanicalrewriting.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BusMechanicalrewriting entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除机械台账信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,205 @@
|
||||
package org.dromara.mechanical.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.tender.domain.vo.BusBillofquantitiesLimitListVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.mechanical.domain.bo.BusMechanicaltypeBo;
|
||||
import org.dromara.mechanical.domain.vo.BusMechanicaltypeVo;
|
||||
import org.dromara.mechanical.domain.BusMechanicaltype;
|
||||
import org.dromara.mechanical.mapper.BusMechanicaltypeMapper;
|
||||
import org.dromara.mechanical.service.IBusMechanicaltypeService;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 设备类型Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BusMechanicaltypeServiceImpl extends ServiceImpl<BusMechanicaltypeMapper, BusMechanicaltype> implements IBusMechanicaltypeService {
|
||||
|
||||
private final BusMechanicaltypeMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询设备类型
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备类型
|
||||
*/
|
||||
@Override
|
||||
public BusMechanicaltypeVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询设备类型列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备类型分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<BusMechanicaltypeVo> queryPageList(BusMechanicaltypeBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<BusMechanicaltype> lqw = buildQueryWrapper(bo);
|
||||
Page<BusMechanicaltypeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备类型列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备类型列表
|
||||
*/
|
||||
@Override
|
||||
public List<BusMechanicaltypeVo> queryList(BusMechanicaltypeBo bo) {
|
||||
LambdaQueryWrapper<BusMechanicaltype> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<BusMechanicaltype> buildQueryWrapper(BusMechanicaltypeBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<BusMechanicaltype> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(BusMechanicaltype::getCreateTime);
|
||||
lqw.orderByAsc(BusMechanicaltype::getId);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getCode()), BusMechanicaltype::getCode, bo.getCode());
|
||||
// lqw.eq(StringUtils.isNotBlank(bo.getPcode()), BusMechanicaltype::getPcode, bo.getPcode());
|
||||
// lqw.eq(StringUtils.isNotBlank(bo.getLargeclass()), BusMechanicaltype::getLargeclass, bo.getLargeclass());
|
||||
// lqw.eq(StringUtils.isNotBlank(bo.getMiddleclass()), BusMechanicaltype::getMiddleclass, bo.getMiddleclass());
|
||||
// lqw.eq(StringUtils.isNotBlank(bo.getSubclass()), BusMechanicaltype::getSubclass, bo.getSubclass());
|
||||
// lqw.like(StringUtils.isNotBlank(bo.getFullName()), BusMechanicaltype::getFullName, bo.getFullName());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备类型
|
||||
*
|
||||
* @param bo 设备类型
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BusMechanicaltypeBo bo) {
|
||||
BusMechanicaltype add = MapstructUtils.convert(bo, BusMechanicaltype.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备类型
|
||||
*
|
||||
* @param bo 设备类型
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(BusMechanicaltypeBo bo) {
|
||||
BusMechanicaltype update = MapstructUtils.convert(bo, BusMechanicaltype.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BusMechanicaltype entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<BusMechanicaltype>().eq(BusMechanicaltype::getCode, entity.getCode()));
|
||||
Long count1 = baseMapper.selectCount(new LambdaQueryWrapper<BusMechanicaltype>().eq(BusMechanicaltype::getCode, entity.getPcode()));
|
||||
if (entity.getId() == null){
|
||||
if(count > 0){
|
||||
throw new ServiceException("编码已重复,请重新输入");
|
||||
}
|
||||
if(count1 == 0 && !"0".equals(entity.getPcode())){
|
||||
throw new ServiceException("父编码不存在,请重新输入");
|
||||
}
|
||||
}else {
|
||||
BusMechanicaltype busMechanicaltype = baseMapper.selectById(entity.getId());
|
||||
if(!busMechanicaltype.getCode().equals(entity.getCode()) && count > 0){
|
||||
throw new ServiceException("编码已重复,请重新输入");
|
||||
}
|
||||
if(!busMechanicaltype.getPcode().equals(entity.getPcode()) &&count1 == 0 && "0".equals(entity.getPcode())){
|
||||
throw new ServiceException("父编码不存在,请重新输入");
|
||||
}
|
||||
}
|
||||
if ((entity.getLargeclass() != null && !entity.getLargeclass().isEmpty())||(entity.getMiddleclass() != null && !entity.getMiddleclass().isEmpty())){
|
||||
if (entity.getFullName() != null && !entity.getFullName().isEmpty()) {
|
||||
throw new ServiceException("当不为子类时,全名为空!");
|
||||
}
|
||||
}
|
||||
if (entity.getSubclass() != null && !entity.getSubclass().isEmpty()) {
|
||||
if (entity.getFullName() == null || entity.getFullName().isEmpty()) {
|
||||
throw new ServiceException("当为子类时,全名不能为空!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备类型信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BusMechanicaltypeVo> getTree(BusMechanicaltypeBo bo) {
|
||||
|
||||
List<BusMechanicaltypeVo> voList = queryList(bo);
|
||||
//构建父子映射
|
||||
Map<String, List<BusMechanicaltypeVo>> parentMap = voList.stream()
|
||||
.collect(Collectors.groupingBy(BusMechanicaltypeVo::getPcode));
|
||||
//递归组装树形结构
|
||||
return buildTree("0", parentMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归构建树形结构
|
||||
*
|
||||
* @param parentId 父节点ID(顶级节点为0)
|
||||
* @param parentMap 父子映射表(key=pid,value=子节点列表)
|
||||
* @return 组装好的子树列表
|
||||
*/
|
||||
private List<BusMechanicaltypeVo> buildTree(String parentId, Map<String, List<BusMechanicaltypeVo>> parentMap) {
|
||||
// 获取当前父节点的所有直接子节点
|
||||
List<BusMechanicaltypeVo> children = parentMap.getOrDefault(parentId, Collections.emptyList());
|
||||
if (children.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 为每个子节点递归设置其下一级子节点
|
||||
for (BusMechanicaltypeVo child : children) {
|
||||
// 递归查询当前子节点的子节点,设置为它的子树
|
||||
List<BusMechanicaltypeVo> subChildren = buildTree(child.getCode(), parentMap);
|
||||
// 注意:需要在Vo中添加子节点列表字段,用于存储子树
|
||||
child.setChildren(subChildren);
|
||||
}
|
||||
return children;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?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="org.dromara.mechanical.mapper.BusMechanicalrewritingMapper">
|
||||
|
||||
</mapper>
|
@ -0,0 +1,7 @@
|
||||
<?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="org.dromara.mechanical.mapper.BusMechanicaltypeMapper">
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user