// package com.fgkj.services;
|
//
|
// import java.util.List;
|
//
|
// import com.fgkj.mapper.BaseDAO;
|
// import com.fgkj.mapper.BaseDAOFactory;
|
//
|
// import com.fgkj.dto.Limit;
|
// import com.fgkj.dto.RoleLimit;
|
// import com.fgkj.dto.Roles;
|
// import com.fgkj.dto.ServiceModel;
|
//
|
// public class RolesService {
|
//
|
//
|
// private Impl mapper;;
|
// private BaseDAO dao1;
|
// private BaseDAO dao2;
|
//
|
// ServiceModel model = new ServiceModel();
|
//
|
// public RolesService() {
|
// dao=BaseDAOFactory.getBaseDAO(BaseDAO.ROLES);
|
// dao1=BaseDAOFactory.getBaseDAO(BaseDAO.ROLELIMIT);
|
// dao2=BaseDAOFactory.getBaseDAO(BaseDAO.LIMIT);
|
// model=new ServiceModel();
|
// }
|
//
|
// public ServiceModel addRoles(Object obj){
|
// Roles r=(Roles) obj;
|
// RoleLimit rl = null;
|
// Boolean bl=false;
|
// Boolean bln=false;
|
// List<Roles> list=dao.serchByCondition(r);
|
//
|
// if(list.isEmpty()){
|
// bl=dao.add(r);
|
// if(bl==true){
|
// model.setCode(1);
|
// model.setMsg("添加成功");
|
// }
|
// else{
|
// model.setMsg("添加失败");
|
// }
|
//
|
// List l=dao.serchByCondition(r);
|
//
|
// Roles role=(Roles) l.get(0);
|
// //System.out.println(role.getRid());
|
//
|
// Limit limit=new Limit();
|
// List<Limit> ls=dao2.searchAll();
|
//
|
//
|
// for(Limit lt:ls){
|
// //System.out.println(lt);
|
// limit=lt;
|
// rl=new RoleLimit(role,limit);
|
// bln=dao1.add(rl);
|
// }
|
// }
|
// return model;
|
// }
|
//
|
//
|
// public ServiceModel delRoles(Object obj){
|
// Roles role=(Roles) obj;
|
// Roles r=new Roles();
|
// RoleLimit rl=null;
|
// List<Roles> l=dao.serchByCondition(role);
|
// //System.out.println(l.size());
|
// for(Roles rs:l){
|
// r=rs;
|
// rl=new RoleLimit(r);
|
// rl.setRl_flag(1);
|
// dao1.del(rl);
|
// }
|
//
|
// if(dao.del(role)){
|
// model.setCode(1);
|
// model.setMsg("删除成功");
|
// }else{
|
// model.setMsg("删除失败");
|
//
|
// }
|
// return model;
|
// }
|
//
|
// public ServiceModel updateRoles(Object obj){
|
// Roles r=(Roles) obj;
|
// List<Roles> list=dao.serchByCondition(r);
|
//
|
// if(!list.isEmpty()){
|
// if(dao.update(r)){
|
// model.setCode(1);
|
// model.setMsg("修改成功");
|
//
|
// }else{
|
// model.setMsg("修改失败");
|
// }
|
// }else{
|
// model.setMsg("修改失败");
|
// }
|
// return model;
|
// }
|
//
|
// public ServiceModel findRoles(Object obj){
|
// Roles r=(Roles) obj;
|
// List<Roles> list=dao.serchByCondition(r);
|
// //System.out.println(list.size());
|
// if(list!=null && list.size()>0){
|
// model.setData(list);
|
// model.setCode(1);
|
// }else{
|
// model.setMsg("查询失败");
|
// }
|
// // for(Roles rl:list){
|
// // System.out.println(rl);
|
// // }
|
// return model;
|
// }
|
//
|
// public ServiceModel findRolesAll(){
|
// List<Roles> list=dao.searchAll();
|
// if(list!=null && list.size()>0){
|
// model.setCode(1);
|
// model.setData(list);
|
// }
|
// for(Roles r:list){
|
// //System.out.println(r);
|
// }
|
// return model;
|
// }
|
//
|
// public ServiceModel findByInfo(Object obj){
|
// Roles r=(Roles) obj;
|
// List list=dao.serchByInfo(r);
|
// if(list==null || list.size()<1){
|
// model.setMsg("没有匹配的角色");
|
// }else{
|
// model.setData(list);
|
// model.setCode(1);
|
// }
|
// return model;
|
// }
|
//
|
// }
|