Commit 799bb62a authored by neo's avatar neo

[DEL] delete menu service interface

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