标签:
@RequestMapping("/api/merBrand")
@ResponseBody
public ResultBrand merBrand(HttpServletRequest request,
@RequestParam("brandId") Long brandId,
@RequestParam("oldBrandId") Long oldBrandId) {
try {
ItemApiContext context=ItemApiContextUtil.getItemApiContext(request);
BrandClient brandClient = BrandTools.getBrandClient();
int resultCode= brandClient.combineBrand(context, oldBrandId, brandId);
if(resultCode ==1){
return new ResultBrand(1,"合并品牌成功!");
}else if(resultCode ==-1){
return new ResultBrand(2,"合并的品牌未认证通过或已删除");
}else if(resultCode == -2){
return new ResultBrand(2,"合并的品牌Id不存在");
}
} catch (Exception e) {
logger.error("合并品牌异常!", e);
}
return new ResultBrand(2,"合并品牌异常");
}
结果集封装类
class ResultBrand{
public ResultBrand(int num,String message){
this.num=num;
this.message=message;
}
private int num;
private String message;
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
标签:
原文地址:http://www.cnblogs.com/zhaoblog/p/5360236.html