修复角色菜单临时接口

This commit is contained in:
zhangchenbiao
2023-08-01 11:43:32 +08:00
parent 83485c3d73
commit c56757e699
11 changed files with 207 additions and 70 deletions

View File

@@ -1,7 +1,9 @@
package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.entity.SysMenuDO;
import com.cool.store.mapper.SysMenuMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
@@ -24,8 +26,28 @@ public class SysMenuDAO {
}
public Long addMenu(SysMenuDO param){
Integer sort = sysMenuMapper.selectMaxSort();
param.setSort(sort + 1);
sysMenuMapper.insertSelective(param);
return param.getId();
}
/**
* 批量删除
* @param idList
* @return
*/
public Integer batchDeleteMenu(List<Long> idList){
if(CollectionUtils.isNotEmpty(idList)){
return CommonConstants.ZERO;
}
return sysMenuMapper.batchDeleteMenu(idList);
}
public Integer batchUpdateMenu(List<SysMenuDO> updateList) {
if(CollectionUtils.isEmpty(updateList)){
return CommonConstants.ZERO;
}
return sysMenuMapper.batchUpdateMenu(updateList);
}
}

View File

@@ -23,7 +23,11 @@ public interface SysMenuMapper {
* 默认更新方法根据主键更新不会把null值更新到数据库避免覆盖之前有值的
* dateTime:2023-06-08 04:38
*/
int updateByPrimaryKeySelective(SysMenuDO record);
int batchUpdateMenu(@Param("recordList") List<SysMenuDO> recordList);
List<SysMenuDO> selectMenuAll(@Param("list") List<Long> parentIds, @Param("platformType") String platformType);
Integer selectMaxSort();
Integer batchDeleteMenu(@Param("list") List<Long> idList);
}

View File

@@ -155,71 +155,73 @@
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update sys_menu
<set>
<if test="parentId != null">
parent_id = #{parentId},
</if>
<if test="code != null">
code = #{code},
</if>
<if test="name != null">
name = #{name},
</if>
<if test="alias != null">
alias = #{alias},
</if>
<if test="path != null">
path = #{path},
</if>
<if test="perms != null">
perms = #{perms},
</if>
<if test="source != null">
source = #{source},
</if>
<if test="sort != null">
sort = #{sort},
</if>
<if test="category != null">
category = #{category},
</if>
<if test="action != null">
action = #{action},
</if>
<if test="remark != null">
remark = #{remark},
</if>
<if test="platform != null">
platform = #{platform},
</if>
<if test="isDeleted != null">
is_deleted = #{isDeleted},
</if>
<if test="type != null">
type = #{type},
</if>
<if test="target != null">
target = #{target},
</if>
<if test="component != null">
component = #{component},
</if>
<if test="icon != null">
icon = #{icon},
</if>
<if test="menuType != null">
menu_type = #{menuType},
</if>
<if test="env != null">
env = #{env},
</if>
<if test="commonFunctionsIcon != null">
common_functions_icon = #{commonFunctionsIcon},
</if>
</set>
where id = #{id}
<update id="batchUpdateMenu">
<foreach collection="recordList" separator=";" item="record">
update sys_menu
<set>
<if test="record.parentId != null">
parent_id = #{record.parentId},
</if>
<if test="record.code != null">
code = #{record.code},
</if>
<if test="record.name != null">
name = #{record.name},
</if>
<if test="record.alias != null">
alias = #{record.alias},
</if>
<if test="record.path != null">
path = #{record.path},
</if>
<if test="record.perms != null">
perms = #{record.perms},
</if>
<if test="record.source != null">
source = #{record.source},
</if>
<if test="record.sort != null">
sort = #{record.sort},
</if>
<if test="record.category != null">
category = #{record.category},
</if>
<if test="record.action != null">
action = #{record.action},
</if>
<if test="record.remark != null">
remark = #{record.remark},
</if>
<if test="record.platform != null">
platform = #{record.platform},
</if>
<if test="record.isDeleted != null">
is_deleted = #{record.isDeleted},
</if>
<if test="record.type != null">
type = #{record.type},
</if>
<if test="record.target != null">
target = #{record.target},
</if>
<if test="record.component != null">
component = #{record.component},
</if>
<if test="record.icon != null">
icon = #{record.icon},
</if>
<if test="record.menuType != null">
menu_type = #{record.menuType},
</if>
<if test="record.env != null">
env = #{record.env},
</if>
<if test="record.commonFunctionsIcon != null">
common_functions_icon = #{record.commonFunctionsIcon},
</if>
</set>
where id = #{record.id}
</foreach>
</update>
<select id="selectMenuAll" resultMap="BaseResultMap">
@@ -228,7 +230,7 @@
from
sys_menu
where
platform=#{platformType}
platform=#{platformType} and is_deleted = '0'
<if test="list!=null and list.size>0">
and parent_id in
<foreach collection="list" item="parentId" open="(" close=")" separator=",">
@@ -236,4 +238,23 @@
</foreach>
</if>
</select>
<select id="selectMaxSort" resultType="java.lang.Integer">
select sort
from sys_menu
order by sort desc
limit 0,1
</select>
<update id="batchDeleteMenu">
update
sys_menu
set
is_deleted = '1'
where
id in
<foreach collection="list" open="(" item="item" separator="," close=")">
#{item}
</foreach>
</update>
</mapper>

View File

@@ -143,7 +143,7 @@
select
<include refid="Base_Column_List"/>
from
sys_role
sys_role and deleted = 0
</select>
<select id="getRoleDetail" resultMap="BaseResultMap">