return new ModelAndView(new RedirectView("../page/management/member/list_member.jsp"));
}
@RequestMapping("/member/queryUsers.do")
public ModelAndView queryUsers(HttpServletRequest request,HttpServletResponse response){
RunTimeUser rtUser = RunTimeUser.getRunTimeUser(request);
PageArgument pageArgment = getPageInfo(request);
String type = request.getParameter("type");
String username = request.getParameter("username");
String merchantname = request.getParameter("merchantname");
String hql = " ";
if("2".equals(type))
{
if(rtUser.getUsertype() == 2)
{
hql = " select u from User u, Merchant m where u.enabled = true and u.locked = false and u.usertype = 2 and m.ID = u.organizationid and m.SJFRDB.id = u.id";
if(!StringUtil.isEmptyStr(merchantname))
{
hql += " and m.SJMC like '%"+merchantname+"%'";
}
hql += " order by u.id desc";
}else if(rtUser.getUsertype() == 3)
{
hql = " select u from User u, Organization o where u.enabled = true and u.locked = false and u.usertype = 3 and o.ID = u.organizationid and o.jgfzr.id = u.id";
if(!StringUtil.isEmptyStr(merchantname))
{
hql += " and o.JGMC like '%"+merchantname+"%'";
}
hql += " order by u.id desc";
}else
{
hql = " select u from User u, Merchant m where u.enabled = true and u.locked = false and u.usertype = 2 and m.ID = u.organizationid and m.SJFRDB.id = u.id";
if(!StringUtil.isEmptyStr(merchantname))
{
hql += " and m.SJMC like '%"+merchantname+"%'";
}
hql += " order by u.id desc";
hql += " union select u from User u, Organization o where u.enabled = true and u.locked = false and u.usertype = 3 and o.ID = u.organizationid and o.jgfzr.id = u.id";
if(!StringUtil.isEmptyStr(merchantname))
{
hql += " and o.JGMC like '%"+merchantname+"%'";
}
hql += " order by u.id desc";
}
}else
{
hql = " from User u where u.enabled = true and u.locked = false";
if(!StringUtil.isEmptyStr(username))
{
hql += " and (u.username like '%"+username+"%' or u.nickname like '%"+username+"%' or u.truename like '%"+username+"%' or u.card.id like '%"+username+"%')";
}
if(rtUser != null && (rtUser.isMerchant()||rtUser.isOrganization()) )
{
hql += " and u.organizationid = " + rtUser.getOrganizationid() + " and u.parent.id = " +rtUser.getId() ;
}
if(!StringUtil.isEmptyStr(merchantname))
{
hql += " and (exists (from Merchant m where m.ID= u.organizationid and m.SJMC like '%"+merchantname+"%' ) or";