mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-11-04 10:57:10 +08:00 
			
		
		
		
	feat: 新增查询参数列表接口
This commit is contained in:
		@@ -0,0 +1,28 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * 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.cnadmin.system.mapper;
 | 
			
		||||
 | 
			
		||||
import top.charles7c.cnadmin.common.base.BaseMapper;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.entity.OptionDO;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 系统参数 Mapper
 | 
			
		||||
 *
 | 
			
		||||
 * @author Bull-BCLS
 | 
			
		||||
 * @since 2023/8/26 19:38
 | 
			
		||||
 */
 | 
			
		||||
public interface OptionMapper extends BaseMapper<OptionDO> {}
 | 
			
		||||
@@ -0,0 +1,74 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * 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.cnadmin.system.model.entity;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableId;
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableName;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 系统参数表
 | 
			
		||||
 *
 | 
			
		||||
 * @author Bull-BCLS
 | 
			
		||||
 * @since 2023/8/26 19:20
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@TableName("sys_option")
 | 
			
		||||
public class OptionDO implements Serializable {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数名称
 | 
			
		||||
     */
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数键
 | 
			
		||||
     */
 | 
			
		||||
    @TableId
 | 
			
		||||
    private String code;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数值
 | 
			
		||||
     */
 | 
			
		||||
    private String value;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数默认值
 | 
			
		||||
     */
 | 
			
		||||
    private String defaultValue;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 描述
 | 
			
		||||
     */
 | 
			
		||||
    private String description;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 修改人
 | 
			
		||||
     */
 | 
			
		||||
    private Long updateUser;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 修改时间
 | 
			
		||||
     */
 | 
			
		||||
    private LocalDateTime updateTime;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,50 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * 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.cnadmin.system.model.query;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import javax.validation.constraints.NotEmpty;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
 | 
			
		||||
import top.charles7c.cnadmin.common.annotation.Query;
 | 
			
		||||
import top.charles7c.cnadmin.common.enums.QueryTypeEnum;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 系统参数查询条件
 | 
			
		||||
 *
 | 
			
		||||
 * @author Bull-BCLS
 | 
			
		||||
 * @since 2023/8/26 19:38
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@Schema(description = "系统参数查询条件")
 | 
			
		||||
public class OptionQuery implements Serializable {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数键列表
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "参数键列表", example = "site_title,site_copyright")
 | 
			
		||||
    @NotEmpty(message = "参数键不能为空")
 | 
			
		||||
    @Query(type = QueryTypeEnum.IN)
 | 
			
		||||
    private List<String> code;
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,74 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * 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.cnadmin.system.model.vo;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonIgnore;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.util.StrUtil;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 系统参数信息
 | 
			
		||||
 *
 | 
			
		||||
 * @author Bull-BCLS
 | 
			
		||||
 * @since 2023/8/26 19:38
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@Schema(description = "系统参数信息")
 | 
			
		||||
public class OptionVO implements Serializable {
 | 
			
		||||
 | 
			
		||||
    private static final long serialVersionUID = 1L;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数名称
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "参数名称", example = "系统标题")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数键
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "参数键", example = "site_title")
 | 
			
		||||
    private String code;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数值
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "参数值", example = "ContiNew Admin")
 | 
			
		||||
    private String value;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 参数默认值
 | 
			
		||||
     */
 | 
			
		||||
    @JsonIgnore
 | 
			
		||||
    private String defaultValue;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 描述
 | 
			
		||||
     */
 | 
			
		||||
    @Schema(description = "描述", example = "用于显示登录页面的系统标题。")
 | 
			
		||||
    private String description;
 | 
			
		||||
 | 
			
		||||
    public String getValue() {
 | 
			
		||||
        return StrUtil.nullToDefault(value, defaultValue);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,40 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * 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.cnadmin.system.service;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import top.charles7c.cnadmin.system.model.query.OptionQuery;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.vo.OptionVO;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 系统参数业务接口
 | 
			
		||||
 *
 | 
			
		||||
 * @author Bull-BCLS
 | 
			
		||||
 * @since 2023/8/26 19:38
 | 
			
		||||
 */
 | 
			
		||||
public interface OptionService {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询列表
 | 
			
		||||
     *
 | 
			
		||||
     * @param query
 | 
			
		||||
     *            查询条件
 | 
			
		||||
     * @return 列表信息
 | 
			
		||||
     */
 | 
			
		||||
    List<OptionVO> list(OptionQuery query);
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,49 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
 * You may obtain a copy of the License at
 | 
			
		||||
 *
 | 
			
		||||
 *     http://www.apache.org/licenses/LICENSE-2.0
 | 
			
		||||
 *
 | 
			
		||||
 * 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.cnadmin.system.service.impl;
 | 
			
		||||
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.bean.BeanUtil;
 | 
			
		||||
 | 
			
		||||
import top.charles7c.cnadmin.common.util.helper.QueryHelper;
 | 
			
		||||
import top.charles7c.cnadmin.system.mapper.OptionMapper;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.query.OptionQuery;
 | 
			
		||||
import top.charles7c.cnadmin.system.model.vo.OptionVO;
 | 
			
		||||
import top.charles7c.cnadmin.system.service.OptionService;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 系统参数业务实现
 | 
			
		||||
 *
 | 
			
		||||
 * @author Bull-BCLS
 | 
			
		||||
 * @since 2023/8/26 19:38
 | 
			
		||||
 */
 | 
			
		||||
@Service
 | 
			
		||||
@RequiredArgsConstructor
 | 
			
		||||
public class OptionServiceImpl implements OptionService {
 | 
			
		||||
 | 
			
		||||
    private final OptionMapper baseMapper;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public List<OptionVO> list(OptionQuery query) {
 | 
			
		||||
        return BeanUtil.copyToList(baseMapper.selectList(QueryHelper.build(query)), OptionVO.class);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user