| @@ -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.KgEntityProperties; | |||||
| import com.ruoyi.platform.service.KgEntityPropertiesService; | |||||
| 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/entityProperties") | |||||
| public class KgEntityPropertiesController extends BaseController { | |||||
| @Autowired | |||||
| private KgEntityPropertiesService kgEntityPropertiesService; | |||||
| /** | |||||
| * 新增主体 | |||||
| * | |||||
| * @param entityProperties | |||||
| * @return | |||||
| */ | |||||
| @PostMapping() | |||||
| public R<String> createEntityProperty(@Validated @RequestBody KgEntityProperties entityProperties) { | |||||
| kgEntityPropertiesService.insertEntityProperties(entityProperties); | |||||
| return R.ok(); | |||||
| } | |||||
| /** | |||||
| * 修改主体 | |||||
| * | |||||
| * @param KgEntityProperties | |||||
| * @return | |||||
| */ | |||||
| @PutMapping | |||||
| public R<String> updateEntityProperty(@Validated @RequestBody KgEntityProperties KgEntityProperties) { | |||||
| kgEntityPropertiesService.updateEntityProperties(KgEntityProperties); | |||||
| return R.ok(); | |||||
| } | |||||
| /** | |||||
| * 主体列表 | |||||
| * @return | |||||
| */ | |||||
| @GetMapping("/list") | |||||
| public TableDataInfo getEntityProperties(@RequestBody KgEntityProperties KgEntityProperties) { | |||||
| startPage(); | |||||
| List<KgEntityProperties> ontologies = kgEntityPropertiesService.getEntityProperties(KgEntityProperties); | |||||
| return getDataTable(ontologies); | |||||
| } | |||||
| /** | |||||
| * 主体详情 | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| @GetMapping("/{id}") | |||||
| public R<KgEntityProperties> getEntityProperty(@PathVariable Long id) { | |||||
| return R.ok(kgEntityPropertiesService.getEntityProperty(id)); | |||||
| } | |||||
| /** | |||||
| * 删除主体 | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| @DeleteMapping("/{id}") | |||||
| public R<String> deleteEntityPropertyById(@PathVariable Long id) { | |||||
| kgEntityPropertiesService.deleteEntityPropertyById(id); | |||||
| return R.ok(); | |||||
| } | |||||
| /** | |||||
| * 主体导出 | |||||
| * @param response | |||||
| * @param id | |||||
| */ | |||||
| @GetMapping("/export/{id}") | |||||
| public void export(HttpServletResponse response,@PathVariable Long id) { | |||||
| KgEntityProperties EntityProperty = kgEntityPropertiesService.getEntityProperty(id); | |||||
| ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class); | |||||
| util.exportExcel(response, null, "主体数据"); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,63 @@ | |||||
| package com.ruoyi.platform.domain.kg; | |||||
| import java.io.Serializable; | |||||
| import java.util.Date; | |||||
| import lombok.Data; | |||||
| /** | |||||
| * kg_entity_properties | |||||
| */ | |||||
| @Data | |||||
| public class KgEntityProperties implements Serializable { | |||||
| /** | |||||
| * 属性主键 | |||||
| */ | |||||
| private Integer id; | |||||
| /** | |||||
| * 属性名 | |||||
| */ | |||||
| private String name; | |||||
| /** | |||||
| * 属性类型(String/Integer等) | |||||
| */ | |||||
| private String type; | |||||
| /** | |||||
| * 关联实体信息 | |||||
| */ | |||||
| private Integer entityId; | |||||
| /** | |||||
| * '是否多值(0否/1是) | |||||
| */ | |||||
| private Boolean isMultivalued; | |||||
| /** | |||||
| * 创建时间 | |||||
| */ | |||||
| private Date createTime; | |||||
| /** | |||||
| * 更新时间 | |||||
| */ | |||||
| private Date updateTime; | |||||
| /** | |||||
| * 删除标志,0表示未删除,1表示已删除 | |||||
| */ | |||||
| private String delFlag; | |||||
| /** | |||||
| * 创建人 | |||||
| */ | |||||
| private String createBy; | |||||
| /** | |||||
| * 更新人 | |||||
| */ | |||||
| private String updateBy; | |||||
| private static final long serialVersionUID = 1L; | |||||
| } | |||||
| @@ -0,0 +1,24 @@ | |||||
| package com.ruoyi.platform.mapper.kg; | |||||
| import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
| import com.ruoyi.platform.domain.kg.KgEntityProperties; | |||||
| import org.apache.ibatis.annotations.Mapper; | |||||
| import java.util.List; | |||||
| @Mapper | |||||
| public interface KgEntityPropertiesMapper extends BaseMapper<KgEntityProperties> { | |||||
| int deleteByPrimaryKey(Long id); | |||||
| int insert(KgEntityProperties record); | |||||
| int insertSelective(KgEntityProperties record); | |||||
| KgEntityProperties selectByPrimaryKey(Long id); | |||||
| int updateByPrimaryKeySelective(KgEntityProperties record); | |||||
| int updateByPrimaryKey(KgEntityProperties record); | |||||
| List<KgEntityProperties> selectList(KgEntityProperties record); | |||||
| } | |||||
| @@ -0,0 +1,24 @@ | |||||
| package com.ruoyi.platform.service; | |||||
| import com.ruoyi.platform.domain.kg.KgEntityProperties; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author Administrator | |||||
| * @description 针对表【kg_entity_properties】的数据库操作Service | |||||
| * @createDate 2025-02-13 15:58:38 | |||||
| */ | |||||
| public interface KgEntityPropertiesService { | |||||
| void insertEntityProperties(KgEntityProperties entityProperty); | |||||
| void updateEntityProperties(KgEntityProperties entityProperty); | |||||
| List<KgEntityProperties> getEntityProperties(KgEntityProperties entityProperty); | |||||
| KgEntityProperties getEntityProperty(Long id); | |||||
| void deleteEntityPropertyById(Long id); | |||||
| } | |||||
| @@ -0,0 +1,49 @@ | |||||
| package com.ruoyi.platform.service.impl; | |||||
| import com.ruoyi.platform.domain.kg.KgEntityProperties; | |||||
| import com.ruoyi.platform.mapper.kg.KgEntityPropertiesMapper; | |||||
| import com.ruoyi.platform.service.KgEntityPropertiesService; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.List; | |||||
| /** | |||||
| * @author Administrator | |||||
| * @description 针对表【kg_entity_properties】的数据库操作Service实现 | |||||
| * @createDate 2025-02-13 15:58:38 | |||||
| */ | |||||
| @Service | |||||
| public class KgEntityPropertiesServiceImpl implements KgEntityPropertiesService{ | |||||
| @Autowired | |||||
| private KgEntityPropertiesMapper kgEntityPropertiesMapper; | |||||
| @Override | |||||
| public void insertEntityProperties(KgEntityProperties entityProperty) { | |||||
| kgEntityPropertiesMapper.insertSelective(entityProperty); | |||||
| } | |||||
| @Override | |||||
| public void updateEntityProperties(KgEntityProperties entityProperty) { | |||||
| kgEntityPropertiesMapper.updateByPrimaryKey(entityProperty); | |||||
| } | |||||
| @Override | |||||
| public List<KgEntityProperties> getEntityProperties(KgEntityProperties entityProperty) { | |||||
| return kgEntityPropertiesMapper.selectList(entityProperty); | |||||
| } | |||||
| @Override | |||||
| public KgEntityProperties getEntityProperty(Long id) { | |||||
| return kgEntityPropertiesMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public void deleteEntityPropertyById(Long id) { | |||||
| kgEntityPropertiesMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| } | |||||
| @@ -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.KgEntityPropertiesMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.ruoyi.platform.domain.kg.KgEntityProperties"> | |||||
| <id column="id" jdbcType="INTEGER" property="id" /> | |||||
| <result column="name" jdbcType="VARCHAR" property="name" /> | |||||
| <result column="type" jdbcType="VARCHAR" property="type" /> | |||||
| <result column="entity_id" jdbcType="INTEGER" property="entityId" /> | |||||
| <result column="is_multivalued" jdbcType="BOOLEAN" property="isMultivalued" /> | |||||
| <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`, `type`, entity_id, is_multivalued, 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_properties | |||||
| where id = #{id,jdbcType=INTEGER} | |||||
| </select> | |||||
| <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | |||||
| delete from kg_entity_properties | |||||
| where id = #{id,jdbcType=INTEGER} | |||||
| </delete> | |||||
| <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ruoyi.platform.domain.kg.KgEntityProperties" useGeneratedKeys="true"> | |||||
| insert into kg_entity_properties (`name`, `type`, entity_id, | |||||
| is_multivalued, create_time, update_time, | |||||
| del_flag, create_by, update_by | |||||
| ) | |||||
| values (#{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{entityId,jdbcType=INTEGER}, | |||||
| #{isMultivalued,jdbcType=BOOLEAN}, #{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.KgEntityProperties" useGeneratedKeys="true"> | |||||
| insert into kg_entity_properties | |||||
| <trim prefix="(" suffix=")" suffixOverrides=","> | |||||
| <if test="name != null"> | |||||
| `name`, | |||||
| </if> | |||||
| <if test="type != null"> | |||||
| `type`, | |||||
| </if> | |||||
| <if test="entityId != null"> | |||||
| entity_id, | |||||
| </if> | |||||
| <if test="isMultivalued != null"> | |||||
| is_multivalued, | |||||
| </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="type != null"> | |||||
| #{type,jdbcType=VARCHAR}, | |||||
| </if> | |||||
| <if test="entityId != null"> | |||||
| #{entityId,jdbcType=INTEGER}, | |||||
| </if> | |||||
| <if test="isMultivalued != null"> | |||||
| #{isMultivalued,jdbcType=BOOLEAN}, | |||||
| </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.KgEntityProperties"> | |||||
| update kg_entity_properties | |||||
| <set> | |||||
| <if test="name != null"> | |||||
| `name` = #{name,jdbcType=VARCHAR}, | |||||
| </if> | |||||
| <if test="type != null"> | |||||
| `type` = #{type,jdbcType=VARCHAR}, | |||||
| </if> | |||||
| <if test="entityId != null"> | |||||
| entity_id = #{entityId,jdbcType=INTEGER}, | |||||
| </if> | |||||
| <if test="isMultivalued != null"> | |||||
| is_multivalued = #{isMultivalued,jdbcType=BOOLEAN}, | |||||
| </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.KgEntityProperties"> | |||||
| update kg_entity_properties | |||||
| set `name` = #{name,jdbcType=VARCHAR}, | |||||
| `type` = #{type,jdbcType=VARCHAR}, | |||||
| entity_id = #{entityId,jdbcType=INTEGER}, | |||||
| is_multivalued = #{isMultivalued,jdbcType=BOOLEAN}, | |||||
| 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_properties | |||||
| </select> | |||||
| </mapper> | |||||