parent
064aa6e2f8
commit
c8dbcbef46
@ -0,0 +1,39 @@ |
|||||||
|
package com.bellmann.common.enums; |
||||||
|
|
||||||
|
import com.bellmann.common.base.IBaseEnum; |
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
public enum OrderLogCodeEnum implements IBaseEnum<String> { |
||||||
|
|
||||||
|
SUCCESS("0","成功"), |
||||||
|
|
||||||
|
THE_DEVICE_IS_NOT_ONLINE("1","设备不在线"), |
||||||
|
|
||||||
|
THE_DEVICE_VERSION_IS_NOT_SUPPORTED("2","设备版本不支持"), |
||||||
|
|
||||||
|
ERROR_IS_ISSUED_UNDER_THE_BUSINESS_PARAMETERS("3","业务参数下发出错"), |
||||||
|
|
||||||
|
FAILED_TO_CREATE_A_CUSTOMER("4","创建客户失败"), |
||||||
|
|
||||||
|
CUSTOM_INFO_AND_DEVICE_BINDING_FAILED("5","客户信息与设备绑定失败"), |
||||||
|
|
||||||
|
UPDATE_DEVICE_INFO_FAILED("6","更新设备信息出错"), |
||||||
|
|
||||||
|
FAILED_TO_LOG_OUT_THE_DEVICE("7","注销设备失败"), |
||||||
|
|
||||||
|
FAILED_TO_LOG_OUT_OF_THE_CUSTOMER("8","注销客户失败"), |
||||||
|
FAILED_TO_UPDATE_CUSTOMER_INFORMATION("9","更新客户信息失败"), |
||||||
|
OTHER_ERRORS("10","其他错误"), |
||||||
|
; |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String value; |
||||||
|
|
||||||
|
@Getter |
||||||
|
private String label; |
||||||
|
|
||||||
|
OrderLogCodeEnum(String value, String label){ |
||||||
|
this.label = label; |
||||||
|
this.value = value; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
package com.bellmann.controller; |
||||||
|
|
||||||
|
|
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.common.result.PageResult; |
||||||
|
import com.bellmann.model.vo.OrderLogVO; |
||||||
|
import com.bellmann.service.OrderLogService; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-06-21 |
||||||
|
*/ |
||||||
|
@Tag(name = "22.工单日志") |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/api/order-log/v1") |
||||||
|
public class OrderLogController { |
||||||
|
private final OrderLogService orderLogService; |
||||||
|
|
||||||
|
@PostMapping("page/{orderId}") |
||||||
|
@Operation(summary = "工单日志分页") |
||||||
|
public PageResult<OrderLogVO> page(@RequestBody BasePageQuery query, @PathVariable Long orderId){ |
||||||
|
return orderLogService.page(query,orderId); |
||||||
|
} |
||||||
|
} |
||||||
|
|
@ -0,0 +1,27 @@ |
|||||||
|
package com.bellmann.converter; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.model.entity.OrderLog; |
||||||
|
import com.bellmann.model.vo.OrderLogVO; |
||||||
|
import org.mapstruct.Mapper; |
||||||
|
import org.mapstruct.Mapping; |
||||||
|
import org.mapstruct.Mappings; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户对象转换器 |
||||||
|
* |
||||||
|
* |
||||||
|
* @since 2022/6/8 |
||||||
|
*/ |
||||||
|
@Mapper(componentModel = "spring") |
||||||
|
public interface OrderLogConverter { |
||||||
|
|
||||||
|
@Mappings({ |
||||||
|
@Mapping(target = "logCode", expression = "java(com.bellmann.common.base.IBaseEnum.getLabelByValue(entity.getLogCode(), com.bellmann.common.enums.OrderLogCodeEnum.class))"), |
||||||
|
}) |
||||||
|
OrderLogVO entity2PageVo(OrderLog entity); |
||||||
|
|
||||||
|
Page<OrderLogVO> entity2PageVo(Page<OrderLog> entity); |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package com.bellmann.mapper; |
||||||
|
|
||||||
|
import com.bellmann.model.entity.OrderLog; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-06-21 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface OrderLogMapper extends BaseMapper<OrderLog> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
package com.bellmann.model.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-06-21 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@TableName("itms_order_log") |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
public class OrderLog implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
private Long orderId; |
||||||
|
|
||||||
|
private Date logTime; |
||||||
|
|
||||||
|
private String logCode; |
||||||
|
|
||||||
|
private String logContent; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
package com.bellmann.model.query; |
||||||
|
|
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
@Schema(description ="devOuiSno分页查询对象") |
||||||
|
@Data |
||||||
|
public class DevOuiSnoQuery extends BasePageQuery { |
||||||
|
|
||||||
|
@Schema(description="关键字(部门名称)") |
||||||
|
private String devOuiSno; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
package com.bellmann.model.vo; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-06-21 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@Schema(description = "工单日志视图") |
||||||
|
public class OrderLogVO { |
||||||
|
|
||||||
|
private Long orderId; |
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") |
||||||
|
private Date logTime; |
||||||
|
|
||||||
|
private String logCode; |
||||||
|
|
||||||
|
private String logContent; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package com.bellmann.service; |
||||||
|
|
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.common.result.PageResult; |
||||||
|
import com.bellmann.model.vo.OrderLogVO; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-06-21 |
||||||
|
*/ |
||||||
|
public interface OrderLogService { |
||||||
|
|
||||||
|
PageResult<OrderLogVO> page(BasePageQuery query, Long orderId); |
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
package com.bellmann.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.common.base.BasePageQuery; |
||||||
|
import com.bellmann.common.result.PageResult; |
||||||
|
import com.bellmann.converter.OrderLogConverter; |
||||||
|
import com.bellmann.mapper.OrderLogMapper; |
||||||
|
import com.bellmann.model.entity.OrderLog; |
||||||
|
import com.bellmann.model.vo.OrderLogVO; |
||||||
|
import com.bellmann.service.OrderLogService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-06-21 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class OrderLogServiceImpl implements OrderLogService { |
||||||
|
|
||||||
|
private final OrderLogMapper orderLogMapper; |
||||||
|
|
||||||
|
private final OrderLogConverter orderLogConverter; |
||||||
|
@Override |
||||||
|
public PageResult<OrderLogVO> page(BasePageQuery query, Long orderId) { |
||||||
|
int pageNum = query.getPageNum(); |
||||||
|
int pageSize = query.getPageSize(); |
||||||
|
Page<OrderLog> page = new Page<>(pageNum,pageSize); |
||||||
|
Page<OrderLog> logPage = orderLogMapper.selectPage(page, new LambdaQueryWrapper<OrderLog>() |
||||||
|
.eq(OrderLog::getOrderId, orderId) |
||||||
|
.orderByDesc(OrderLog::getLogTime) |
||||||
|
); |
||||||
|
return PageResult.success(orderLogConverter.entity2PageVo(logPage)); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
<?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.bellmann.mapper.OrderLogMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="BaseResultMap" type="com.bellmann.model.entity.OrderLog"> |
||||||
|
<id column="order_id" property="orderId" /> |
||||||
|
<result column="log_time" property="logTime" /> |
||||||
|
<result column="log_code" property="logCode" /> |
||||||
|
<result column="log_content" property="logContent" /> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<!-- 通用查询结果列 --> |
||||||
|
<sql id="Base_Column_List"> |
||||||
|
order_id, log_time, log_code, log_content |
||||||
|
</sql> |
||||||
|
|
||||||
|
</mapper> |
Loading…
Reference in new issue