mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 05:12:07 +08:00
1、标签设计接口入参检查完善;2、部分校验器类包名和类名规范;
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
package com.cf.imes.module.system.enums.label;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 标签模板类型枚举
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/15 10:46
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum LabelTemplateType {
|
||||
/**
|
||||
* 板材包裹
|
||||
*/
|
||||
PLATEPACKAGELABEL("platePackageLabel"),
|
||||
|
||||
/**
|
||||
* 机台标签
|
||||
*/
|
||||
MACHINELABEL("machineLabel"),
|
||||
|
||||
/**
|
||||
* 配件包裹标签
|
||||
*/
|
||||
PARTSPACKAGELABEL("partsPackageLabel"),
|
||||
|
||||
/**
|
||||
* 订单包裹标签
|
||||
*/
|
||||
ORDERPACKAGELABEL("orderPackageLabel");
|
||||
|
||||
private String type;
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.dept.vo.dept;
|
||||
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.dept.vo.dept;
|
||||
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.cf.imes.module.system.controller.admin.dict.vo.data;
|
||||
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
import com.cf.imes.framework.common.validation.InEnum;
|
||||
import com.cf.imes.module.system.validation.system.dict.CssClassValid;
|
||||
import com.cf.imes.module.system.validation.dict.CssClassValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
+2
-46
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.labeltemplate;
|
||||
|
||||
import com.cf.imes.framework.common.util.json.JsonUtils;
|
||||
import com.cf.imes.module.system.validation.label.LabelTemplateTypeValid;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -8,22 +8,13 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
import com.cf.imes.framework.excel.core.util.ExcelUtils;
|
||||
import com.cf.imes.framework.operatelog.core.annotations.OperateLog;
|
||||
import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
import com.cf.imes.module.system.controller.admin.labeltemplate.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelTemplateDO;
|
||||
import com.cf.imes.module.system.service.labeltemplate.LabelTemplateService;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Tag(name = "标签模板管理")
|
||||
@@ -61,24 +52,6 @@ public class LabelTemplateController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得标签模板")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:label-template:query')")
|
||||
@OperateLog(enable = false)
|
||||
public CommonResult<LabelTemplateRespVO> getLabelTemplate(@RequestParam("id") Long id) {
|
||||
return success(labelTemplateService.getLabelTemplate(id));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得标签模板分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:label-template:query')")
|
||||
@OperateLog(enable = false)
|
||||
public CommonResult<PageResult<LabelTemplateRespVO>> getLabelTemplatePage(@Valid LabelTemplatePageReqVO pageReqVO) {
|
||||
PageResult<LabelTemplateDO> pageResult = labelTemplateService.getLabelTemplatePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, LabelTemplateRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/group-list")
|
||||
@Operation(summary = "获得分组标签模板列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:label-template:query')")
|
||||
@@ -92,7 +65,7 @@ public class LabelTemplateController {
|
||||
@Parameter(name = "type", description = "标签类型", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('system:label-template:query','sysTagDesignManager:query')")
|
||||
@OperateLog(enable = false)
|
||||
public CommonResult<LabelTemplateRespVO> getDefaultLabelTemplate(@RequestParam("type") String type) {
|
||||
public CommonResult<LabelTemplateRespVO> getDefaultLabelTemplate(@RequestParam("type") @LabelTemplateTypeValid String type) {
|
||||
return success(labelTemplateService.getDefaultLabelTemplate(type));
|
||||
}
|
||||
|
||||
@@ -102,21 +75,4 @@ public class LabelTemplateController {
|
||||
public CommonResult<Boolean> setDefaultTemplate(@RequestParam Long id) {
|
||||
return success(labelTemplateService.setDefaultTemplate(id));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出标签模板 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('system:label-template:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportLabelTemplateExcel(@Valid LabelTemplatePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<LabelTemplateDO> list = labelTemplateService.getLabelTemplatePage(pageReqVO).getList()
|
||||
.stream().map(m->m.setTemplate(JsonUtils.unzipString(m.getTemplate()))).collect(Collectors.toList());
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "标签模板.xls", "数据", LabelTemplateRespVO.class,
|
||||
BeanUtils.toBean(list, LabelTemplateRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+4
-1
@@ -1,10 +1,11 @@
|
||||
package com.cf.imes.module.system.controller.admin.labeltemplate.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -16,9 +17,11 @@ import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
|
||||
public class LabelTemplatePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "标签类型", example = "2")
|
||||
@Size(max = 50, message = "标签类型长度不能超过50")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "标签名称", example = "王五")
|
||||
@Size(max = 50, message = "标签名称长度不能超过50")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
|
||||
+4
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@Schema(description = "管理后台 - 标签模板新增/修改 Request VO")
|
||||
@Data
|
||||
@@ -14,14 +15,17 @@ public class LabelTemplateSaveReqVO {
|
||||
|
||||
@Schema(description = "标签类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "标签类型不能为空")
|
||||
@Size(max = 50, message = "标签类型长度不能超过50")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "标签名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "标签名称不能为空")
|
||||
@Size(max = 50, message = "标签名称长度不能超过50")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
@Size(max = 255, message = "备注长度不能超过255")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.notice.vo;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.cf.imes.module.system.controller.admin.organ.vo.organ;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.organ.vo.organ;
|
||||
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.organ.vo.packages;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.organ.vo.packages;
|
||||
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.cf.imes.module.system.controller.admin.permission.vo.role;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.permission.vo.role;
|
||||
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.permission.vo.role;
|
||||
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.user.vo.profile;
|
||||
|
||||
import com.cf.imes.module.system.validation.system.user.Sex;
|
||||
import com.cf.imes.module.system.validation.user.SexValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class UserProfileUpdateReqVO {
|
||||
private String email;
|
||||
|
||||
@Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1")
|
||||
@Sex
|
||||
@SexValid
|
||||
private Integer sex;
|
||||
|
||||
private Long organId;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.cf.imes.module.system.controller.admin.user.vo.user;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package com.cf.imes.module.system.controller.admin.user.vo.user;
|
||||
|
||||
import com.cf.imes.framework.common.validation.Mobile;
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.system.user.Sex;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.user.SexValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class UserSaveReqVO {
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "用户性别,参见 SexEnum 枚举类", example = "1")
|
||||
@Sex
|
||||
@SexValid
|
||||
private Integer sex;
|
||||
|
||||
@Schema(description = "用户头像", example = "https://www.cf.com/xxx.png")
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package com.cf.imes.module.system.controller.admin.user.vo.user;
|
||||
|
||||
import com.cf.imes.module.system.validation.system.common.CommonStatus;
|
||||
import com.cf.imes.module.system.validation.common.CommonStatus;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
-18
@@ -2,8 +2,6 @@ package com.cf.imes.module.system.service.labeltemplate;
|
||||
|
||||
import java.util.*;
|
||||
import com.cf.imes.module.system.controller.admin.labeltemplate.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelTemplateDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@@ -36,22 +34,6 @@ public interface LabelTemplateService {
|
||||
*/
|
||||
void deleteLabelTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 获得标签模板
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 标签模板
|
||||
*/
|
||||
LabelTemplateRespVO getLabelTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 获得标签模板分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 标签模板分页
|
||||
*/
|
||||
PageResult<LabelTemplateDO> getLabelTemplatePage(LabelTemplatePageReqVO pageReqVO);
|
||||
|
||||
// ==================== 子表(标签元素模板) ====================
|
||||
|
||||
|
||||
|
||||
-14
@@ -11,7 +11,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import com.cf.imes.module.system.controller.admin.labeltemplate.vo.*;
|
||||
import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelTemplateDO;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.dal.mysql.labeltemplate.LabelTemplateMapper;
|
||||
import javax.annotation.Resource;
|
||||
@@ -74,19 +73,6 @@ public class LabelTemplateServiceImpl implements LabelTemplateService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public LabelTemplateRespVO getLabelTemplate(Long id) {
|
||||
LabelTemplateDO labelTemplateDO = labelTemplateMapper.selectById(id);
|
||||
labelTemplateDO.setTemplate(JsonUtils.unzipString(labelTemplateDO.getTemplate()));
|
||||
LabelTemplateRespVO labelTemplateRespVO = BeanUtils.toBean(labelTemplateDO, LabelTemplateRespVO.class);
|
||||
return labelTemplateRespVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<LabelTemplateDO> getLabelTemplatePage(LabelTemplatePageReqVO pageReqVO) {
|
||||
return labelTemplateMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, List<LabelTemplateRespVO>> getGroupList() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.validation.system.common;
|
||||
package com.cf.imes.module.system.validation.common;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.validation.system.common;
|
||||
package com.cf.imes.module.system.validation.common;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.validation.system.dict;
|
||||
package com.cf.imes.module.system.validation.dict;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.validation.system.dict;
|
||||
package com.cf.imes.module.system.validation.dict;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.cf.imes.module.system.validation.label;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 标签模版类型校验注解
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/15 10:42
|
||||
*/
|
||||
@Target({
|
||||
ElementType.FIELD,
|
||||
ElementType.PARAMETER
|
||||
})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Constraint(
|
||||
validatedBy = {LabelTemplateTypeValidator.class}
|
||||
)
|
||||
public @interface LabelTemplateTypeValid {
|
||||
String message() default "标签模板类型不合法";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.cf.imes.module.system.validation.label;
|
||||
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.module.system.enums.label.LabelTemplateType;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 标签模版类型校验器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/10/15 10:43
|
||||
*/
|
||||
public class LabelTemplateTypeValidator implements ConstraintValidator<LabelTemplateTypeValid, String> {
|
||||
|
||||
@Override
|
||||
public boolean isValid(String value, ConstraintValidatorContext context) {
|
||||
// 非空使用@NotBlank等进行校验
|
||||
if (CharSequenceUtil.isEmpty(value)) {
|
||||
return true;
|
||||
}
|
||||
for (LabelTemplateType type : LabelTemplateType.values()) {
|
||||
if (ObjectUtil.equal(type.getType(), value)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.validation.system.user;
|
||||
package com.cf.imes.module.system.validation.user;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
@@ -22,7 +22,7 @@ import java.lang.annotation.Target;
|
||||
@Constraint(
|
||||
validatedBy = {SexValidator.class}
|
||||
)
|
||||
public @interface Sex {
|
||||
public @interface SexValid {
|
||||
String message() default "性别不合法,1:男、2:女";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.cf.imes.module.system.validation.system.user;
|
||||
package com.cf.imes.module.system.validation.user;
|
||||
|
||||
import com.cf.imes.module.system.enums.common.SexEnum;
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.Objects;
|
||||
* @author Gqr
|
||||
* @since 2024/10/12 9:50
|
||||
*/
|
||||
public class SexValidator implements ConstraintValidator<Sex, Integer> {
|
||||
public class SexValidator implements ConstraintValidator<SexValid, Integer> {
|
||||
|
||||
@Override
|
||||
public boolean isValid(Integer value, ConstraintValidatorContext context) {
|
||||
Reference in New Issue
Block a user