Commit 6504702d by 陶光胜

获取超级管理员菜单接口

parent 9c413dc8
......@@ -5,7 +5,8 @@ public enum ResourceTypeEnum {
FWH_RESOURCE(2, "服务号资源"),
APPLET_RESOURCE(3, "小程序资源"),
STORE_RESOURCE(4, "门店资源"),
GOODS_RESOURCE(5, "商品资源");
GOODS_RESOURCE(5, "商品资源"),
ORDER_RESOURCE(6,"订单资源");
private Integer code;
private String message;
......
......@@ -44,6 +44,7 @@ public class UnionEnterpriseDTO implements Serializable {
private Long appletResourceId;
private Long storeResourceId;
private Long goodsResourceId;
private Long orderResourceId;
public Integer getUnionId() {
return unionId;
......@@ -140,4 +141,12 @@ public class UnionEnterpriseDTO implements Serializable {
public void setGoodsResourceId(Long goodsResourceId) {
this.goodsResourceId = goodsResourceId;
}
public Long getOrderResourceId() {
return orderResourceId;
}
public void setOrderResourceId(Long orderResourceId) {
this.orderResourceId = orderResourceId;
}
}
\ No newline at end of file
package com.gic.auth.service;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.UnionEnterpriseDTO;
......@@ -11,4 +12,7 @@ public interface UnionEnterpriseApiService {
ServiceResponse<Integer> delUnionEnterprise(Integer unionId, Integer enterpriseId);
ServiceResponse<UnionEnterpriseDTO> getUnionEnterpriseById(Integer unionId);
ServiceResponse<Page<UnionEnterpriseDTO>> pageUnionEnterprise(String search, Integer enterpriseId, Integer pageNum,
Integer pageSize, Integer authorizationStatus);
}
package com.gic.auth.dao.mapper;
import com.gic.auth.entity.TabSysUnionEnterprise;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -55,4 +56,8 @@ public interface TabSysUnionEnterpriseMapper {
int updateByPrimaryKey(TabSysUnionEnterprise record);
List<TabSysUnionEnterprise> getEnterpriseByUnionEnterpriseId(@Param("unionEnterpriseId") Integer unionEnterpriseId);
Page<TabSysUnionEnterprise> pageUnionEnterprise(@Param("enterpriseId") Integer enterpriseId,
@Param("authorizationStatus") Integer authorizationStatus,
@Param("search") String search);
}
\ No newline at end of file
package com.gic.auth.service;
import com.gic.auth.entity.TabSysUnionEnterprise;
import com.github.pagehelper.Page;
public interface UnionEnterpriseService {
int saveUnionEnterprise(TabSysUnionEnterprise tabSysUnionEnterprise);
......@@ -12,4 +13,6 @@ public interface UnionEnterpriseService {
int delUnionEnterprise(Integer id);
TabSysUnionEnterprise getUnionEnterpriseById(Integer unionId);
Page<TabSysUnionEnterprise> pageUnionEnterprise(Integer enterpriseId, Integer authorizationStatus, String search);
}
......@@ -4,6 +4,7 @@ import com.gic.auth.dao.mapper.TabSysUnionEnterpriseMapper;
import com.gic.auth.entity.TabSysUnionEnterprise;
import com.gic.auth.service.UnionEnterpriseService;
import com.gic.enterprise.constants.Constants;
import com.github.pagehelper.Page;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -46,4 +47,9 @@ public class UnionEnterpriseServiceImpl implements UnionEnterpriseService {
public TabSysUnionEnterprise getUnionEnterpriseById(Integer unionId) {
return this.tabSysUnionEnterpriseMapper.selectByPrimaryKey(unionId);
}
@Override
public Page<TabSysUnionEnterprise> pageUnionEnterprise(Integer enterpriseId, Integer authorizationStatus, String search) {
return this.tabSysUnionEnterpriseMapper.pageUnionEnterprise(enterpriseId, authorizationStatus, search);
}
}
......@@ -27,7 +27,7 @@ public class MenuApiServiceImpl implements MenuApiService {
int parentId = 0;
if(currentMenu != null){
TabSysMenu menu = this.menuService.getMenuById(currentMenu);
parentId = menu.getParentId();
parentId = currentMenu;
level = menu.getLevel()+1;
}
return ServiceResponse.success(this.treeMenu(menuList, level, parentId));
......
package com.gic.auth.service.outer.impl;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.constant.AuthorizationStatusEnum;
import com.gic.auth.constant.ResourceTypeEnum;
......@@ -10,7 +11,9 @@ import com.gic.auth.service.UnionEnterpriseApiService;
import com.gic.auth.service.UnionEnterpriseResourceService;
import com.gic.auth.service.UnionEnterpriseService;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.constants.Constants;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -73,6 +76,13 @@ public class UnionEnterpriseApiServiceImpl implements UnionEnterpriseApiService
return ServiceResponse.success(enterpriseDTO);
}
@Override
public ServiceResponse<Page<UnionEnterpriseDTO>> pageUnionEnterprise(String search, Integer enterpriseId, Integer pageNum, Integer pageSize, Integer authorizationStatus) {
PageHelper.startPage(pageNum, pageSize);
com.github.pagehelper.Page<TabSysUnionEnterprise> page = this.unionEnterpriseService.pageUnionEnterprise(enterpriseId, authorizationStatus, search);
return ServiceResponse.success(PageHelperUtils.changePageHelperToCurrentPage(page, UnionEnterpriseDTO.class));
}
private int saveResource(Integer unionId, UnionEnterpriseDTO enterpriseDTO){
int i = 0;
i = this.unionEnterpriseResourceService.saveResource(unionId, enterpriseDTO.getMemberCardResourceId(),
......@@ -100,6 +110,11 @@ public class UnionEnterpriseApiServiceImpl implements UnionEnterpriseApiService
if( i == 0){
throw new RuntimeException();
}
i = this.unionEnterpriseResourceService.saveResource(unionId, enterpriseDTO.getOrderResourceId(),
ResourceTypeEnum.ORDER_RESOURCE.getCode(), enterpriseDTO.getEnterpriseId());
if( i == 0){
throw new RuntimeException();
}
return i;
}
......@@ -124,5 +139,9 @@ public class UnionEnterpriseApiServiceImpl implements UnionEnterpriseApiService
if(resource != null){
enterpriseDTO.setGoodsResourceId(resource.getResource());
}
resource = this.unionEnterpriseResourceService.getByUnionIdAndType(unionId, ResourceTypeEnum.ORDER_RESOURCE.getCode());
if(resource != null){
enterpriseDTO.setOrderResourceId(resource.getResource());
}
}
}
......@@ -146,4 +146,17 @@
where union_enterprise_id = #{unionId,jdbcType=INTEGER}
and status=1
</select>
<select id="pageUnionEnterprise" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tab_sys_union_enterprise
where enterprise_id = #{enterpriseId,jdbcType=INTEGER}
and status=1
<if test="search != null and search !=''">
and union_enterprise_name like concat('%',#{search}, '%')
</if>
<if test="authorizationStatus != null">
and authorization_status = #{authorizationStatus}
</if>
</select>
</mapper>
\ No newline at end of file
package com.gic.auth.web.controller;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.AuthCodeDTO;
import com.gic.auth.dto.UnionEnterpriseDTO;
import com.gic.auth.service.AuthCodeApiService;
import com.gic.auth.service.UnionEnterpriseApiService;
import com.gic.auth.web.qo.PageQO;
import com.gic.auth.web.qo.UnionEnterpriseQO;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
......@@ -65,6 +67,14 @@ public class UnionEnterpriseController {
return EnterpriseRestResponse.failure(response);
}
@RequestMapping("page-union-enterprise")
public RestResponse pageUnionEnterprise(String search, Integer authorizationStatus, PageQO pageQO){
Integer enterpriseId = UserDetailUtils.getUserDetail().getEnterpriseId();
ServiceResponse<Page<UnionEnterpriseDTO>> pageServiceResponse = this.unionEnterpriseApiService.
pageUnionEnterprise(search, enterpriseId, pageQO.getCurrentPage(), pageQO.getPageSize(), authorizationStatus);
return RestResponse.success(pageServiceResponse.getResult());
}
private RestResponse validateAuthCode(UnionEnterpriseQO unionEnterpriseQO){
ServiceResponse<AuthCodeDTO> authCode = this.authCodeApiService.getAuthCode(unionEnterpriseQO.getAuthCodeId());
if(authCode.isSuccess()){
......
......@@ -11,6 +11,7 @@ public class UnionEnterpriseQO implements Serializable {
private Long appletResourceId;
private Long storeResourceId;
private Long goodsResourceId;
private Long orderResourceId;
private Integer authCodeId;
private Integer unionId;
......@@ -93,4 +94,12 @@ public class UnionEnterpriseQO implements Serializable {
public void setGoodsResourceId(Long goodsResourceId) {
this.goodsResourceId = goodsResourceId;
}
public Long getOrderResourceId() {
return orderResourceId;
}
public void setOrderResourceId(Long orderResourceId) {
this.orderResourceId = orderResourceId;
}
}
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