<?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.haha.mapper.DictDataMapper">

    <resultMap id="BaseResultMap" type="com.haha.entity.DictData">
        <id column="id" property="id"/>
        <result column="dict_code" property="dictCode"/>
        <result column="item_value" property="itemValue"/>
        <result column="item_label" property="itemLabel"/>
        <result column="item_desc" property="itemDesc"/>
        <result column="parent_id" property="parentId"/>
        <result column="css_class" property="cssClass"/>
        <result column="list_class" property="listClass"/>
        <result column="is_default" property="isDefault"/>
        <result column="status" property="status"/>
        <result column="sort_order" property="sortOrder"/>
        <result column="create_by" property="createBy"/>
        <result column="create_time" property="createTime"/>
        <result column="update_by" property="updateBy"/>
        <result column="update_time" property="updateTime"/>
        <result column="remark" property="remark"/>
    </resultMap>

    <sql id="Base_Column_List">
        id, dict_code, item_value, item_label, item_desc, parent_id, css_class, list_class,
        is_default, status, sort_order, create_by, create_time, update_by, update_time, remark
    </sql>

    <select id="selectByDictCode" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"/>
        FROM t_dict_data
        WHERE dict_code = #{dictCode}
        AND status = 1
        ORDER BY sort_order ASC, id ASC
    </select>

    <delete id="deleteByDictCode">
        DELETE FROM t_dict_data WHERE dict_code = #{dictCode}
    </delete>

</mapper>
