Commit c3effd4e authored by hezhen's avatar hezhen

修改收藏

parent 2729e34e
...@@ -50,10 +50,10 @@ public class AppUserCollectBiz extends BaseBiz<AppUserCollectMapper, AppUserColl ...@@ -50,10 +50,10 @@ public class AppUserCollectBiz extends BaseBiz<AppUserCollectMapper, AppUserColl
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
} }
//查看是否收藏 //查看是否收藏
public ObjectRestResponse checkUserCollect(Integer id,Integer userId){ public ObjectRestResponse checkUserCollect(Integer id,Integer userId,Integer type){
Example example = new Example(AppUserCollect.class); Example example = new Example(AppUserCollect.class);
Example.Criteria criteria = example.createCriteria(); Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId",userId).andEqualTo("typeId",id).andEqualTo("isDel",0); criteria.andEqualTo("userId",userId).andEqualTo("typeId",id).andEqualTo("type",type).andEqualTo("isDel",0);
int count=selectCountByExample(example); int count=selectCountByExample(example);
boolean falg=count>0?false:true; boolean falg=count>0?false:true;
return ObjectRestResponse.succ(falg); return ObjectRestResponse.succ(falg);
......
...@@ -81,15 +81,18 @@ public class AppUserCollectController extends CommonBaseController { ...@@ -81,15 +81,18 @@ public class AppUserCollectController extends CommonBaseController {
return collectBiz.addUserCollect(collectDTO); return collectBiz.addUserCollect(collectDTO);
} }
@RequestMapping(value = "/collect/{id}",method = RequestMethod.GET) @RequestMapping(value = "/collect",method = RequestMethod.GET)
@ApiModelProperty("查看是否收藏") @ApiModelProperty("查看是否收藏")
public ObjectRestResponse<AppUser> get(@PathVariable Integer id)throws Exception{ public ObjectRestResponse<AppUser> get(
@RequestParam(value = "id",defaultValue = "0")Integer id,
@RequestParam(value = "type",defaultValue = "0")Integer type
)throws Exception{
String username = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId(); String username = userAuthUtil.getInfoFromToken(userAuthConfig.getToken(request)).getId();
if (username == null) { if (username == null) {
throw new Exception(); throw new Exception();
} }
Integer userid=Integer.parseInt(username); Integer userid=Integer.parseInt(username);
return collectBiz.checkUserCollect(userid,id); return collectBiz.checkUserCollect(userid,id,type);
} }
/** /**
* 取消收藏 * 取消收藏
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment