|
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.hb.proj.model.MenuPO;
|
|
import com.hb.proj.model.MenuPO;
|
|
|
|
+import com.hb.proj.model.MenuVO;
|
|
import com.hb.proj.utils.PinyinFromHanzi;
|
|
import com.hb.proj.utils.PinyinFromHanzi;
|
|
import com.hb.xframework.dao.core.SpringJdbcDAO;
|
|
import com.hb.xframework.dao.core.SpringJdbcDAO;
|
|
import com.hb.xframework.dao.util.UUIDHexGenerator;
|
|
import com.hb.xframework.dao.util.UUIDHexGenerator;
|
|
@@ -30,21 +31,20 @@ public class MenuService {
|
|
return dao.queryForList(sql.toString(),fatherMenuId);
|
|
return dao.queryForList(sql.toString(),fatherMenuId);
|
|
}
|
|
}
|
|
|
|
|
|
- public Map<String,Object> getMenu(String menuId){
|
|
|
|
|
|
+ public MenuVO getMenu(String menuId){
|
|
StringBuilder sql=new StringBuilder(100);
|
|
StringBuilder sql=new StringBuilder(100);
|
|
sql.append("select menu.*,");
|
|
sql.append("select menu.*,");
|
|
sql.append("(select sm.menu_name from tsys_menu sm where sm.menu_id=menu.father_menu_id) father_menu_name");
|
|
sql.append("(select sm.menu_name from tsys_menu sm where sm.menu_id=menu.father_menu_id) father_menu_name");
|
|
sql.append(" from tsys_menu menu where menu.menu_id=?");
|
|
sql.append(" from tsys_menu menu where menu.menu_id=?");
|
|
- return dao.queryForMap(sql.toString(), menuId);
|
|
|
|
|
|
+ return dao.queryForPojo(sql.toString(),MenuVO.class, menuId);
|
|
}
|
|
}
|
|
|
|
|
|
public String addMenu(MenuPO menu){
|
|
public String addMenu(MenuPO menu){
|
|
UUIDHexGenerator uuid=new UUIDHexGenerator();
|
|
UUIDHexGenerator uuid=new UUIDHexGenerator();
|
|
- menu.setModifyTime(new Date());
|
|
|
|
menu.setMenuId(uuid.generate());
|
|
menu.setMenuId(uuid.generate());
|
|
- if(StringUtils.isEmpty(menu.getFatherMenuId())){
|
|
|
|
- menu.setFatherMenuId("0");
|
|
|
|
- }
|
|
|
|
|
|
+ menu.setModifyTime(new Date());
|
|
|
|
+ menu.setCreateTime(new Date());
|
|
|
|
+ menu.setDelIf(false);
|
|
if(menu.getDisplayNum()==null){
|
|
if(menu.getDisplayNum()==null){
|
|
Number num=getMenuMaxDispNum(menu.getFatherMenuId());
|
|
Number num=getMenuMaxDispNum(menu.getFatherMenuId());
|
|
menu.setDisplayNum(num==null?0:(num.intValue()+1));
|
|
menu.setDisplayNum(num==null?0:(num.intValue()+1));
|
|
@@ -54,9 +54,9 @@ public class MenuService {
|
|
//增加菜单的时候,自动增加浏览功能项
|
|
//增加菜单的时候,自动增加浏览功能项
|
|
Map<String,Object> fun=new HashMap<String,Object>();
|
|
Map<String,Object> fun=new HashMap<String,Object>();
|
|
fun.put("funId", uuid.generate());
|
|
fun.put("funId", uuid.generate());
|
|
- fun.put("createTime", new Date());
|
|
|
|
|
|
+ fun.put("modifyTime", new Date());
|
|
fun.put("menuId",menu.getMenuId());
|
|
fun.put("menuId",menu.getMenuId());
|
|
- fun.put("createBy", menu.getModifyBy());
|
|
|
|
|
|
+ fun.put("modifyBy", menu.getModifyBy());
|
|
fun.put("funCode", PinyinFromHanzi.getPinyin(menu.getMenuName()).toUpperCase()+"_BROWSE");
|
|
fun.put("funCode", PinyinFromHanzi.getPinyin(menu.getMenuName()).toUpperCase()+"_BROWSE");
|
|
fun.put("funName", "浏览");
|
|
fun.put("funName", "浏览");
|
|
|
|
|
|
@@ -102,11 +102,11 @@ public class MenuService {
|
|
superAssistCode="C";
|
|
superAssistCode="C";
|
|
}
|
|
}
|
|
else{
|
|
else{
|
|
- Map<String,Object> superMenu=getMenu(superId);
|
|
|
|
|
|
+ MenuVO superMenu=getMenu(superId);
|
|
if(superMenu==null){
|
|
if(superMenu==null){
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
- superAssistCode=(String)superMenu.get("assistCode");
|
|
|
|
|
|
+ superAssistCode=superMenu.getAssistCode();
|
|
if(StringUtils.isEmpty(superAssistCode)){
|
|
if(StringUtils.isEmpty(superAssistCode)){
|
|
superAssistCode="C";
|
|
superAssistCode="C";
|
|
}
|
|
}
|