Forráskód Böngészése

菜单查询代码推送

wuxw 6 éve%!(EXTRA string=óta)
szülő
commit
e1e609f544

+ 16 - 4
Api/src/main/java/com/java110/api/listener/menu/ListMenusListener.java

@@ -3,16 +3,28 @@ package com.java110.api.listener.menu;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.api.listener.AbstractServiceApiListener;
 import com.java110.api.listener.AbstractServiceApiListener;
 import com.java110.common.constant.ServiceCodeMenuConstant;
 import com.java110.common.constant.ServiceCodeMenuConstant;
+import com.java110.common.util.BeanConvertUtil;
 import com.java110.core.annotation.Java110Listener;
 import com.java110.core.annotation.Java110Listener;
 import com.java110.core.context.DataFlowContext;
 import com.java110.core.context.DataFlowContext;
 import com.java110.core.smo.menu.IMenuInnerServiceSMO;
 import com.java110.core.smo.menu.IMenuInnerServiceSMO;
+import com.java110.dto.menu.MenuDto;
+import com.java110.dto.menuGroup.MenuGroupDto;
 import com.java110.event.service.api.ServiceDataFlowEvent;
 import com.java110.event.service.api.ServiceDataFlowEvent;
+import com.java110.vo.api.menu.ApiMenuDataVo;
+import com.java110.vo.api.menu.ApiMenuVo;
+import com.java110.vo.api.menuGroup.ApiMenuGroupDataVo;
+import com.java110.vo.api.menuGroup.ApiMenuGroupVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
 
 
 
 
 /**
 /**
- * 查询小区侦听类
+ * 查询菜单
  */
  */
 @Java110Listener("listMenusListener")
 @Java110Listener("listMenusListener")
 public class ListMenusListener extends AbstractServiceApiListener {
 public class ListMenusListener extends AbstractServiceApiListener {
@@ -52,8 +64,7 @@ public class ListMenusListener extends AbstractServiceApiListener {
 
 
     @Override
     @Override
     protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
     protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
-
-        /*MenuDto menuDto = BeanConvertUtil.covertBean(reqJson, MenuDto.class);
+        MenuDto menuDto = BeanConvertUtil.covertBean(reqJson, MenuDto.class);
 
 
         int count = menuInnerServiceSMOImpl.queryMenusCount(menuDto);
         int count = menuInnerServiceSMOImpl.queryMenusCount(menuDto);
 
 
@@ -73,7 +84,8 @@ public class ListMenusListener extends AbstractServiceApiListener {
 
 
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiMenuVo), HttpStatus.OK);
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(JSONObject.toJSONString(apiMenuVo), HttpStatus.OK);
 
 
-        context.setResponseEntity(responseEntity);*/
+        context.setResponseEntity(responseEntity);
+
 
 
     }
     }
 }
 }

+ 41 - 3
CommunityService/src/main/java/com/java110/community/dao/IMenuServiceDao.java

@@ -88,11 +88,49 @@ public interface IMenuServiceDao {
 
 
 
 
     /**
     /**
-     * 查询路由总数
+     * 查询菜单总数
      *
      *
-     * @param info 路由信息
-     * @return 路由数量
+     * @param info 菜单信息
+     * @return 菜单数量
      */
      */
     int queryBasePrivilegesCount(Map info);
     int queryBasePrivilegesCount(Map info);
 
 
+
+    /**
+     * 保存 菜单信息 Business数据到 Instance中
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    int saveMenuInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询菜单信息(instance过程)
+     * 根据bId 查询菜单信息
+     * @param info bId 信息
+     * @return 菜单信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getMenuInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改菜单信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    int updateMenuInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询菜单总数
+     *
+     * @param info 菜单信息
+     * @return 菜单数量
+     */
+    int queryMenusCount(Map info);
+
 }
 }

+ 65 - 0
CommunityService/src/main/java/com/java110/community/dao/impl/MenuServiceDaoImpl.java

@@ -149,4 +149,69 @@ public class MenuServiceDaoImpl extends BaseServiceDao implements IMenuServiceDa
         return Integer.parseInt(businessBasePrivilegeInfos.get(0).get("count").toString());
         return Integer.parseInt(businessBasePrivilegeInfos.get(0).get("count").toString());
     }
     }
 
 
+
+
+    /**
+     * 保存路由信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int saveMenuInfo(Map info) throws DAOException {
+        logger.debug("保存路由信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("menuServiceDaoImpl.saveMenuInfo",info);
+
+        return saveFlag;
+    }
+
+
+    /**
+     * 查询路由信息(instance)
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getMenuInfo(Map info) throws DAOException {
+        logger.debug("查询路由信息 入参 info : {}",info);
+
+        List<Map> businessMenuInfos = sqlSessionTemplate.selectList("menuServiceDaoImpl.getMenuInfo",info);
+
+        return businessMenuInfos;
+    }
+
+
+    /**
+     * 修改路由信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int updateMenuInfo(Map info) throws DAOException {
+        logger.debug("修改路由信息Instance 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("menuServiceDaoImpl.updateMenuInfo",info);
+
+        return saveFlag;
+    }
+
+    /**
+     * 查询路由数量
+     * @param info 路由信息
+     * @return 路由数量
+     */
+    @Override
+    public int queryMenusCount(Map info) {
+        logger.debug("查询路由数据 入参 info : {}",info);
+
+        List<Map> businessMenuInfos = sqlSessionTemplate.selectList("menuServiceDaoImpl.queryMenusCount", info);
+        if (businessMenuInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessMenuInfos.get(0).get("count").toString());
+    }
+
+
 }
 }

+ 42 - 0
CommunityService/src/main/java/com/java110/community/smo/impl/MenuInnerServiceSMOImpl.java

@@ -7,6 +7,7 @@ import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.core.smo.menu.IMenuInnerServiceSMO;
 import com.java110.core.smo.menu.IMenuInnerServiceSMO;
 import com.java110.dto.PageDto;
 import com.java110.dto.PageDto;
 import com.java110.dto.basePrivilege.BasePrivilegeDto;
 import com.java110.dto.basePrivilege.BasePrivilegeDto;
+import com.java110.dto.menu.MenuDto;
 import com.java110.dto.menuGroup.MenuGroupDto;
 import com.java110.dto.menuGroup.MenuGroupDto;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -113,4 +114,45 @@ public class MenuInnerServiceSMOImpl extends BaseServiceSMO implements IMenuInne
     @Override
     @Override
     public int queryBasePrivilegesCount(@RequestBody BasePrivilegeDto basePrivilegeDto) {
     public int queryBasePrivilegesCount(@RequestBody BasePrivilegeDto basePrivilegeDto) {
         return menuServiceDaoImpl.queryBasePrivilegesCount(BeanConvertUtil.beanCovertMap(basePrivilegeDto));    }
         return menuServiceDaoImpl.queryBasePrivilegesCount(BeanConvertUtil.beanCovertMap(basePrivilegeDto));    }
+
+
+
+    @Override
+    public List<MenuDto> queryMenus(@RequestBody  MenuDto menuDto) {
+
+        //校验是否传了 分页信息
+
+        int page = menuDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            menuDto.setPage((page - 1) * menuDto.getRow());
+            menuDto.setRow(page * menuDto.getRow());
+        }
+
+        List<MenuDto> menus = BeanConvertUtil.covertBeanList(menuServiceDaoImpl.getMenuInfo(BeanConvertUtil.beanCovertMap(menuDto)), MenuDto.class);
+
+
+        return menus;
+    }
+
+    @Override
+    public int updateMenu(@RequestBody MenuDto menuDto) {
+        return menuServiceDaoImpl.updateMenuInfo(BeanConvertUtil.beanCovertMap(menuDto));
+    }
+
+    @Override
+    public int saveMenu(@RequestBody MenuDto menuDto) {
+        return menuServiceDaoImpl.saveMenuInfo(BeanConvertUtil.beanCovertMap(menuDto));
+    }
+
+    @Override
+    public int deleteMenu(@RequestBody MenuDto menuDto) {
+        menuDto.setStatusCd("1");
+        return menuServiceDaoImpl.updateMenuInfo(BeanConvertUtil.beanCovertMap(menuDto));
+    }
+
+    @Override
+    public int queryMenusCount(@RequestBody MenuDto menuDto) {
+        return menuServiceDaoImpl.queryMenusCount(BeanConvertUtil.beanCovertMap(menuDto));    }
+
 }
 }

+ 4 - 5
WebService/src/main/java/com/java110/web/smo/menu/impl/EditMenuSMOImpl.java

@@ -29,11 +29,10 @@ public class EditMenuSMOImpl extends AbstractComponentSMO implements IEditMenuSM
         //super.validatePageInfo(pd);
         //super.validatePageInfo(pd);
 
 
         Assert.hasKeyAndValue(paramIn, "mId", "菜单ID不能为空");
         Assert.hasKeyAndValue(paramIn, "mId", "菜单ID不能为空");
-Assert.hasKeyAndValue(paramIn, "name", "必填,请填写菜单名称");
-Assert.hasKeyAndValue(paramIn, "url", "必填,请菜单菜单地址");
-Assert.hasKeyAndValue(paramIn, "seq", "必填,请填写序列");
-Assert.hasKeyAndValue(paramIn, "isShow", "必填,请选择是否显示菜单");
-
+        Assert.hasKeyAndValue(paramIn, "name", "必填,请填写菜单名称");
+        Assert.hasKeyAndValue(paramIn, "url", "必填,请菜单菜单地址");
+        Assert.hasKeyAndValue(paramIn, "seq", "必填,请填写序列");
+        Assert.hasKeyAndValue(paramIn, "isShow", "必填,请选择是否显示菜单");
 
 
 
 
         super.checkUserHasPrivilege(pd, restTemplate, PrivilegeCodeConstant.MENU_MANAGE);
         super.checkUserHasPrivilege(pd, restTemplate, PrivilegeCodeConstant.MENU_MANAGE);

+ 80 - 0
java110-bean/src/main/java/com/java110/dto/menu/MenuDto.java

@@ -0,0 +1,80 @@
+package com.java110.dto.menu;
+
+import com.java110.dto.PageDto;
+
+import java.io.Serializable;
+
+public class MenuDto extends PageDto implements Serializable {
+
+    private String mId;
+    private String name;
+    private String url;
+    private String seq;
+    private String isShow;
+    private String description;
+    private String statusCd;
+
+    public String getMId() {
+        return mId;
+    }
+
+    public void setMId(String mId) {
+        this.mId = mId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getSeq() {
+        return seq;
+    }
+
+    public void setSeq(String seq) {
+        this.seq = seq;
+    }
+
+    public String getIsShow() {
+        return isShow;
+    }
+
+    public void setIsShow(String isShow) {
+        this.isShow = isShow;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getmId() {
+        return mId;
+    }
+
+    public void setmId(String mId) {
+        this.mId = mId;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+}

+ 35 - 18
java110-bean/src/main/java/com/java110/vo/api/menu/ApiMenuDataVo.java

@@ -6,48 +6,65 @@ import java.util.Date;
 public class ApiMenuDataVo implements Serializable {
 public class ApiMenuDataVo implements Serializable {
 
 
     private String mId;
     private String mId;
-private String name;
-private String url;
-private String seq;
-private String isShow;
-private String description;
-public String getMId() {
+    private String name;
+    private String url;
+    private String seq;
+    private String isShow;
+    private String description;
+
+    public String getMId() {
         return mId;
         return mId;
     }
     }
-public void setMId(String mId) {
+
+    public void setMId(String mId) {
         this.mId = mId;
         this.mId = mId;
     }
     }
-public String getName() {
+
+    public String getName() {
         return name;
         return name;
     }
     }
-public void setName(String name) {
+
+    public void setName(String name) {
         this.name = name;
         this.name = name;
     }
     }
-public String getUrl() {
+
+    public String getUrl() {
         return url;
         return url;
     }
     }
-public void setUrl(String url) {
+
+    public void setUrl(String url) {
         this.url = url;
         this.url = url;
     }
     }
-public String getSeq() {
+
+    public String getSeq() {
         return seq;
         return seq;
     }
     }
-public void setSeq(String seq) {
+
+    public void setSeq(String seq) {
         this.seq = seq;
         this.seq = seq;
     }
     }
-public String getIsShow() {
+
+    public String getIsShow() {
         return isShow;
         return isShow;
     }
     }
-public void setIsShow(String isShow) {
+
+    public void setIsShow(String isShow) {
         this.isShow = isShow;
         this.isShow = isShow;
     }
     }
-public String getDescription() {
+
+    public String getDescription() {
         return description;
         return description;
     }
     }
-public void setDescription(String description) {
+
+    public void setDescription(String description) {
         this.description = description;
         this.description = description;
     }
     }
 
 
+    public String getmId() {
+        return mId;
+    }
 
 
-
+    public void setmId(String mId) {
+        this.mId = mId;
+    }
 }
 }

+ 50 - 0
java110-core/src/main/java/com/java110/core/smo/menu/IMenuInnerServiceSMO.java

@@ -2,6 +2,7 @@ package com.java110.core.smo.menu;
 
 
 import com.java110.core.feign.FeignConfiguration;
 import com.java110.core.feign.FeignConfiguration;
 import com.java110.dto.basePrivilege.BasePrivilegeDto;
 import com.java110.dto.basePrivilege.BasePrivilegeDto;
+import com.java110.dto.menu.MenuDto;
 import com.java110.dto.menuGroup.MenuGroupDto;
 import com.java110.dto.menuGroup.MenuGroupDto;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -117,4 +118,53 @@ public interface IMenuInnerServiceSMO {
     int deleteBasePrivilege(@RequestBody BasePrivilegeDto routeDto);
     int deleteBasePrivilege(@RequestBody BasePrivilegeDto routeDto);
 
 
 
 
+
+
+    /**
+     * <p>查询菜单信息</p>
+     *
+     * @param routeDto 数据对象分享
+     * @return MenuGroupDto 对象数据
+     */
+    @RequestMapping(value = "/queryMenus", method = RequestMethod.POST)
+    List<MenuDto> queryMenus(@RequestBody MenuDto routeDto);
+
+    /**
+     * 查询<p>菜单</p>总记录数
+     *
+     * @param routeDto 数据对象分享
+     * @return 菜单记录数
+     */
+    @RequestMapping(value = "/queryMenusCount", method = RequestMethod.POST)
+    int queryMenusCount(@RequestBody MenuDto routeDto);
+
+    /**
+     * <p>修改菜单信息</p>
+     *
+     * @param routeDto 数据对象分享
+     * @return ServiceDto 对象数据
+     */
+    @RequestMapping(value = "/updateMenu", method = RequestMethod.POST)
+    int updateMenu(@RequestBody MenuDto routeDto);
+
+
+    /**
+     * <p>添加菜单信息</p>
+     *
+     * @param routeDto 数据对象分享
+     * @return MenuDto 对象数据
+     */
+    @RequestMapping(value = "/saveMenu", method = RequestMethod.POST)
+    int saveMenu(@RequestBody MenuDto routeDto);
+
+    /**
+     * <p>删除菜单信息</p>
+     *
+     * @param routeDto 数据对象分享
+     * @return MenuDto 对象数据
+     */
+    @RequestMapping(value = "/deleteMenu", method = RequestMethod.POST)
+    int deleteMenu(@RequestBody MenuDto routeDto);
+
+
 }
 }

+ 114 - 0
java110-db/src/main/resources/mapper/menu/MenuServiceDaoImplMapper.xml

@@ -177,4 +177,118 @@
         </if>
         </if>
     </select>
     </select>
 
 
+
+
+    <!-- 保存路由信息至 instance表中 add by wuxw 2018-07-03 -->
+    <insert id="saveMenuInfo" parameterType="Map">
+        insert into m_menu(
+           m_id,name,g_id,url,seq,p_id,description,is_show
+        ) values (
+            #{mId},#{name},#{gId},#{url},#{seq},#{pId},#{description},#{isShow}
+        )
+    </insert>
+
+
+    <!-- 查询路由信息 add by wuxw 2018-07-03 -->
+    <select id="getMenuInfo" parameterType="Map" resultType="Map">
+        select t.m_id mId,t.name,t.g_id gId,t.url,t.seq,t.p_id pId,t.description,t.is_show isShow
+        from m_menu t
+        where t.status_cd= '0'
+        <if test="gId !=null and gId != ''">
+            and t.g_id= #{gId}
+        </if>
+        <if test="name !=null and name != ''">
+            and t.name like concat('%',#{name},'%')
+        </if>
+        <if test="mId !=null and mId != ''">
+            and t.m_id= #{mId}
+        </if>
+        <if test="pId !=null and pId != ''">
+            and t.p_id= #{pId}
+        </if>
+        <if test="isShow !=null and isShow != ''">
+            and t.is_show= #{isShow}
+        </if>
+        <if test="url !=null and url != ''">
+            and t.url like concat('%',#{url},'%')
+        </if>
+        <if test="seq !=null">
+            and t.seq= #{seq}
+        </if>
+        <if test="description !=null and description != ''">
+            and t.description= #{description}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+
+    </select>
+
+
+    <!-- 修改路由信息
+  ,t.description,t.is_show isShow
+    add by wuxw 2018-07-03 -->
+    <update id="updateMenuInfo" parameterType="Map">
+        update m_menu t
+        <set>
+            <if test="statusCd !=null and statusCd != ''">
+                t.status_cd = #{statusCd},
+            </if>
+            <if test="name !=null and name != ''">
+                t.name= #{name},
+            </if>
+            <if test="gId !=null and gId != ''">
+                t.g_id= #{gId},
+            </if>
+            <if test="url !=null and url != ''">
+                t.url= #{url},
+            </if>
+            <if test="seq !=null ">
+                t.seq= #{seq},
+            </if>
+            <if test="isShow !=null and isShow != ''">
+                t.is_show= #{isShow},
+            </if>
+            <if test="description !=null and description != ''">
+                t.description= #{description}
+            </if>
+        </set>
+        where t.m_id= #{mId}
+
+    </update>
+
+    <!-- 查询路由数量 add by wuxw 2018-07-03 -->
+    <select id="queryMenusCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from m_menu t
+        where t.status_cd= '0'
+        <if test="gId !=null and gId != ''">
+            and t.g_id= #{gId}
+        </if>
+        <if test="name !=null and name != ''">
+            and t.name like concat('%',#{name},'%')
+        </if>
+        <if test="mId !=null and mId != ''">
+            and t.m_id= #{mId}
+        </if>
+        <if test="pId !=null and pId != ''">
+            and t.p_id= #{pId}
+        </if>
+        <if test="isShow !=null and isShow != ''">
+            and t.is_show= #{isShow}
+        </if>
+        <if test="url !=null and url != ''">
+            and t.url like concat('%',#{url},'%')
+        </if>
+        <if test="seq !=null">
+            and t.seq= #{seq}
+        </if>
+        <if test="description !=null and description != ''">
+            and t.description= #{description}
+        </if>
+        order by t.create_time desc
+    </select>
+
+
 </mapper>
 </mapper>