feat: 网元开关查询修改

This commit is contained in:
caiyuchao
2025-07-03 20:15:44 +08:00
parent 588cfcd162
commit 24f25c0cfd
5 changed files with 61 additions and 30 deletions

View File

@@ -1,11 +1,14 @@
package org.agt.module.license.controller.admin.license.vo; package org.agt.module.license.controller.admin.license.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.agt.framework.common.pojo.PageParam; import org.agt.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
import static org.agt.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static org.agt.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@@ -29,7 +32,7 @@ public class LicensePageReqVO extends PageParam {
private LocalDateTime[] expirationTime; private LocalDateTime[] expirationTime;
@Schema(description = "网元开关") @Schema(description = "网元开关")
private String neSwitch; private List<Integer> neSwitch;
@Schema(description = "用户数") @Schema(description = "用户数")
private Integer userNum; private Integer userNum;

View File

@@ -1,27 +1,45 @@
package org.agt.module.license.controller.admin.license.vo; package org.agt.module.license.controller.admin.license.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.VO;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.Data;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import org.agt.framework.excel.core.annotations.DictFormat; import org.agt.framework.excel.core.annotations.DictFormat;
import org.agt.framework.excel.core.convert.DictConvert; import org.agt.framework.excel.core.convert.DictConvert;
import org.agt.module.license.dal.dataobject.customer.CustomerDO;
import org.agt.module.license.dal.dataobject.project.ProjectDO;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - License Response VO") @Schema(description = "管理后台 - License Response VO")
@Data @Data
@ExcelIgnoreUnannotated @ExcelIgnoreUnannotated
public class LicenseRespVO { public class LicenseRespVO implements VO {
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25585")
@ExcelProperty("主键")
private Long id;
@Schema(description = "客户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31667") @Schema(description = "客户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31667")
@ExcelProperty("客户ID") @Trans(type = TransType.SIMPLE, target = CustomerDO.class, fields = "name", ref = "customerName")
private Long customerId; private Long customerId;
@Schema(description = "客户")
@ExcelProperty("客户")
private String customerName;
@Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2496") @Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2496")
@ExcelProperty("项目ID") @Trans(type = TransType.SIMPLE, target = ProjectDO.class, fields = "name", ref = "projectName")
private Long projectId; private Long projectId;
@Schema(description = "项目")
@ExcelProperty("项目")
private String projectName;
@Schema(description = "sn", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "sn", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("sn") @ExcelProperty("sn")
private String sn; private String sn;
@@ -33,7 +51,7 @@ public class LicenseRespVO {
@Schema(description = "网元开关") @Schema(description = "网元开关")
@ExcelProperty(value = "网元开关", converter = DictConvert.class) @ExcelProperty(value = "网元开关", converter = DictConvert.class)
@DictFormat("lic_ne_switch") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 @DictFormat("lic_ne_switch") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private String neSwitch; private List<Integer> neSwitch;
@Schema(description = "用户数") @Schema(description = "用户数")
@ExcelProperty("用户数") @ExcelProperty("用户数")

View File

@@ -1,11 +1,12 @@
package org.agt.module.license.controller.admin.license.vo; package org.agt.module.license.controller.admin.license.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import jakarta.validation.constraints.NotEmpty;
import java.util.*; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.*; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - License新增/修改 Request VO") @Schema(description = "管理后台 - License新增/修改 Request VO")
@Data @Data
@@ -30,7 +31,7 @@ public class LicenseSaveReqVO {
private LocalDateTime expirationTime; private LocalDateTime expirationTime;
@Schema(description = "网元开关") @Schema(description = "网元开关")
private String neSwitch; private List<Integer> neSwitch;
@Schema(description = "用户数") @Schema(description = "用户数")
private Integer userNum; private Integer userNum;

View File

@@ -1,19 +1,27 @@
package org.agt.module.license.dal.dataobject.license; package org.agt.module.license.dal.dataobject.license;
import lombok.*; import com.baomidou.mybatisplus.annotation.KeySequence;
import java.util.*; import com.baomidou.mybatisplus.annotation.TableField;
import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.baomidou.mybatisplus.annotation.*; import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.agt.framework.mybatis.core.dataobject.BaseDO; import org.agt.framework.mybatis.core.dataobject.BaseDO;
import java.time.LocalDateTime;
import java.util.List;
/** /**
* License DO * License DO
* *
* @author 管理员 * @author 管理员
*/ */
@TableName("lic_license") @TableName(value = "lic_license", autoResultMap = true)
@KeySequence("lic_license_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 @KeySequence("lic_license_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@@ -49,7 +57,8 @@ public class LicenseDO extends BaseDO {
* *
* 枚举 {@link TODO lic_ne_switch 对应的类} * 枚举 {@link TODO lic_ne_switch 对应的类}
*/ */
private String neSwitch; @TableField(typeHandler = JacksonTypeHandler.class)
private List<Integer> neSwitch;
/** /**
* 用户数 * 用户数
*/ */

View File

@@ -1,13 +1,12 @@
package org.agt.module.license.dal.mysql.license; package org.agt.module.license.dal.mysql.license;
import java.util.*; import cn.hutool.core.collection.CollUtil;
import org.agt.framework.common.pojo.PageResult; import org.agt.framework.common.pojo.PageResult;
import org.agt.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.agt.framework.mybatis.core.mapper.BaseMapperX; import org.agt.framework.mybatis.core.mapper.BaseMapperX;
import org.agt.framework.mybatis.core.query.LambdaQueryWrapperX;
import org.agt.module.license.controller.admin.license.vo.LicensePageReqVO;
import org.agt.module.license.dal.dataobject.license.LicenseDO; import org.agt.module.license.dal.dataobject.license.LicenseDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.agt.module.license.controller.admin.license.vo.*;
/** /**
* License Mapper * License Mapper
@@ -23,7 +22,6 @@ public interface LicenseMapper extends BaseMapperX<LicenseDO> {
.eqIfPresent(LicenseDO::getProjectId, reqVO.getProjectId()) .eqIfPresent(LicenseDO::getProjectId, reqVO.getProjectId())
.likeIfPresent(LicenseDO::getSn, reqVO.getSn()) .likeIfPresent(LicenseDO::getSn, reqVO.getSn())
.betweenIfPresent(LicenseDO::getExpirationTime, reqVO.getExpirationTime()) .betweenIfPresent(LicenseDO::getExpirationTime, reqVO.getExpirationTime())
.eqIfPresent(LicenseDO::getNeSwitch, reqVO.getNeSwitch())
.eqIfPresent(LicenseDO::getUserNum, reqVO.getUserNum()) .eqIfPresent(LicenseDO::getUserNum, reqVO.getUserNum())
.eqIfPresent(LicenseDO::getBaseStationNum, reqVO.getBaseStationNum()) .eqIfPresent(LicenseDO::getBaseStationNum, reqVO.getBaseStationNum())
.eqIfPresent(LicenseDO::getActivationCode, reqVO.getActivationCode()) .eqIfPresent(LicenseDO::getActivationCode, reqVO.getActivationCode())
@@ -33,6 +31,8 @@ public interface LicenseMapper extends BaseMapperX<LicenseDO> {
.eqIfPresent(LicenseDO::getStatus, reqVO.getStatus()) .eqIfPresent(LicenseDO::getStatus, reqVO.getStatus())
.eqIfPresent(LicenseDO::getRemark, reqVO.getRemark()) .eqIfPresent(LicenseDO::getRemark, reqVO.getRemark())
.betweenIfPresent(LicenseDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(LicenseDO::getCreateTime, reqVO.getCreateTime())
.apply(CollUtil.isNotEmpty(reqVO.getNeSwitch()), "JSON_CONTAINS(ne_switch, {0})",
reqVO.getNeSwitch() != null ? reqVO.getNeSwitch().toString() : "")
.orderByDesc(LicenseDO::getId)); .orderByDesc(LicenseDO::getId));
} }