From 01572e1f679e789e434e9cdfac491b54b68a0ec0 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Fri, 12 Sep 2025 15:09:18 +0800
Subject: [PATCH] 商户信息
---
oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java | 8 ++++++++
oying-system/src/main/resources/mapper/system/MerchantMapper.xml | 8 ++++++++
oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java | 10 ++++++----
oying-system/src/main/java/com/oying/modules/system/service/MerchantService.java | 2 ++
oying-system/src/main/java/com/oying/modules/system/mapper/MerchantMapper.java | 10 +++++++---
5 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/oying-system/src/main/java/com/oying/modules/system/mapper/MerchantMapper.java b/oying-system/src/main/java/com/oying/modules/system/mapper/MerchantMapper.java
index 09e82ae..6d1d63b 100644
--- a/oying-system/src/main/java/com/oying/modules/system/mapper/MerchantMapper.java
+++ b/oying-system/src/main/java/com/oying/modules/system/mapper/MerchantMapper.java
@@ -2,7 +2,9 @@
import com.oying.modules.system.domain.Merchant;
import com.oying.modules.system.domain.dto.MerchantsQueryCriteria;
+
import java.util.List;
+
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -10,13 +12,15 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
-* @author lixin
-* @date 2025-05-29
-**/
+ * @author lixin
+ * @date 2025-05-29
+ **/
@Mapper
public interface MerchantMapper extends BaseMapper<Merchant> {
IPage<Merchant> findAll(@Param("criteria") MerchantsQueryCriteria criteria, Page<Object> page);
List<Merchant> findAll(@Param("criteria") MerchantsQueryCriteria criteria);
+
+ List<Merchant> findByUserId(@Param("userId") Long userId);
}
diff --git a/oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java b/oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java
index 0d41388..187dc4e 100644
--- a/oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java
+++ b/oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java
@@ -5,6 +5,7 @@
import com.oying.modules.system.service.MerchantService;
import com.oying.modules.system.domain.dto.MerchantsQueryCriteria;
import com.oying.utils.R;
+import com.oying.utils.SecurityUtils;
import lombok.RequiredArgsConstructor;
import java.util.List;
@@ -48,6 +49,13 @@
return new ResponseEntity<>(R.success(merchantService.queryAll(criteria, page)), HttpStatus.OK);
}
+ @GetMapping("findByUserId")
+ @ApiOperation("根据用户查询商户信息")
+ @PreAuthorize("@el.check('merchant:list')")
+ public ResponseEntity<Object> findByUserId() {
+ return new ResponseEntity<>(R.success(merchantService.findByUserId(SecurityUtils.getCurrentUserId())), HttpStatus.OK);
+ }
+
@PostMapping
@Log("新增商户信息")
@ApiOperation("新增商户信息")
diff --git a/oying-system/src/main/java/com/oying/modules/system/service/MerchantService.java b/oying-system/src/main/java/com/oying/modules/system/service/MerchantService.java
index 5d1c847..b1b7c9d 100644
--- a/oying-system/src/main/java/com/oying/modules/system/service/MerchantService.java
+++ b/oying-system/src/main/java/com/oying/modules/system/service/MerchantService.java
@@ -56,4 +56,6 @@
* @throws IOException /
*/
void download(List<Merchant> all, HttpServletResponse response) throws IOException;
+
+ List<Merchant> findByUserId(Long userId);
}
diff --git a/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java b/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java
index 5e17186..24bcd05 100644
--- a/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java
+++ b/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java
@@ -16,12 +16,9 @@
import org.springframework.transaction.annotation.Transactional;
import com.oying.utils.PageUtil;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
import com.oying.utils.PageResult;
@@ -48,6 +45,11 @@
}
@Override
+ public List<Merchant> findByUserId(Long userId) {
+ return merchantMapper.findByUserId(userId);
+ }
+
+ @Override
@Transactional(rollbackFor = Exception.class)
public void create(Merchant resources) {
resources.setMerchantCode(IdUtil.getSnowflakeNextIdStr());
diff --git a/oying-system/src/main/resources/mapper/system/MerchantMapper.xml b/oying-system/src/main/resources/mapper/system/MerchantMapper.xml
index d0e02ff..71a7dc8 100644
--- a/oying-system/src/main/resources/mapper/system/MerchantMapper.xml
+++ b/oying-system/src/main/resources/mapper/system/MerchantMapper.xml
@@ -49,4 +49,12 @@
</where>
order by merchant_sort desc
</select>
+ <select id="findByUserId" resultMap="BaseResultMap">
+ select
+ <include refid="Base_Column_List"/>
+ from sys_merchant as m
+ left join sys_user_merchant as u on u.merchant_id = m.merchant_id
+ where user_id = #{userId}
+ order by m.merchant_id
+ </select>
</mapper>
--
Gitblit v1.9.3