Przeglądaj źródła

完善套系拥有的藏品种类数

zhangyang 2 lat temu
rodzic
commit
90869fea84

+ 12 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PoTetherController.java

@@ -56,6 +56,18 @@ public class PoTetherController extends BaseController
         List<PoTether> list= poTetherService.selectListByTitleAndTime(tetherName,tetherTimeStart,tetherTimeEnd);
         return getDataTable(list);
     }
+    /**
+     * 查询套系列表 数量
+     */
+    @PreAuthorize("@ss.hasPermi('system:tether:list')")
+    @GetMapping("/list")
+    @ApiOperation("查询套系列表 在售")
+    public TableDataInfo Total(PoTether poTether)
+    {
+        startPage();
+        List<PoTether> sellingList = poTetherService.selectPoTetherCollectionList(poTether);
+        return getDataTable(sellingList);
+    }
 
     /**
      * 查询套系列表 在售

+ 13 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/PoTetherMapper.java

@@ -135,4 +135,17 @@ public interface PoTetherMapper
      * @return
      */
     boolean updatePoTetherIsGrounding(Integer grounding, Long tetherId);
+
+    /**
+     * 更新种类
+     * @param poTether
+     */
+    void updatePostTetherCollection(PoTether poTether);
+
+    /**
+     * 查询更新完的种类
+     * @param poTether
+     * @return
+     */
+    List<PoTether> selectPoTetherCollectionList(PoTether poTether);
 }

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IPoTetherService.java

@@ -130,5 +130,13 @@ public interface IPoTetherService
      * @return
      */
     boolean updatePoTetherIsGrounding(Integer grounding, Long tetherId);
+
+    /**
+     * 藏品种类个数
+     * @param poTether
+     * @return
+     */
+    List<PoTether> selectPoTetherCollectionList(PoTether poTether);
+
 }
 

+ 12 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PoTetherServiceImpl.java

@@ -276,5 +276,17 @@ public class PoTetherServiceImpl implements IPoTetherService
         return poTetherMapper.updatePoTetherIsGrounding(grounding,  tetherId);
     }
 
+    /**
+     * 藏品种类个数
+     * @param poTether
+     * @return
+     */
+    @Override
+    public List<PoTether> selectPoTetherCollectionList(PoTether poTether) {
+
+        poTetherMapper.updatePostTetherCollection(poTether);
+        return poTetherMapper.selectPoTetherCollectionList(poTether);
+    }
+
 }
 

+ 28 - 0
ruoyi-system/src/main/resources/mapper/system/PoTetherMapper.xml

@@ -113,6 +113,7 @@
             <if test="exchange != null">and exchange = #{exchange}</if>
             <if test="grounding != null">and grounding = #{grounding}</if>
             <if test="cochain != null">and cochain = #{cochain}</if>
+            <if test="tetherId != null">and tether_id = #{tetherId}</if>
             and del_flag = '0'
             and sell_status = 2
         </where>
@@ -163,6 +164,20 @@
         </foreach>
     </select>
 
+<!--    查询更新完种类数的套系信息-->
+    <select id="selectPoTetherCollectionList" resultType="PoTether" resultMap="PoTetherResult">
+        <include refid="selectPoTetherVo"/>
+        <if test="tetherName != null  and tetherName != ''"> and tether_name like concat('%', #{tetherName}, '%')</if>
+        <if test="showTime != null "> and show_time = #{showTime}</if>
+        <if test="total != null "> and total = #{total}</if>
+        <if test="status != null  and status != ''"> and status = #{status}</if>
+        <if test="image != null and image != '' ">and image = #{image}</if>
+        <if test="exchange != null">and exchange = #{exchange}</if>
+        <if test="grounding != null">and grounding = #{grounding}</if>
+        <if test="cochain != null">and cochain = #{cochain}</if>
+        <if test="tetherId != null">and tether_id = #{tetherId}</if>
+    </select>
+
     <!--新增-->
     <insert id="insertPoTether" parameterType="PoTether" useGeneratedKeys="true" keyProperty="tetherId">
         insert into po_tether
@@ -245,5 +260,18 @@
     <update id="updatePoTetherIsGrounding" parameterType="PoTether">
         update po_tether set grounding = #{grounding} where tether_id = #{tetherId}
     </update>
+<!--    更新种类-->
+    <update id="updatePostTetherCollection" parameterType="PoTether">
+        UPDATE po_tether INNER JOIN (
+            SELECT
+            po_tether.tether_id,
+            ( SELECT COUNT( po_Tetherandcollection.tether_id )
+            FROM po_Tetherandcollection WHERE po_tether.tether_id = po_Tetherandcollection.tether_id ) AS total
+            FROM
+            po_tether
+            ) a
+        ON po_tether.tether_id = a.tether_id
+            SET po_tether.total = a.total
+    </update>
 </mapper>