guardia-mall/backend/target/classes/mapper/SettingMapper.xml

25 lines
923 B
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zioinfo.mall.admin.mapper.SettingMapper">
<resultMap id="settingMap" type="com.zioinfo.mall.admin.dto.MallSetting">
<id property="key" column="key"/>
<result property="value" column="value"/>
<result property="updatedAt" column="updated_at"/>
</resultMap>
<select id="findAll" resultMap="settingMap">
SELECT key, value, updated_at FROM mall_setting ORDER BY key ASC
</select>
<select id="findByKey" resultMap="settingMap">
SELECT key, value, updated_at FROM mall_setting WHERE key = #{key}
</select>
<update id="upsert">
INSERT INTO mall_setting (key, value, updated_at)
VALUES (#{key}, #{value}, NOW())
ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = NOW()
</update>
</mapper>