Commit 2578feeb authored by Quxl's avatar Quxl

管理组权限

parent 90f4352e
...@@ -155,8 +155,8 @@ public class AdminAuthController { ...@@ -155,8 +155,8 @@ public class AdminAuthController {
@ResponseBody @ResponseBody
@PostMapping("updateGroupAuth") @PostMapping("updateGroupAuth")
@ApiOperation("保存或更新管理组权限") @ApiOperation("保存或更新管理组权限")
public Object updateGroupAuth(Integer group_id, Integer[] menu_id) { public Object updateGroupAuth(Integer group_id, Integer[] menu_id, Integer[] film_type) {
service.updateGroupAuth(group_id, menu_id); service.updateGroupAuth(group_id, menu_id, film_type);
return Rjx.jsonOk(); return Rjx.jsonOk();
} }
......
...@@ -23,6 +23,6 @@ public interface AdminAuthService { ...@@ -23,6 +23,6 @@ public interface AdminAuthService {
List<Map<String, Object>> queryGroupAuth(Integer group_id); List<Map<String, Object>> queryGroupAuth(Integer group_id);
void updateGroupAuth(Integer group_id, Integer[] menu_id); void updateGroupAuth(Integer group_id, Integer[] menu_ids, Integer[] film_types);
} }
...@@ -14,6 +14,7 @@ import com.egolm.common.jdbc.Page; ...@@ -14,6 +14,7 @@ import com.egolm.common.jdbc.Page;
import com.egolm.film.api.admin.service.AdminAuthService; import com.egolm.film.api.admin.service.AdminAuthService;
import com.egolm.film.bean.Fc_admin; import com.egolm.film.bean.Fc_admin;
import com.egolm.film.bean.Fc_admin_group; import com.egolm.film.bean.Fc_admin_group;
import com.egolm.film.bean.Fc_admin_group_filmtype;
import com.egolm.film.bean.Fc_admin_group_menu; import com.egolm.film.bean.Fc_admin_group_menu;
import com.egolm.film.config.WebMvcConfig; import com.egolm.film.config.WebMvcConfig;
import com.egolm.film.util.SqlWhere; import com.egolm.film.util.SqlWhere;
...@@ -91,16 +92,25 @@ public class AdminAuthServiceImpl implements AdminAuthService { ...@@ -91,16 +92,25 @@ public class AdminAuthServiceImpl implements AdminAuthService {
@Override @Override
@Transactional @Transactional
public void updateGroupAuth(Integer group_id, Integer[] ids) { public void updateGroupAuth(Integer group_id, Integer[] menu_ids, Integer[] film_types) {
String sql = "delete from fc_admin_group_menu where group_id = ?";
jdbcTemplate.executeUpdate(sql, group_id);
List<Fc_admin_group_menu> agmList = new ArrayList<Fc_admin_group_menu>(); List<Fc_admin_group_menu> agmList = new ArrayList<Fc_admin_group_menu>();
for(Integer menu_id : ids) { for(Integer menu_id : menu_ids) {
Fc_admin_group_menu agm = new Fc_admin_group_menu(); Fc_admin_group_menu agm = new Fc_admin_group_menu();
agm.setGroup_id(group_id); agm.setGroup_id(group_id);
agm.setMenu_id(menu_id); agm.setMenu_id(menu_id);
agmList.add(agm);
} }
List<Fc_admin_group_filmtype> gtypeList = new ArrayList<Fc_admin_group_filmtype>();
for(Integer film_type : film_types) {
Fc_admin_group_filmtype gtype = new Fc_admin_group_filmtype();
gtype.setGroup_id(group_id);
gtype.setFilm_type(film_type);
gtypeList.add(gtype);
}
jdbcTemplate.executeUpdate("delete from fc_admin_group_menu where group_id = ?", group_id);
jdbcTemplate.batchSave(agmList); jdbcTemplate.batchSave(agmList);
jdbcTemplate.executeUpdate("delete from fc_admin_group_filmtype where group_id = ?", group_id);
jdbcTemplate.batchSave(gtypeList);
} }
......
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_filmtype")
public class Fc_admin_group_filmtype implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
private Integer group_id;
@Id
private Integer film_type;
/**
* 无参数构造方法
*/
public Fc_admin_group_filmtype () {
super();
}
/**
* 全参数构造方法
* @param group_id
* @param film_type
*/
public Fc_admin_group_filmtype(Integer group_id, Integer film_type) {
this.group_id = group_id;
this.film_type = film_type;
}
public void setGroup_id(Integer group_id) {
this.group_id = group_id;
}
public Integer getGroup_id() {
return group_id;
}
public void setFilm_type(Integer film_type) {
this.film_type = film_type;
}
public Integer getFilm_type() {
return film_type;
}
}
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