Explorar o código

银河后台批发网站列表

zwhui hai 1 ano
pai
achega
278034909a

+ 11 - 0
netflix-dao/src/main/java/com/cyksj/mapper/WebInfoMapper.java

@@ -1,11 +1,22 @@
 package com.cyksj.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.cyksj.model.entity.WebInfo;
+import com.cyksj.model.views.WebInfoView;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * @author zwhui
  * @date 2025/6/13 14:03
  */
 public interface WebInfoMapper extends BaseMapper<WebInfo> {
+    Page<WebInfoView> getWebInfo(@Param("page") Page<WebInfoView> objectPage,
+                                 @Param("prefix") String prefix,
+                                 @Param("wholesaleId") Long wholesaleId,
+                                 @Param("shopName") String shopName,
+                                 @Param("userId") Long userId,
+                                 @Param("nickName") String nickName);
+
+
 }

+ 32 - 0
netflix-dao/src/main/java/com/cyksj/model/views/WebInfoView.java

@@ -0,0 +1,32 @@
+package com.cyksj.model.views;
+
+import lombok.Data;
+
+/**
+ * @author zwhui
+ * @date 2025/6/16 12:14
+ */
+@Data
+public class WebInfoView {
+    private Long id;
+
+    private String showId;
+
+    private Long userId;
+
+    private String nickname;
+    /**
+     * 网站前缀
+     */
+    private String prefix;
+
+    /**
+     * 店铺名称
+     */
+    private String shopName;
+
+    /**
+     * true运营中||false停止运营
+     */
+    private Boolean status;
+}

+ 26 - 0
netflix-dao/src/main/resources/mapper/WebInfoMapper.xml

@@ -0,0 +1,26 @@
+<?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.cyksj.mapper.WebInfoMapper">
+
+    <select id="getWebInfo" resultType="com.cyksj.model.views.WebInfoView">
+        select w.id,w.show_id,u.id as userId,u.nickname,w.prefix,w.shop_name,w.status from web_info w left join user u left join w.show_id = u.show_id
+        <where>
+            <if test="prefix != null">
+                and w.prefix = #{prefix}
+            </if>
+            <if test="wholesaleId != null">
+                and w.id = #{wholesaleId}
+            </if>
+            <if test="shopName != null">
+                and w.shop_name like '%${shopName}'
+            </if>
+            <if test="userId != null">
+                and u.id = #{userId}
+            </if>
+            <if test="nickName != null">
+                and u.nickname like '%${nickName}%'
+            </if>
+        </where>
+    </select>
+</mapper>

+ 51 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/wholesale/WholesaleController.java

@@ -0,0 +1,51 @@
+package com.cyksj.web.controller.manage.wholesale;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.cyksj.common.exception.BusinessRuntimeException;
+import com.cyksj.dto.Result;
+import com.cyksj.enums.GatewayResponse;
+import com.cyksj.mapper.WebInfoMapper;
+import com.cyksj.model.entity.WebInfo;
+import com.cyksj.model.views.WebInfoView;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 批发网站管理
+ * @author zwhui
+ * @date 2025/6/16 12:07
+ */
+@Slf4j
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/manage/wholesale")
+public class WholesaleController {
+
+    private final WebInfoMapper webInfoMapper;
+
+    /**
+     * 查询店铺网站信息
+     */
+    @GetMapping("/list/webInfo")
+    public Result<Page<WebInfoView>> getWebInfo(String prefix,Long wholesaleId,String shopName,Long userId,String nickName,@RequestParam(defaultValue = "1") Integer start,@RequestParam(defaultValue = "10") Integer limit) {
+        log.info("查询店铺网站信息 prefix:{},wholesaleId:{},shopName:{},userId:{},nickName:{}",prefix,wholesaleId,shopName,userId,nickName);
+        Page<WebInfoView> page = webInfoMapper.getWebInfo(new Page<>(start,limit),prefix,wholesaleId,shopName,userId,nickName);
+        return GatewayResponse.SUCCESS.newBuilder().toResult(page);
+    }
+
+
+    /**
+     * 上下架店铺
+     */
+    @PutMapping("/updStatus/{id}")
+    public Result<Void> updateStatus(@PathVariable Long id) {
+        WebInfo webInfo = webInfoMapper.selectById(id);
+        if (webInfo == null) {
+            throw new BusinessRuntimeException("店铺不存在");
+        }
+        webInfo.setStatus(!webInfo.getStatus());
+        webInfoMapper.updateById(webInfo);
+        return GatewayResponse.SUCCESS.newBuilder().toResult();
+    }
+}