Browse Source

Kg OntologyInfo init

dev-cp
chenpeng 1 year ago
parent
commit
2d9db72efe
6 changed files with 416 additions and 0 deletions
  1. +91
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/kg/KgOntologyInfoController.java
  2. +67
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/kg/KgOntologyInfo.java
  3. +32
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/kg/KgOntologyInfoMapper.java
  4. +24
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/KgOntologyInfoService.java
  5. +49
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/KgOntologyInfoServiceImpl.java
  6. +153
    -0
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/KgOntologyInfoMapper.xml

+ 91
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/kg/KgOntologyInfoController.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.KgOntologyInfo;
import com.ruoyi.platform.service.KgOntologyInfoService;
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("/kgOntology")
public class KgOntologyInfoController extends BaseController {

@Autowired
private KgOntologyInfoService kgOntologyInfoService;

/**
* 新增主体
*
* @param ontology
* @return
*/
@PostMapping()
public R<String> createOntology(@Validated @RequestBody KgOntologyInfo ontology) {
kgOntologyInfoService.insertOntology(ontology);
return R.ok();
}

/**
* 修改主体
*
* @param ontology
* @return
*/
@PutMapping
public R<String> updateOntology(@Validated @RequestBody KgOntologyInfo ontology) {
kgOntologyInfoService.updateOntology(ontology);
return R.ok();
}

/**
* 主体列表
* @return
*/
@GetMapping("/list")
public TableDataInfo getOntologies(@RequestBody KgOntologyInfo ontology) {
startPage();
List<KgOntologyInfo> ontologies = kgOntologyInfoService.getOntologies(ontology);
return getDataTable(ontologies);
}

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

/**
* 删除主体
* @param id
* @return
*/
@DeleteMapping("/{id}")
public R<String> deleteontologyById(@PathVariable Long id) {
kgOntologyInfoService.deleteOntologyById(id);
return R.ok();
}

/**
* 主体导出
* @param response
* @param id
*/
@GetMapping("/export/{id}")
public void export(HttpServletResponse response,@PathVariable Long id) {
KgOntologyInfo ontology = kgOntologyInfoService.getOntology(id);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
util.exportExcel(response, null, "主体数据");
}
}

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

@@ -0,0 +1,67 @@
package com.ruoyi.platform.domain.kg;

import java.io.Serializable;
import java.util.Date;
import lombok.Data;

import javax.validation.constraints.NotNull;

/**
* kg_ontology_info
*/
@Data
public class KgOntologyInfo implements Serializable {
/**
* 主体主键
*/
private Integer id;

/**
* 主体名称
*/
@NotNull(message = "主体名称不能为空")
private String name;

/**
* 主体描述
*/
@NotNull(message = "主体描述不能为空")
private String description;

/**
* 概念个数
*/
private Integer conceptsCount;

/**
* 关系个数
*/
private Integer relationsCount;

/**
* 创建时间
*/
private Date createTime;

/**
* 更新时间
*/
private Date updateTime;

/**
* 创建人
*/
private String createBy;

/**
* 更新人
*/
private String updateBy;

/**
* 删除标志,0表示未删除,1表示已删除
*/
private Boolean delFlag;

private static final long serialVersionUID = 1L;
}

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

@@ -0,0 +1,32 @@
package com.ruoyi.platform.mapper.kg;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.platform.domain.kg.KgOntologyInfo;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
* @author Administrator
* @description 针对表【kg_ontology_info】的数据库操作Mapper
* @createDate 2025-02-13 14:40:46
* @Entity ontology.domain.KgOntologyInfo
*/
@Mapper
public interface KgOntologyInfoMapper extends BaseMapper<KgOntologyInfo> {

KgOntologyInfo selectByPrimaryKey(Long id);

void updateByPrimaryKeySelective(KgOntologyInfo kgOntologyInfo);

void insertSelective(KgOntologyInfo kgOntologyInfo);

void deleteByPrimaryKey(Long id);
List<KgOntologyInfo> selectList(KgOntologyInfo ontology);


}





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

@@ -0,0 +1,24 @@
package com.ruoyi.platform.service;


import com.ruoyi.platform.domain.kg.KgOntologyInfo;

import java.util.List;

/**
* @author Administrator
* @description 针对表【kg_ontology_info】的数据库操作Service
* @createDate 2025-02-13 14:40:46
*/
public interface KgOntologyInfoService {

void insertOntology(KgOntologyInfo ontology);

void updateOntology(KgOntologyInfo ontology);

List<KgOntologyInfo> getOntologies(KgOntologyInfo ontology);

KgOntologyInfo getOntology(Long id);

void deleteOntologyById(Long id);
}

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

@@ -0,0 +1,49 @@
package com.ruoyi.platform.service.impl;

import com.ruoyi.platform.domain.kg.KgOntologyInfo;
import com.ruoyi.platform.mapper.kg.KgOntologyInfoMapper;
import com.ruoyi.platform.service.KgOntologyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【kg_ontology_info】的数据库操作Service实现
* @createDate 2025-02-13 14:40:46
*/
@Service
public class KgOntologyInfoServiceImpl implements KgOntologyInfoService {
@Autowired
private KgOntologyInfoMapper kgOntologyInfoMapper;

@Override
public void insertOntology(KgOntologyInfo ontology) {
kgOntologyInfoMapper.insert(ontology);
}

@Override
public void updateOntology(KgOntologyInfo ontology) {
kgOntologyInfoMapper.updateById(ontology);
}

@Override
public List<KgOntologyInfo> getOntologies(KgOntologyInfo ontology) {
return kgOntologyInfoMapper.selectList(ontology);
}

@Override
public KgOntologyInfo getOntology(Long id) {
return kgOntologyInfoMapper.selectById(id);
}

@Override
public void deleteOntologyById(Long id) {
kgOntologyInfoMapper.deleteById(id);
}
}





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

@@ -0,0 +1,153 @@
<?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.KgOntologyInfoMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.platform.domain.kg.KgOntologyInfo">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="concepts_count" jdbcType="INTEGER" property="conceptsCount" />
<result column="relations_count" jdbcType="INTEGER" property="relationsCount" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
<result column="del_flag" jdbcType="BOOLEAN" property="delFlag" />
</resultMap>
<sql id="Base_Column_List">
id, `name`, description, concepts_count, relations_count, create_time, update_time,
create_by, update_by, del_flag
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from kg_ontology_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from kg_ontology_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.platform.domain.kg.KgOntologyInfo" useGeneratedKeys="true">
insert into kg_ontology_info (`name`, description, concepts_count,
relations_count, create_time, update_time,
create_by, update_by, del_flag
)
values (#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{conceptsCount,jdbcType=INTEGER},
#{relationsCount,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR}, #{delFlag,jdbcType=BOOLEAN}
)
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.platform.domain.kg.KgOntologyInfo" useGeneratedKeys="true">
insert into kg_ontology_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">
`name`,
</if>
<if test="description != null">
description,
</if>
<if test="conceptsCount != null">
concepts_count,
</if>
<if test="relationsCount != null">
relations_count,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="delFlag != null">
del_flag,
</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="conceptsCount != null">
#{conceptsCount,jdbcType=INTEGER},
</if>
<if test="relationsCount != null">
#{relationsCount,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=BOOLEAN},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.platform.domain.kg.KgOntologyInfo">
update kg_ontology_info
<set>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="conceptsCount != null">
concepts_count = #{conceptsCount,jdbcType=INTEGER},
</if>
<if test="relationsCount != null">
relations_count = #{relationsCount,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="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=BOOLEAN},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.ruoyi.platform.domain.kg.KgOntologyInfo">
update kg_ontology_info
set `name` = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
concepts_count = #{conceptsCount,jdbcType=INTEGER},
relations_count = #{relationsCount,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
create_by = #{createBy,jdbcType=VARCHAR},
update_by = #{updateBy,jdbcType=VARCHAR},
del_flag = #{delFlag,jdbcType=BOOLEAN}
where id = #{id,jdbcType=INTEGER}
</update>

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

Loading…
Cancel
Save