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;
import lombok.*;
import java.util.*;
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.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import java.util.List;
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;
@Schema(description = "网元开关")
private String neSwitch;
private List<Integer> neSwitch;
@Schema(description = "用户数")
private Integer userNum;

View File

@@ -1,27 +1,45 @@
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 lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import lombok.Data;
import org.agt.framework.excel.core.annotations.DictFormat;
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")
@Data
@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")
@ExcelProperty("客户ID")
@Trans(type = TransType.SIMPLE, target = CustomerDO.class, fields = "name", ref = "customerName")
private Long customerId;
@Schema(description = "客户")
@ExcelProperty("客户")
private String customerName;
@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;
@Schema(description = "项目")
@ExcelProperty("项目")
private String projectName;
@Schema(description = "sn", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("sn")
private String sn;
@@ -33,7 +51,7 @@ public class LicenseRespVO {
@Schema(description = "网元开关")
@ExcelProperty(value = "网元开关", converter = DictConvert.class)
@DictFormat("lic_ne_switch") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中
private String neSwitch;
private List<Integer> neSwitch;
@Schema(description = "用户数")
@ExcelProperty("用户数")

View File

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

View File

@@ -1,19 +1,27 @@
package org.agt.module.license.dal.dataobject.license;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
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 java.time.LocalDateTime;
import java.util.List;
/**
* License DO
*
* @author 管理员
*/
@TableName("lic_license")
@TableName(value = "lic_license", autoResultMap = true)
@KeySequence("lic_license_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@@ -49,7 +57,8 @@ public class LicenseDO extends BaseDO {
*
* 枚举 {@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;
import java.util.*;
import cn.hutool.core.collection.CollUtil;
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.query.LambdaQueryWrapperX;
import org.agt.module.license.controller.admin.license.vo.LicensePageReqVO;
import org.agt.module.license.dal.dataobject.license.LicenseDO;
import org.apache.ibatis.annotations.Mapper;
import org.agt.module.license.controller.admin.license.vo.*;
/**
* License Mapper
@@ -23,7 +22,6 @@ public interface LicenseMapper extends BaseMapperX<LicenseDO> {
.eqIfPresent(LicenseDO::getProjectId, reqVO.getProjectId())
.likeIfPresent(LicenseDO::getSn, reqVO.getSn())
.betweenIfPresent(LicenseDO::getExpirationTime, reqVO.getExpirationTime())
.eqIfPresent(LicenseDO::getNeSwitch, reqVO.getNeSwitch())
.eqIfPresent(LicenseDO::getUserNum, reqVO.getUserNum())
.eqIfPresent(LicenseDO::getBaseStationNum, reqVO.getBaseStationNum())
.eqIfPresent(LicenseDO::getActivationCode, reqVO.getActivationCode())
@@ -33,6 +31,8 @@ public interface LicenseMapper extends BaseMapperX<LicenseDO> {
.eqIfPresent(LicenseDO::getStatus, reqVO.getStatus())
.eqIfPresent(LicenseDO::getRemark, reqVO.getRemark())
.betweenIfPresent(LicenseDO::getCreateTime, reqVO.getCreateTime())
.apply(CollUtil.isNotEmpty(reqVO.getNeSwitch()), "JSON_CONTAINS(ne_switch, {0})",
reqVO.getNeSwitch() != null ? reqVO.getNeSwitch().toString() : "")
.orderByDesc(LicenseDO::getId));
}