Browse Source

Kg Entity init

dev-cp
chenpeng 1 year ago
parent
commit
c8a1cbcf15
6 changed files with 454 additions and 0 deletions
  1. +91
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/kg/KgEntityController.java
  2. +78
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/kg/KgEntityInfo.java
  3. +24
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/kg/KgEntityInfoMapper.java
  4. +24
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/KgEntityInfoService.java
  5. +49
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/KgEntityInfoServiceImpl.java
  6. +188
    -0
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/KgEntityInfoMapper.xml

+ 91
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/kg/KgEntityController.java View File

@@ -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<String> createEntity(@Validated @RequestBody KgEntityInfo entityInfo) {
kgEntityInfoService.insertEntity(entityInfo);
return R.ok();
}

/**
* 修改主体
*
* @param entityInfo
* @return
*/
@PutMapping
public R<String> updateEntity(@Validated @RequestBody KgEntityInfo entityInfo) {
kgEntityInfoService.updateEntity(entityInfo);
return R.ok();
}

/**
* 主体列表
* @return
*/
@GetMapping("/list")
public TableDataInfo getEntities(@RequestBody KgEntityInfo entityInfo) {
startPage();
List<KgEntityInfo> ontologies = kgEntityInfoService.getEntities(entityInfo);
return getDataTable(ontologies);
}

/**
* 主体详情
* @param id
* @return
*/
@GetMapping("/{id}")
public R<KgEntityInfo> getEntity(@PathVariable Long id) {
return R.ok(kgEntityInfoService.getEntity(id));
}

/**
* 删除主体
* @param id
* @return
*/
@DeleteMapping("/{id}")
public R<String> 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<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
util.exportExcel(response, null, "主体数据");
}
}

+ 78
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/kg/KgEntityInfo.java View File

@@ -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;
}

+ 24
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/kg/KgEntityInfoMapper.java View File

@@ -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<KgEntityInfo> {
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<KgEntityInfo> selectList(KgEntityInfo entityInfo);
}

+ 24
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/KgEntityInfoService.java View File

@@ -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<KgEntityInfo> getEntities(KgEntityInfo entityInfo);

KgEntityInfo getEntity(Long id);

void deleteEntityById(Long id);
}

+ 49
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/KgEntityInfoServiceImpl.java View File

@@ -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<KgEntityInfo> 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);
}
}





+ 188
- 0
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/KgEntityInfoMapper.xml View File

@@ -0,0 +1,188 @@
<?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.ruoyi.platform.mapper.kg.KgEntityInfoMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.platform.domain.kg.KgEntityInfo">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="bk_color" jdbcType="VARCHAR" property="bkColor" />
<result column="display_x" jdbcType="INTEGER" property="displayX" />
<result column="display_y" jdbcType="INTEGER" property="displayY" />
<result column="icon" jdbcType="VARCHAR" property="icon" />
<result column="ontology_id" jdbcType="INTEGER" property="ontologyId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="del_flag" jdbcType="CHAR" property="delFlag" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
</resultMap>
<sql id="Base_Column_List">
id, `name`, description, bk_color, display_x, display_y, icon, ontology_id, create_time,
update_time, del_flag, create_by, update_by
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from kg_entity_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from kg_entity_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.platform.domain.kg.KgEntityInfo" useGeneratedKeys="true">
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>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.platform.domain.kg.KgEntityInfo" useGeneratedKeys="true">
insert into kg_entity_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">
`name`,
</if>
<if test="description != null">
description,
</if>
<if test="bkColor != null">
bk_color,
</if>
<if test="displayX != null">
display_x,
</if>
<if test="displayY != null">
display_y,
</if>
<if test="icon != null">
icon,
</if>
<if test="ontologyId != null">
ontology_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="delFlag != null">
del_flag,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="updateBy != null">
update_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="bkColor != null">
#{bkColor,jdbcType=VARCHAR},
</if>
<if test="displayX != null">
#{displayX,jdbcType=INTEGER},
</if>
<if test="displayY != null">
#{displayY,jdbcType=INTEGER},
</if>
<if test="icon != null">
#{icon,jdbcType=VARCHAR},
</if>
<if test="ontologyId != null">
#{ontologyId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=CHAR},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.platform.domain.kg.KgEntityInfo">
update kg_entity_info
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="bkColor != null">
bk_color = #{bkColor,jdbcType=VARCHAR},
</if>
<if test="displayX != null">
display_x = #{displayX,jdbcType=INTEGER},
</if>
<if test="displayY != null">
display_y = #{displayY,jdbcType=INTEGER},
</if>
<if test="icon != null">
icon = #{icon,jdbcType=VARCHAR},
</if>
<if test="ontologyId != null">
ontology_id = #{ontologyId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=CHAR},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.ruoyi.platform.domain.kg.KgEntityInfo">
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}
</update>

<select id="selectList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from kg_entity_info
</select>
</mapper>

Loading…
Cancel
Save