Commit 36d396f8 authored by Quxl's avatar Quxl

xxx

parent c81c6f81
package com.egolm.film.api.admin;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
......@@ -147,16 +141,6 @@ public class AdminAuthController {
return Rjx.jsonOk().setData(datas);
}
@ResponseBody
@PostMapping("allAuth")
@ApiOperation("全部管理组权限查询")
public Object allAuth() throws IOException {
Resource resource = new ClassPathResource("auth_admin.json");
BufferedReader br = new BufferedReader(new InputStreamReader(resource.getInputStream()));
String text = StringUtil.read(br);
return Rjx.jsonOk().setData(JSON.parseArray(text));
}
@ResponseBody
@PostMapping("groupAuth")
@ApiOperation("管理组权限查询")
......@@ -164,19 +148,26 @@ public class AdminAuthController {
@ApiImplicitParam(paramType="query", dataType="int", required=true, name="group_id", value="组ID"),
})
public Object groupAuth(Integer group_id) throws FileNotFoundException {
String json = service.queryGroupAuth(group_id);
return Rjx.jsonOk().setData(JSON.parseArray(json));
List<Map<String, Object>> list = service.queryGroupAuth(group_id);
return Rjx.jsonOk().setData(list);
}
@ResponseBody
@PostMapping("updateGroupAuth")
@ApiOperation("保存或更新管理组权限")
public Object updateGroupAuth(Integer group_id, Integer[] menu_id) {
service.updateGroupAuth(group_id, menu_id);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("groupSaveOrUpdate")
@ApiOperation("保存或更新管理组")
public Object groupSaveOrUpdate(Integer group_id, String group_name, Integer state, String pwoer, String group_power) {
public Object groupSaveOrUpdate(Integer group_id, String group_name, Integer state, String pwoer) {
Fc_admin_group group = new Fc_admin_group();
group.setGroup_id(group_id);
group.setGroup_name(group_name);
group.setState(state);
group.setGroup_power(group_power);
group.setPower(pwoer);
service.saveOrUpdateGroup(group);
return Rjx.jsonOk();
......
......@@ -21,6 +21,8 @@ public interface AdminAuthService {
void mergeAdmin(Fc_admin admin);
String queryGroupAuth(Integer group_id);
List<Map<String, Object>> queryGroupAuth(Integer group_id);
void updateGroupAuth(Integer group_id, Integer[] menu_id);
}
package com.egolm.film.api.admin.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.egolm.common.StringUtil;
import com.egolm.common.jdbc.JdbcTemplate;
......@@ -64,9 +66,37 @@ public class AdminAuthServiceImpl implements AdminAuthService {
}
@Override
public String queryGroupAuth(Integer group_id) {
String sql = "select group_power from fc_admin_group where group_id = ?";
return jdbcTemplate.queryForString(sql, group_id);
public List<Map<String, Object>> queryGroupAuth(Integer group_id) {
String s = "select am.*, agm.group_id from fc_admin_menu am left join fc_admin_group_menu agm on am.menu_id = agm.menu_id and agm.group_id = ? order by order_num";
List<Map<String, Object>> list = jdbcTemplate.queryForList(s, group_id);
return this.getTree(list, null);
}
private List<Map<String, Object>> getTree(List<Map<String, Object>> list, Integer id) {
List<Map<String, Object>> nodes = new ArrayList<Map<String, Object>>();
for(Map<String, Object> map : list) {
Number menu_id = (Number)map.get("menu_id");
Number parent_id = (Number)map.get("parent_id");
if((id == null && parent_id == null) || (id.intValue() == parent_id.intValue())) {
Number menu_type = (Number)map.get("menu_type");
if(menu_type.intValue() == 0 || menu_type.intValue() == 1) {
map.put("childs", this.getTree(list, menu_id.intValue()));
}
nodes.add(map);
}
}
return nodes;
}
@Override
@Transactional
public void updateGroupAuth(Integer group_id, Integer[] menu_id) {
String sql = "delete from fc_admin_group_menu where group_id = ?";
jdbcTemplate.executeUpdate(sql, group_id);
}
}
......@@ -6,7 +6,7 @@ import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-19
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_admin")
......
......@@ -6,7 +6,7 @@ import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-19
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_admin_group")
......
package com.egolm.film.bean;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_admin_group_menu")
public class Fc_admin_group_menu implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
private Integer menu_id;
@Id
private Integer group_id;
/**
* 无参数构造方法
*/
public Fc_admin_group_menu () {
super();
}
/**
* 全参数构造方法
* @param menu_id
* @param group_id
*/
public Fc_admin_group_menu(Integer menu_id, Integer group_id) {
this.menu_id = menu_id;
this.group_id = group_id;
}
public void setMenu_id(Integer menu_id) {
this.menu_id = menu_id;
}
public Integer getMenu_id() {
return menu_id;
}
public void setGroup_id(Integer group_id) {
this.group_id = group_id;
}
public Integer getGroup_id() {
return group_id;
}
}
package com.egolm.film.bean;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_admin_menu")
public class Fc_admin_menu implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
private Integer menu_id;
/**
* 0 目录, 1 菜单, 2 按钮,其他
*/
private Integer menu_type;
private Integer parent_id;
private Integer order_num;
private String menu_name;
private String menu_no;
private String menu_link;
private String menu_icon;
/**
* 无参数构造方法
*/
public Fc_admin_menu () {
super();
}
/**
* 全参数构造方法
* @param menu_id
* @param menu_type 0 目录, 1 菜单, 2 按钮,其他
* @param parent_id
* @param order_num
* @param menu_name
* @param menu_no
* @param menu_link
* @param menu_icon
*/
public Fc_admin_menu(Integer menu_id, Integer menu_type, Integer parent_id, Integer order_num, String menu_name, String menu_no, String menu_link, String menu_icon) {
this.menu_id = menu_id;
this.menu_type = menu_type;
this.parent_id = parent_id;
this.order_num = order_num;
this.menu_name = menu_name;
this.menu_no = menu_no;
this.menu_link = menu_link;
this.menu_icon = menu_icon;
}
public void setMenu_id(Integer menu_id) {
this.menu_id = menu_id;
}
public Integer getMenu_id() {
return menu_id;
}
public void setMenu_type(Integer menu_type) {
this.menu_type = menu_type;
}
public Integer getMenu_type() {
return menu_type;
}
public void setParent_id(Integer parent_id) {
this.parent_id = parent_id;
}
public Integer getParent_id() {
return parent_id;
}
public void setOrder_num(Integer order_num) {
this.order_num = order_num;
}
public Integer getOrder_num() {
return order_num;
}
public void setMenu_name(String menu_name) {
this.menu_name = menu_name;
}
public String getMenu_name() {
return menu_name;
}
public void setMenu_no(String menu_no) {
this.menu_no = menu_no;
}
public String getMenu_no() {
return menu_no;
}
public void setMenu_link(String menu_link) {
this.menu_link = menu_link;
}
public String getMenu_link() {
return menu_link;
}
public void setMenu_icon(String menu_icon) {
this.menu_icon = menu_icon;
}
public String getMenu_icon() {
return menu_icon;
}
}
package com.egolm.film.bean;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;
/**
* @author 曲欣亮
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_logs")
public class Fc_logs implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
private Long id;
private String type;
private String loginid;
private String prefix;
private String path;
private String ip;
private String content;
private Date create_time;
/**
* 无参数构造方法
*/
public Fc_logs () {
super();
}
/**
* 全参数构造方法
* @param id
* @param type
* @param loginid
* @param prefix
* @param path
* @param ip
* @param content
* @param create_time
*/
public Fc_logs(Long id, String type, String loginid, String prefix, String path, String ip, String content, Date create_time) {
this.id = id;
this.type = type;
this.loginid = loginid;
this.prefix = prefix;
this.path = path;
this.ip = ip;
this.content = content;
this.create_time = create_time;
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public void setLoginid(String loginid) {
this.loginid = loginid;
}
public String getLoginid() {
return loginid;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getPrefix() {
return prefix;
}
public void setPath(String path) {
this.path = path;
}
public String getPath() {
return path;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getIp() {
return ip;
}
public void setContent(String content) {
this.content = content;
}
public String getContent() {
return content;
}
public void setCreate_time(Date create_time) {
this.create_time = create_time;
}
public Date getCreate_time() {
return create_time;
}
}
package com.egolm.film.bean;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_logs_ext")
public class Fc_logs_ext implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
private String path;
private String ext;
/**
* 无参数构造方法
*/
public Fc_logs_ext () {
super();
}
/**
* 全参数构造方法
* @param path
* @param ext
*/
public Fc_logs_ext(String path, String ext) {
this.path = path;
this.ext = ext;
}
public void setPath(String path) {
this.path = path;
}
public String getPath() {
return path;
}
public void setExt(String ext) {
this.ext = ext;
}
public String getExt() {
return ext;
}
}
......@@ -6,7 +6,7 @@ import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-19
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_member")
......
......@@ -6,7 +6,7 @@ import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-19
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_member_film")
......
......@@ -6,7 +6,7 @@ import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-19
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_member_film_all")
......
......@@ -6,7 +6,7 @@ import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-19
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_member_film_director")
......
......@@ -6,7 +6,7 @@ import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-19
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_member_film_issuer")
......
......@@ -6,7 +6,7 @@ import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-19
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_member_film_playactor")
......
......@@ -6,7 +6,7 @@ import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-19
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_member_film_show")
......
......@@ -6,7 +6,7 @@ import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-19
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_user")
......
package com.egolm.film.bean;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* @author 曲欣亮
* @since 2018-11-23
* @version v-1.0
*/
@Entity(name="fc_user_group")
public class Fc_user_group implements java.io.Serializable {
private static final long serialVersionUID = 1L;
/**
* 用户组id
*/
@Id
private Integer group_id;
/**
* 小组名称
*/
private String group_name;
/**
* 创建时间
*/
private Long create_time;
/**
* 创建者ip
*/
private String create_ip;
/**
* 管理员id
*/
private Long adminid;
/**
* 小组状态
*/
private Integer state;
/**
* 权限
*/
private String power;
/**
* 成员数量
*/
private Long user_num;
/**
* 工作介绍
*/
private String job_desc;
/**
* 无参数构造方法
*/
public Fc_user_group () {
super();
}
/**
* 全参数构造方法
* @param group_id 用户组id
* @param group_name 小组名称
* @param create_time 创建时间
* @param create_ip 创建者ip
* @param adminid 管理员id
* @param state 小组状态
* @param power 权限
* @param user_num 成员数量
* @param job_desc 工作介绍
*/
public Fc_user_group(Integer group_id, String group_name, Long create_time, String create_ip, Long adminid, Integer state, String power, Long user_num, String job_desc) {
this.group_id = group_id;
this.group_name = group_name;
this.create_time = create_time;
this.create_ip = create_ip;
this.adminid = adminid;
this.state = state;
this.power = power;
this.user_num = user_num;
this.job_desc = job_desc;
}
public void setGroup_id(Integer group_id) {
this.group_id = group_id;
}
public Integer getGroup_id() {
return group_id;
}
public void setGroup_name(String group_name) {
this.group_name = group_name;
}
public String getGroup_name() {
return group_name;
}
public void setCreate_time(Long create_time) {
this.create_time = create_time;
}
public Long getCreate_time() {
return create_time;
}
public void setCreate_ip(String create_ip) {
this.create_ip = create_ip;
}
public String getCreate_ip() {
return create_ip;
}
public void setAdminid(Long adminid) {
this.adminid = adminid;
}
public Long getAdminid() {
return adminid;
}
public void setState(Integer state) {
this.state = state;
}
public Integer getState() {
return state;
}
public void setPower(String power) {
this.power = power;
}
public String getPower() {
return power;
}
public void setUser_num(Long user_num) {
this.user_num = user_num;
}
public Long getUser_num() {
return user_num;
}
public void setJob_desc(String job_desc) {
this.job_desc = job_desc;
}
public String getJob_desc() {
return job_desc;
}
}
......@@ -14,7 +14,7 @@ public class DBUtil {
"film_new",
"root",
"egolm#2018");
mysqlTo.execute("fc_admin_group");
mysqlTo.execute();
}
}
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