xin
2025-09-12 01572e1f679e789e434e9cdfac491b54b68a0ec0
商户信息
5 files modified
32 ■■■■ changed files
oying-system/src/main/java/com/oying/modules/system/mapper/MerchantMapper.java 4 ●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/system/rest/MerchantController.java 8 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/system/service/MerchantService.java 2 ●●●●● patch | view | raw | blame | history
oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java 10 ●●●●● patch | view | raw | blame | history
oying-system/src/main/resources/mapper/system/MerchantMapper.xml 8 ●●●●● patch | view | raw | blame | history
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;
@@ -19,4 +21,6 @@
    IPage<Merchant> findAll(@Param("criteria") MerchantsQueryCriteria criteria, Page<Object> page);
    List<Merchant> findAll(@Param("criteria") MerchantsQueryCriteria criteria);
    List<Merchant> findByUserId(@Param("userId") Long userId);
}
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("新增商户信息")
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);
}
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());
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>