All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mapper.DataDictionaryMapper.xml Maven / Gradle / Ivy

The newest version!
<?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.kamingpan.infrastructure.entity.dao.DataDictionaryDao">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.kamingpan.infrastructure.entity.model.entity.DataDictionary">
        <result column="id" property="id"/>
        <result column="creator_id" property="creatorId"/>
        <result column="creator" property="creator"/>
        <result column="create_time" property="createTime"/>
        <result column="updater_id" property="updaterId"/>
        <result column="updater" property="updater"/>
        <result column="update_time" property="updateTime"/>
        <result column="deleted" property="deleted"/>
        <result column="label" property="label"/>
        <result column="value" property="value"/>
        <result column="type" property="type"/>
        <result column="clazz" property="clazz"/>
        <result column="variable" property="variable"/>
        <result column="sort" property="sort"/>
        <result column="remark" property="remark"/>
    </resultMap>

    <!-- vo映射结果 -->
    <resultMap id="DataDictionary" type="com.kamingpan.infrastructure.entity.model.vo.DataDictionaryVO">
        <result column="id" property="id"/>
        <result column="label" property="label"/>
        <result column="value" property="value"/>
        <result column="type" property="type"/>
        <result column="clazz" property="clazz"/>
        <result column="variable" property="variable"/>
        <result column="sort" property="sort"/>
        <result column="remark" property="remark"/>
        <result column="updater" property="updater"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="BaseColumnList">
        id,
        creator_id,
        creator,
        create_time,
        updater_id,
        updater,
        update_time,
        deleted,
        label, value, type, clazz, variable, sort, remark
    </sql>

    <!-- 根据数据字典查询数据字典信息 -->
    <select id="listByDataDictionary" resultMap="DataDictionary">
        select
            dd.id,
            dd.label,
            dd.value,
            dd.type,
            dd.clazz,
            dd.variable,
            dd.updater,
            dd.update_time
        from
            system_data_dictionary dd
        where
            dd.deleted = #{deleted}
            <if test="dataDictionary != null">
                <if test="dataDictionary.clazz != null and dataDictionary.clazz != ''">
                    and dd.clazz like #{dataDictionary.clazz}
                </if>
                <if test="dataDictionary.variable != null and dataDictionary.variable != ''">
                    and dd.variable like #{dataDictionary.variable}
                </if>
                <if test="dataDictionary.label != null and dataDictionary.label != ''">
                    and dd.label like #{dataDictionary.label}
                </if>
                <if test="dataDictionary.value != null and dataDictionary.value != ''">
                    and dd.value like #{dataDictionary.value}
                </if>
            </if>
    </select>

    <!-- 根据类和变量查询数据字典 -->
    <select id="listByClazzAndVariable" resultMap="DataDictionary">
        select
            label,
            value
        from
            system_data_dictionary
        where
            clazz = #{clazz}
            and variable = #{variable}
            and deleted = #{deleted}
        order by
            sort
    </select>

    <!-- 根据类、变量和值查询数据字典 -->
    <select id="getByClazzAndVariableAndValue" resultMap="DataDictionary">
        select
            label,
            value
        from
            system_data_dictionary
        where
            clazz = #{clazz}
            and variable = #{variable}
            and value = #{value}
            and deleted = #{deleted}
    </select>

    <!-- 根据主键查询数据字典详情 -->
    <select id="getDataDictionaryById" resultMap="DataDictionary">
        select
            dd.id,
            dd.label,
            dd.value,
            dd.type,
            dd.clazz,
            dd.variable,
            dd.sort,
            dd.remark,
            dd.updater,
            dd.update_time
        from
            system_data_dictionary dd
        where
            dd.id = #{id}
            and dd.deleted = #{deleted}
    </select>

    <!-- 根据类、变量和值列表查询数据字典标签列表 -->
    <select id="listLabelByClazzAndVariable" resultType="java.lang.String">
        select
            label
        from
            system_data_dictionary
        where
            clazz = #{clazz}
            and variable = #{variable}
            <if test="null != values and values.size() > 0">
                and value in <foreach item="item" index="index" collection="values" open="(" close=")" separator=",">#{item}</foreach>
            </if>
        order by
            sort
    </select>

</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy