mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-10 08:57:19 +08:00
chore(extension/crud): crane4j 2.3.1 => 2.4.0
This commit is contained in:
@@ -69,7 +69,7 @@
|
|||||||
<nashorn.version>15.4</nashorn.version>
|
<nashorn.version>15.4</nashorn.version>
|
||||||
<x-file-storage.version>2.0.0</x-file-storage.version>
|
<x-file-storage.version>2.0.0</x-file-storage.version>
|
||||||
<aws-s3.version>1.12.626</aws-s3.version>
|
<aws-s3.version>1.12.626</aws-s3.version>
|
||||||
<crane4j.version>2.3.1</crane4j.version>
|
<crane4j.version>2.4.0</crane4j.version>
|
||||||
<knife4j.version>4.4.0</knife4j.version>
|
<knife4j.version>4.4.0</knife4j.version>
|
||||||
<ttl.version>2.14.4</ttl.version>
|
<ttl.version>2.14.4</ttl.version>
|
||||||
<ip2region.version>3.1.6</ip2region.version>
|
<ip2region.version>3.1.6</ip2region.version>
|
||||||
|
@@ -21,7 +21,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.format.support.FormattingConversionService;
|
import org.springframework.format.support.FormattingConversionService;
|
||||||
import org.springframework.web.accept.ContentNegotiationManager;
|
import org.springframework.web.accept.ContentNegotiationManager;
|
||||||
@@ -38,7 +37,6 @@ import top.charles7c.continew.starter.extension.crud.handler.CrudRequestMappingH
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@Import({UserNicknameContainer.class})
|
|
||||||
public class CrudAutoConfiguration extends DelegatingWebMvcConfiguration {
|
public class CrudAutoConfiguration extends DelegatingWebMvcConfiguration {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,52 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
|
||||||
* <p>
|
|
||||||
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* <p>
|
|
||||||
* http://www.gnu.org/licenses/lgpl.html
|
|
||||||
* <p>
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package top.charles7c.continew.starter.extension.crud.autoconfigure;
|
|
||||||
|
|
||||||
import cn.crane4j.core.container.Container;
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import top.charles7c.continew.starter.extension.crud.base.CommonUserService;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户昵称容器
|
|
||||||
*
|
|
||||||
* @author Charles7c
|
|
||||||
* @since 1.2.0
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class UserNicknameContainer implements Container<Long> {
|
|
||||||
|
|
||||||
private final CommonUserService userService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getNamespace() {
|
|
||||||
return "userNickname";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<Long, String> get(Collection<Long> ids) {
|
|
||||||
Long id = CollUtil.getFirst(ids);
|
|
||||||
String name = userService.getNicknameById(id);
|
|
||||||
return Collections.singletonMap(id, name);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import top.charles7c.continew.starter.extension.crud.constant.ContainerConstants;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -44,7 +45,7 @@ public class BaseDetailResp extends BaseResp {
|
|||||||
* 修改人
|
* 修改人
|
||||||
*/
|
*/
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@Assemble(container = "userNickname", props = @Mapping(ref = "updateUserString"))
|
@Assemble(container = ContainerConstants.USER_NICKNAME, props = @Mapping(ref = "updateUserString"))
|
||||||
private Long updateUser;
|
private Long updateUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import top.charles7c.continew.starter.extension.crud.constant.ContainerConstants;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -49,7 +50,7 @@ public class BaseResp implements Serializable {
|
|||||||
* 创建人
|
* 创建人
|
||||||
*/
|
*/
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@Assemble(container = "userNickname", props = @Mapping(ref = "createUserString"))
|
@Assemble(container = ContainerConstants.USER_NICKNAME, props = @Mapping(ref = "createUserString"))
|
||||||
private Long createUser;
|
private Long createUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -16,6 +16,10 @@
|
|||||||
|
|
||||||
package top.charles7c.continew.starter.extension.crud.base;
|
package top.charles7c.continew.starter.extension.crud.base;
|
||||||
|
|
||||||
|
import cn.crane4j.annotation.ContainerMethod;
|
||||||
|
import cn.crane4j.annotation.MappingType;
|
||||||
|
import top.charles7c.continew.starter.extension.crud.constant.ContainerConstants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 公共用户业务接口
|
* 公共用户业务接口
|
||||||
*
|
*
|
||||||
@@ -30,5 +34,6 @@ public interface CommonUserService {
|
|||||||
* @param id ID
|
* @param id ID
|
||||||
* @return 昵称
|
* @return 昵称
|
||||||
*/
|
*/
|
||||||
|
@ContainerMethod(namespace = ContainerConstants.USER_NICKNAME, type = MappingType.NONE)
|
||||||
String getNicknameById(Long id);
|
String getNicknameById(Long id);
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
|
||||||
|
* <p>
|
||||||
|
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* <p>
|
||||||
|
* http://www.gnu.org/licenses/lgpl.html
|
||||||
|
* <p>
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package top.charles7c.continew.starter.extension.crud.constant;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源容器相关常量(Crane4j 数据填充组件使用)
|
||||||
|
*
|
||||||
|
* @author Charles7c
|
||||||
|
* @since 1.2.0
|
||||||
|
*/
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public class ContainerConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户昵称
|
||||||
|
*/
|
||||||
|
public static final String USER_NICKNAME = "UserNickname";
|
||||||
|
}
|
Reference in New Issue
Block a user