mx_datav_gs/mxdata_v-system/target/classes/mybatis/business/MxPageGroupMapper.xml

185 lines
7.7 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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.alonginfo.project.business.mapper.MxPageGroupMapper">
<resultMap type="MxPageGroup" id="MxPageGroupResult">
<result property="groupId" column="group_id" />
<result property="groupName" column="group_name" />
<result property="pagePath" column="page_path" />
<result property="settingId" column="setting_id" />
<result property="description" column="description" />
<result property="createTime" column="create_time" />
<!-- 设置信息 -->
<association property="mxGroupSetting" javaType="MxGroupSetting">
<result property="settingName" column="setting_name" />
<result property="autoSwitch" column="auto_switch" />
<result property="switchAnimation" column="switch_animation" />
<result property="switchTime" column="switch_time" />
<result property="description" column="setting_description" />
</association>
<collection property="themeManagers" javaType="java.util.ArrayList" ofType="ThemeManager">
<result property="themeId" column="page_id" />
<result property="themeName" column="page_name" />
<result property="appCtrl" column="app_ctrl" />
<result property="introduce" column="introduce" />
</collection>
</resultMap>
<!-- 工程 -->
<resultMap type="MxProject" id="MxProjectResult">
<result property="proId" column="pro_id" />
<result property="proName" column="pro_name" />
</resultMap>
<!-- 主题管理 -->
<resultMap type="MxPages" id="MxPagesResult">
<result property="pageId" column="page_id" />
<result property="pageName" column="page_name" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectMxPageGroupVo">
SELECT
a.group_id,
a.group_name,
a.page_path,
a.setting_id,
a.description,
a.create_time,
b.setting_name,
b.auto_switch,
b.switch_animation,
b.switch_time,
b.description setting_description,
d.page_name ,
d.page_id
FROM
mx_page_group a
LEFT JOIN mx_group_setting b ON a.setting_id = b.setting_id
left join mx_page_mid_group c on a.group_id = c.group_id
left join mx_pages d on c.page_id=d.page_id
order by a.group_id , c.order_num
</sql>
<!-- 查询分组列表 -->
<select id="selectMxPageGroupList" parameterType="MxPageGroup" resultMap="MxPageGroupResult">
<include refid="selectMxPageGroupVo"/>
<where>
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
<if test="pagePath != null and pagePath != ''"> and page_path = #{pagePath}</if>
<if test="settingId != null and settingId != ''"> and setting_id = #{settingId}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
</where>
</select>
<!-- 根据分组id 查询分组信息 -->
<select id="selectMxPageGroupById" parameterType="String" resultMap="MxPageGroupResult">
<include refid="selectMxPageGroupVo"/>
where group_id = #{groupId}
</select>
<!-- 插入分组信息 -->
<insert id="insertMxPageGroup" parameterType="MxPageGroup">
insert into mx_page_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="groupId != null and groupId != ''">group_id,</if>
<if test="groupName != null and groupName != ''">group_name,</if>
<if test="pagePath != null and pagePath != ''">page_path,</if>
<if test="settingId != null and settingId != ''">setting_id,</if>
<if test="description != null and description != ''">description,</if>
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="groupId != null and groupId != ''">#{groupId},</if>
<if test="groupName != null and groupName != ''">#{groupName},</if>
<if test="pagePath != null and pagePath != ''">#{pagePath},</if>
<if test="settingId != null and settingId != ''">#{settingId},</if>
<if test="description != null and description != ''">#{description},</if>
sysdate()
</trim>
</insert>
<!-- 更新分组信息 -->
<update id="updateMxPageGroup" parameterType="MxPageGroup">
update mx_page_group
<trim prefix="SET" suffixOverrides=",">
<if test="groupName != null and groupName != ''">group_name = #{groupName},</if>
<if test="settingId != null and settingId != ''">setting_id = #{settingId},</if>
<if test="description != null and description != ''">description = #{description},</if>
create_time = sysdate()
</trim>
where group_id = #{groupId}
</update>
<!--根据分组id 删除分组信息-->
<delete id="deleteMxPageGroupById" parameterType="String">
delete from mx_page_group where group_id = #{groupId}
</delete>
<!-- 删除分组相关的分组&主题中间表 -->
<delete id="deleteMxPageMidGroupByGroupId" parameterType="String">
delete from mx_page_mid_group where group_id = #{groupId}
</delete>
<!---->
<delete id="removePageInGroup" >
delete from mx_page_mid_group where group_id = #{groupId} and page_id =#{themeId}
</delete>
<!-- 插入分组主题数据 -->
<insert id="addPageToGroup">
insert into mx_page_mid_group(group_id,page_id,order_num)
values
<foreach collection="themeManagers" index="index" item="item" separator=",">
(#{groupId},#{item.themeId},#{item.orderNum})
</foreach>
</insert>
<!--获取工程列表 -->
<select id="getProjectList" resultMap="MxProjectResult">
select * from mx_project
</select>
<!-- 获取主题信息 -->
<select id="getPagesList" resultMap="MxPagesResult">
select page_id,page_name,create_time from mx_pages
where pro_id = #{proId}
</select>
<!-- 根据分组id 获取最大排序只(如果没有新增分组 返回0 -->
<select id="getMaxOrderNum" resultType="int">
select IFNULL( max(order_num) ,0) from mx_page_mid_group where group_id = #{groupId}
</select>
<!--修改分组主题排序-->
<update id="editOrderNum">
update mx_page_mid_group set order_num = #{orderNum} where group_id=#{groupId} and page_id=#{themeId}
</update>
<!-- 根据page_path 查询主题信息-->
<select id="listPagesByGroupPagePath" resultMap="MxPageGroupResult">
SELECT
a.group_id,
a.group_name,
a.page_path,
a.setting_id,
a.description,
a.create_time,
b.setting_name,
b.auto_switch,
b.switch_animation,
b.switch_time,
b.description setting_description,
d.page_name ,
d.page_id,
d.app_ctrl,
d.introduce
FROM
mx_page_group a
LEFT JOIN mx_group_setting b ON a.setting_id = b.setting_id
left join mx_page_mid_group c on a.group_id = c.group_id
left join mx_pages d on c.page_id=d.page_id
where a.page_path = #{pagePath}
order by c.order_num
</select>
</mapper>