4 Commity 6484de0af7 ... 7ae9f6bee4

Autor SHA1 Wiadomość Data
  hamjin 7ae9f6bee4 藏品Controller层藏品增改功能实现 2 lat temu
  hamjin a6c5ef2c87 藏品Service层框架 2 lat temu
  hamjin 6d48929253 藏品Bean注释修正 2 lat temu
  hamjin 06977bd685 实现藏品Dao层 2 lat temu

+ 91 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PoCollectionController.java

@@ -0,0 +1,91 @@
+package com.ruoyi.web.controller.system;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.domain.PoCollection;
+import com.ruoyi.system.service.IPoCollectionService;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 藏品 信息操作处理
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/collections")
+public class PoCollectionController extends BaseController {
+    @Autowired
+    private IPoCollectionService collectionService;
+
+    /**
+     * 获取藏品列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(PoCollection collection) {
+        return new TableDataInfo();
+    }
+
+    /**
+     * 获取藏品列表
+     */
+    @GetMapping("/export")
+    public AjaxResult export(PoCollection collection) {
+        return AjaxResult.success();
+    }
+
+    /**
+     * 根据藏品编号获取详细信息
+     */
+    @GetMapping(value = "/{collectionId}")
+    public AjaxResult getInfo(@PathVariable("collectionId") Long collectionId) {
+        return success();
+    }
+
+    /**
+     * 新增藏品
+     */
+    @PreAuthorize("@ss.hasPermi('collection:add')")
+    @Log(title = "藏品", businessType = BusinessType.INSERT)
+    @ApiOperation("添加藏品")
+    @PostMapping
+    public AjaxResult add(@Validated @RequestBody PoCollection collection) {
+        List<PoCollection> collectionList = collectionService.selectCollections(collection);
+        if (collectionList != null && !collectionList.isEmpty())
+            return error("重复的藏品");
+        return toAjax(collectionService.insertCollection(collection));
+    }
+
+    /**
+     * 修改藏品
+     */
+    @PreAuthorize("@ss.hasPermi('collection:edit')")
+    @Log(title = "藏品", businessType = BusinessType.UPDATE)
+    @ApiOperation("编辑藏品")
+    @PutMapping
+    public AjaxResult edit(@Validated @RequestBody PoCollection collection) {
+        PoCollection collection1 = collectionService.selectCollectionById(collection.getCollectionId());
+        if (collection1 == null)
+            return error("要修改的藏品不存在");
+        if (collection1.getCochain() == 0)
+            return error("要修改的藏品已上链");
+        collection.setUpdateBy(getUsername());
+        return toAjax(collectionService.updateCollection(collection));
+    }
+
+    /**
+     * 删除藏品
+     */
+    @DeleteMapping("/{collectionIds}")
+    public AjaxResult remove(@PathVariable Long[] collectionIds) {
+        return AjaxResult.success();
+    }
+}

+ 3 - 3
ruoyi-system/src/main/java/com/ruoyi/system/domain/PoCollection.java

@@ -1,12 +1,12 @@
 package com.ruoyi.system.domain;
 
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
- * 【请填写功能名称】对象 po_collection
+ * 【藏品管理】藏品 po_collection
  *
  * @author ruoyi
  * @date 2023-02-12

+ 62 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/PoCollectionMapper.java

@@ -0,0 +1,62 @@
+package com.ruoyi.system.mapper;
+
+import com.ruoyi.system.domain.PoCollection;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 藏品表 数据层
+ *
+ * @author blue
+ */
+@Mapper
+public interface PoCollectionMapper {
+    /**
+     * 查询藏品信息
+     *
+     * @param collectionId 藏品ID
+     * @return 藏品信息
+     */
+    PoCollection selectPoCollectionById(Long collectionId);
+
+    /**
+     * 查询藏品列表
+     *
+     * @param collections 藏品信息
+     * @return 藏品集合
+     */
+    List<PoCollection> selectPoCollectionList(PoCollection collections);
+
+    /**
+     * 新增藏品
+     *
+     * @param collections 藏品信息
+     * @return 结果
+     */
+    int insertPoCollection(PoCollection collections);
+
+    /**
+     * 修改藏品
+     *
+     * @param collections 藏品信息
+     * @return 结果
+     */
+    int updatePoCollection(PoCollection collections);
+
+    /**
+     * 批量删除藏品
+     *
+     * @param collectionsId 藏品ID
+     * @return 结果
+     */
+    int deletePoCollectionById(Long collectionsId);
+
+    /**
+     * 批量删除藏品信息
+     *
+     * @param collectionsIds 需要删除的藏品ID
+     * @return 结果
+     */
+    int deletePoCollectionByIds(Long[] collectionsIds);
+}

+ 67 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IPoCollectionService.java

@@ -0,0 +1,67 @@
+package com.ruoyi.system.service;
+
+import com.ruoyi.system.domain.PoCollection;
+
+import java.util.List;
+
+/**
+ * 消息接口
+ */
+public interface IPoCollectionService {
+    /**
+     * 根据Id查询
+     *
+     * @param collectionIdList 要查询的藏品ID
+     * @return 藏品ID对应的藏品
+     */
+    public List<PoCollection> selectCollectionByCollectionId(Long[] collectionIdList);
+
+    /**
+     * 增加
+     *
+     * @param collection 藏品信息
+     * @return 操作状态
+     */
+    public int insertCollection(PoCollection collection);
+
+    /**
+     * 修改
+     *
+     * @param collection 更新的藏品信息
+     * @return 操作状态
+     */
+    public int updateCollection(PoCollection collection);
+
+    /**
+     * 批量删除
+     *
+     * @param collectionIds
+     * @return
+     */
+    int deleteCollectionByIds(Long[] collectionIds);
+
+    /**
+     * 删除
+     *
+     * @param collectionId
+     * @return
+     */
+    int deleteCollectionById(Long collectionId);
+
+    /**
+     * 获取符合要求的藏品
+     *
+     * @param collection 搜索的藏品信息
+     * @return 符合要求的藏品,默认为全部藏品
+     */
+    List<PoCollection> selectCollections(PoCollection collection);
+
+    /**
+     * 获取藏品详细内容
+     *
+     * @param collectionId 藏品ID
+     * @return 藏品信息
+     */
+    PoCollection selectCollectionById(Long collectionId);
+}
+

+ 95 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PoCollectionServiceImpl.java

@@ -0,0 +1,95 @@
+package com.ruoyi.system.service.impl;
+
+import com.ruoyi.system.domain.PoCollection;
+import com.ruoyi.system.mapper.PoCollectionMapper;
+import com.ruoyi.system.service.IPoCollectionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class PoCollectionServiceImpl implements IPoCollectionService {
+    @Autowired
+    PoCollectionMapper poCollectionMapper;
+
+    /**
+     * 根据Id查询
+     *
+     * @param collectionIdList 要查询的藏品ID表
+     * @return 藏品ID对应的藏品
+     */
+    @Override
+    public List<PoCollection> selectCollectionByCollectionId(Long[] collectionIdList) {
+        return null;
+    }
+
+    /**
+     * 获取符合要求的藏品
+     *
+     * @param collection 搜索的藏品信息
+     * @return 符合要求的藏品,默认为全部藏品
+     */
+    @Override
+    public List<PoCollection> selectCollections(PoCollection collection) {
+        return null;
+    }
+
+    /**
+     * 获取藏品详细内容
+     *
+     * @param collectionId 藏品ID
+     * @return 藏品信息
+     */
+    @Override
+    public PoCollection selectCollectionById(Long collectionId) {
+        return null;
+    }
+
+    /**
+     * 增加
+     *
+     * @param collection 藏品信息
+     * @return 操作状态
+     */
+    @Override
+    public int insertCollection(PoCollection collection) {
+        List<PoCollection> poCollection = poCollectionMapper.selectPoCollectionList(collection);
+        if (poCollection != null)
+            return -1;
+        return poCollectionMapper.insertPoCollection(collection);
+    }
+
+    /**
+     * 修改
+     *
+     * @param collection 更新的藏品信息
+     * @return 操作状态
+     */
+    @Override
+    public int updateCollection(PoCollection collection) {
+        return poCollectionMapper.updatePoCollection(collection);
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param collectionIds 藏品ID
+     * @return 操作状态
+     */
+    @Override
+    public int deleteCollectionByIds(Long[] collectionIds) {
+        return 0;
+    }
+
+    /**
+     * 单个删除
+     *
+     * @param collectionId 藏品ID
+     * @return 操作状态
+     */
+    @Override
+    public int deleteCollectionById(Long collectionId) {
+        return 0;
+    }
+}

+ 153 - 0
ruoyi-system/src/main/resources/mapper/system/PoCollectionMapper.xml

@@ -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.system.mapper.PoCollectionMapper">
+
+    <resultMap type="PoCollection" id="PoCollectionResult">
+        <result property="collectionId" column="collection_id"/>
+        <result property="collectionTitle" column="collection_title"/>
+        <result property="collectionType" column="collection_type"/>
+        <result property="status" column="status"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="remark" column="remark"/>
+        <result property="image" column="image"/>
+        <result property="formwork" column="formwork"/>
+        <result property="price" column="price"/>
+        <result property="publisherName" column="publisher_name"/>
+        <result property="story" column="story"/>
+        <result property="grounding" column="grouding"/>
+        <result property="cochain" column="cochain"/>
+        <result property="tetherId" column="tetherId"/>
+    </resultMap>
+
+    <sql id="selectPoCollectionVo">
+        select collection_id,
+               collection_title,
+               collection_type,
+               status,
+               create_by,
+               create_time,
+               update_by,
+               update_time,
+               remark,
+               del_flag,
+               publisher_name,
+               formwork,
+               price,
+               story,
+               grounding,
+               cochain,
+               tether_id
+        from po_collection
+    </sql>
+
+    <select id="selectPoCollectionById" parameterType="Long" resultMap="PoCollectionResult">
+        <include refid="selectPoCollectionVo"/>
+        where collection_id = #{collectionId}
+    </select>
+
+    <select id="selectPoCollectionList" parameterType="PoCollection" resultMap="PoCollectionResult">
+        <include refid="selectPoCollectionVo"/>
+        <where>
+            <if test="collectionTitle != null and collectionTitle != ''">
+                AND collection_title like concat('%', #{collectionTitle}, '%')
+            </if>
+            <if test="createBy != null and createBy != ''">
+                AND create_by like concat('%', #{createBy}, '%')
+            </if>
+            <if test="publisherName != null and publisherName != ''">
+                AND publisher_name like concat('%', #{publisherName}, '%')
+            </if>
+            <if test="delFlag != null and delFlag != ''">
+                AND del_flag like concat('%', #{delFlag}, '%')
+            </if>
+            <if test="collectionType != null and collectionType != ''">
+                AND collection_type like concat('%', #{collectionType}, '%')
+            </if>
+            <if test="grouding != null and grouding != ''">
+                AND grounding like concat('%', #{grounding}, '%')
+            </if>
+            <if test="cochain != null and cochain != ''">
+                AND cochain like concat('%', #{cochain}, '%')
+            </if>
+            <if test="tetherId != null and tetherId != ''">
+                AND tether_id like concat('%', #{tetherId}, '%')
+            </if>
+        </where>
+    </select>
+
+    <insert id="insertPoCollection" parameterType="PoCollection">
+        insert into po_collection (
+        <if test="collectionTitle != null and collectionTitle != '' ">collection_title,</if>
+        <if test="collectionType != null and collectionType != '' ">collection_type,</if>
+        <if test="status != null and status != '' ">status,</if>
+        <if test="remark != null and remark != ''">remark,</if>
+        <if test="createBy != null and createBy != ''">create_by,</if>
+        <if test="publisherName != null and publisherName != ''">publisher_name,</if>
+        <if test="formwork != null and formwork != ''">formwork,</if>
+        <if test="price != null and price != ''">price,</if>
+        <if test="story != null and story != ''">story,</if>
+        <if test="grouding != null and grouding != ''">grounding,</if>
+        <if test="cochain != null and cochain != ''">cochain,</if>
+        <if test="tetherId != null and tetherId != ''">tether_id,</if>
+        del_flag,
+        create_time
+        )values(
+        <if test="collectionTitle != null and collectionTitle != ''">#{collectionTitle},</if>
+        <if test="collectionType != null and collectionType != ''">#{collectionType},</if>
+        <if test="status != null and status != ''">#{status},</if>
+        <if test="remark != null and remark != ''">#{remark},</if>
+        <if test="createBy != null and createBy != ''">#{createBy},</if>
+        <if test="publisherName != null and publisherName != ''">#{publisherName},</if>
+        <if test="formwork != null and formwork != ''">#{formwork},</if>
+        <if test="price != null and price != ''">#{price},</if>
+        <if test="story != null and story != ''">#{story},</if>
+        <if test="grouding != null and grouding != ''">#{grounding},</if>
+        <if test="cochain != null and cochain != ''">#{cochain},</if>
+        <if test="tetherId != null and tetherId != ''">#{tetherId},</if>
+        0,
+        sysdate()
+        )
+    </insert>
+
+    <update id="updatePoCollection" parameterType="PoCollection">
+        update po_collection
+        <set>
+            <if test="collectionTitle != null and collectionTitle != ''">collection_title = #{collectionTitle},</if>
+            <if test="collectionType != null and collectionType != ''">collection_type = #{collectionType},</if>
+            <if test="status != null and status != ''">status = #{status},</if>
+            <if test="remark != null and remark != ''">remark = #{remark},</if>
+            <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
+            <if test="publisherName != null and publisherName != ''">publisher_name = #{publisherName},</if>
+            <if test="formwork != null and formwork != ''">formwork = #{formwork},</if>
+            <if test="price != null and price != ''">price = #{price},</if>
+            <if test="story != null and story != ''">story = #{story},</if>
+            <if test="grouding != null and grouding != ''">grouding = #{grounding},</if>
+            <if test="cochain != null and cochain != ''">cochain = #{cochain},</if>
+            <if test="tetherId != null and tetherId != ''">tetherId = #{tetherId},</if>
+            update_time = sysdate()
+        </set>
+        where collection_id = #{collectionId}
+    </update>
+
+    <delete id="deletePoCollectionById" parameterType="Long">
+        delete
+        from po_collection
+        where collection_id = #{collectionId}
+          and cochain != 0
+    </delete>
+
+    <delete id="deletePoCollectionByIds" parameterType="Long">
+        delete from po_collection where collection_id in
+        <foreach item="collectionId" collection="array" open="(" separator="," close=")">
+            #{collectionId}
+        </foreach>
+        and cochain != 0
+    </delete>
+
+</mapper>