2 Commits 2a886f8f41 ... 6f52c74a9c

Auteur SHA1 Message Date
  半月无霜 6f52c74a9c 合并 il y a 4 ans
  半月无霜 a21dd86d26 活动助力助力条件修改 il y a 4 ans

+ 5 - 2
ymall/src/main/java/com/liangjian11/ymall/mapper/activityCenter/ActivityHelperMapper.java

@@ -31,6 +31,9 @@ public interface ActivityHelperMapper extends BaseMapper<ActivityHelper> {
 	 */
 	@Select(" SELECT count(1) FROM activityhelper ${filterSql} ")
 	Integer getCount(@Param("filterSql") String filterSql);
-
-
+	
+	@Select(" SELECT count(1) FROM activityjointor A " +
+			" JOIN activityhelper B ON A.id = B.acjoinid " +
+			" WHERE  A.acid = #{acid} AND B.helperunionid = #{unionid} ")
+	Integer getHelpedCount(@Param("acid") Integer acid, @Param("unionid") String unionid);
 }

+ 4 - 0
ymall/src/main/java/com/liangjian11/ymall/service/impl/activityCenter/ActivityHelperServiceImpl.java

@@ -62,6 +62,10 @@ public class ActivityHelperServiceImpl implements ActivityHelperService {
 		Integer count = this.getHelpedCount(acjoinId, unionid);
 		if(count>0)
 			return ResultUtil.createFail("助力失败,不能重复助力");
+		Integer acid = info.getAcid();// 活动ID
+		int num = ahMapper.getHelpedCount(acid, unionid);
+		if(num>0)
+			return ResultUtil.createFail("助力失败,您已帮别人助力");
 		
 		ActivityHelper helper = new ActivityHelper();
 		helper.setAcjoinid(acjoinId);

+ 5 - 2
ymall/src/test/java/com/liangjian11/ymall/ServiceTest.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.liangjian11.ymall.controller.common.WechatController;
 import com.liangjian11.ymall.handle.WxMpHandle;
 import com.liangjian11.ymall.mapper.UserAccountMapper;
+import com.liangjian11.ymall.mapper.activityCenter.ActivityHelperMapper;
 import com.liangjian11.ymall.mapper.activityCenter.ActivityJointorMapper;
 import com.liangjian11.ymall.model.Doctor;
 import com.liangjian11.ymall.model.UserAccount;
@@ -53,12 +54,14 @@ public class ServiceTest {
 	@Autowired
 	private ActivityJointorMapper ajMapper;
 	@Autowired
+	private ActivityHelperMapper ahMapper;
+	@Autowired
   	private HospitalDomain hospitalDomain;
 	
 	@Test
 	public void runTest(){
-		String token = wxMpHandle.getToken();
-		System.out.println(token);
+		Integer a = ahMapper.getHelpedCount(28, "oZh4guJFWppeFPZLnhwOig20MqtA");
+		System.out.println(a);
 	}
 
 	@Test