Commit 799bb62a authored by neo's avatar neo

[DEL] delete menu service interface

parent 44ad4bf0
package pwc.taxtech.atms.controller;
import java.util.List;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import pwc.taxtech.atms.dto.MenuDisplayDto;
import pwc.taxtech.atms.dto.MenuDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.entity.Menu;
import pwc.taxtech.atms.service.MenuService;
import pwc.taxtech.atms.service.impl.MenuServiceImpl;
import java.util.List;
/** @see PwC.Tax.Tech.Atms.WebApi\Controllers\MenuController.cs */
@RestController
@RequestMapping("/api/v1/menu")
public class MenuController {
......@@ -23,18 +26,20 @@ public class MenuController {
private static final Logger logger = LoggerFactory.getLogger(MenuController.class);
@Autowired
private MenuService menuService;
private MenuServiceImpl menuService;
@ApiOperation(value = "获取用于显示的菜单列表", notes = "请提供条件参数serviceId")
@RequestMapping(value = "/display", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody List<MenuDisplayDto> getMenusForDisplay(@RequestParam("serviceId") Integer serviceId) {
public @ResponseBody
List<MenuDisplayDto> getMenusForDisplay(@RequestParam("serviceId") Integer serviceId) {
logger.info("come into menu display");
return menuService.getMenusForDisplay(serviceId);
}
@ApiOperation(value = "获取菜单列表", notes = "请提供条件参数serviceId")
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody List<MenuDto> getMenus(@RequestParam("serviceId") Integer serviceId) {
public @ResponseBody
List<MenuDto> getMenus(@RequestParam("serviceId") Integer serviceId) {
logger.info("come into menu");
return menuService.getMenus(serviceId);
}
......
package pwc.taxtech.atms.service;
import java.util.List;
import pwc.taxtech.atms.dto.MenuDisplayDto;
import pwc.taxtech.atms.dto.MenuDto;
import pwc.taxtech.atms.entity.Menu;
public interface MenuService {
List<MenuDisplayDto> getMenusForDisplay(Integer moduleId);
List<MenuDto> getMenus(Integer moduleId);
List<Menu> findByIsActive(Boolean isActive);
void update(Menu menu);
}
package pwc.taxtech.atms.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.common.CommonConstants;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.dao.MenuMapper;
......@@ -18,19 +12,22 @@ import pwc.taxtech.atms.dto.MenuDisplayDto;
import pwc.taxtech.atms.dto.MenuDto;
import pwc.taxtech.atms.entity.Menu;
import pwc.taxtech.atms.entity.MenuExample;
import pwc.taxtech.atms.service.MenuService;
import pwc.taxtech.atms.exception.ApplicationException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
*/
@Service
public class MenuServiceImpl implements MenuService {
public class MenuServiceImpl {
private static final Logger logger = LoggerFactory.getLogger(MenuServiceImpl.class);
@Autowired
private MenuMapper menuMapper;
@Override
public List<MenuDisplayDto> getMenusForDisplay(Integer moduleId) {
logger.debug("Start to get menus for display");
if (moduleId == null) {
......@@ -53,13 +50,17 @@ public class MenuServiceImpl implements MenuService {
MenuDisplayDto menuDisplayDto = new MenuDisplayDto();
CommonUtils.copyProperties(menu, menuDisplayDto);
return menuDisplayDto;
};
}
;
private MenuDto rotateMenuToMenuDto(Menu menu) {
MenuDto menuDto = new MenuDto();
CommonUtils.copyProperties(menu, menuDto);
return menuDto;
};
}
;
private void getSubMenuDto(MenuDisplayDto menu, List<Menu> menus) {
List<MenuDisplayDto> subMenuDtos = menus.stream()
......@@ -72,7 +73,6 @@ public class MenuServiceImpl implements MenuService {
}
}
@Override
public List<MenuDto> getMenus(Integer moduleId) {
logger.debug("Start to get menus");
if (moduleId == null) {
......@@ -112,14 +112,12 @@ public class MenuServiceImpl implements MenuService {
}
}
@Override
public List<Menu> findByIsActive(Boolean isActive) {
MenuExample menuExample = new MenuExample();
menuExample.createCriteria().andIsActiveEqualTo(isActive);
return menuMapper.selectByExample(menuExample);
}
@Override
public void update(Menu menu) {
menuMapper.updateByPrimaryKeySelective(menu);
}
......
......@@ -54,7 +54,6 @@ import pwc.taxtech.atms.exception.ApplicationException;
import pwc.taxtech.atms.security.AtmsPasswordEncoder;
import pwc.taxtech.atms.security.JwtUtil;
import pwc.taxtech.atms.security.LdapAuthenticationProvider;
import pwc.taxtech.atms.service.MenuService;
import pwc.taxtech.atms.service.OperationLogService;
import java.util.ArrayList;
......@@ -85,7 +84,7 @@ public class UserServiceImpl extends AbstractService {
@Autowired
private RoleServiceImpl roleService;
@Autowired
private MenuService menuService;
private MenuServiceImpl menuService;
@Autowired
private UserAccountServiceImpl userAccountService;
@Autowired
......
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