diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/WeChatController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/WeChatController.java index a27a7a7..69f160b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/WeChatController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/WeChatController.java @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import javax.validation.Valid; /** * 微信签名 @@ -53,7 +54,7 @@ public class WeChatController extends BaseController { */ @ApiOperation("获取微信二维码") @PostMapping("/findWxCode") - public AjaxResult findWxCode(@RequestBody WeChatCodeRequest req) { + public AjaxResult findWxCode(@Valid @RequestBody WeChatCodeRequest req) { return AjaxResult.success(weChatService.findWxCode(req)); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BShanghuMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BShanghuMapper.java index 0810385..b29963f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BShanghuMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BShanghuMapper.java @@ -91,4 +91,11 @@ public interface BShanghuMapper { * @return 商户信息 */ BShanghu findByPhone(@Param("phoneNumber") String phoneNumber); + + /** + * 删除广告商户关联 + * + * @param posterId 广告id + */ + void editByPosterId(@Param("posterId") Long posterId); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/IBShanghuService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/IBShanghuService.java index e7fcc62..030da9d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/IBShanghuService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/IBShanghuService.java @@ -1,6 +1,5 @@ package com.ruoyi.system.service; -import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.system.domain.BShanghu; import java.util.List; @@ -87,8 +86,16 @@ public interface IBShanghuService { /** * 根据手机号查询商户 + * * @param phoneNumber 手机号 * @return 商户信息 */ BShanghu findByPhone(String phoneNumber); + + /** + * 删除广告商户关联 + * + * @param posterId 广告id + */ + void editByPosterId(Long posterId); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BPosterServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BPosterServiceImpl.java index a338e79..eaa41df 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BPosterServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BPosterServiceImpl.java @@ -115,6 +115,11 @@ public class BPosterServiceImpl implements IBPosterService { if (BeanUtil.isEmpty(bPoster)) { throw new ServiceException("所选广告不存在"); } + if (CollectionUtil.isEmpty(req.getShanghuIds()) && StrUtil.isEmpty(req.getShanghuCity()) && StrUtil.isEmpty(req.getShanghuName())) { + throw new ServiceException("商户不能为空"); + } + // 删除广告商户关联 + shanghuService.editByPosterId(req.getPosterId()); if (CollectionUtil.isNotEmpty(req.getShanghuIds())) { shanghuService.editPostIdByIds(req.getPosterId(), req.getShanghuIds()); return; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BShanghuServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BShanghuServiceImpl.java index 5552d14..8260d7e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BShanghuServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BShanghuServiceImpl.java @@ -170,4 +170,14 @@ public class BShanghuServiceImpl implements IBShanghuService { public BShanghu findByPhone(String phoneNumber) { return bShanghuMapper.findByPhone(phoneNumber); } + + /** + * 删除广告商户关联 + * + * @param posterId 广告id + */ + @Override + public void editByPosterId(Long posterId) { + bShanghuMapper.editByPosterId(posterId); + } } diff --git a/ruoyi-admin/src/main/resources/mapper/netEwm/BShanghuMapper.xml b/ruoyi-admin/src/main/resources/mapper/netEwm/BShanghuMapper.xml index ec4bd54..1292e87 100644 --- a/ruoyi-admin/src/main/resources/mapper/netEwm/BShanghuMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/netEwm/BShanghuMapper.xml @@ -116,6 +116,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + update b_shanghu + set poster_id = null + where poster_id = #{posterId} + + delete from b_shanghu where id = #{id}