DataDictMapper.xml 2.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
<?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="cn.iocoder.mall.admin.dao.DataDictMapper">

    <sql id="FIELDS">
        id, enum_value, value, display_name, sort,
        memo, create_time
    </sql>

    <select id="selectByEnumValueAndValue" resultType="DataDictDO">
        SELECT
          <include refid="FIELDS"/>
        FROM data_dict
        WHERE enum_value = #{enumValue}
        AND value = #{value}
        AND deleted = 0
        LIMIT 1
    </select>

    <select id="selectById" resultType="DataDictDO">
        SELECT
            <include refid="FIELDS"/>
        FROM data_dict
        WHERE id = #{id}
        AND deleted = 0
    </select>

    <select id="selectList" resultType="DataDictDO">
        SELECT
            <include refid="FIELDS"/>
        FROM data_dict
        WHERE deleted = 0
    </select>

    <insert id="insert" parameterType="DataDictDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
        INSERT INTO data_dict (
          id, enum_value, value, display_name, sort,
          memo, create_time, deleted
        ) VALUES (
          #{id}, #{enumValue}, #{value}, #{displayName}, #{sort},
          #{memo}, #{createTime}, #{deleted}
        )
    </insert>

    <update id="update" parameterType="DataDictDO">
        UPDATE data_dict
        <set>
            <if test="enumValue != null">
                enum_value = #{enumValue},
            </if>
            <if test="value != null">
                value = #{value},
            </if>
            <if test="displayName != null">
                display_name = #{displayName},
            </if>
            <if test="sort != null">
                sort = #{sort},
            </if>
            <if test="memo != null">
                memo = #{memo},
            </if>
            <if test="deleted != null">
                deleted = #{deleted}
            </if>
        </set>
        WHERE id = #{id}
    </update>

</mapper>