158 lines
6.2 KiB
XML
158 lines
6.2 KiB
XML
|
<?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.MxDataSetMapper">
|
||
|
|
||
|
<!--映射关系-->
|
||
|
<!--MxDataGroup-->
|
||
|
<resultMap type="MxDataGroup" id="MxDataGroupResult">
|
||
|
<result property="dGroupId" column="d_group_id" />
|
||
|
<result property="dGroupName" column="d_group_name" />
|
||
|
<result property="dGroupSort" column="d_group_sort" />
|
||
|
<result property="createTime" column="create_time" />
|
||
|
</resultMap>
|
||
|
<!--MxDataSet-->
|
||
|
<resultMap type="MxDataSet" id="MxDataSetResult">
|
||
|
<result property="dsId" column="DS_ID" />
|
||
|
<result property="dsName" column="DS_NAME" />
|
||
|
<result property="databaseId" column="DATABASE_ID" />
|
||
|
<result property="dataSql" column="DATA_SQL" />
|
||
|
<result property="hasParam" column="has_param" />
|
||
|
<result property="ajaxId" column="code_get_id" />
|
||
|
<result property="typeId" column="TYPE_ID" />
|
||
|
<!-- 设置信息 -->
|
||
|
<association property="dataSetKeys" column="b" resultMap="MxDataSetKeyResult"/>
|
||
|
</resultMap>
|
||
|
<!--MxDataSetKeyResult -->
|
||
|
<resultMap type="MxDataSetKey" id="MxDataSetKeyResult">
|
||
|
<result property="keyId" column="key_id" />
|
||
|
<result property="keyName" column="key_name" />
|
||
|
</resultMap>
|
||
|
<sql id="selectMxDataGroupVo">
|
||
|
select d_group_id, d_group_name,d_group_sort, create_time from mx_data_group order by d_group_sort
|
||
|
</sql>
|
||
|
<sql id="selectMxDataSetVo">
|
||
|
select DS_ID,DS_NAME,DATABASE_ID,DATA_SQL,d_group_id,has_param,code_get_id from mx_data_set
|
||
|
</sql>
|
||
|
|
||
|
<!-- 查询 数据集分组-->
|
||
|
<select id="selectMxDataGroupList" parameterType="MxDataGroup" resultMap="MxDataGroupResult">
|
||
|
<include refid="selectMxDataGroupVo"/>
|
||
|
</select>
|
||
|
|
||
|
<!-- 添加 数据集分组 -->
|
||
|
<insert id="addMxDataGroup" parameterType="MxDataGroup">
|
||
|
insert into mx_data_group(
|
||
|
<if test="dGroupId != null and dGroupId != ''">d_group_id,</if>
|
||
|
<if test="dGroupName != null and dGroupName != ''">d_group_name,</if>
|
||
|
<if test="dGroupSort != null and dGroupSort != ''">d_group_sort,</if>
|
||
|
create_time
|
||
|
)
|
||
|
values(
|
||
|
<if test="dGroupId != null and dGroupId != ''">#{dGroupId},</if>
|
||
|
<if test="dGroupName != null and dGroupName != ''">#{dGroupName},</if>
|
||
|
<if test="dGroupSort != null and dGroupSort != ''">#{dGroupSort},</if>
|
||
|
sysdate()
|
||
|
)
|
||
|
</insert>
|
||
|
|
||
|
<!-- 删除数据集分组 -->
|
||
|
<delete id="deleteMxDataGroup">
|
||
|
delete from mx_data_group where d_group_id = #{dGroupId}
|
||
|
</delete>
|
||
|
|
||
|
<!-- 修改数据集分组 -->
|
||
|
<update id="editMxDataGroup" parameterType="MxDataGroup">
|
||
|
update mx_data_group
|
||
|
<set>
|
||
|
<if test="dGroupName != null and dGroupName != ''">d_group_name = #{dGroupName},</if>
|
||
|
<if test="dGroupSort != null and dGroupSort != ''">d_group_sort = #{dGroupSort},</if>
|
||
|
create_time = sysdate()
|
||
|
</set>
|
||
|
where d_group_id = #{dGroupId}
|
||
|
</update>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<!--数据集 ====================================-->
|
||
|
<!-- 根据数据集分类id获取数据集 -->
|
||
|
<select id="getDataSetListByDGroupId" resultMap="MxDataSetResult">
|
||
|
<include refid="selectMxDataSetVo"/>
|
||
|
where d_Group_Id = #{dGroupId}
|
||
|
</select>
|
||
|
|
||
|
<!-- 根据数据查询别名获取数据集 -->
|
||
|
<select id="getDataSetListByAjaxId" resultMap="MxDataSetResult">
|
||
|
<include refid="selectMxDataSetVo"/>
|
||
|
where code_get_id = #{ajaxId}
|
||
|
</select>
|
||
|
|
||
|
<!-- 添加数据集 -->
|
||
|
<insert id="addDataSet">
|
||
|
insert into mx_data_set(
|
||
|
<if test="dsId != null and dsId != ''">ds_id,</if>
|
||
|
<if test="dsName != null and dsName != ''">ds_name,</if>
|
||
|
<if test="databaseId != null and databaseId != ''">database_id,</if>
|
||
|
<if test="dataSql != null and dataSql != ''">data_sql,</if>
|
||
|
<if test="dGroupId != null and dGroupId != ''">d_group_id,</if>
|
||
|
<if test="hasParam != null and hasParam != ''">has_param,</if>
|
||
|
<if test="ajaxId != null and ajaxId != ''">code_get_id,</if>
|
||
|
create_time
|
||
|
)
|
||
|
values(
|
||
|
<if test="dsId != null and dsId != ''">#{dsId},</if>
|
||
|
<if test="dsName != null and dsName != ''">#{dsName},</if>
|
||
|
<if test="databaseId != null and databaseId != ''">#{databaseId},</if>
|
||
|
<if test="dataSql != null and dataSql != ''">#{dataSql},</if>
|
||
|
<if test="dGroupId != null and dGroupId != ''">#{dGroupId},</if>
|
||
|
<if test="hasParam != null and hasParam != ''">#{hasParam},</if>
|
||
|
<if test="ajaxId != null and ajaxId != ''">#{ajaxId},</if>
|
||
|
sysdate()
|
||
|
)
|
||
|
</insert>
|
||
|
|
||
|
<!-- 添加数据集相关key -->
|
||
|
<insert id="addMxDtaSetKey" parameterType="MxDataSetKey" >
|
||
|
insert into mx_data_set_key(KEY_ID,KEY_NAME,DS_ID) values(#{keyId},#{keyName},#{dsId})
|
||
|
</insert>
|
||
|
|
||
|
<!--删除数据集 -->
|
||
|
<delete id="deleteMxDataSetById">
|
||
|
delete from mx_data_set where ds_id =#{dsId}
|
||
|
</delete>
|
||
|
<!-- 根据数据集id 删除数据集相关id -->
|
||
|
<delete id="deleteMxDataSetKeyByDsId">
|
||
|
delete from mx_data_set_key where ds_id =#{dsId}
|
||
|
</delete>
|
||
|
|
||
|
<select id="getMxDataSet" resultMap="MxDataSetResult" >
|
||
|
<include refid="selectMxDataSetVo"/>
|
||
|
where ds_id = #{dsId}
|
||
|
</select>
|
||
|
<!-- 执行动态sql -->
|
||
|
<select id="executeSql" parameterType="map" resultType="map">
|
||
|
${dataSql}
|
||
|
</select>
|
||
|
<!-- 查询所有mx_data_set_key-->
|
||
|
<select id="listMxDataSetKey" resultMap="MxDataSetKeyResult">
|
||
|
select key_id ,key_name from mx_data_set_key
|
||
|
</select>
|
||
|
|
||
|
<!--根据分组id 查询所有数据集 及 数据集key -->
|
||
|
<select id="mxDataqueryDataSetBydGroupId" resultMap="MxDataSetResult">
|
||
|
SELECT
|
||
|
a.DS_ID,
|
||
|
a.DS_NAME,
|
||
|
b.KEY_ID,
|
||
|
b.KEY_NAME
|
||
|
FROM
|
||
|
mx_data_set a
|
||
|
left join mx_data_set_key b on a.ds_ID = b.DS_ID
|
||
|
where a.d_group_id = #{dGroupId}
|
||
|
and a.has_param != '1'
|
||
|
</select>
|
||
|
</mapper>
|