<?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.bonus.boot.manager.manager.dao.DictDao">

	<sql id="where">
		<where>
			<if test="params.id != null and params.id != ''">
				and id = #{params.id}
			</if>
			<if test="params.type != null and params.type != ''">
				and type = #{params.type}
			</if>
			<if test="params.k != null and params.k != ''">
				and k = #{params.k}
			</if>
			<if test="params.val != null and params.val != ''">
				and val = #{params.val}
			</if>

		</where>
	</sql>

	<select id="count" resultType="int">
		select count(1) from t_dict t
		<include refid="where" />
	</select>

	<select id="list" resultType="com.bonus.boot.manager.manager.entity.Dict">
		select * from t_dict t
		<include refid="where" />
		${params.orderBy}
		limit #{offset}, #{limit}
	</select>

	<update id="update">
		update t_dict t
		<set>
			<if test="type != null">
				type = #{type},
			</if>
			<if test="k != null">
				k = #{k},
			</if>
			<if test="val != null">
				val = #{val},
			</if>
			updateTime = now()

		</set>

		where t.id = #{id}
	</update>

</mapper>
