写死菜单

This commit is contained in:
zhangchenbiao
2023-06-08 17:01:31 +08:00
parent 665cb2190f
commit 171957bea0
30 changed files with 878 additions and 35 deletions

View File

@@ -0,0 +1,26 @@
package com.cool.store.dao;
import com.cool.store.entity.SysMenuDO;
import com.cool.store.mapper.SysMenuMapper;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
/**
* @author zhangchenbiao
* @FileName: SysMenuDAO
* @Description:
* @date 2023-06-08 16:41
*/
@Repository
public class SysMenuDAO {
@Resource
private SysMenuMapper sysMenuMapper;
public List<SysMenuDO> selectMenuAll(List<Long> parentIds, String platformType){
return sysMenuMapper.selectMenuAll(parentIds, platformType);
}
}

View File

@@ -0,0 +1,29 @@
package com.cool.store.mapper;
import com.cool.store.entity.SysMenuDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author zhangchenbiao
* @date 2023-06-08 04:38
*/
public interface SysMenuMapper {
/**
*
* 默认插入方法,只会给有值的字段赋值
* 会对传进来的字段做判空处理如果字段为空则使用数据库默认字段或者null
* dateTime:2023-06-08 04:38
*/
int insertSelective(SysMenuDO record);
/**
*
* 默认更新方法根据主键更新不会把null值更新到数据库避免覆盖之前有值的
* dateTime:2023-06-08 04:38
*/
int updateByPrimaryKeySelective(SysMenuDO record);
List<SysMenuDO> selectMenuAll(@Param("list") List<Long> parentIds, @Param("platformType") String platformType);
}

View File

@@ -0,0 +1,239 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cool.store.mapper.SysMenuMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.SysMenuDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
<result column="code" jdbcType="VARCHAR" property="code"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="alias" jdbcType="VARCHAR" property="alias"/>
<result column="path" jdbcType="VARCHAR" property="path"/>
<result column="perms" jdbcType="VARCHAR" property="perms"/>
<result column="source" jdbcType="VARCHAR" property="source"/>
<result column="sort" jdbcType="INTEGER" property="sort"/>
<result column="category" jdbcType="INTEGER" property="category"/>
<result column="action" jdbcType="INTEGER" property="action"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="platform" jdbcType="VARCHAR" property="platform"/>
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted"/>
<result column="type" jdbcType="VARCHAR" property="type"/>
<result column="target" jdbcType="VARCHAR" property="target"/>
<result column="component" jdbcType="VARCHAR" property="component"/>
<result column="icon" jdbcType="VARCHAR" property="icon"/>
<result column="menu_type" jdbcType="TINYINT" property="menuType"/>
<result column="env" jdbcType="VARCHAR" property="env"/>
<result column="common_functions_icon" jdbcType="VARCHAR" property="commonFunctionsIcon"/>
</resultMap>
<sql id="Base_Column_List">
id, parent_id, code, name, alias, path, perms, source, sort, category, action, remark,
platform, is_deleted, type, target, component, icon, menu_type, env, common_functions_icon
</sql>
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
insert into sys_menu
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="parentId != null">
parent_id,
</if>
<if test="code != null">
code,
</if>
<if test="name != null">
name,
</if>
<if test="alias != null">
alias,
</if>
<if test="path != null">
path,
</if>
<if test="perms != null">
perms,
</if>
<if test="source != null">
source,
</if>
<if test="sort != null">
sort,
</if>
<if test="category != null">
category,
</if>
<if test="action != null">
action,
</if>
<if test="remark != null">
remark,
</if>
<if test="platform != null">
platform,
</if>
<if test="isDeleted != null">
is_deleted,
</if>
<if test="type != null">
type,
</if>
<if test="target != null">
target,
</if>
<if test="component != null">
component,
</if>
<if test="icon != null">
icon,
</if>
<if test="menuType != null">
menu_type,
</if>
<if test="env != null">
env,
</if>
<if test="commonFunctionsIcon != null">
common_functions_icon,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">
#{parentId},
</if>
<if test="code != null">
#{code},
</if>
<if test="name != null">
#{name},
</if>
<if test="alias != null">
#{alias},
</if>
<if test="path != null">
#{path},
</if>
<if test="perms != null">
#{perms},
</if>
<if test="source != null">
#{source},
</if>
<if test="sort != null">
#{sort},
</if>
<if test="category != null">
#{category},
</if>
<if test="action != null">
#{action},
</if>
<if test="remark != null">
#{remark},
</if>
<if test="platform != null">
#{platform},
</if>
<if test="isDeleted != null">
#{isDeleted},
</if>
<if test="type != null">
#{type},
</if>
<if test="target != null">
#{target},
</if>
<if test="component != null">
#{component},
</if>
<if test="icon != null">
#{icon},
</if>
<if test="menuType != null">
#{menuType},
</if>
<if test="env != null">
#{env},
</if>
<if test="commonFunctionsIcon != null">
#{commonFunctionsIcon},
</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>
<select id="selectMenuAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
sys_menu
where
platform=#{platformType}
<if test="list!=null and list.size>0">
and parent_id in
<foreach collection="list" item="parentId" open="(" close=")" separator=",">
#{parentId}
</foreach>
</if>
</select>
</mapper>