<?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.SystemMapper">
	<sql id="allRuleField">
		R_ID ruleId, 
		R_NUM ruleNum, 
		R_DESC ruleDesc, 
		R_TYPE ruleType,
		R_CREATE_DATE ruleCreateDate, 
		R_IS_STATUS ruleStatus
	</sql>

	<!-- 根据ID，获取一个商城系统规则 -->
	<select id="selectOneShopRuleById" parameterType="Integer" resultType="ShopSystemRule">
		SELECT
			R_ID ruleId, R_NUM ruleNum, R_DESC ruleDesc, 
			R_TYPE ruleType, R_CREATE_DATE ruleCreateDate, R_IS_STATUS ruleStatus
		FROM
			TB_IAMBERRY_ADMIN_RELU
		WHERE
			R_ID = #{ruleId}
	</select>
	
	<select id="selectAllShopRule"  resultType="ShopSystemRule">
		SELECT
			<include refid="allRuleField"></include>
		FROM
			TB_IAMBERRY_ADMIN_RELU 
		ORDER BY R_CREATE_DATE DESC
	</select>
</mapper>
