Browse Source

实现藏品Dao层

Signed-off-by: hamjin <335908093@qq.com>
hamjin 2 years ago
parent
commit
06977bd685

+ 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);
+}

+ 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>