用户名和手机登了 这个地方 应该怎么做呢 如果用query 查出来的是多条了
package nuoshang.bluejay.modules;
import nuoshang.bluejay.bean.Address;
import nuoshang.bluejay.services.UserAddService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.util.NutMap;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Fail;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
/**
* 用户收货地址
* Created by Administrator on 2016/8/22.
*/
@IocBean
@At("/address")
@Fail("http:500")
public class UserAddModule {
private static final Log log = Logs.get();
@Inject
private UserAddService userAddService;
@At("/add")
@Ok("json")
public Object add(@Param("..") Address address){
Address addr = userAddService.save(address);
Integer id = addr.getUser_address_id();
NutMap re = new NutMap();
if( id != null || id != 0){
return re.setv("result", "01").addv("msg", "保存成功!");
}else {
return re.setv("result", "00").addv("msg", "保存失败!");
}
}
@At("/find")
@Ok("json")
public Object find(@Param("id") Integer id){
NutMap re = new NutMap();
if( id == null || id == 0){
return re.setv("result", "03").addv("msg", "Id不能为空!");
}
Address address = userAddService.find(id);
if( address != null){
return re.setv("result", "01").addv("data",address);
}else {
return re.setv("result", "02").addv("msg", "未查到数据!");
}
}
@At("/rm")
@Ok("json")
public Object rm(@Param("id") Integer id){
NutMap re = new NutMap();
if(id <= 0){
return re.setv("result", "03").addv("msg", "Id不能为空!");
}
userAddService.delete(id);
return re.setv("result", "01").addv("msg", "删除成功!");
}
@At("/update")
@Ok("json")
public Object updateAdd(@Param("..") Address address){
NutMap re = new NutMap();
if(address.getUser_address_id() <= 0 ||address.getAdd_user_id() <= 0){
return re.setv("result", "03").addv("msg", "Id不能为空!");
}
userAddService.update(address);
return re.setv("result", "01").addv("msg", "保存成功!");
}
@At("/list")
@Ok("json")
public Object list(@Param("uid") Integer uid){
NutMap re = new NutMap();
if(uid ==null || uid ==0){
return re.setv("result", "03").addv("msg", "用户Id不能为空!");
}
return userAddService.list(uid);
}
}