未验证 提交 3c07e571 编写于 作者: 查尔斯-BUG万象集's avatar 查尔斯-BUG万象集 提交者: GitHub

Merge pull request #17 from Bull-BCLS/dev

feat: 新增查询参数列表接口
/*
* 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> {}
\ No newline at end of file
/*
* 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;
}
/*
* 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;
}
\ No newline at end of file
/*
* 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);
}
}
\ No newline at end of file
/*
* 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);
}
\ No newline at end of file
/*
* 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);
}
}
\ No newline at end of file
import axios from 'axios';
import qs from 'query-string';
const BASE_URL = '/api/system/option';
const BASE_URL = '/system/option';
export interface BasicConfigRecord {
site_title?: string;
......
/*
* 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.webapi.controller.system;
import java.util.List;
import lombok.RequiredArgsConstructor;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.charles7c.cnadmin.common.model.vo.R;
import top.charles7c.cnadmin.system.model.query.OptionQuery;
import top.charles7c.cnadmin.system.model.vo.OptionVO;
import top.charles7c.cnadmin.system.service.OptionService;
/**
* 系统参数管理 API
*
* @author Bull-BCLS
* @since 2023/8/26 19:38
*/
@Tag(name = "系统参数管理 API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/system/option")
public class OptionController {
private final OptionService optionService;
@Operation(summary = "查询系统参数列表", description = "查询系统参数列表")
@GetMapping
public R<List<OptionVO>> list(@Validated OptionQuery query) {
return R.ok(optionService.list(query));
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册