<?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">
<!-- 命名，每一个映射对象不一样
	namespace:必须与对应的接口全类名一致
 -->
<mapper namespace="com.iamberry.wechat.service.mapper.ConfigMapper">
	<resultMap type="Config" id="toConfig">
		<id column="id" property="id"/>
		<result column="ticket" property="ticket"/>
		<result column="appid" property="appid"/>
		<result column="appsecret" property="appsecret"/>
		<result column="create_time" property="createTime"/>
		<result column="wxpub_name" property="wxpubName"/>
	</resultMap>
	
	<select id="getConfig" parameterType="string" resultMap="toConfig">
		SELECT * FROM tb_wx_config WHERE appid = #{appid} LIMIT 0, 1
	</select>
  
  	<update id="updateConfig" parameterType="Config">
		UPDATE tb_wx_config 
		SET
			ticket = #{ticket} , 
			create_time = #{createTime} , 
			appid = #{appid} , 
			appsecret = #{appsecret} , 
			wxpub_name = #{wxpubName}
		WHERE
			ID = #{id}
  	</update>
</mapper>
