MerchantLevelMapper.xml 3.96 KB
<?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.com.glsx.dj.system.mapper.MerchantLevelMapper" >
  <resultMap id="BaseResultMap" type="cn.com.glsx.dj.system.model.MerchantLevel" >
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="user_id" property="userId" jdbcType="INTEGER" />
    <result column="user_type" property="userType" jdbcType="TINYINT" />
    <result column="merchant_id" property="merchantId" jdbcType="INTEGER" />
    <result column="merchant_name" property="merchantName" jdbcType="VARCHAR" />
    <result column="city_merchant_id" property="cityMerchantId" jdbcType="INTEGER" />
    <result column="city_merchant_name" property="cityMerchantName" jdbcType="VARCHAR" />
    <result column="province_merchant_id" property="provinceMerchantId" jdbcType="INTEGER" />
    <result column="province_merchant_name" property="provinceMerchantName" jdbcType="VARCHAR" />
    <result column="factory_merchant_id" property="factoryMerchantId" jdbcType="INTEGER" />
    <result column="factory_merchant_name" property="factoryMerchantName" jdbcType="VARCHAR" />
    <result column="created_by" property="createdBy" jdbcType="VARCHAR" />
    <result column="created_date" property="createdDate" jdbcType="TIMESTAMP" />
    <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
    <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP" />
    <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    id, user_id, user_type, merchant_id, merchant_name, city_merchant_id, city_merchant_name, 
    province_merchant_id, province_merchant_name, factory_merchant_id, factory_merchant_name, 
    created_by, created_date, updated_by, updated_date, deleted_flag
  </sql>
  
  <select id="listMerchantIds" parameterType="cn.com.glsx.dj.system.model.MerchantLevel" resultType="java.lang.Integer">
  	select merchant_id from dj_system_merchant_level
  	<where>
  		deleted_flag='N'
  		<if test="factoryMerchantId != null">
  			and factory_merchant_id = #{factoryMerchantId}
  		</if>
  		<if test="provinceMerchantId != null">
  			and province_merchant_id = #{provinceMerchantId}
  		</if>
  		<if test="cityMerchantId != null">
  			and city_merchant_id = #{cityMerchantId}
  		</if>
  		<if test="merchantId != null">
  			and merchant_id = #{merchantId}
  		</if>
  	</where> 
  </select>
  
  <select id="listMerchant" parameterType="cn.com.glsx.dj.system.model.MerchantLevel" resultMap="BaseResultMap">
  	select user_type,merchant_id,merchant_name from dj_system_merchant_level
  	<where>
  		deleted_flag='N'
  		<if test="factoryMerchantId != null">
  			and factory_merchant_id = #{factoryMerchantId}
  		</if>
  		<if test="provinceMerchantId != null">
  			and province_merchant_id = #{provinceMerchantId}
  		</if>
  		<if test="cityMerchantId != null">
  			and city_merchant_id = #{cityMerchantId}
  		</if>
  		<if test="merchantId != null">
  			and merchant_id = #{merchantId}
  		</if>
  		<if test="userType != null">
  			and user_type = #{userType}
  		</if>
  	</where> 
  </select>

	<select id="listSelfMerchantId" parameterType="cn.com.glsx.dj.system.model.MerchantLevel" resultMap="BaseResultMap">
		select <include refid="Base_Column_List" /> from dj_system_merchant_level
		<where>
			deleted_flag='N'
			<if test="factoryMerchantId != null">
				and factory_merchant_id = #{factoryMerchantId}
			</if>
			<if test="provinceMerchantId != null">
				and province_merchant_id = #{provinceMerchantId}
			</if>
			<if test="cityMerchantId != null">
				and city_merchant_id = #{cityMerchantId}
			</if>
			<if test="merchantId != null">
				and merchant_id = #{merchantId}
			</if>
			<if test="userType != null">
				and user_type = #{userType}
			</if>
		</where>
	</select>
</mapper>