| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462 |
- <?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="menuServiceDaoImpl">
- <!-- 保存路由信息至 instance表中 add by wuxw 2018-07-03 -->
- <insert id="saveMenuGroupInfo" parameterType="Map">
- insert into m_menu_group(
- g_id,name,icon,label,seq,description,group_type,store_type
- ) values (
- #{gId},#{name},#{icon},#{label},#{seq},#{description},#{groupType},#{storeType}
- )
- </insert>
- <!-- 查询路由信息 add by wuxw 2018-07-03 -->
- <select id="getMenuGroupInfo" parameterType="Map" resultType="Map">
- select t.g_id,t.name,t.icon,t.label,t.seq,t.description,t.g_id gId,t.group_type groupType,t.store_type storeType
- from m_menu_group t
- where t.status_cd= '0'
- <if test="gId !=null and gId != ''">
- and t.g_id= #{gId}
- </if>
- <if test="name !=null and name != ''">
- and t.name like concat('%',#{name},'%')
- </if>
- <if test="icon !=null and icon != ''">
- and t.icon= #{icon}
- </if>
- <if test="label !=null and label != ''">
- and t.label= #{label}
- </if>
- <if test="groupType !=null and groupType != ''">
- and t.group_type= #{groupType}
- </if>
- <if test="storeType !=null and storeType != ''">
- and t.store_type= #{storeType}
- </if>
- <if test="seq !=null">
- and t.seq= #{seq}
- </if>
- <if test="description !=null and description != ''">
- and t.description= #{description}
- </if>
- order by t.seq desc
- <if test="page != -1 and page != null ">
- limit #{page}, #{row}
- </if>
- </select>
- <!-- 修改路由信息 add by wuxw 2018-07-03 -->
- <update id="updateMenuGroupInfo" parameterType="Map">
- update m_menu_group t
- <set>
- <if test="statusCd !=null and statusCd != ''">
- t.status_cd = #{statusCd},
- </if>
- <if test="name !=null and name != ''">
- t.name= #{name},
- </if>
- <if test="icon !=null and icon != ''">
- t.icon= #{icon},
- </if>
- <if test="groupType !=null and groupType != ''">
- t.group_type= #{groupType},
- </if>
- <if test="label !=null ">
- t.label= #{label},
- </if>
- <if test="seq !=null ">
- t.seq= #{seq},
- </if>
- <if test="storeType !=null and storeType != ''">
- t.store_type= #{storeType},
- </if>
- <if test="description !=null and description != ''">
- t.description= #{description}
- </if>
- </set>
- where t.g_id= #{gId}
- </update>
- <!-- 查询路由数量 add by wuxw 2018-07-03 -->
- <select id="queryMenuGroupsCount" parameterType="Map" resultType="Map">
- select count(1) count
- from m_menu_group t
- where t.status_cd= '0'
- <if test="gId !=null and gId != ''">
- and t.g_id= #{gId}
- </if>
- <if test="name !=null and name != ''">
- and t.name like concat('%',#{name},'%')
- </if>
- <if test="icon !=null and icon != ''">
- and t.icon= #{icon}
- </if>
- <if test="groupType !=null and groupType != ''">
- and t.group_type= #{groupType}
- </if>
- <if test="statusCd !=null and statusCd != ''">
- and t.status_cd= #{statusCd}
- </if>
- <if test="label !=null and label != ''">
- and t.label= #{label}
- </if>
- <if test="seq !=null">
- and t.seq= #{seq}
- </if>
- <if test="storeType !=null and storeType != ''">
- and t.store_type= #{storeType}
- </if>
- <if test="description !=null and description != ''">
- and t.description= #{description}
- </if>
- </select>
- <!-- 保存路由信息至 instance表中 add by wuxw 2018-07-03 -->
- <insert id="saveBasePrivilegeRelInfo" parameterType="Map">
- insert into p_privilege_rel(
- p_id,pg_id
- ) values (
- #{pId},#{pgId}
- )
- </insert>
- <!-- 保存路由信息至 instance表中 add by wuxw 2018-07-03 -->
- <insert id="saveBasePrivilegeInfo" parameterType="Map">
- insert into p_privilege(
- p_id,name,resource,domain,description,m_id
- ) values (
- #{pId},#{name},#{resource},#{domain},#{description},#{mId}
- )
- </insert>
- <!-- 查询路由信息 add by wuxw 2018-07-03 -->
- <select id="getBasePrivilegeInfo" parameterType="Map" resultType="Map">
- select t.p_id,t.name,t.domain,t.resource,t.description,t.p_id pId,t.create_time createTime,st.name stName
- from p_privilege t
- left join store_type st on t.domain=st.store_type_cd
- where t.status_cd= '0'
- <if test="pId !=null and pId != ''">
- and t.p_id= #{pId}
- </if>
- <if test="name !=null and name != ''">
- and t.name like concat('%',#{name},'%')
- </if>
- <if test="resource !=null and resource != ''">
- and t.resource = #{resource}
- </if>
- <if test="domain !=null and domain != ''">
- and t.domain= #{domain}
- </if>
- <if test="mId !=null and mId != ''">
- and t.m_id= #{mId}
- </if>
- order by t.create_time desc
- <if test="page != -1 and page != null ">
- limit #{page}, #{row}
- </if>
- </select>
- <!-- 修改路由信息 add by wuxw 2018-07-03 -->
- <update id="updateBasePrivilegeInfo" parameterType="Map">
- update p_privilege t
- <set>
- <if test="statusCd !=null and statusCd != ''">
- t.status_cd = #{statusCd},
- </if>
- <if test="name !=null and name != ''">
- t.name= #{name},
- </if>
- <if test="resource !=null and resource != ''">
- t.resource= #{resource},
- </if>
- <if test="domain !=null and domain != ''">
- t.domain= #{domain},
- </if>
- <if test="description !=null and description != ''">
- t.description= #{description}
- </if>
- </set>
- where t.p_id= #{pId}
- </update>
- <!-- 修改路由信息 add by wuxw 2018-07-03 -->
- <update id="updateBasePrivilegeRelInfo" parameterType="Map">
- update p_privilege_rel t
- <set>
- <if test="statusCd !=null and statusCd != ''">
- t.status_cd = #{statusCd},
- </if>
- <if test="pgId !=null and pgId != ''">
- t.pg_id= #{pgId},
- </if>
- </set>
- where t.p_id= #{pId}
- </update>
- <!-- 查询路由数量 add by wuxw 2018-07-03 -->
- <select id="queryBasePrivilegesCount" parameterType="Map" resultType="Map">
- select count(1) count
- from p_privilege t
- where 1 =1
- <if test="pId !=null and pId != ''">
- and t.p_id= #{pId}
- </if>
- <if test="name !=null and name != ''">
- and t.name like concat('%',#{name},'%')
- </if>
- <if test="resource !=null and resource != ''">
- and t.resource = #{resource}
- </if>
- <if test="domain !=null and domain != ''">
- and t.domain= #{domain}
- </if>
- <if test="mId !=null and mId != ''">
- and t.m_id= #{mId}
- </if>
- <if test="statusCd !=null and statusCd != ''">
- and t.status_cd= #{statusCd}
- </if>
- </select>
- <!-- 保存路由信息至 instance表中 add by wuxw 2018-07-03 -->
- <insert id="saveMenuInfo" parameterType="Map">
- insert into m_menu(
- m_id,name,g_id,url,seq,p_id,description,is_show
- ) values (
- #{mId},#{name},#{gId},#{url},#{seq},'-1',#{description},#{isShow}
- )
- </insert>
- <!-- 查询路由信息 add by wuxw 2018-07-03 -->
- <select id="getMenuInfo" parameterType="Map" resultType="Map">
- select DISTINCT t.m_id mId,t.name,t.g_id gId,t.url,t.seq,t.p_id pId,t.description,t.is_show isShow,
- if(t.is_show='Y','显示','不显示') isShowName,
- t.m_id pId,t.name pName,mg.name menuGroupName,mg.store_type,st.name storeTypeName
- from m_menu t,p_privilege p,m_menu_group mg,store_type st
- where t.status_cd= '0'
- and p.status_cd= '0'
- and t.m_id = p.m_id
- and t.g_id = mg.g_id
- and mg.store_type = st.store_type_cd
- <if test="gId !=null and gId != ''">
- and t.g_id= #{gId}
- </if>
- <if test="name !=null and name != ''">
- and t.name like concat('%',#{name},'%')
- </if>
- <if test="mName !=null and mName != ''">
- and t.name like concat('%',#{mName},'%')
- </if>
- <if test="domain !=null and domain != ''">
- and p.domain= #{domain}
- </if>
- <if test="pName !=null and pName != ''">
- and p.name like concat('%',#{pName},'%')
- </if>
- <if test="mId !=null and mId != ''">
- and t.m_id= #{mId}
- </if>
- <if test="pId !=null and pId != ''">
- and p.p_id= #{pId}
- </if>
- <if test="isShow !=null and isShow != ''">
- and t.is_show= #{isShow}
- </if>
- <if test="url !=null and url != ''">
- and t.url like concat('%',#{url},'%')
- </if>
- <if test="seq !=null">
- and t.seq= #{seq}
- </if>
- <if test="description !=null and description != ''">
- and t.description= #{description}
- </if>
- <if test="uName != null and uName != ''">
- and exists(
- SELECT 1
- FROM p_privilege_user ppu,u_user u
- WHERE ppu.`p_id` = p.`p_id`
- AND ppu.`privilege_flag` = '0'
- and ppu.user_id = u.user_id
- AND u.`name` = #{uName}
- AND ppu.`status_cd` = '0'
- UNION
- SELECT 1
- FROM p_privilege_user ppu,
- p_privilege_group ppg,p_privilege_rel ppr,u_user u
- WHERE ppu.`p_id` = ppr.pg_id
- AND ppr.pg_id = ppg.pg_id
- AND ppr.p_id = p.`p_id`
- AND ppu.`privilege_flag` = '1'
- and ppu.user_id = u.user_id
- AND u.`name` = #{uName}
- AND ppu.`status_cd` = '0'
- AND ppg.status_cd = '0'
- AND ppr.status_cd = '0'
- )
- </if>
- order by t.seq
- <if test="page != -1 and page != null ">
- limit #{page}, #{row}
- </if>
- </select>
- <!-- 修改路由信息
- ,t.description,t.is_show isShow
- add by wuxw 2018-07-03 -->
- <update id="updateMenuInfo" parameterType="Map">
- update m_menu t
- <set>
- <if test="statusCd !=null and statusCd != ''">
- t.status_cd = #{statusCd},
- </if>
- <if test="name !=null and name != ''">
- t.name= #{name},
- </if>
- <if test="gId !=null and gId != ''">
- t.g_id= #{gId},
- </if>
- <if test="url !=null and url != ''">
- t.url= #{url},
- </if>
- <if test="seq !=null ">
- t.seq= #{seq},
- </if>
- <if test="isShow !=null and isShow != ''">
- t.is_show= #{isShow},
- </if>
- <if test="description !=null and description != ''">
- t.description= #{description}
- </if>
- </set>
- where t.m_id= #{mId}
- </update>
- <!-- 查询路由数量 add by wuxw 2018-07-03 -->
- <select id="queryMenusCount" parameterType="Map" resultType="Map">
- select count(DISTINCT(t.m_id)) count
- from m_menu t,p_privilege p,m_menu_group mg,store_type st
- where t.status_cd= '0'
- and p.status_cd= '0'
- and t.m_id = p.m_id
- and t.g_id = mg.g_id
- and mg.store_type = st.store_type_cd
- <if test="gId !=null and gId != ''">
- and t.g_id= #{gId}
- </if>
- <if test="name !=null and name != ''">
- and t.name like concat('%',#{name},'%')
- </if>
- <if test="mName !=null and mName != ''">
- and t.name like concat('%',#{mName},'%')
- </if>
- <if test="pId !=null and pId != ''">
- and t.p_id= #{pId}
- </if>
- <if test="domain !=null and domain != ''">
- and p.domain= #{domain}
- </if>
- <if test="pName !=null and pName != ''">
- and p.name like concat('%',#{pName},'%')
- </if>
- <if test="mId !=null and mId != ''">
- and p.m_id= #{mId}
- </if>
- <if test="pId !=null and pId != ''">
- and t.p_id= #{pId}
- </if>
- <if test="isShow !=null and isShow != ''">
- and t.is_show= #{isShow}
- </if>
- <if test="url !=null and url != ''">
- and t.url like concat('%',#{url},'%')
- </if>
- <if test="seq !=null">
- and t.seq= #{seq}
- </if>
- <if test="description !=null and description != ''">
- and t.description= #{description}
- </if>
- <if test="uName != null and uName != ''">
- and exists(
- SELECT 1
- FROM p_privilege_user ppu,u_user u
- WHERE ppu.`p_id` = p.`p_id`
- AND ppu.`privilege_flag` = '0'
- and ppu.user_id = u.user_id
- AND u.`name` = #{uName}
- AND ppu.`status_cd` = '0'
- UNION
- SELECT 1
- FROM p_privilege_user ppu,
- p_privilege_group ppg,p_privilege_rel ppr,u_user u
- WHERE ppu.`p_id` = ppr.pg_id
- AND ppr.pg_id = ppg.pg_id
- AND ppr.p_id = p.`p_id`
- AND ppu.`privilege_flag` = '1'
- and ppu.user_id = u.user_id
- AND u.`name` = #{uName}
- AND ppu.`status_cd` = '0'
- AND ppg.status_cd = '0'
- AND ppr.status_cd = '0'
- )
- </if>
- </select>
- <select id="checkUserHasResource" parameterType="Map" resultType="Map">
- SELECT pp.*,'-1' AS pg_id,'' AS pg_name FROM p_privilege_user ppu,p_privilege pp
- WHERE ppu.`p_id` = pp.`p_id`
- <if test="resource != null and resource != ''">
- AND pp.`resource` = #{resource}
- </if>
- AND ppu.`privilege_flag` = '0'
- AND ppu.`user_id` = #{userId}
- AND ppu.`status_cd` = '0'
- AND pp.`status_cd` = '0'
- UNION
- SELECT pp.*,ppg.pg_id,ppg.name pg_name FROM p_privilege_user ppu,p_privilege_group ppg,p_privilege
- pp,p_privilege_rel ppr
- WHERE ppu.`p_id` = ppr.pg_id
- AND ppr.pg_id = ppg.pg_id
- AND ppr.p_id = pp.`p_id`
- <if test="resource != null and resource != ''">
- AND pp.`resource` = #{resource}
- </if>
- AND ppu.`privilege_flag` = '1'
- AND ppu.`user_id` = #{userId}
- AND ppu.`status_cd` = '0'
- AND pp.`status_cd` = '0'
- AND ppg.status_cd = '0'
- AND ppr.status_cd = '0'
- </select>
- </mapper>
|