Commit 04f2419d by Suvalue

菜单添加排序以及pagecode

parent ac20ccde
package com.bsoft.api.common.aspect; package com.bsoft.api.common.aspect;
import org.apache.poi.ss.usermodel.DateUtil;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Aspect;
...@@ -13,6 +14,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; ...@@ -13,6 +14,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
@Aspect @Aspect
...@@ -36,13 +38,17 @@ public class RequestMappingAspect { ...@@ -36,13 +38,17 @@ public class RequestMappingAspect {
} }
private Object request(ProceedingJoinPoint joinPoint) throws Throwable { private Object request(ProceedingJoinPoint joinPoint) throws Throwable {
Date beginDate = new Date();
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
Logger logger = org.slf4j.LoggerFactory.getLogger(joinPoint.getTarget().getClass()); Logger logger = org.slf4j.LoggerFactory.getLogger(joinPoint.getTarget().getClass());
Object result = joinPoint.proceed(); Object result = joinPoint.proceed();
String uri = request.getRequestURI(); String uri = request.getRequestURI();
Object[] params = joinPoint.getArgs(); Object[] params = joinPoint.getArgs();
List<Object> paramsList = Arrays.asList(params); List<Object> paramsList = Arrays.asList(params);
logger.debug("URL:" + uri + "入参参数:" + paramsList+"返回结果:"+result); Date endDate = new Date();
logger.debug("执行时间:"+
(endDate.getTime()-beginDate.getTime())
+",URL:" + uri + "入参参数:" + paramsList+"返回结果:"+result);
return result; return result;
} }
} }
...@@ -26,10 +26,10 @@ public class ExcelController { ...@@ -26,10 +26,10 @@ public class ExcelController {
private ExcelService excelService; private ExcelService excelService;
@PostMapping("export") @PostMapping("export")
// @Token @Token
@ApiOperation("将Table转换为Xls") @ApiOperation("将Table转换为Xls")
public Object tableToXls(HttpServletRequest request,@RequestBody ExportReq info){ public Object tableToXls(HttpServletRequest request,@RequestBody ExportReq info){
String tableStr =StringEscapeUtils.unescapeHtml4(info.getTabaleStr()); String tableStr =StringEscapeUtils.unescapeHtml4(info.getTableStr());
log.info("table参数:"+tableStr); log.info("table参数:"+tableStr);
String realPath = request.getSession().getServletContext().getRealPath("/"); String realPath = request.getSession().getServletContext().getRealPath("/");
String fileUrl =excelService.tableToXls(realPath,tableStr); String fileUrl =excelService.tableToXls(realPath,tableStr);
......
...@@ -15,6 +15,10 @@ public class SysMenu { ...@@ -15,6 +15,10 @@ public class SysMenu {
private Long parentId; private Long parentId;
private String pageCode;
private Long sort;
public Long getId() { public Long getId() {
return id; return id;
} }
...@@ -63,6 +67,22 @@ public class SysMenu { ...@@ -63,6 +67,22 @@ public class SysMenu {
this.parentId = parentId; this.parentId = parentId;
} }
public String getPageCode() {
return pageCode;
}
public void setPageCode(String pageCode) {
this.pageCode = pageCode;
}
public Long getSort() {
return sort;
}
public void setSort(Long sort) {
this.sort = sort;
}
@Override @Override
public String toString() { public String toString() {
return "SysMenu{" + return "SysMenu{" +
...@@ -72,6 +92,8 @@ public class SysMenu { ...@@ -72,6 +92,8 @@ public class SysMenu {
", menuUrl='" + menuUrl + '\'' + ", menuUrl='" + menuUrl + '\'' +
", menuImage='" + menuImage + '\'' + ", menuImage='" + menuImage + '\'' +
", parentId=" + parentId + ", parentId=" + parentId +
", pageCode='" + pageCode + '\'' +
", sort=" + sort +
'}'; '}';
} }
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ public class ExportReq { ...@@ -6,7 +6,7 @@ public class ExportReq {
@ApiModelProperty("Table Html") @ApiModelProperty("Table Html")
private String tableStr; private String tableStr;
public String getTabaleStr() { public String getTableStr() {
return tableStr; return tableStr;
} }
......
...@@ -10,8 +10,10 @@ import javax.annotation.Resource; ...@@ -10,8 +10,10 @@ import javax.annotation.Resource;
import java.awt.*; import java.awt.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
public class SysMenuServiceImpl implements SysMenuService { public class SysMenuServiceImpl implements SysMenuService {
...@@ -25,6 +27,7 @@ public class SysMenuServiceImpl implements SysMenuService { ...@@ -25,6 +27,7 @@ public class SysMenuServiceImpl implements SysMenuService {
SysMenu sysMenu = new SysMenu(); SysMenu sysMenu = new SysMenu();
List<SysMenuList> list = sysMenuMapper.selectMenuByUser(userId); List<SysMenuList> list = sysMenuMapper.selectMenuByUser(userId);
List<SysMenuList> resultList = getLevelData(list, Long.valueOf(MENU_TOP_PARENT_ID)); List<SysMenuList> resultList = getLevelData(list, Long.valueOf(MENU_TOP_PARENT_ID));
resultList=resultList.stream().sorted(Comparator.comparing(SysMenu::getSort)).collect(Collectors.toList());
return resultList; return resultList;
} }
...@@ -33,6 +36,7 @@ public class SysMenuServiceImpl implements SysMenuService { ...@@ -33,6 +36,7 @@ public class SysMenuServiceImpl implements SysMenuService {
for (SysMenuList data : list) { for (SysMenuList data : list) {
if (data.getParentId() == parentcode){ if (data.getParentId() == parentcode){
List<SysMenuList> childList = getLevelData(list,data.getId()); List<SysMenuList> childList = getLevelData(list,data.getId());
childList=childList.stream().sorted(Comparator.comparing(SysMenu::getSort)).collect(Collectors.toList());
data.setSysMenuList(childList); data.setSysMenuList(childList);
resultList.add(data); resultList.add(data);
} }
......
...@@ -11,7 +11,7 @@ spring.datasource.url=jdbc:oracle:thin:@192.168.18.171:1521:his ...@@ -11,7 +11,7 @@ spring.datasource.url=jdbc:oracle:thin:@192.168.18.171:1521:his
# Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA40\uFF09 # Redis\u6570\u636E\u5E93\u7D22\u5F15\uFF08\u9ED8\u8BA40\uFF09
spring.redis.database=1 spring.redis.database=1
spring.redis.host=192.168.18.55 spring.redis.host=192.168.18.169
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=ll123456 spring.redis.password=ll123456
spring.redis.jedis.pool.max-active=8 spring.redis.jedis.pool.max-active=8
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<property name="log.dev.level" value="DEBUG" /> <property name="log.dev.level" value="DEBUG" />
<property name="log.test.level" value="DEBUG" /> <property name="log.test.level" value="DEBUG" />
<property name="log.prod.level" value="DEBUG" /> <property name="log.prod.level" value="DEBUG" />
<property name="log.max.size" value="100MB" /> <!-- 日志文件大小 --> <property name="log.max.size" value="10MB" /> <!-- 日志文件大小 -->
<springProperty scope="context" name="log.profile" source="spring.profiles.active" defaultValue="app"/> <springProperty scope="context" name="log.profile" source="spring.profiles.active" defaultValue="app"/>
<property name="log.base" value="/logs/${log.profile}"/> <property name="log.base" value="/logs/${log.profile}"/>
<springProperty scope="context" name="log.moduleName" source="spring.application.name" defaultValue="app"/> <springProperty scope="context" name="log.moduleName" source="spring.application.name" defaultValue="app"/>
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
<result column="MENU_URL" jdbcType="VARCHAR" property="menuUrl" /> <result column="MENU_URL" jdbcType="VARCHAR" property="menuUrl" />
<result column="MENU_IMAGE" jdbcType="VARCHAR" property="menuImage" /> <result column="MENU_IMAGE" jdbcType="VARCHAR" property="menuImage" />
<result column="PARENT_ID" jdbcType="DECIMAL" property="parentId" /> <result column="PARENT_ID" jdbcType="DECIMAL" property="parentId" />
<result column="PAGE_CODE" jdbcType="VARCHAR" property="pageCode" />
<result column="SORT" jdbcType="DECIMAL" property="sort" />
</resultMap> </resultMap>
<resultMap id="sysMenuResultMap" type="com.bsoft.api.model.respmodel.SysMenuList" extends="BaseResultMap"/> <resultMap id="sysMenuResultMap" type="com.bsoft.api.model.respmodel.SysMenuList" extends="BaseResultMap"/>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
...@@ -19,12 +21,12 @@ ...@@ -19,12 +21,12 @@
</selectKey> </selectKey>
insert into SYS_MENU ( insert into SYS_MENU (
MENU_NAME, MENU_URL, MENU_IMAGE, MENU_NAME, MENU_URL, MENU_IMAGE,
PARENT_ID) PARENT_ID,PAGE_CODE,SORT)
values ( values (
#{menuName,jdbcType=VARCHAR}, #{menuUrl,jdbcType=VARCHAR}, #{menuImage,jdbcType=VARCHAR}, #{menuName,jdbcType=VARCHAR}, #{menuUrl,jdbcType=VARCHAR}, #{menuImage,jdbcType=VARCHAR},
values (#{createData,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL}, values (#{createData,jdbcType=TIMESTAMP}, #{createUserid,jdbcType=DECIMAL}, #{state,jdbcType=DECIMAL},
#{menuName,jdbcType=VARCHAR}, #{menuUrl,jdbcType=VARCHAR}, #{menuImage,jdbcType=VARCHAR}, #{menuName,jdbcType=VARCHAR}, #{menuUrl,jdbcType=VARCHAR}, #{menuImage,jdbcType=VARCHAR},
#{parentId,jdbcType=DECIMAL}) #{parentId,jdbcType=DECIMAL},#{pageCode,jdbcType=VARCHAR},#{sort,jdbcType=DECIMAL})
</insert> </insert>
<update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.SysMenu"> <update id="updateByPrimaryKey" parameterType="com.bsoft.api.model.SysMenu">
update SYS_MENU update SYS_MENU
...@@ -32,11 +34,13 @@ ...@@ -32,11 +34,13 @@
MENU_NAME = #{menuName,jdbcType=VARCHAR}, MENU_NAME = #{menuName,jdbcType=VARCHAR},
MENU_URL = #{menuUrl,jdbcType=VARCHAR}, MENU_URL = #{menuUrl,jdbcType=VARCHAR},
MENU_IMAGE = #{menuImage,jdbcType=VARCHAR}, MENU_IMAGE = #{menuImage,jdbcType=VARCHAR},
PARENT_ID = #{parentId,jdbcType=DECIMAL} PARENT_ID = #{parentId,jdbcType=DECIMAL},
PAGE_CODE=#{pageCode,jdbcType=VARCHAR},
SORT=#{sort,jdbcType=DECIMAL}
where ID = #{id,jdbcType=DECIMAL} where ID = #{id,jdbcType=DECIMAL}
</update> </update>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select ID,MENU_NAME, MENU_URL, MENU_IMAGE, PARENT_ID select ID,MENU_NAME, MENU_URL, MENU_IMAGE, PARENT_ID,PAGE_CODE,SORT
from SYS_MENU from SYS_MENU
where ID = #{id,jdbcType=DECIMAL} where ID = #{id,jdbcType=DECIMAL}
</select> </select>
...@@ -45,7 +49,7 @@ ...@@ -45,7 +49,7 @@
from SYS_MENU from SYS_MENU
</select> </select>
<select id="selectMenuByUser" resultMap="sysMenuResultMap"> <select id="selectMenuByUser" resultMap="sysMenuResultMap">
select DISTINCT m.ID,m.MENU_NAME,m.MENU_URL,m.MENU_IMAGE,m.PARENT_ID select DISTINCT m.ID,m.MENU_NAME,m.MENU_URL,m.MENU_IMAGE,m.PARENT_ID,m.PAGE_CODE,m.SORT
from from
SYS_ROLE_MENU_RS rmr SYS_ROLE_MENU_RS rmr
LEFT JOIN LEFT JOIN
...@@ -56,7 +60,7 @@ ...@@ -56,7 +60,7 @@
union union
select DISTINCT m.ID,m.MENU_NAME,m.MENU_URL,m.MENU_IMAGE,m.PARENT_ID select DISTINCT m.ID,m.MENU_NAME,m.MENU_URL,m.MENU_IMAGE,m.PARENT_ID,m.PAGE_CODE,m.SORT
from from
SYS_USER_MENU_RS umr SYS_USER_MENU_RS umr
LEFT JOIN LEFT JOIN
......
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