Commit 644ef01b by zhiwj

Merge branch 'developer' of…

Merge branch 'developer' of http://115.159.76.241/base_platform_enterprise/gic-platform-auth into developer
parents c8c347fd 18eb1d44
package com.gic.auth.dao.mapper;
import com.gic.auth.entity.TabMenu;
import com.gic.auth.entity.TabSysMenu;
import java.util.List;
public interface TabMenuMapper {
public interface TabSysMenuMapper {
/**
* 根据主键删除
*
......@@ -19,7 +19,7 @@ public interface TabMenuMapper {
* @param record 实体对象
* @return 更新条目数
*/
int insert(TabMenu record);
int insert(TabSysMenu record);
/**
* 动态插入一条记录
......@@ -27,7 +27,7 @@ public interface TabMenuMapper {
* @param record 实体对象
* @return 更新条目数
*/
int insertSelective(TabMenu record);
int insertSelective(TabSysMenu record);
/**
* 根据主键查询
......@@ -35,7 +35,7 @@ public interface TabMenuMapper {
* @param menuId 主键
* @return 实体对象
*/
TabMenu selectByPrimaryKey(Integer menuId);
TabSysMenu selectByPrimaryKey(Integer menuId);
/**
* 根据主键动态更新记录
......@@ -43,7 +43,7 @@ public interface TabMenuMapper {
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKeySelective(TabMenu record);
int updateByPrimaryKeySelective(TabSysMenu record);
/**
* 根据主键更新记录
......@@ -51,7 +51,7 @@ public interface TabMenuMapper {
* @param record 实体对象
* @return 更新条目数
*/
int updateByPrimaryKey(TabMenu record);
int updateByPrimaryKey(TabSysMenu record);
List<TabMenu> listMenu();
List<TabSysMenu> listMenu();
}
\ No newline at end of file
......@@ -3,9 +3,9 @@ package com.gic.auth.entity;
import java.util.Date;
/**
* tab_menu
* tab_sys_menu
*/
public class TabMenu {
public class TabSysMenu {
/**
*
*/
......
package com.gic.auth.service;
import com.gic.auth.entity.TabMenu;
import com.gic.auth.entity.TabSysMenu;
import java.util.List;
public interface MenuService {
List<TabMenu> listMenu();
List<TabSysMenu> listMenu();
TabMenu getMenuById(Integer menuId);
TabSysMenu getMenuById(Integer menuId);
}
package com.gic.auth.service.impl;
import com.gic.auth.dao.mapper.TabMenuMapper;
import com.gic.auth.entity.TabMenu;
import com.gic.auth.dao.mapper.TabSysMenuMapper;
import com.gic.auth.entity.TabSysMenu;
import com.gic.auth.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -10,14 +10,14 @@ import java.util.List;
@Service("menuService")
public class MenuServiceImpl implements MenuService {
@Autowired
private TabMenuMapper tabMenuMapper;
private TabSysMenuMapper tabSysMenuMapper;
@Override
public List<TabMenu> listMenu() {
return this.tabMenuMapper.listMenu();
public List<TabSysMenu> listMenu() {
return this.tabSysMenuMapper.listMenu();
}
@Override
public TabMenu getMenuById(Integer menuId) {
return this.tabMenuMapper.selectByPrimaryKey(menuId);
public TabSysMenu getMenuById(Integer menuId) {
return this.tabSysMenuMapper.selectByPrimaryKey(menuId);
}
}
......@@ -2,10 +2,11 @@ package com.gic.auth.service.outer.impl;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.MenuDTO;
import com.gic.auth.entity.TabMenu;
import com.gic.auth.entity.TabSysMenu;
import com.gic.auth.service.MenuApiService;
import com.gic.auth.service.MenuService;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.utils.UserDetailUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.dubbo.rpc.RpcContext;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -20,21 +21,22 @@ public class MenuApiServiceImpl implements MenuApiService {
@Override
public ServiceResponse<List<MenuDTO>> getUserMenu(Integer userId, Integer enterpriseId, Integer currentMenu) {
System.out.println(RpcContext.getContext().getAttachments());
List<TabMenu> menuList = this.menuService.listMenu();
System.out.println(UserDetailUtils.getUserDetail());
List<TabSysMenu> menuList = this.menuService.listMenu();
int level = 1;
int parentId = 0;
if(currentMenu != null){
TabMenu menu = this.menuService.getMenuById(currentMenu);
TabSysMenu menu = this.menuService.getMenuById(currentMenu);
parentId = menu.getParentId();
level = menu.getLevel()+1;
}
return ServiceResponse.success(this.treeMenu(menuList, level, parentId));
}
private List<MenuDTO> treeMenu(List<TabMenu> menuList, int level, int parentId){
private List<MenuDTO> treeMenu(List<TabSysMenu> menuList, int level, int parentId){
List<MenuDTO> list = new ArrayList<>();
if(level < 5){
for(TabMenu menu : menuList){
for(TabSysMenu menu : menuList){
if(level == menu.getLevel() && menu.getIsShow().intValue() == 1 && menu.getParentId().intValue() == parentId){
MenuDTO menuDTO = EntityUtil.changeEntityByJSON(MenuDTO.class, menu);
menuDTO.setChildren(this.treeMenu(menuList, menu.getLevel().intValue()+1, menuDTO.getMenuId()));
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gic.auth.dao.mapper.TabMenuMapper">
<resultMap id="BaseResultMap" type="com.gic.auth.entity.TabMenu">
<mapper namespace="com.gic.auth.dao.mapper.TabSysMenuMapper">
<resultMap id="BaseResultMap" type="com.gic.auth.entity.TabSysMenu">
<id column="menu_id" jdbcType="INTEGER" property="menuId" />
<result column="menu_name" jdbcType="VARCHAR" property="menuName" />
<result column="project" jdbcType="VARCHAR" property="project" />
......@@ -23,15 +23,15 @@
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_menu
from tab_sys_menu
where menu_id = #{menuId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_menu
delete from tab_sys_menu
where menu_id = #{menuId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.auth.entity.TabMenu">
insert into tab_menu (menu_id, menu_name, project,
<insert id="insert" parameterType="com.gic.auth.entity.TabSysMenu">
insert into tab_sys_menu (menu_id, menu_name, project,
menu_url, parent_id, target,
icon_url, sort, status,
create_time, update_time, level,
......@@ -42,8 +42,8 @@
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{level,jdbcType=INTEGER},
#{isShow,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabMenu">
insert into tab_menu
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabSysMenu">
insert into tab_sys_menu
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="menuId != null">
menu_id,
......@@ -127,8 +127,8 @@
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabMenu">
update tab_menu
<update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabSysMenu">
update tab_sys_menu
<set>
<if test="menuName != null">
menu_name = #{menuName,jdbcType=VARCHAR},
......@@ -169,8 +169,8 @@
</set>
where menu_id = #{menuId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.auth.entity.TabMenu">
update tab_menu
<update id="updateByPrimaryKey" parameterType="com.gic.auth.entity.TabSysMenu">
update tab_sys_menu
set menu_name = #{menuName,jdbcType=VARCHAR},
project = #{project,jdbcType=VARCHAR},
menu_url = #{menuUrl,jdbcType=VARCHAR},
......@@ -188,7 +188,7 @@
<select id="listMenu" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_menu
from tab_sys_menu
where status=1
</select>
</mapper>
\ No newline at end of file
......@@ -20,15 +20,15 @@
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_user
from tab_sys_user
where user_id = #{userId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tab_user
delete from tab_sys_user
where user_id = #{userId,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.gic.auth.entity.TabUser" useGeneratedKeys="true" keyProperty="userId">
insert into tab_user (user_id, user_name, phone_number,
insert into tab_sys_user (user_id, user_name, phone_number,
password, super_admin, status,
create_time, update_time, enterprise_id,
phone_area_code)
......@@ -38,7 +38,7 @@
#{phoneAreaCode,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.gic.auth.entity.TabUser">
insert into tab_user
insert into tab_sys_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
......@@ -105,7 +105,7 @@
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.gic.auth.entity.TabUser">
update tab_user
update tab_sys_user
<set>
<if test="userName != null">
user_name = #{userName,jdbcType=VARCHAR},
......@@ -138,7 +138,7 @@
where user_id = #{userId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.auth.entity.TabUser">
update tab_user
update tab_sys_user
set user_name = #{userName,jdbcType=VARCHAR},
phone_number = #{phoneNumber,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
......@@ -152,7 +152,7 @@
</update>
<select id="countByPhone" resultType="int">
select count(1) from tab_user
select count(1) from tab_sys_user
where status = 1
<if test="userId != null">
user_id <![CDATA[ <> ]]> #{userId}
......@@ -164,7 +164,7 @@
<select id="selectByEnterpriseId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_user
from tab_sys_user
where enterprise_id = #{enterpriseId,jdbcType=INTEGER}
and status = 1
and super_admin = 1
......
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