From c8a1cbcf156d84696421c501561abe40a894d5cc Mon Sep 17 00:00:00 2001 From: chenpeng Date: Thu, 13 Feb 2025 17:04:50 +0800 Subject: [PATCH] Kg Entity init --- .../controller/kg/KgEntityController.java | 91 +++++++++ .../platform/domain/kg/KgEntityInfo.java | 78 ++++++++ .../mapper/kg/KgEntityInfoMapper.java | 24 +++ .../platform/service/KgEntityInfoService.java | 24 +++ .../service/impl/KgEntityInfoServiceImpl.java | 49 +++++ .../managementPlatform/KgEntityInfoMapper.xml | 188 ++++++++++++++++++ 6 files changed, 454 insertions(+) create mode 100644 ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/kg/KgEntityController.java create mode 100644 ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/kg/KgEntityInfo.java create mode 100644 ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/kg/KgEntityInfoMapper.java create mode 100644 ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/KgEntityInfoService.java create mode 100644 ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/KgEntityInfoServiceImpl.java create mode 100644 ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/KgEntityInfoMapper.xml diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/kg/KgEntityController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/kg/KgEntityController.java new file mode 100644 index 00000000..d3fc302c --- /dev/null +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/kg/KgEntityController.java @@ -0,0 +1,91 @@ +package com.ruoyi.platform.controller.kg; + +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.page.TableDataInfo; +import com.ruoyi.platform.domain.kg.KgEntityInfo; +import com.ruoyi.platform.service.KgEntityInfoService; +import com.ruoyi.system.api.domain.SysDictData; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@RestController +@RequestMapping("/kg/entity") +public class KgEntityController extends BaseController { + + @Autowired + private KgEntityInfoService kgEntityInfoService; + + /** + * 新增主体 + * + * @param entityInfo + * @return + */ + @PostMapping() + public R createEntity(@Validated @RequestBody KgEntityInfo entityInfo) { + kgEntityInfoService.insertEntity(entityInfo); + return R.ok(); + } + + /** + * 修改主体 + * + * @param entityInfo + * @return + */ + @PutMapping + public R updateEntity(@Validated @RequestBody KgEntityInfo entityInfo) { + kgEntityInfoService.updateEntity(entityInfo); + return R.ok(); + } + + /** + * 主体列表 + * @return + */ + @GetMapping("/list") + public TableDataInfo getEntities(@RequestBody KgEntityInfo entityInfo) { + startPage(); + List ontologies = kgEntityInfoService.getEntities(entityInfo); + return getDataTable(ontologies); + } + + /** + * 主体详情 + * @param id + * @return + */ + @GetMapping("/{id}") + public R getEntity(@PathVariable Long id) { + return R.ok(kgEntityInfoService.getEntity(id)); + } + + /** + * 删除主体 + * @param id + * @return + */ + @DeleteMapping("/{id}") + public R deleteEntityById(@PathVariable Long id) { + kgEntityInfoService.deleteEntityById(id); + return R.ok(); + } + + /** + * 主体导出 + * @param response + * @param id + */ + @GetMapping("/export/{id}") + public void export(HttpServletResponse response,@PathVariable Long id) { + KgEntityInfo Entity = kgEntityInfoService.getEntity(id); + ExcelUtil util = new ExcelUtil(SysDictData.class); + util.exportExcel(response, null, "主体数据"); + } +} diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/kg/KgEntityInfo.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/kg/KgEntityInfo.java new file mode 100644 index 00000000..9abe5e6f --- /dev/null +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/kg/KgEntityInfo.java @@ -0,0 +1,78 @@ +package com.ruoyi.platform.domain.kg; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * kg_entity_info + */ +@Data +public class KgEntityInfo implements Serializable { + /** + * 实体主键 + */ + private Integer id; + + /** + * 实体名称 + */ + private String name; + + /** + * 实体描述 + */ + private String description; + + /** + * 背景色 + */ + private String bkColor; + + /** + * 横坐标 + */ + private Integer displayX; + + /** + * 纵坐标 + */ + private Integer displayY; + + /** + * 图标路径 + */ + private String icon; + + /** + * 主体主键 + */ + private Integer ontologyId; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 删除标志,0表示未删除,1表示已删除 + */ + private String delFlag; + + /** + * 创建人 + */ + private String createBy; + + /** + * 更新人 + */ + private String updateBy; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/kg/KgEntityInfoMapper.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/kg/KgEntityInfoMapper.java new file mode 100644 index 00000000..0f69a8b6 --- /dev/null +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/kg/KgEntityInfoMapper.java @@ -0,0 +1,24 @@ +package com.ruoyi.platform.mapper.kg; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ruoyi.platform.domain.kg.KgEntityInfo; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface KgEntityInfoMapper extends BaseMapper { + int deleteByPrimaryKey(Long id); + + int insert(KgEntityInfo record); + + int insertSelective(KgEntityInfo record); + + KgEntityInfo selectByPrimaryKey(Long id); + + int updateByPrimaryKeySelective(KgEntityInfo record); + + int updateByPrimaryKey(KgEntityInfo record); + + List selectList(KgEntityInfo entityInfo); +} \ No newline at end of file diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/KgEntityInfoService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/KgEntityInfoService.java new file mode 100644 index 00000000..191981fe --- /dev/null +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/KgEntityInfoService.java @@ -0,0 +1,24 @@ +package com.ruoyi.platform.service; + + +import com.ruoyi.platform.domain.kg.KgEntityInfo; + +import java.util.List; + +/** +* @author Administrator +* @description 针对表【kg_entity_info】的数据库操作Service +* @createDate 2025-02-13 15:58:02 +*/ +public interface KgEntityInfoService { + + void insertEntity(KgEntityInfo entityInfo); + + void updateEntity(KgEntityInfo entityInfo); + + List getEntities(KgEntityInfo entityInfo); + + KgEntityInfo getEntity(Long id); + + void deleteEntityById(Long id); +} diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/KgEntityInfoServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/KgEntityInfoServiceImpl.java new file mode 100644 index 00000000..266c97d6 --- /dev/null +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/KgEntityInfoServiceImpl.java @@ -0,0 +1,49 @@ +package com.ruoyi.platform.service.impl; + +import com.ruoyi.platform.domain.kg.KgEntityInfo; +import com.ruoyi.platform.mapper.kg.KgEntityInfoMapper; +import com.ruoyi.platform.service.KgEntityInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +* @author Administrator +* @description 针对表【kg_entity_info】的数据库操作Service实现 +* @createDate 2025-02-13 15:58:02 +*/ +@Service +public class KgEntityInfoServiceImpl implements KgEntityInfoService{ + @Autowired + private KgEntityInfoMapper kgEntityInfoMapper; + + @Override + public void insertEntity(KgEntityInfo entityInfo) { + kgEntityInfoMapper.insertSelective(entityInfo); + } + + @Override + public void updateEntity(KgEntityInfo entityInfo) { + kgEntityInfoMapper.updateByPrimaryKey(entityInfo); + } + + @Override + public List getEntities(KgEntityInfo entityInfo) { + return kgEntityInfoMapper.selectList(entityInfo); + } + + @Override + public KgEntityInfo getEntity(Long id) { + return kgEntityInfoMapper.selectByPrimaryKey(id); + } + + @Override + public void deleteEntityById(Long id) { + kgEntityInfoMapper.deleteByPrimaryKey(id); + } +} + + + + diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/KgEntityInfoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/KgEntityInfoMapper.xml new file mode 100644 index 00000000..123ea071 --- /dev/null +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/KgEntityInfoMapper.xml @@ -0,0 +1,188 @@ + + + + + + + + + + + + + + + + + + + + id, `name`, description, bk_color, display_x, display_y, icon, ontology_id, create_time, + update_time, del_flag, create_by, update_by + + + + delete from kg_entity_info + where id = #{id,jdbcType=INTEGER} + + + insert into kg_entity_info (`name`, description, bk_color, + display_x, display_y, icon, + ontology_id, create_time, update_time, + del_flag, create_by, update_by + ) + values (#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{bkColor,jdbcType=VARCHAR}, + #{displayX,jdbcType=INTEGER}, #{displayY,jdbcType=INTEGER}, #{icon,jdbcType=VARCHAR}, + #{ontologyId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, + #{delFlag,jdbcType=CHAR}, #{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR} + ) + + + insert into kg_entity_info + + + `name`, + + + description, + + + bk_color, + + + display_x, + + + display_y, + + + icon, + + + ontology_id, + + + create_time, + + + update_time, + + + del_flag, + + + create_by, + + + update_by, + + + + + #{name,jdbcType=VARCHAR}, + + + #{description,jdbcType=VARCHAR}, + + + #{bkColor,jdbcType=VARCHAR}, + + + #{displayX,jdbcType=INTEGER}, + + + #{displayY,jdbcType=INTEGER}, + + + #{icon,jdbcType=VARCHAR}, + + + #{ontologyId,jdbcType=INTEGER}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{delFlag,jdbcType=CHAR}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{updateBy,jdbcType=VARCHAR}, + + + + + update kg_entity_info + + + `name` = #{name,jdbcType=VARCHAR}, + + + description = #{description,jdbcType=VARCHAR}, + + + bk_color = #{bkColor,jdbcType=VARCHAR}, + + + display_x = #{displayX,jdbcType=INTEGER}, + + + display_y = #{displayY,jdbcType=INTEGER}, + + + icon = #{icon,jdbcType=VARCHAR}, + + + ontology_id = #{ontologyId,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + del_flag = #{delFlag,jdbcType=CHAR}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + update_by = #{updateBy,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update kg_entity_info + set `name` = #{name,jdbcType=VARCHAR}, + description = #{description,jdbcType=VARCHAR}, + bk_color = #{bkColor,jdbcType=VARCHAR}, + display_x = #{displayX,jdbcType=INTEGER}, + display_y = #{displayY,jdbcType=INTEGER}, + icon = #{icon,jdbcType=VARCHAR}, + ontology_id = #{ontologyId,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + del_flag = #{delFlag,jdbcType=CHAR}, + create_by = #{createBy,jdbcType=VARCHAR}, + update_by = #{updateBy,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + + \ No newline at end of file