feat:增加枚举配置
This commit is contained in:
@@ -1,12 +1,15 @@
|
|||||||
package com.tiesheng.core.controller.config;
|
package com.tiesheng.core.controller.config;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
|
import com.tiesheng.core.pojos.dao.CoreConfigEnum;
|
||||||
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
||||||
import com.tiesheng.core.pojos.dto.PageDTO;
|
import com.tiesheng.core.pojos.dto.PageDTO;
|
||||||
import com.tiesheng.core.pojos.dto.config.ConfigSystemDTO;
|
import com.tiesheng.core.pojos.dto.config.ConfigSystemDTO;
|
||||||
|
import com.tiesheng.core.pojos.dto.config.EnumTypeDTO;
|
||||||
import com.tiesheng.core.service.CoreConfigService;
|
import com.tiesheng.core.service.CoreConfigService;
|
||||||
import com.tiesheng.util.exception.ApiException;
|
import com.tiesheng.util.exception.ApiException;
|
||||||
import com.tiesheng.util.pojos.ApiResp;
|
import com.tiesheng.util.pojos.ApiResp;
|
||||||
@@ -67,4 +70,25 @@ public class ConfigController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取枚举列表
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/enum/list")
|
||||||
|
@TokenIgnore
|
||||||
|
public ApiResp<List<CoreConfigEnum>> enumList(EnumTypeDTO dto) {
|
||||||
|
|
||||||
|
QueryWrapper<CoreConfigEnum> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("is_deleted", 0);
|
||||||
|
if (!StrUtil.isEmpty(dto.getType())) {
|
||||||
|
queryWrapper.eq("type", dto.getType());
|
||||||
|
}
|
||||||
|
List<CoreConfigEnum> selectList = coreConfigService.getEnumMapper().selectList(queryWrapper);
|
||||||
|
|
||||||
|
return ApiResp.respOK(selectList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.tiesheng.core.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.tiesheng.core.pojos.dao.CoreConfigEnum;
|
||||||
|
|
||||||
|
public interface CoreConfigEnumMapper extends BaseMapper<CoreConfigEnum> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package com.tiesheng.core.pojos.dao;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.tiesheng.core.pojos.DaoBase;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置-枚举
|
||||||
|
*/
|
||||||
|
@TableName(value = "core_config_enum")
|
||||||
|
public class CoreConfigEnum extends DaoBase {
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
@TableField(value = "`type`")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
@TableField(value = "`name`")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@TableField(value = "remark")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展字段
|
||||||
|
*/
|
||||||
|
@TableField(value = "ext")
|
||||||
|
private String ext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取类型
|
||||||
|
*
|
||||||
|
* @return type - 类型
|
||||||
|
*/
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置类型
|
||||||
|
*
|
||||||
|
* @param type 类型
|
||||||
|
*/
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取名称
|
||||||
|
*
|
||||||
|
* @return name - 名称
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置名称
|
||||||
|
*
|
||||||
|
* @param name 名称
|
||||||
|
*/
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取备注
|
||||||
|
*
|
||||||
|
* @return remark - 备注
|
||||||
|
*/
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置备注
|
||||||
|
*
|
||||||
|
* @param remark 备注
|
||||||
|
*/
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取扩展字段
|
||||||
|
*
|
||||||
|
* @return ext - 扩展字段
|
||||||
|
*/
|
||||||
|
public String getExt() {
|
||||||
|
return ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置扩展字段
|
||||||
|
*
|
||||||
|
* @param ext 扩展字段
|
||||||
|
*/
|
||||||
|
public void setExt(String ext) {
|
||||||
|
this.ext = ext;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.tiesheng.core.pojos.dto.config;
|
||||||
|
|
||||||
|
public class EnumTypeDTO {
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.tiesheng.core.service;
|
package com.tiesheng.core.service;
|
||||||
|
|
||||||
|
import com.tiesheng.core.mapper.CoreConfigEnumMapper;
|
||||||
import com.tiesheng.core.mapper.CoreConfigSystemMapper;
|
import com.tiesheng.core.mapper.CoreConfigSystemMapper;
|
||||||
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10,5 +12,10 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class CoreConfigService extends TsServiceBase<CoreConfigSystemMapper, CoreConfigSystem> {
|
public class CoreConfigService extends TsServiceBase<CoreConfigSystemMapper, CoreConfigSystem> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CoreConfigEnumMapper coreConfigEnumMapper;
|
||||||
|
|
||||||
|
public CoreConfigEnumMapper getEnumMapper() {
|
||||||
|
return coreConfigEnumMapper;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
SET NAMES utf8mb4;
|
SET NAMES utf8mb4;
|
||||||
SET FOREIGN_KEY_CHECKS = 0;
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for core_log_operation
|
CREATE TABLE `core_config_enum`
|
||||||
-- ----------------------------
|
(
|
||||||
|
`id` varchar(50) NOT NULL,
|
||||||
|
`create_time` datetime NOT NULL,
|
||||||
|
`update_time` datetime NOT NULL,
|
||||||
|
`is_deleted` int(6) NOT NULL DEFAULT '0',
|
||||||
|
`type` varchar(50) DEFAULT NULL COMMENT '类型',
|
||||||
|
`name` varchar(255) DEFAULT NULL COMMENT '名称',
|
||||||
|
`remark` varchar(500) DEFAULT NULL COMMENT '备注',
|
||||||
|
`ext` varchar(255) DEFAULT NULL COMMENT '扩展字段',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='配置-枚举';
|
||||||
|
|
||||||
CREATE TABLE `core_log_operation`
|
CREATE TABLE `core_log_operation`
|
||||||
(
|
(
|
||||||
`id` varchar(50) NOT NULL,
|
`id` varchar(50) NOT NULL,
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.tiesheng.core.mapper.CoreConfigEnumMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.tiesheng.core.pojos.dao.CoreConfigEnum">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
<!--@Table core_config_enum-->
|
||||||
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
|
||||||
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||||
|
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||||
|
<result column="ext" jdbcType="VARCHAR" property="ext" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
<!--@mbg.generated-->
|
||||||
|
id, create_time, update_time, is_deleted, `type`, `name`, remark, ext
|
||||||
|
</sql>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user