增加注释
This commit is contained in:
parent
7484683d3a
commit
5f7f5c707b
|
|
@ -21,7 +21,7 @@ public class BonusMaterialMallApplication
|
|||
public static void main(String[] args)
|
||||
{
|
||||
SpringApplication.run(BonusMaterialMallApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 2024机具租赁商城启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
System.out.println("(♥◠‿◠)ノ゙ 2024安徽机械化装备平台启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" .-------. ____ __ \n" +
|
||||
" | _ _ \\ \\ \\ / / \n" +
|
||||
" | ( ' ) | \\ _. / ' \n" +
|
||||
|
|
|
|||
|
|
@ -44,4 +44,15 @@ public class BookCarController extends BaseController {
|
|||
return bookCarService.getBookCarDetails(devInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除预约车
|
||||
* @param devInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除预约车")
|
||||
@PostMapping("/deleteById")
|
||||
public AjaxResult deleteById(@RequestBody BookCarInfoDto devInfo) {
|
||||
return bookCarService.deleteById(devInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,14 @@ import java.util.List;
|
|||
*/
|
||||
@Data
|
||||
public class BookCarInfoDto {
|
||||
//
|
||||
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "订单id")
|
||||
private Integer bookId;
|
||||
|
||||
@ApiModelProperty(value = "设备id")
|
||||
private String maId;
|
||||
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
|
|
|
|||
|
|
@ -36,4 +36,11 @@ public interface BookCarMapper {
|
|||
* @return
|
||||
*/
|
||||
DevInfoVo selectDevInfoByMaId(@Param("maId") String maId, @Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 删除预约车
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int deleteById(Integer id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,4 +26,10 @@ public interface BookCarService {
|
|||
*/
|
||||
AjaxResult getBookCarDetails(BookCarInfoDto devInfo);
|
||||
|
||||
/**
|
||||
* 删除预约车
|
||||
* @param devInfo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult deleteById(BookCarInfoDto devInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,9 @@ package com.bonus.material.book.service.impl;
|
|||
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.book.domain.BookCarDetailDto;
|
||||
import com.bonus.material.book.domain.BookCarInfoDto;
|
||||
import com.bonus.material.book.domain.BookCarVo;
|
||||
import com.bonus.material.book.domain.CompanyPersonPhoneKey;
|
||||
|
|
@ -18,9 +16,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -94,4 +90,18 @@ public class BookCarServiceImpl implements BookCarService {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除预约车
|
||||
* @param devInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult deleteById(BookCarInfoDto devInfo) {
|
||||
if (devInfo == null || StringUtils.isEmpty(devInfo.getMaId())) {
|
||||
return AjaxResult.error("传入设备ID为空,请刷新后重试");
|
||||
}
|
||||
int result = bookCarMapper.deleteById(devInfo.getId());
|
||||
return result > 0 ? AjaxResult.success("删除成功") : AjaxResult.error("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ public class DevInfo extends BaseEntity {
|
|||
|
||||
private static final long serialVersionUID = 429270031714225761L;
|
||||
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Integer id;
|
||||
|
||||
/** 设备id */
|
||||
@Excel(name = "设备id")
|
||||
@ApiModelProperty(value = "设备id")
|
||||
|
|
|
|||
|
|
@ -430,6 +430,14 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
return sumTypeMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备信息列表
|
||||
* 该方法根据传入的DevInfoVo对象中的属性值,查询符合条件的设备信息列表
|
||||
* 主要用于设备信息的批量查询筛选
|
||||
*
|
||||
* @param devInfo 包含查询条件的DevInfoVo对象,用于指定查询的设备信息条件
|
||||
* @return 返回一个DevInfoVo对象列表,包含所有符合条件的设备信息
|
||||
*/
|
||||
@Override
|
||||
public List<DevInfoVo> selectDevInfoLists(DevInfoVo devInfo) {
|
||||
return devInfoMapper.selectDevInfoLists(devInfo);
|
||||
|
|
@ -443,20 +451,31 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
return devInfoMapper.selectCompanyList(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备的上下架状态
|
||||
*
|
||||
* @param devInfo 包含设备ID列表和新状态的设备信息对象
|
||||
* @return AjaxResult对象,操作结果或错误信息
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateUpDown(DevInfo devInfo) {
|
||||
// 检查是否提供了设备ID列表和新状态
|
||||
if (devInfo == null || CollectionUtil.isEmpty(devInfo.getMaIds())) {
|
||||
return AjaxResult.warn("请选择设备");
|
||||
}
|
||||
if (devInfo.getMaStatus() == null) {
|
||||
return AjaxResult.warn("请选择设备状态");
|
||||
}
|
||||
|
||||
devInfo.getMaIds().removeIf(Objects::isNull);
|
||||
List<Long> maIds = devInfo.getMaIds();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(maIds)) {
|
||||
for (Long maId : maIds) {
|
||||
Integer oldStatus = devInfoMapper.getMaStatusByMaId(maId);
|
||||
Integer newStatus = devInfo.getMaStatus();
|
||||
|
||||
// 根据旧状态和新状态进行状态转换检查
|
||||
switch (oldStatus) {
|
||||
case 0:
|
||||
if (newStatus.equals(TO_BE_LISTED.getCode()) || newStatus.equals(ON_HIRE.getCode())) {continue;}
|
||||
|
|
@ -473,12 +492,14 @@ public class DevInfoServiceImpl implements DevInfoService {
|
|||
return AjaxResult.warn("设备ID:" + maId + "设备状态异常,请修改后重试");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
devInfoMapper.updateUpDown(maIds, devInfo.getMaStatus());
|
||||
} catch (DataAccessException e) {
|
||||
throw new ServiceException("批量修改状态时SQL执行异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
return AjaxResult.success("操作成功");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
values(#{maId}, 0, #{orderCompany}, #{orderUser}, #{creater}, now())
|
||||
</insert>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete from book_car_detail where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="getBookCarDetails" resultType="com.bonus.material.device.domain.vo.DevInfoVo">
|
||||
SELECT
|
||||
bcd.id as id,
|
||||
d.ma_id as maId,
|
||||
d.code as code,
|
||||
d.device_name as deviceName,
|
||||
|
|
|
|||
Loading…
Reference in New Issue