feat: 登录授权接口
This commit is contained in:
@ -55,6 +55,9 @@
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@ -0,0 +1,95 @@
|
||||
package day.gitlab.dolphin.core.controller;
|
||||
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import day.gitlab.dolphin.core.entity.Dictionary;
|
||||
import day.gitlab.dolphin.core.service.DictionaryService;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典 控制层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dictionary")
|
||||
public class DictionaryController {
|
||||
|
||||
@Autowired
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
/**
|
||||
* 保存字典。
|
||||
*
|
||||
* @param dictionary 字典
|
||||
* @return {@code true} 保存成功,{@code false} 保存失败
|
||||
*/
|
||||
@PostMapping("save")
|
||||
public boolean save(@RequestBody Dictionary dictionary) {
|
||||
return dictionaryService.save(dictionary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键删除字典。
|
||||
*
|
||||
* @param id 主键
|
||||
* @return {@code true} 删除成功,{@code false} 删除失败
|
||||
*/
|
||||
@DeleteMapping("remove/{id}")
|
||||
public boolean remove(@PathVariable String id) {
|
||||
return dictionaryService.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键更新字典。
|
||||
*
|
||||
* @param dictionary 字典
|
||||
* @return {@code true} 更新成功,{@code false} 更新失败
|
||||
*/
|
||||
@PutMapping("update")
|
||||
public boolean update(@RequestBody Dictionary dictionary) {
|
||||
return dictionaryService.updateById(dictionary);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有字典。
|
||||
*
|
||||
* @return 所有数据
|
||||
*/
|
||||
@GetMapping("list")
|
||||
public List<Dictionary> list() {
|
||||
return dictionaryService.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键获取字典。
|
||||
*
|
||||
* @param id 字典主键
|
||||
* @return 字典详情
|
||||
*/
|
||||
@GetMapping("getInfo/{id}")
|
||||
public Dictionary getInfo(@PathVariable String id) {
|
||||
return dictionaryService.getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询字典。
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @return 分页对象
|
||||
*/
|
||||
@GetMapping("page")
|
||||
public Page<Dictionary> page(Page<Dictionary> page) {
|
||||
return dictionaryService.page(page);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package day.gitlab.dolphin.core.controller;
|
||||
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import day.gitlab.dolphin.core.entity.DictionaryItem;
|
||||
import day.gitlab.dolphin.core.service.DictionaryItemService;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典项 控制层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dictionaryItem")
|
||||
public class DictionaryItemController {
|
||||
|
||||
@Autowired
|
||||
private DictionaryItemService dictionaryItemService;
|
||||
|
||||
/**
|
||||
* 保存字典项。
|
||||
*
|
||||
* @param dictionaryItem 字典项
|
||||
* @return {@code true} 保存成功,{@code false} 保存失败
|
||||
*/
|
||||
@PostMapping("save")
|
||||
public boolean save(@RequestBody DictionaryItem dictionaryItem) {
|
||||
return dictionaryItemService.save(dictionaryItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键删除字典项。
|
||||
*
|
||||
* @param id 主键
|
||||
* @return {@code true} 删除成功,{@code false} 删除失败
|
||||
*/
|
||||
@DeleteMapping("remove/{id}")
|
||||
public boolean remove(@PathVariable String id) {
|
||||
return dictionaryItemService.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键更新字典项。
|
||||
*
|
||||
* @param dictionaryItem 字典项
|
||||
* @return {@code true} 更新成功,{@code false} 更新失败
|
||||
*/
|
||||
@PutMapping("update")
|
||||
public boolean update(@RequestBody DictionaryItem dictionaryItem) {
|
||||
return dictionaryItemService.updateById(dictionaryItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有字典项。
|
||||
*
|
||||
* @return 所有数据
|
||||
*/
|
||||
@GetMapping("list")
|
||||
public List<DictionaryItem> list() {
|
||||
return dictionaryItemService.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键获取字典项。
|
||||
*
|
||||
* @param id 字典项主键
|
||||
* @return 字典项详情
|
||||
*/
|
||||
@GetMapping("getInfo/{id}")
|
||||
public DictionaryItem getInfo(@PathVariable String id) {
|
||||
return dictionaryItemService.getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询字典项。
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @return 分页对象
|
||||
*/
|
||||
@GetMapping("page")
|
||||
public Page<DictionaryItem> page(Page<DictionaryItem> page) {
|
||||
return dictionaryItemService.page(page);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package day.gitlab.dolphin.core.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 字典 实体类。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@Table("sys_core_dictionary")
|
||||
public class Dictionary implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 字典代码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 字典类型: enum-枚举、tree-树型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 字典描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Timestamp createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Timestamp updateTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package day.gitlab.dolphin.core.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 字典项 实体类。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@Table("sys_core_dictionary_item")
|
||||
public class DictionaryItem implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 字典ID
|
||||
*/
|
||||
private String dictionaryId;
|
||||
|
||||
/**
|
||||
* 父级ID,如果为空则为根节点
|
||||
*/
|
||||
private String parentId;
|
||||
|
||||
/**
|
||||
* 字典项名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 字典项代码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 字典项排序,升序排列
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 字典项描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Timestamp createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Timestamp updateTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
package day.gitlab.dolphin.core.entity.table;
|
||||
|
||||
import com.mybatisflex.core.query.QueryColumn;
|
||||
import com.mybatisflex.core.table.TableDef;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 字典项 表定义层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public class DictionaryItemTableDef extends TableDef {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 字典项
|
||||
*/
|
||||
public static final DictionaryItemTableDef DICTIONARY_ITEM = new DictionaryItemTableDef();
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
public final QueryColumn ID = new QueryColumn(this, "id");
|
||||
|
||||
/**
|
||||
* 字典项代码
|
||||
*/
|
||||
public final QueryColumn CODE = new QueryColumn(this, "code");
|
||||
|
||||
/**
|
||||
* 字典项名称
|
||||
*/
|
||||
public final QueryColumn NAME = new QueryColumn(this, "name");
|
||||
|
||||
/**
|
||||
* 字典项排序,升序排列
|
||||
*/
|
||||
public final QueryColumn SORT = new QueryColumn(this, "sort");
|
||||
|
||||
/**
|
||||
* 父级ID,如果为空则为根节点
|
||||
*/
|
||||
public final QueryColumn PARENT_ID = new QueryColumn(this, "parent_id");
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");
|
||||
|
||||
/**
|
||||
* 字典项描述
|
||||
*/
|
||||
public final QueryColumn DESCRIPTION = new QueryColumn(this, "description");
|
||||
|
||||
/**
|
||||
* 字典ID
|
||||
*/
|
||||
public final QueryColumn DICTIONARY_ID = new QueryColumn(this, "dictionary_id");
|
||||
|
||||
/**
|
||||
* 所有字段。
|
||||
*/
|
||||
public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");
|
||||
|
||||
/**
|
||||
* 默认字段,不包含逻辑删除或者 large 等字段。
|
||||
*/
|
||||
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, DICTIONARY_ID, PARENT_ID, NAME, CODE, SORT, DESCRIPTION, CREATE_TIME, UPDATE_TIME};
|
||||
|
||||
public DictionaryItemTableDef() {
|
||||
super("", "sys_core_dictionary_item");
|
||||
}
|
||||
|
||||
private DictionaryItemTableDef(String schema, String name, String alisa) {
|
||||
super(schema, name, alisa);
|
||||
}
|
||||
|
||||
public DictionaryItemTableDef as(String alias) {
|
||||
String key = getNameWithSchema() + "." + alias;
|
||||
return getCache(key, k -> new DictionaryItemTableDef("", "sys_core_dictionary_item", alias));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
package day.gitlab.dolphin.core.entity.table;
|
||||
|
||||
import com.mybatisflex.core.query.QueryColumn;
|
||||
import com.mybatisflex.core.table.TableDef;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 字典 表定义层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public class DictionaryTableDef extends TableDef {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 字典
|
||||
*/
|
||||
public static final DictionaryTableDef DICTIONARY = new DictionaryTableDef();
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
public final QueryColumn ID = new QueryColumn(this, "id");
|
||||
|
||||
/**
|
||||
* 字典代码
|
||||
*/
|
||||
public final QueryColumn CODE = new QueryColumn(this, "code");
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
public final QueryColumn NAME = new QueryColumn(this, "name");
|
||||
|
||||
/**
|
||||
* 字典类型: enum-枚举、tree-树型
|
||||
*/
|
||||
public final QueryColumn TYPE = new QueryColumn(this, "type");
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
public final QueryColumn CREATE_TIME = new QueryColumn(this, "create_time");
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
public final QueryColumn UPDATE_TIME = new QueryColumn(this, "update_time");
|
||||
|
||||
/**
|
||||
* 字典描述
|
||||
*/
|
||||
public final QueryColumn DESCRIPTION = new QueryColumn(this, "description");
|
||||
|
||||
/**
|
||||
* 所有字段。
|
||||
*/
|
||||
public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");
|
||||
|
||||
/**
|
||||
* 默认字段,不包含逻辑删除或者 large 等字段。
|
||||
*/
|
||||
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, NAME, CODE, TYPE, DESCRIPTION, CREATE_TIME, UPDATE_TIME};
|
||||
|
||||
public DictionaryTableDef() {
|
||||
super("", "sys_core_dictionary");
|
||||
}
|
||||
|
||||
private DictionaryTableDef(String schema, String name, String alisa) {
|
||||
super(schema, name, alisa);
|
||||
}
|
||||
|
||||
public DictionaryTableDef as(String alias) {
|
||||
String key = getNameWithSchema() + "." + alias;
|
||||
return getCache(key, k -> new DictionaryTableDef("", "sys_core_dictionary", alias));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package day.gitlab.dolphin.core.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import day.gitlab.dolphin.core.entity.DictionaryItem;
|
||||
|
||||
/**
|
||||
* 字典项 映射层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface DictionaryItemMapper extends BaseMapper<DictionaryItem> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package day.gitlab.dolphin.core.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import day.gitlab.dolphin.core.entity.Dictionary;
|
||||
|
||||
/**
|
||||
* 字典 映射层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Mapper
|
||||
public interface DictionaryMapper extends BaseMapper<Dictionary> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package day.gitlab.dolphin.core.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import day.gitlab.dolphin.core.entity.DictionaryItem;
|
||||
|
||||
/**
|
||||
* 字典项 服务层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public interface DictionaryItemService extends IService<DictionaryItem> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package day.gitlab.dolphin.core.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import day.gitlab.dolphin.core.entity.Dictionary;
|
||||
|
||||
/**
|
||||
* 字典 服务层。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
public interface DictionaryService extends IService<Dictionary> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package day.gitlab.dolphin.core.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import day.gitlab.dolphin.core.entity.DictionaryItem;
|
||||
import day.gitlab.dolphin.core.mapper.DictionaryItemMapper;
|
||||
import day.gitlab.dolphin.core.service.DictionaryItemService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 字典项 服务层实现。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Service
|
||||
public class DictionaryItemServiceImpl extends ServiceImpl<DictionaryItemMapper, DictionaryItem> implements DictionaryItemService{
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package day.gitlab.dolphin.core.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import day.gitlab.dolphin.core.entity.Dictionary;
|
||||
import day.gitlab.dolphin.core.mapper.DictionaryMapper;
|
||||
import day.gitlab.dolphin.core.service.DictionaryService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 字典 服务层实现。
|
||||
*
|
||||
* @author jiangyc
|
||||
* @since 2025-11-28
|
||||
*/
|
||||
@Service
|
||||
public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Dictionary> implements DictionaryService{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user