Commit 3537df7c authored by hezhen's avatar hezhen

修改收藏

parent 1847dccc
......@@ -30,9 +30,19 @@ public class AppUserCollectBiz extends BaseBiz<AppUserCollectMapper, AppUserColl
//新增收藏
public ObjectRestResponse addUserCollect(AppUserCollectDTO collectDTO)throws Exception{
if(collectDTO==null){
Integer typeId=collectDTO.getTypeId();
Integer type=collectDTO.getType();
if(collectDTO==null||typeId==null||type==null){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数为空");
}
Example example = new Example(AppUserCollect.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("userId",collectDTO.getUserId()).andEqualTo("typeId",typeId)
.andEqualTo("type",type).andEqualTo("isDel",0);
int count=selectCountByExample(example);
if (count>0){
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "已收藏!");
}
AppUserCollect collect=new AppUserCollect();
BeanUtils.copyProperties(collect,collectDTO);
insertSelective(collect);
......
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