|
@@ -3,12 +3,11 @@ package com.happy.action;
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
import com.happy.Model.Admin;
|
|
import com.happy.Model.Admin;
|
|
|
-import com.happy.Model.Admin_power;
|
|
|
|
|
|
|
+import com.happy.Model.AdminPower;
|
|
|
import com.happy.Until.GetHttpParam;
|
|
import com.happy.Until.GetHttpParam;
|
|
|
import com.happy.Until.PwdDefind;
|
|
import com.happy.Until.PwdDefind;
|
|
|
import com.happy.Until.ResUtil;
|
|
import com.happy.Until.ResUtil;
|
|
|
-import com.happy.Until.ResponseUtil;
|
|
|
|
|
-import com.happy.service.AdminManagerService;
|
|
|
|
|
|
|
+import com.happy.dto.IPage;
|
|
|
import com.happy.service.AdminService;
|
|
import com.happy.service.AdminService;
|
|
|
import com.opensymphony.xwork2.ActionSupport;
|
|
import com.opensymphony.xwork2.ActionSupport;
|
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.JSONObject;
|
|
@@ -19,7 +18,6 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
public class adminAction extends ActionSupport implements ServletRequestAware {
|
|
public class adminAction extends ActionSupport implements ServletRequestAware {
|
|
|
|
|
|
|
@@ -33,8 +31,7 @@ public class adminAction extends ActionSupport implements ServletRequestAware {
|
|
|
public String password;
|
|
public String password;
|
|
|
public Integer id;
|
|
public Integer id;
|
|
|
public int page; // 当前页
|
|
public int page; // 当前页
|
|
|
- public int rows;// 每页显示的行数rows123
|
|
|
|
|
- public String phoneName;
|
|
|
|
|
|
|
+ public int rows;// 每页显示的行数rows
|
|
|
|
|
|
|
|
public HttpServletRequest getRequest() {
|
|
public HttpServletRequest getRequest() {
|
|
|
return request;
|
|
return request;
|
|
@@ -56,133 +53,310 @@ public class adminAction extends ActionSupport implements ServletRequestAware {
|
|
|
this.response = response;
|
|
this.response = response;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public String getAdminName() {
|
|
|
|
|
- return adminName;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setAdminName(String adminName) {
|
|
|
|
|
- this.adminName = adminName;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public String getPassword() {
|
|
|
|
|
- return password;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setPassword(String password) {
|
|
|
|
|
- this.password = password;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public Integer getId() {
|
|
|
|
|
- return id;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setId(Integer id) {
|
|
|
|
|
- this.id = id;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public int getPage() {
|
|
|
|
|
- return page;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setPage(int page) {
|
|
|
|
|
- this.page = page;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public int getRows() {
|
|
|
|
|
- return rows;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setRows(int rows) {
|
|
|
|
|
- this.rows = rows;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public String getPhoneName() {
|
|
|
|
|
- return phoneName;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- public void setPhoneName(String phoneName) {
|
|
|
|
|
- this.phoneName = phoneName;
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 描述:登录
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String loginAdmin() {
|
|
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
|
|
+ StringBuilder getOneSqlx = new StringBuilder("");
|
|
|
|
|
+ getOneSqlx.append(" and admin_name = '").append(adminName).append("'")
|
|
|
|
|
+ .append(" and password = '").append(password).append("'");
|
|
|
|
|
+ Admin login = adminService.getOen(getOneSqlx.toString());
|
|
|
|
|
+ if (login != null) {
|
|
|
|
|
+ login.setPassword("********");
|
|
|
|
|
+ resultJson.put("message", "登录成功");
|
|
|
|
|
+ resultJson.put("code", 200);
|
|
|
|
|
+ resultJson.put("data", login);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ resultJson.put("message", "用户名或密码错误");
|
|
|
|
|
+ resultJson.put("code", 205);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 描述:新增管理端管理员账号
|
|
* 描述:新增管理端管理员账号
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
public String insertAdmin() {
|
|
public String insertAdmin() {
|
|
|
- JSONObject resultjson = new JSONObject();
|
|
|
|
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
Gson gson = new Gson();
|
|
Gson gson = new Gson();
|
|
|
com.alibaba.fastjson.JSONObject json = GetHttpParam.getRequestParameters(request);
|
|
com.alibaba.fastjson.JSONObject json = GetHttpParam.getRequestParameters(request);
|
|
|
if (json == null) {
|
|
if (json == null) {
|
|
|
- resultjson.put("message", "请传入参数");
|
|
|
|
|
- ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
|
|
|
|
+ resultJson.put("message", "请传入参数");
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
Admin admin = null;
|
|
Admin admin = null;
|
|
|
try {
|
|
try {
|
|
|
admin = gson.fromJson(json.toString(), new TypeToken<Admin>() {}.getType());
|
|
admin = gson.fromJson(json.toString(), new TypeToken<Admin>() {}.getType());
|
|
|
if (admin == null) {
|
|
if (admin == null) {
|
|
|
- resultjson.put("message", "数据为空");
|
|
|
|
|
- resultjson.put("code", 500);
|
|
|
|
|
- ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
|
|
|
|
+ resultJson.put("message", "数据为空");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
if (admin.getAdminName()==null || admin.getUserName()==null || admin.getLevel()==null || admin.getAdminPower()==null || admin.getAdminPower().equals("") || admin.getPhone()==null){
|
|
if (admin.getAdminName()==null || admin.getUserName()==null || admin.getLevel()==null || admin.getAdminPower()==null || admin.getAdminPower().equals("") || admin.getPhone()==null){
|
|
|
- resultjson.put("message", "各参数不能为空");
|
|
|
|
|
- resultjson.put("code", 500);
|
|
|
|
|
- ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
|
|
|
|
+ resultJson.put("message", "各参数不能为空");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
if (!PwdDefind.vertify(admin.getPassword())){
|
|
if (!PwdDefind.vertify(admin.getPassword())){
|
|
|
- resultjson.put("message", "密码至少包含:大小写英文字母、数字、特殊符号,密码长度大于8位,小于20位");
|
|
|
|
|
- resultjson.put("code", 500);
|
|
|
|
|
- ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
|
|
|
|
+ resultJson.put("message", "密码至少包含:大小写英文字母、数字、特殊符号,密码长度大于8位,小于20位");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
StringBuilder getOneSqlx = new StringBuilder("");
|
|
StringBuilder getOneSqlx = new StringBuilder("");
|
|
|
- getOneSqlx.append(" and adminName = ").append(admin.getAdminName());
|
|
|
|
|
|
|
+ getOneSqlx.append(" and admin_name = '").append(admin.getAdminName()).append("'");
|
|
|
Admin listc = adminService.getOen(getOneSqlx.toString());
|
|
Admin listc = adminService.getOen(getOneSqlx.toString());
|
|
|
if (listc != null) {
|
|
if (listc != null) {
|
|
|
- resultjson.put("message", "该用户已存在");
|
|
|
|
|
- resultjson.put("code", 500);
|
|
|
|
|
- ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
|
|
|
|
+ resultJson.put("message", "该用户已存在");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
int m = adminService.insertAdmin(admin);
|
|
int m = adminService.insertAdmin(admin);
|
|
|
if (m > 0) {
|
|
if (m > 0) {
|
|
|
- resultjson.put("message", "添加成功");
|
|
|
|
|
- resultjson.put("code", 200);
|
|
|
|
|
- ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
|
|
|
|
+ resultJson.put("message", "添加成功");
|
|
|
|
|
+ resultJson.put("code", 200);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
} else {
|
|
} else {
|
|
|
- resultjson.put("message", "添加失败");
|
|
|
|
|
- resultjson.put("code", 502);
|
|
|
|
|
- ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
|
|
|
|
+ resultJson.put("message", "添加失败");
|
|
|
|
|
+ resultJson.put("code", 502);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
|
|
+ resultJson.put("message", "未知异常:"+ e);
|
|
|
|
|
+ resultJson.put("code", 205);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ resultJson.put("message", "未知异常");
|
|
|
|
|
+ resultJson.put("code", 205);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 描述:修改管理端管理员账号
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String updateAdmin() {
|
|
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
|
|
+ Gson gson = new Gson();
|
|
|
|
|
+ com.alibaba.fastjson.JSONObject json = GetHttpParam.getRequestParameters(request);
|
|
|
|
|
+ if (json == null) {
|
|
|
|
|
+ resultJson.put("message", "请传入参数");
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ Admin admin = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ admin = gson.fromJson(json.toString(), new TypeToken<Admin>() {}.getType());
|
|
|
|
|
+ if (admin == null) {
|
|
|
|
|
+ resultJson.put("message", "数据为空");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(admin.getId()==null){
|
|
|
|
|
+ resultJson.put("message", "修改用户Id不能为空");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (admin.getAdminName()==null || admin.getUserName()==null || admin.getLevel()==null || admin.getAdminPower()==null || admin.getAdminPower().equals("") || admin.getPhone()==null){
|
|
|
|
|
+ resultJson.put("message", "各参数不能为空");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!PwdDefind.vertify(admin.getPassword())){
|
|
|
|
|
+ resultJson.put("message", "密码至少包含:大小写英文字母、数字、特殊符号,密码长度大于8位,小于20位");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ StringBuilder getOneSqlx = new StringBuilder("");
|
|
|
|
|
+ getOneSqlx.append(" and admin_name = '").append(admin.getAdminName()).append("'");
|
|
|
|
|
+ getOneSqlx.append(" and id != '").append(admin.getId()).append("'");
|
|
|
|
|
+ Admin listc = adminService.getOen(getOneSqlx.toString());
|
|
|
|
|
+ if (listc != null) {
|
|
|
|
|
+ resultJson.put("message", "该用户已存在");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ int m = adminService.updateAdmin(admin);
|
|
|
|
|
+ if (m > 0) {
|
|
|
|
|
+ resultJson.put("message", "修改成功");
|
|
|
|
|
+ resultJson.put("code", 200);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ resultJson.put("message", "修改失败");
|
|
|
|
|
+ resultJson.put("code", 502);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
+ resultJson.put("message", "未知异常:"+ e);
|
|
|
|
|
+ resultJson.put("code", 205);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ resultJson.put("message", "未知异常");
|
|
|
|
|
+ resultJson.put("code", 205);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 描述:删除
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String delAdmin(){
|
|
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
|
|
+ if (id == null) {
|
|
|
|
|
+ resultJson.put("message", "请传入id");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ int m = adminService.delAdmin(id);
|
|
|
|
|
+ if (m > 0) {
|
|
|
|
|
+ resultJson.put("message", "删除成功");
|
|
|
|
|
+ resultJson.put("code", 200);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ resultJson.put("message", "未知异常");
|
|
|
|
|
+ resultJson.put("code", 205);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 描述:重置密码
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String removePwd(){
|
|
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
|
|
+ if (id == null) {
|
|
|
|
|
+ resultJson.put("message", "请传入id");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ Admin admin = adminService.getById(id);
|
|
|
|
|
+ if (admin != null && !"".equals(admin)) {
|
|
|
|
|
+ admin.setPassword("Jams123456");
|
|
|
|
|
+ int m = adminService.updateAdmin(admin);
|
|
|
|
|
+ if(m > 0){
|
|
|
|
|
+ resultJson.put("message", "重置成功");
|
|
|
|
|
+ resultJson.put("code", 200);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ resultJson.put("message", "重置失败");
|
|
|
|
|
+ resultJson.put("code", 502);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ resultJson.put("message", "未知异常");
|
|
|
|
|
+ resultJson.put("code", 205);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 描述:分页查询
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String queryPage(){
|
|
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
|
|
+ StringBuilder s1 = new StringBuilder("");
|
|
|
|
|
+ if (adminName!=null){
|
|
|
|
|
+ s1.append(" and admin_name like '%").append(adminName).append("'");
|
|
|
|
|
+ }
|
|
|
|
|
+ IPage<Admin> adminIPage = adminService.queryPage(s1.toString(),page,rows);
|
|
|
|
|
+ if(adminIPage!=null && !"".equals(adminIPage)){
|
|
|
|
|
+ resultJson.put("message", "查询分页成功");
|
|
|
|
|
+ resultJson.put("code", 200);
|
|
|
|
|
+ resultJson.put("date", adminIPage);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ resultJson.put("message", "查询分页失败");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
}
|
|
}
|
|
|
- resultjson.put("message", "未知异常");
|
|
|
|
|
- resultjson.put("code", 205);
|
|
|
|
|
- ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public String login() {
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 描述:根据Id查询详细
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public String getById(){
|
|
|
|
|
+ JSONObject resultJson = new JSONObject();
|
|
|
|
|
+ if (id == null) {
|
|
|
|
|
+ resultJson.put("message", "请传入id");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ Admin admin = adminService.getById(id);
|
|
|
|
|
+ if (admin != null) {
|
|
|
|
|
+ resultJson.put("message", "查询成功");
|
|
|
|
|
+ resultJson.put("code", 200);
|
|
|
|
|
+ resultJson.put("date", admin);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ resultJson.put("message", "未查到用户信息");
|
|
|
|
|
+ resultJson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 菜单查询
|
|
|
|
|
+ public String getIndexList(){
|
|
|
JSONObject resultjson = new JSONObject();
|
|
JSONObject resultjson = new JSONObject();
|
|
|
- StringBuilder getOneSqlx = new StringBuilder("");
|
|
|
|
|
- getOneSqlx.append(" and adminName = ").append(adminName)
|
|
|
|
|
- .append(" and password = ").append(password);
|
|
|
|
|
- Admin login = adminService.getOen(getOneSqlx.toString());
|
|
|
|
|
- if (login != null) {
|
|
|
|
|
- resultjson.put("message", "登录成功");
|
|
|
|
|
|
|
+ StringBuilder s1 = new StringBuilder("");
|
|
|
|
|
+ if (id==null){
|
|
|
|
|
+ resultjson.put("message", "请传入用户Id");
|
|
|
|
|
+ resultjson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ Admin admin = adminService.getById(id);
|
|
|
|
|
+ if (admin==null){
|
|
|
|
|
+ resultjson.put("message", "未查到用户信息");
|
|
|
|
|
+ resultjson.put("code", 500);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ String ids = admin.getAdminPower();
|
|
|
|
|
+ s1.append(" and id in (").append(ids).append(") ");
|
|
|
|
|
+ List<AdminPower> lpower = adminService.queryTree(s1.toString());
|
|
|
|
|
+ if (lpower!=null){
|
|
|
|
|
+ resultjson.put("message", "返回成功");
|
|
|
resultjson.put("code", 200);
|
|
resultjson.put("code", 200);
|
|
|
- resultjson.put("data", login);
|
|
|
|
|
|
|
+ resultjson.put("data",lpower);
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
- resultjson.put("message", "用户名或密码错误");
|
|
|
|
|
|
|
+ resultjson.put("message", "数据为空");
|
|
|
resultjson.put("code", 205);
|
|
resultjson.put("code", 205);
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultjson.toString());
|
|
|
return null;
|
|
return null;
|