上下架管理
This commit is contained in:
parent
61fa7f53fd
commit
2eed453e53
|
|
@ -0,0 +1,106 @@
|
|||
package com.bonus.material.upOrDown.equipment.controller;
|
||||
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.material.upOrDown.equipment.domain.EquipmentEntity;
|
||||
import com.bonus.material.upOrDown.equipment.service.UpOrDownEquipmentService;
|
||||
import com.bonus.material.upOrDown.equipment.domain.EquipmentEntity;
|
||||
import com.bonus.material.upOrDown.tool.entity.ToolEntity;
|
||||
import com.bonus.material.upOrDown.tool.service.UpOrDownToolService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/16 14:11
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/upOrDown/equipment")
|
||||
@Api(value = "装备上下架", tags = "装备上下架")
|
||||
public class UpOrDownEquipmentController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private UpOrDownEquipmentService upOrDownEquipmentService;
|
||||
|
||||
@ApiOperation(value = "装备上架列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EquipmentEntity entity) {
|
||||
try {
|
||||
startPage();
|
||||
List<EquipmentEntity> list = upOrDownEquipmentService.list(entity);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 下架装备列表
|
||||
*
|
||||
* @param entity 实体
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "下架装备列表")
|
||||
@GetMapping("/downEquipmentList")
|
||||
public TableDataInfo downList(EquipmentEntity entity) {
|
||||
try {
|
||||
startPage();
|
||||
List<EquipmentEntity> list = upOrDownEquipmentService.listByDown(entity);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 下架装备
|
||||
*/
|
||||
@ApiOperation(value = "下架装备")
|
||||
@PostMapping("/down/{equipmentId}")
|
||||
public AjaxResult down(@PathVariable("equipmentId") Long equipmentId)
|
||||
{
|
||||
upOrDownEquipmentService.downEquipmentById(equipmentId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上架
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量上架装备")
|
||||
@PostMapping("/batch/up")
|
||||
public AjaxResult upToolBatch(@RequestBody List<Long> ids) {
|
||||
upOrDownEquipmentService.upEquipmentBatch(ids);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量下架
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量下架装备")
|
||||
@PostMapping("/batch/down")
|
||||
public AjaxResult downToolBatch(@RequestBody List<Long> ids) {
|
||||
upOrDownEquipmentService.downEquipmentBatch(ids);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,345 @@
|
|||
package com.bonus.material.upOrDown.equipment.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.material.devchange.domain.MaDevFile;
|
||||
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/15 23:13
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class EquipmentEntity {
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
private Integer maId;
|
||||
|
||||
private Integer devId;
|
||||
/**
|
||||
* 类型id
|
||||
*/
|
||||
private Integer typeId;
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Integer orderId;
|
||||
/**
|
||||
* 所属省份
|
||||
* 说明:装备当前所在的省份
|
||||
*/
|
||||
private String province;
|
||||
/**
|
||||
* 专业Id
|
||||
* 说明:装备所属的专业领域(如机械、电子、建筑等)
|
||||
*/
|
||||
private Integer majorId;
|
||||
/**
|
||||
* 专业
|
||||
* 说明:装备所属的专业领域(如机械、电子、建筑等)
|
||||
*/
|
||||
private String major;
|
||||
/**
|
||||
* 管理模式
|
||||
*/
|
||||
private String manageType;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer count;
|
||||
/**
|
||||
* 主工序id
|
||||
*/
|
||||
private Integer mainProcessId;
|
||||
/**
|
||||
* 主工序
|
||||
* 说明:装备主要参与的工序环节
|
||||
*/
|
||||
private String mainProcess;
|
||||
/**
|
||||
* 子工序id
|
||||
* 说明:装备参与的具体子工序
|
||||
*/
|
||||
private Integer subProcessId;
|
||||
/**
|
||||
* 子工序
|
||||
* 说明:装备参与的具体子工序
|
||||
*/
|
||||
private String subProcess;
|
||||
|
||||
/**
|
||||
* 装备大类目id
|
||||
* 说明:装备所属的一级分类(如工程机械、仪器仪表等)
|
||||
*/
|
||||
private Integer mainCategoryId;
|
||||
/**
|
||||
* 装备大类目
|
||||
* 说明:装备所属的一级分类(如工程机械、仪器仪表等)
|
||||
*/
|
||||
private String mainCategory;
|
||||
/**
|
||||
* 装备小类目id
|
||||
* 说明:装备所属的二级分类,主类目下的细分分类
|
||||
*/
|
||||
private Integer subCategoryId;
|
||||
/**
|
||||
* 装备小类目
|
||||
* 说明:装备所属的二级分类,主类目下的细分分类
|
||||
*/
|
||||
private String subCategory;
|
||||
/**
|
||||
* 装备分支id
|
||||
* 说明:小类目下的更细分类,代表具体的装备类型分支
|
||||
*/
|
||||
private Integer branchId;
|
||||
/**
|
||||
* 装备分支
|
||||
* 说明:小类目下的更细分类,代表具体的装备类型分支
|
||||
*/
|
||||
private String branch;
|
||||
|
||||
/**
|
||||
* 装备名称
|
||||
* 说明:装备的具体名称,用于标识和展示
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 规格型号
|
||||
* 说明:装备的规格和型号信息,反映装备的技术参数
|
||||
*/
|
||||
private String specificationModel;
|
||||
|
||||
/**
|
||||
* 装备编码
|
||||
* 说明:系统内部为装备分配的唯一编码,用于管理和识别
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 装备状态
|
||||
* 说明:装备当前的状态(如在用、闲置、维修中、报废等)
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 使用年限
|
||||
* 说明:装备已使用的年限
|
||||
*/
|
||||
private String serviceLife;
|
||||
|
||||
/**
|
||||
* 使用项目Id
|
||||
* 说明:装备当前正在使用的项目名称
|
||||
*/
|
||||
private String usingProjectId;
|
||||
/**
|
||||
* 使用项目
|
||||
* 说明:装备当前正在使用的项目名称
|
||||
*/
|
||||
private String usingProject;
|
||||
|
||||
/**
|
||||
* 使用到期时间
|
||||
* 说明:装备预计的使用到期时间或租赁到期时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date expirationTime;
|
||||
|
||||
/**
|
||||
* 使用次数
|
||||
* 说明:装备累计的使用次数统计
|
||||
*/
|
||||
private Integer usageCount;
|
||||
|
||||
/**
|
||||
* 维修次数
|
||||
* 说明:装备累计的维修次数统计
|
||||
*/
|
||||
private Integer repairCount;
|
||||
|
||||
/**
|
||||
* 装备原始编码
|
||||
* 说明:装备出厂时厂家赋予的原始编码,用于溯源
|
||||
*/
|
||||
private String originalCode;
|
||||
|
||||
/**
|
||||
* 计量单位
|
||||
* 说明:装备的计量单位(如台、套、个等)
|
||||
*/
|
||||
private String unit;
|
||||
/**
|
||||
* 生产厂家id
|
||||
* 说明:装备的生产制造厂商名称
|
||||
*/
|
||||
private Integer manufacturerId;
|
||||
/**
|
||||
* 生产厂家
|
||||
* 说明:装备的生产制造厂商名称
|
||||
*/
|
||||
private String manufacturer;
|
||||
|
||||
/**
|
||||
* 出厂日期
|
||||
* 说明:装备从厂家生产出厂的日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date productionDate;
|
||||
|
||||
// 新增:开始出厂时间(查询条件,用于筛选 >= 该日期的记录)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date startProductionDate;
|
||||
|
||||
// 新增:结束出厂时间(查询条件,用于筛选 <= 该日期的记录)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date endProductionDate;
|
||||
|
||||
|
||||
/**
|
||||
* 采购日期
|
||||
* 说明:装备被采购入库的日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date purchaseDate;
|
||||
/**
|
||||
* 开始采购日期
|
||||
* 说明:装备被采购入库的日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date startPurchaseDate;
|
||||
/**
|
||||
* 结束采购日期
|
||||
* 说明:装备被采购入库的日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date endPurchaseDate;
|
||||
|
||||
/**
|
||||
* 资产原值(元)
|
||||
* 说明:装备的原始采购价值,以元为单位
|
||||
*/
|
||||
private BigDecimal originalValue;
|
||||
|
||||
|
||||
/**
|
||||
* 最小资产原值(元)
|
||||
* 说明:装备的原始采购价值,以元为单位
|
||||
*/
|
||||
private BigDecimal minOriginalValue;
|
||||
|
||||
|
||||
/**
|
||||
* 最大资产原值(元)
|
||||
* 说明:装备的原始采购价值,以元为单位
|
||||
*/
|
||||
private BigDecimal maxOriginalValue;
|
||||
|
||||
/**
|
||||
* 最大使用年限(年)
|
||||
* 说明:装备设计的最大可使用年限
|
||||
*/
|
||||
private Integer maxServiceLifeYears;
|
||||
|
||||
/**
|
||||
* 下次维保日期
|
||||
* 说明:装备下一次需要进行维护保养的日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date nextMaintenanceDate;
|
||||
|
||||
/**
|
||||
* 产权单位id
|
||||
* 说明:装备的所有权所属单位
|
||||
*/
|
||||
private Integer propertyUnitId;
|
||||
/**
|
||||
* 产权单位
|
||||
* 说明:装备的所有权所属单位
|
||||
*/
|
||||
private String propertyUnit;
|
||||
|
||||
/**
|
||||
* 装备外观
|
||||
* 说明:装备外观图片的URL列表,存储装备的外观照片
|
||||
*/
|
||||
private List<MaDevFile> appearanceImages;
|
||||
|
||||
/**
|
||||
* 合格证
|
||||
* 说明:装备合格证的URL列表,存储合格证扫描件或照片
|
||||
*/
|
||||
private List<MaDevFile> certificates;
|
||||
|
||||
/**
|
||||
* 定期检验报告
|
||||
* 说明:装备定期检验报告的URL列表
|
||||
*/
|
||||
private List<MaDevFile> inspectionReports;
|
||||
|
||||
/**
|
||||
* 采购发票
|
||||
* 说明:装备采购发票的URL列表,存储发票扫描件或照片
|
||||
*/
|
||||
private List<MaDevFile> purchaseInvoices;
|
||||
/**
|
||||
* 特征项列表
|
||||
*/
|
||||
private List<DevInfoPropertyVo> propertyVoList;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNumber;
|
||||
/**
|
||||
* 订单创建人
|
||||
*/
|
||||
private String orderCreateUser;
|
||||
/**
|
||||
* 订单时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date orderCreateTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date startOrderCreateTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date endOrderCreateTime;
|
||||
/**
|
||||
* 订单时间
|
||||
*/
|
||||
|
||||
private String orderStatus;
|
||||
|
||||
private String daysDiff;
|
||||
|
||||
private String remainingDays;
|
||||
|
||||
private String remainingYears;
|
||||
|
||||
private String yearsDiff;
|
||||
|
||||
private String expirationYears;
|
||||
|
||||
private String actualStartYear;
|
||||
|
||||
private String remainingStartYear;
|
||||
|
||||
private String isWarn;
|
||||
private String entryStatus;
|
||||
|
||||
private String upDownStatus;
|
||||
|
||||
private String remainingStopYear;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.material.upOrDown.equipment.mapper;
|
||||
|
||||
import com.bonus.material.upOrDown.equipment.domain.EquipmentEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UpOrDownEquipmentMapper {
|
||||
List<EquipmentEntity> list(EquipmentEntity entity);
|
||||
|
||||
List<EquipmentEntity> listByDown(EquipmentEntity entity);
|
||||
|
||||
void downEquipmentById(Long equipmentId);
|
||||
|
||||
void upEquipmentBatch(List<Long> ids);
|
||||
|
||||
void downEquipmentBatch(List<Long> ids);
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.material.upOrDown.equipment.service;
|
||||
|
||||
import com.bonus.material.upOrDown.equipment.domain.EquipmentEntity;
|
||||
import com.bonus.material.upOrDown.tool.entity.ToolEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UpOrDownEquipmentService {
|
||||
|
||||
List<EquipmentEntity> listByDown(EquipmentEntity entity);
|
||||
|
||||
void downEquipmentById(Long equipmentId);
|
||||
|
||||
void upEquipmentBatch(List<Long> ids);
|
||||
|
||||
void downEquipmentBatch(List<Long> ids);
|
||||
|
||||
List<EquipmentEntity> list(EquipmentEntity entity);
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.bonus.material.upOrDown.equipment.service.impl;
|
||||
|
||||
import com.bonus.material.upOrDown.equipment.domain.EquipmentEntity;
|
||||
import com.bonus.material.upOrDown.equipment.mapper.UpOrDownEquipmentMapper;
|
||||
import com.bonus.material.upOrDown.equipment.service.UpOrDownEquipmentService;
|
||||
import com.bonus.material.upOrDown.tool.entity.ToolEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/16 14:13
|
||||
*/
|
||||
@Service
|
||||
public class UpOrDownEquipmentServiceImpl implements UpOrDownEquipmentService {
|
||||
|
||||
@Resource
|
||||
private UpOrDownEquipmentMapper upOrDownEquipmentMapper;
|
||||
|
||||
@Override
|
||||
public List<EquipmentEntity> list(EquipmentEntity entity) {
|
||||
return upOrDownEquipmentMapper.list(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EquipmentEntity> listByDown(EquipmentEntity entity) {
|
||||
return upOrDownEquipmentMapper.listByDown(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downEquipmentById(Long equipmentId) {
|
||||
upOrDownEquipmentMapper.downEquipmentById(equipmentId);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upEquipmentBatch(List<Long> ids) {
|
||||
upOrDownEquipmentMapper.upEquipmentBatch(ids) ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downEquipmentBatch(List<Long> ids) {
|
||||
upOrDownEquipmentMapper.downEquipmentBatch(ids) ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,147 @@
|
|||
package com.bonus.material.upOrDown.tool.controller;
|
||||
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.material.upOrDown.tool.entity.ToolEntity;
|
||||
import com.bonus.material.upOrDown.tool.service.UpOrDownToolService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/15 23:10
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/upOrDown/tool")
|
||||
@Api(value = "工具上下架", tags = "工具上下架")
|
||||
public class UpOrDownToolController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private UpOrDownToolService toolService;
|
||||
|
||||
@ApiOperation(value = "工具上架列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ToolEntity entity) {
|
||||
try {
|
||||
startPage();
|
||||
List<ToolEntity> list = toolService.list(entity);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 数量工具列表
|
||||
*
|
||||
* @param entity 实体
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "数量工具列表")
|
||||
@GetMapping("/numberToolList")
|
||||
public TableDataInfo listByNumber(ToolEntity entity) {
|
||||
try {
|
||||
startPage();
|
||||
List<ToolEntity> list = toolService.listByNumber(entity);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 上架数量工具
|
||||
*
|
||||
* @param entity 实体
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "上架数量工具")
|
||||
@PostMapping("/upByNumber")
|
||||
public AjaxResult upToolByNumber(@RequestBody ToolEntity entity) {
|
||||
return toolService.upToolByNumber(entity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 编码工具列表
|
||||
*
|
||||
* @param entity 实体
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "编码工具列表")
|
||||
@GetMapping("/codeToolList")
|
||||
public TableDataInfo listByCode(ToolEntity entity) {
|
||||
try {
|
||||
startPage();
|
||||
List<ToolEntity> list = toolService.listByCode(entity);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 上架编码工具
|
||||
*
|
||||
* @param entity 实体
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation(value = "上架编码工具")
|
||||
@PostMapping("/upByCode")
|
||||
public AjaxResult upToolByCode(@RequestBody ToolEntity entity) {
|
||||
return toolService.upToolByCode(entity);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 下架工具
|
||||
*/
|
||||
@ApiOperation(value = "下架工具")
|
||||
@PostMapping("/down/{toolId}")
|
||||
public AjaxResult down(@PathVariable("toolId") Long toolId)
|
||||
{
|
||||
toolService.downToolById(toolId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上架
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量上架工具")
|
||||
@PostMapping("/batch/up")
|
||||
public AjaxResult upToolBatch(@RequestBody List<Long> ids) {
|
||||
toolService.upToolBatch(ids);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量下架
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量下架工具")
|
||||
@PostMapping("/batch/down")
|
||||
public AjaxResult downToolBatch(@RequestBody List<Long> ids) {
|
||||
toolService.downToolBatch(ids);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
package com.bonus.material.upOrDown.tool.entity;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/15 23:13
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class ToolEntity {
|
||||
/**
|
||||
* 主键(自增)
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工具编码(编码管理使用)
|
||||
*/
|
||||
private String toolCode;
|
||||
|
||||
/**
|
||||
* 工具类型ID(非空)
|
||||
*/
|
||||
private Long typeId;
|
||||
|
||||
private String typeName;
|
||||
|
||||
/**
|
||||
* 管理方式:1-编码管理;2-数量管理(非空)
|
||||
* 建议后续用枚举
|
||||
*/
|
||||
private Integer manageMode;
|
||||
|
||||
/**
|
||||
* 装备原值(仅编码设备)
|
||||
* 对应数据库 decimal(10,2),用 BigDecimal 保证精度
|
||||
*/
|
||||
private BigDecimal originCost;
|
||||
|
||||
/**
|
||||
* 总数量(非空,默认1.00)
|
||||
*/
|
||||
private BigDecimal totalNum;
|
||||
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
* 在库数量(非空,默认0.00)
|
||||
*/
|
||||
private BigDecimal availableNum;
|
||||
|
||||
/**
|
||||
* 在用数量(非空,默认0.00)
|
||||
*/
|
||||
private BigDecimal inNum;
|
||||
|
||||
/**
|
||||
* 维修数量(非空,默认0.00)
|
||||
*/
|
||||
private BigDecimal repairNum;
|
||||
|
||||
/**
|
||||
* 报废数量(非空,默认0.00)
|
||||
*/
|
||||
private BigDecimal scrapNum;
|
||||
|
||||
/**
|
||||
* 厂家id(非空,默认0)
|
||||
*/
|
||||
private Integer supplierId;
|
||||
|
||||
private String supplierName;
|
||||
|
||||
/**
|
||||
* 采购日期
|
||||
* 用 LocalDate 对应数据库 date 类型(Java 8+ 推荐)
|
||||
*/
|
||||
private LocalDate purchaseDate;
|
||||
|
||||
/**
|
||||
* 出厂日期
|
||||
*/
|
||||
private LocalDate productionDate;
|
||||
|
||||
/**
|
||||
* 最近检验日期
|
||||
*/
|
||||
private LocalDate lastCheckDate;
|
||||
|
||||
/**
|
||||
* 下次检验日期
|
||||
*/
|
||||
private LocalDate nextCheckDate;
|
||||
|
||||
/**
|
||||
* 当前状态:0-在库 1-在用 2-在修 3-已报废(非空,默认0)
|
||||
* 建议后续用枚举
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 上下架状态:1-上架 0-下架(非空,默认0)
|
||||
* 建议后续用枚举
|
||||
*/
|
||||
private String upDownStatus;
|
||||
|
||||
/**
|
||||
* 所属公司ID(非空)
|
||||
*/
|
||||
private Long companyId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 创建时间(默认当前时间)
|
||||
* 对应数据库 DEFAULT CURRENT_TIMESTAMP
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间(默认当前时间,更新时自动刷新)
|
||||
* 对应数据库 DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 装备原值
|
||||
*/
|
||||
private String identifyCode;
|
||||
|
||||
|
||||
/**
|
||||
* 4级父节点id
|
||||
*/
|
||||
private String fourthParentId;
|
||||
/**
|
||||
* 4级父节点名称
|
||||
*/
|
||||
@Excel(name = "工具专业")
|
||||
private String fourthParentName;
|
||||
|
||||
/**
|
||||
* 3级父节点id
|
||||
*/
|
||||
private String greatGrandparentId;
|
||||
/**
|
||||
* 3级父节点名称
|
||||
*/
|
||||
@Excel(name = "施工类型")
|
||||
private String greatGrandparentName;
|
||||
/**
|
||||
* 2级父节点id
|
||||
*/
|
||||
@Excel(name = "工具类型")
|
||||
private String grandparentTypeId;
|
||||
/**
|
||||
* 2级父节点名称
|
||||
*/
|
||||
@Excel(name = "工具类型")
|
||||
private String grandparentTypeName;
|
||||
|
||||
/**
|
||||
* 1级父节点id
|
||||
*/
|
||||
private String parentTypeId;
|
||||
/**
|
||||
* 1级父节点名称
|
||||
*/
|
||||
@Excel(name = "工具名称")
|
||||
private String parentTypeName;
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
private String fileList;
|
||||
|
||||
private List<DevInfoPropertyVo> propertyVoList;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.material.upOrDown.tool.mapper;
|
||||
|
||||
import com.bonus.material.upOrDown.tool.entity.ToolEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UpOrDownToolMapper {
|
||||
List<ToolEntity> list(ToolEntity entity);
|
||||
|
||||
List<ToolEntity> listByNumber(ToolEntity entity);
|
||||
|
||||
List<ToolEntity> listByCode(ToolEntity entity);
|
||||
|
||||
int upToolBatch(List<Long> ids);
|
||||
|
||||
int downToolBatch(List<Long> ids);
|
||||
|
||||
void downToolById(Long toolId);
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.material.upOrDown.tool.service;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.upOrDown.tool.entity.ToolEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UpOrDownToolService {
|
||||
List<ToolEntity> list(ToolEntity entity);
|
||||
|
||||
List<ToolEntity> listByNumber(ToolEntity entity);
|
||||
|
||||
AjaxResult upToolByNumber(ToolEntity entity);
|
||||
|
||||
List<ToolEntity> listByCode(ToolEntity entity);
|
||||
|
||||
AjaxResult upToolByCode(ToolEntity entity);
|
||||
|
||||
|
||||
void upToolBatch(List<Long> ids);
|
||||
|
||||
void downToolBatch(List<Long> ids);
|
||||
|
||||
void downToolById(Long toolId);
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package com.bonus.material.upOrDown.tool.service.impl;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.upOrDown.tool.entity.ToolEntity;
|
||||
import com.bonus.material.upOrDown.tool.mapper.UpOrDownToolMapper;
|
||||
import com.bonus.material.upOrDown.tool.service.UpOrDownToolService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 30791
|
||||
* @version 1.0
|
||||
* Create by 2025/11/15 23:11
|
||||
*/
|
||||
|
||||
@Service
|
||||
public class UpOrDownToolServiceImpl implements UpOrDownToolService {
|
||||
|
||||
@Resource
|
||||
private UpOrDownToolMapper upOrDownToolMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<ToolEntity> list(ToolEntity entity) {
|
||||
return upOrDownToolMapper.list(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ToolEntity> listByNumber(ToolEntity entity) {
|
||||
return upOrDownToolMapper.listByNumber(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult upToolByNumber(ToolEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ToolEntity> listByCode(ToolEntity entity) {
|
||||
return upOrDownToolMapper.listByCode(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult upToolByCode(ToolEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void upToolBatch(List<Long> ids) {
|
||||
upOrDownToolMapper.upToolBatch(ids) ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downToolBatch(List<Long> ids) {
|
||||
upOrDownToolMapper.downToolBatch(ids) ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downToolById(Long toolId) {
|
||||
upOrDownToolMapper.downToolById(toolId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,287 @@
|
|||
<?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="com.bonus.material.upOrDown.equipment.mapper.UpOrDownEquipmentMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.bonus.material.devchange.domain.MaDevInfo">
|
||||
<id column="ma_id" property="maId"/>
|
||||
<result column="device_name" property="deviceName"/>
|
||||
<result column="device_count" property="deviceCount"/>
|
||||
<result column="code" property="code"/>
|
||||
<result column="identify_code" property="identifyCode"/>
|
||||
<result column="type_id" property="typeId"/>
|
||||
<result column="ma_status" property="maStatus"/>
|
||||
<result column="lease_scope" property="leaseScope"/>
|
||||
<result column="location" property="location"/>
|
||||
<result column="brand" property="brand"/>
|
||||
<result column="item_type_model" property="modelName"/>
|
||||
<result column="production_date" property="productionDate"/>
|
||||
<result column="working_hours" property="workingHours"/>
|
||||
<result column="pic_url" property="picUrl"/>
|
||||
<result column="js_month_price" property="jsMonthPrice"/>
|
||||
<result column="js_day_price" property="jsDayPrice"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="gps_code" property="gpsCode"/>
|
||||
<result column="on_company" property="ownCo"/>
|
||||
<result column="person" property="person"/>
|
||||
<result column="person_phone" property="personPhone"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="creator" property="creator"/>
|
||||
<result column="deposit" property="deposit"/>
|
||||
<result column="is_active" property="isActive"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="update_by" property="updateBy"/>
|
||||
<result column="is_operator" property="isOperator"/>
|
||||
<result column="specification" property="specification"/>
|
||||
<result column="province_id" property="provinceId"/>
|
||||
<result column="city_id" property="cityId"/>
|
||||
<result column="area_id" property="areaId"/>
|
||||
<result column="video_url" property="videoUrl"/>
|
||||
<result column="check_date" property="checkDate"/>
|
||||
<result column="check_cycle" property="checkCycle"/>
|
||||
<result column="is_qc" property="isQc"/>
|
||||
<result column="is_safe_book" property="isSafeBook"/>
|
||||
<result column="total_up_day" property="totalUpDay"/>
|
||||
<result column="total_lease_day" property="totalLeaseDay"/>
|
||||
<result column="origina_value" property="originaValue"/>
|
||||
<result column="change_status" jdbcType="CHAR" property="changeStatus"/>
|
||||
<result column="expiration_time" jdbcType="DATE" property="expirationTime"/>
|
||||
<result column="entry_status" jdbcType="CHAR" property="entryStatus"/>
|
||||
<result column="up_down_status" jdbcType="CHAR" property="upDownStatus"/>
|
||||
<result column="json_data" property="jsonData"/>
|
||||
<result column="buy_price" property="buyPrice"/>
|
||||
<result column="on_project" property="onProject"/>
|
||||
<result column="childGx" property="childGx"/>
|
||||
<result column="company_name" property="companyName"/>
|
||||
<result column="devCategory" property="devCategory"/>
|
||||
<result column="devModel" property="devModel"/>
|
||||
<result column="devName" property="devName"/>
|
||||
<result column="devSubcategory" property="devSubcategory"/>
|
||||
<result column="mainGx" property="mainGx"/>
|
||||
<result column="next_check_time" property="nextCheckTime"/>
|
||||
<result column="proType" property="proType"/>
|
||||
<result column="unit_name" property="unitName"/>
|
||||
<result column="pro_name" property="proName"/>
|
||||
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
ma_id, device_name, device_weight, device_count, `code`, identify_code, type_id, ma_status,
|
||||
lease_scope, `location`, brand, model_name, production_date, working_hours, serial_number,
|
||||
pic_url, js_month_price, js_day_price, `description`,
|
||||
gps_code, on_company, person, person_phone, create_time, creator, deposit, is_active,
|
||||
update_time, update_by, is_operator, specification, province_id, city_id, area_id,
|
||||
video_url, own_id, check_date, check_cycle, is_qc, is_safe_book, is_zone, zone_id,
|
||||
total_up_day, total_lease_day, origina_value, change_status, expiration_time, entry_status,
|
||||
up_down_status, json_data, buy_price, item_type_model, on_project
|
||||
</sql>
|
||||
|
||||
|
||||
|
||||
<update id="downEquipmentById">
|
||||
update ma_dev_info set up_down_status='0' where ma_id=#{maId}
|
||||
</update>
|
||||
|
||||
<update id="upEquipmentBatch">
|
||||
UPDATE
|
||||
ma_dev_info
|
||||
SET
|
||||
up_down_status = 1
|
||||
WHERE
|
||||
ma_id IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="downEquipmentBatch">
|
||||
UPDATE
|
||||
ma_dev_info
|
||||
SET
|
||||
up_down_status = 0
|
||||
WHERE
|
||||
ma_id IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<select id="list" resultType="com.bonus.material.upOrDown.equipment.domain.EquipmentEntity">
|
||||
select mdi.ma_id AS maId,
|
||||
mdi.type_id AS typeId,
|
||||
mdi.manage_type AS manageType,
|
||||
mdi.device_count AS count,
|
||||
mtv.maxTypeId AS majorId,
|
||||
mtv.proType AS major,
|
||||
mtv.mainGxId AS mainProcessId,
|
||||
mtv.mainGx AS mainProcess,
|
||||
mtv.childGxId AS subProcessId,
|
||||
mtv.childGx AS subProcess,
|
||||
mtv.devCategoryId AS mainCategoryId,
|
||||
mtv.devCategory AS mainCategory,
|
||||
mtv.devSubcategory AS subCategory,
|
||||
mtv.devSubcategoryId AS subCategoryId,
|
||||
mtv.devNameId AS branchId,
|
||||
mtv.devName AS branch,
|
||||
mdi.device_name AS name,
|
||||
mdi.item_type_model As specificationModel,
|
||||
mdi.code AS code,
|
||||
mdi.up_down_status AS upDownStatus,
|
||||
mdi.change_status AS status,
|
||||
TIMESTAMPDIFF(YEAR, mdi.production_date, CURDATE()) AS serviceLife,
|
||||
jsp.pro_code AS usingProjectId,
|
||||
jsp.pro_name AS usingProject,
|
||||
mdi.identify_code AS originalCode,
|
||||
mdi.supplier_id AS manufacturerId,
|
||||
ms.supplier_name AS manufacturer,
|
||||
mdi.purchase_date AS purchaseDate,
|
||||
mdi.production_date AS productionDate,
|
||||
sd.dept_id AS propertyUnitId,
|
||||
sd.dept_name AS propertyUnit,
|
||||
mdi.buy_price AS originalValue,
|
||||
mdi.unit AS unit,
|
||||
mdq.next_check_time AS nextMaintenanceDate,
|
||||
mdi.max_working_hours AS maxServiceLifeYears,
|
||||
0 AS repairCount,
|
||||
0 AS usageCount,
|
||||
sc.name AS province
|
||||
from ma_dev_info mdi
|
||||
INNER JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
|
||||
LEFT JOIN jj_sing_project jsp ON mdi.on_project = jsp.pro_code
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
|
||||
LEFT JOIN (SELECT max( next_check_time) next_check_time,ma_id from ma_dev_qc GROUP BY ma_id ) mdq on
|
||||
mdi.ma_id=mdq.ma_id
|
||||
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.supplier_id
|
||||
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
|
||||
<where>
|
||||
mdi.is_active = '1' and mdi.entry_status = '1'
|
||||
and mdi.up_down_status='1'
|
||||
<if test="typeId != null and typeId != 0 ">
|
||||
and (
|
||||
mtv.mainGxId = #{typeId}
|
||||
or mtv.childGxId = #{typeId}
|
||||
or mtv.devCategoryId = #{typeId}
|
||||
or mtv.devSubcategoryId = #{typeId}
|
||||
or mtv.maxTypeId = #{typeId}
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="name != null and name != ''">
|
||||
and mdi.device_name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
|
||||
<if test="specificationModel != null and specificationModel != ''">
|
||||
and mdi.item_type_model like concat('%', #{specificationModel}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and mdi.ma_status = #{status}
|
||||
</if>
|
||||
|
||||
<if test="code != null and code != ''">
|
||||
and mdi.code like concat('%', #{code}, '%')
|
||||
</if>
|
||||
|
||||
<if test="majorId != null and majorId != ''">
|
||||
and mtv.maxTypeId = #{majorId}
|
||||
</if>
|
||||
|
||||
<if test="major != null and major != ''">
|
||||
and mtv.proType like concat('%', #{major}, '%')
|
||||
</if>
|
||||
|
||||
<if test="subProcess != null and subProcess != ''">
|
||||
and mtv.childGx like concat('%', #{subProcess}, '%')
|
||||
</if>
|
||||
|
||||
|
||||
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="listByDown" resultType="com.bonus.material.upOrDown.equipment.domain.EquipmentEntity">
|
||||
|
||||
select mdi.ma_id AS maId,
|
||||
mdi.type_id AS typeId,
|
||||
mdi.manage_type AS manageType,
|
||||
mdi.device_count AS count,
|
||||
mtv.maxTypeId AS majorId,
|
||||
mtv.proType AS major,
|
||||
mtv.mainGxId AS mainProcessId,
|
||||
mtv.mainGx AS mainProcess,
|
||||
mtv.childGxId AS subProcessId,
|
||||
mtv.childGx AS subProcess,
|
||||
mtv.devCategoryId AS mainCategoryId,
|
||||
mtv.devCategory AS mainCategory,
|
||||
mtv.devSubcategory AS subCategory,
|
||||
mtv.devSubcategoryId AS subCategoryId,
|
||||
mtv.devNameId AS branchId,
|
||||
mtv.devName AS branch,
|
||||
mdi.device_name AS name,
|
||||
mdi.item_type_model As specificationModel,
|
||||
mdi.code AS code,
|
||||
mdi.up_down_status AS upDownStatus,
|
||||
mdi.change_status AS status,
|
||||
TIMESTAMPDIFF(YEAR, mdi.production_date, CURDATE()) AS serviceLife,
|
||||
jsp.pro_code AS usingProjectId,
|
||||
jsp.pro_name AS usingProject,
|
||||
mdi.identify_code AS originalCode,
|
||||
mdi.supplier_id AS manufacturerId,
|
||||
ms.supplier_name AS manufacturer,
|
||||
mdi.purchase_date AS purchaseDate,
|
||||
mdi.production_date AS productionDate,
|
||||
sd.dept_id AS propertyUnitId,
|
||||
sd.dept_name AS propertyUnit,
|
||||
mdi.buy_price AS originalValue,
|
||||
mdi.unit AS unit,
|
||||
mdq.next_check_time AS nextMaintenanceDate,
|
||||
mdi.max_working_hours AS maxServiceLifeYears,
|
||||
0 AS repairCount,
|
||||
0 AS usageCount,
|
||||
sc.name AS province
|
||||
from ma_dev_info mdi
|
||||
INNER JOIN ma_type_view mtv ON mtv.typeId = mdi.type_id
|
||||
LEFT JOIN jj_sing_project jsp ON mdi.on_project = jsp.pro_code
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = mdi.on_company
|
||||
LEFT JOIN (SELECT max( next_check_time) next_check_time,ma_id from ma_dev_qc GROUP BY ma_id ) mdq on
|
||||
mdi.ma_id=mdq.ma_id
|
||||
LEFT JOIN ma_supplier ms ON ms.supplier_id = mdi.supplier_id
|
||||
LEFT JOIN sys_cnarea sc ON sc.area_code = mdi.province_id
|
||||
<where>
|
||||
mdi.is_active = '1' and mdi.entry_status = '1'
|
||||
and mdi.up_down_status='0'
|
||||
<if test="typeId != null and typeId != 0 ">
|
||||
and (
|
||||
mtv.mainGxId = #{typeId}
|
||||
or mtv.childGxId = #{typeId}
|
||||
or mtv.devCategoryId = #{typeId}
|
||||
or mtv.devSubcategoryId = #{typeId}
|
||||
or mtv.maxTypeId = #{typeId}
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="name != null and name != ''">
|
||||
and mdi.device_name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
|
||||
|
||||
|
||||
<if test="specificationModel != null and specificationModel != ''">
|
||||
and mdi.item_type_model like concat('%', #{specificationModel}, '%')
|
||||
</if>
|
||||
|
||||
<if test="majorId != null and majorId != ''">
|
||||
and mtv.maxTypeId = #{majorId}
|
||||
</if>
|
||||
|
||||
<if test="code != null and code != ''">
|
||||
and mdi.code like concat('%', #{code}, '%')
|
||||
</if>
|
||||
|
||||
<if test="status != null and status != ''">
|
||||
AND mdi.change_status=#{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,214 @@
|
|||
<?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="com.bonus.material.upOrDown.tool.mapper.UpOrDownToolMapper">
|
||||
<update id="upToolBatch">
|
||||
UPDATE
|
||||
tool_ledger
|
||||
SET
|
||||
up_down_status = 1
|
||||
WHERE
|
||||
id IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<update id="downToolBatch">
|
||||
UPDATE
|
||||
tool_ledger
|
||||
SET
|
||||
up_down_status = 0
|
||||
WHERE
|
||||
id IN
|
||||
<foreach collection="list" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<update id="downToolById">
|
||||
update tool_ledger set up_down_status='0' where id=#{id}
|
||||
</update>
|
||||
|
||||
<select id="list" resultType="com.bonus.material.upOrDown.tool.entity.ToolEntity">
|
||||
SELECT
|
||||
tl.id,
|
||||
tt.type_id AS typeId,
|
||||
tt.type_name AS typeName,
|
||||
tt.unit_name AS unitName,
|
||||
tt.manage_type AS manageMode,
|
||||
tl.tool_code as toolCode,
|
||||
tt1.type_name AS parentTypeName, -- 1级父节点名称
|
||||
tt2.type_name AS grandparentTypeName, -- 2级父节点名称
|
||||
tt3.type_name AS greatGrandparentName, -- 3级父节点名称
|
||||
tt4.type_name AS fourthParentName, -- 4级父节点名称
|
||||
SUM(COALESCE ( tl.available_num, 0 )) AS availableNum,
|
||||
SUM(COALESCE ( tl.in_num, 0 )) AS inNum,
|
||||
SUM(COALESCE ( tl.scrap_num, 0 )) AS scrapNum,
|
||||
SUM(COALESCE ( tl.repair_num, 0 )) AS repairNum,
|
||||
SUM(COALESCE ( tl.total_num, 0 )) AS totalNum
|
||||
FROM
|
||||
tool_type tt
|
||||
LEFT JOIN tool_ledger tl ON tl.type_id = tt.type_id
|
||||
-- 关联1级父节点(直接父节点)
|
||||
INNER JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||
-- 关联2级父节点(祖父节点)
|
||||
INNER JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
|
||||
-- 关联3级父节点(曾祖父节点)
|
||||
INNER JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
|
||||
-- 关联4级父节点
|
||||
INNER JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
||||
WHERE
|
||||
tt.del_flag = '0'
|
||||
AND tl.up_down_status='1'
|
||||
AND tt1.del_flag = '0'
|
||||
AND tt2.del_flag = '0'
|
||||
AND tt3.del_flag = '0'
|
||||
AND tt4.del_flag = '0'
|
||||
and tl.id is not null
|
||||
<if test="fourthParentId != null and fourthParentId != ''">
|
||||
AND tt4.type_name LIKE CONCAT('%', #{fourthParentName}, '%')
|
||||
</if>
|
||||
<if test="greatGrandparentId != null and greatGrandparentId != ''">
|
||||
AND tt3.type_name LIKE CONCAT('%', #{greatGrandparentName}, '%')
|
||||
</if>
|
||||
<if test="grandparentTypeId != null and grandparentTypeId != ''">
|
||||
AND tt2.type_name LIKE CONCAT('%', #{grandparentTypeName}, '%')
|
||||
</if>
|
||||
<if test="parentTypeId != null and parentTypeId != ''">
|
||||
AND tt1.type_name LIKE CONCAT('%', #{parentTypeName}, '%')
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
||||
</if>
|
||||
GROUP BY tl.id
|
||||
ORDER BY
|
||||
tl.create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="listByNumber" resultType="com.bonus.material.upOrDown.tool.entity.ToolEntity">
|
||||
SELECT
|
||||
tl.id,
|
||||
tt.type_id AS typeId,
|
||||
tt.type_name AS typeName,
|
||||
tt.unit_name AS unitName,
|
||||
tt.manage_type AS manageMode,
|
||||
tl.tool_code as toolCode,
|
||||
tt1.type_name AS parentTypeName, -- 1级父节点名称
|
||||
tt2.type_name AS grandparentTypeName, -- 2级父节点名称
|
||||
tt3.type_name AS greatGrandparentName, -- 3级父节点名称
|
||||
tt4.type_name AS fourthParentName, -- 4级父节点名称
|
||||
SUM(COALESCE ( tl.available_num, 0 )) AS availableNum,
|
||||
SUM(COALESCE ( tl.in_num, 0 )) AS inNum,
|
||||
SUM(COALESCE ( tl.scrap_num, 0 )) AS scrapNum,
|
||||
SUM(COALESCE ( tl.repair_num, 0 )) AS repairNum,
|
||||
SUM(COALESCE ( tl.total_num, 0 )) AS totalNum
|
||||
FROM
|
||||
tool_type tt
|
||||
LEFT JOIN tool_ledger tl ON tl.type_id = tt.type_id
|
||||
-- 关联1级父节点(直接父节点)
|
||||
INNER JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||
-- 关联2级父节点(祖父节点)
|
||||
INNER JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
|
||||
-- 关联3级父节点(曾祖父节点)
|
||||
INNER JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
|
||||
-- 关联4级父节点
|
||||
INNER JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
||||
WHERE
|
||||
tt.del_flag = '0'
|
||||
AND tl.up_down_status='0'
|
||||
and tl.manage_mode='1'
|
||||
AND tt1.del_flag = '0'
|
||||
AND tt2.del_flag = '0'
|
||||
AND tt3.del_flag = '0'
|
||||
AND tt4.del_flag = '0'
|
||||
<if test="fourthParentId != null and fourthParentId != ''">
|
||||
AND tt4.type_name LIKE CONCAT('%', #{fourthParentName}, '%')
|
||||
</if>
|
||||
<if test="greatGrandparentId != null and greatGrandparentId != ''">
|
||||
AND tt3.type_name LIKE CONCAT('%', #{greatGrandparentName}, '%')
|
||||
</if>
|
||||
<if test="grandparentTypeId != null and grandparentTypeId != ''">
|
||||
AND tt2.type_name LIKE CONCAT('%', #{grandparentTypeName}, '%')
|
||||
</if>
|
||||
<if test="parentTypeId != null and parentTypeId != ''">
|
||||
AND tt1.type_name LIKE CONCAT('%', #{parentTypeName}, '%')
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
||||
</if>
|
||||
GROUP BY tl.id
|
||||
ORDER BY
|
||||
tl.create_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="listByCode" resultType="com.bonus.material.upOrDown.tool.entity.ToolEntity">
|
||||
SELECT
|
||||
tl.id,
|
||||
tt.type_id AS typeId,
|
||||
tt.type_name AS typeName,
|
||||
tt.unit_name AS unitName,
|
||||
tt.manage_type AS manageMode,
|
||||
tl.tool_code as toolCode,
|
||||
tl.up_down_status,
|
||||
tl.origin_cost,
|
||||
tl.next_check_date,
|
||||
tl.production_date,
|
||||
tl.supplier_id,
|
||||
ms.supplier_name,
|
||||
tt1.type_name AS parentTypeName, -- 1级父节点名称
|
||||
tt2.type_name AS grandparentTypeName, -- 2级父节点名称
|
||||
tt3.type_name AS greatGrandparentName, -- 3级父节点名称
|
||||
tt4.type_name AS fourthParentName, -- 4级父节点名称
|
||||
SUM(COALESCE ( tl.available_num, 0 )) AS availableNum,
|
||||
SUM(COALESCE ( tl.in_num, 0 )) AS inNum,
|
||||
SUM(COALESCE ( tl.scrap_num, 0 )) AS scrapNum,
|
||||
SUM(COALESCE ( tl.repair_num, 0 )) AS repairNum,
|
||||
SUM(COALESCE ( tl.total_num, 0 )) AS totalNum
|
||||
FROM
|
||||
tool_type tt
|
||||
|
||||
LEFT JOIN tool_ledger tl ON tl.type_id = tt.type_id
|
||||
left join ma_supplier ms on ms.supplier_id=tl.supplier_id
|
||||
-- 关联1级父节点(直接父节点)
|
||||
INNER JOIN tool_type tt1 ON tt.parent_id = tt1.type_id
|
||||
-- 关联2级父节点(祖父节点)
|
||||
INNER JOIN tool_type tt2 ON tt1.parent_id = tt2.type_id
|
||||
-- 关联3级父节点(曾祖父节点)
|
||||
INNER JOIN tool_type tt3 ON tt2.parent_id = tt3.type_id
|
||||
-- 关联4级父节点
|
||||
INNER JOIN tool_type tt4 ON tt3.parent_id = tt4.type_id
|
||||
WHERE
|
||||
tt.del_flag = '0'
|
||||
AND tl.up_down_status='0'
|
||||
and tl.manage_mode='0'
|
||||
AND tt1.del_flag = '0'
|
||||
AND tt2.del_flag = '0'
|
||||
AND tt3.del_flag = '0'
|
||||
AND tt4.del_flag = '0'
|
||||
<if test="fourthParentId != null and fourthParentId != ''">
|
||||
AND tt4.type_name LIKE CONCAT('%', #{fourthParentName}, '%')
|
||||
</if>
|
||||
<if test="greatGrandparentId != null and greatGrandparentId != ''">
|
||||
AND tt3.type_name LIKE CONCAT('%', #{greatGrandparentName}, '%')
|
||||
</if>
|
||||
<if test="grandparentTypeId != null and grandparentTypeId != ''">
|
||||
AND tt2.type_name LIKE CONCAT('%', #{grandparentTypeName}, '%')
|
||||
</if>
|
||||
<if test="parentTypeId != null and parentTypeId != ''">
|
||||
AND tt1.type_name LIKE CONCAT('%', #{parentTypeName}, '%')
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
AND tt.type_name LIKE CONCAT('%', #{typeName}, '%')
|
||||
</if>
|
||||
<if test="toolCode != null and toolCode != ''">
|
||||
AND tl.tool_code LIKE CONCAT('%', #{toolCode}, '%')
|
||||
</if>
|
||||
GROUP BY tl.id
|
||||
ORDER BY
|
||||
tl.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue