<?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.pluss.platform.mapper.AliMccMapper">

	   	<insert id="saveAliMcc" parameterType="cn.pluss.platform.entity.AliMcc">
        	insert into tb_pluss_ali_mcc(mccCode)VALUES(#{mccCode})
    	</insert>

	   	<insert id="saveAliMccBatch">
        	insert into tb_pluss_ali_mcc(mccCode) VALUES 
    			<foreach collection="list" item="item" index="index" separator=",">
			(#{mccCode}		)
				</foreach>
    	</insert>

		<select id="queryAliMcc" parameterType="cn.pluss.platform.entity.AliMcc" resultType="cn.pluss.platform.entity.AliMcc">
			SELECT * from tb_pluss_ali_mcc 
				<where> 
					<if test="id!= null"> 
					 	and id = #{id}
					 </if> 
					<if test="mccCode!= null"> 
					 	and mccCode = #{mccCode}
					 </if> 
				 </where> 
		</select>

		<select id="queryAliMccList" parameterType="cn.pluss.platform.entity.AliMcc" resultType="cn.pluss.platform.entity.AliMcc">
			SELECT * from tb_pluss_ali_mcc 
				<where> 
					<if test="id!= null"> 
					 and 	id = #{id}
					 </if> 
					<if test="mccCode!= null"> 
					 and 	mccCode = #{mccCode}
					 </if> 
				 </where> 
		</select>

		<update id="updateAliMcc" parameterType="cn.pluss.platform.entity.AliMcc" >
			update tb_pluss_ali_mcc 
				  <set> 
					<if test="mccCode!= null"> 
					 	mccCode = #{mccCode}
					 </if> 
				</set>
			where id=#{id} 
		</update>

		<delete id="deleteAliMcc" parameterType="cn.pluss.platform.entity.AliMcc" >
			DELETE FROM tb_pluss_ali_mcc where id=#{id}
		</delete>

		<select id="queryAliMccPage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.AliMcc">
			SELECT * from tb_pluss_ali_mcc 
				<where> 
					<if test="id!= null"> 
					and id = #{id}
					 </if> 
					<if test="mccCode!= null"> 
					and mccCode = #{mccCode}
					 </if> 
				 </where> 
			order by id desc  limit #{pageSize}  offset  #{offset}  
		</select>

		<select id="queryAliMccPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">
			SELECT count(*) from tb_pluss_ali_mcc 
					<where> 
					<if test="id!= null"> 
					 and id = #{id}
					 </if> 
					<if test="mccCode!= null"> 
					 and mccCode = #{mccCode}
					 </if> 
				</where>
		</select>
		
		<select id="queryMccCode" resultType="java.lang.String">
              select mccCode from tb_pluss_ali_mcc where mccCode like CONCAT("%",#{mccCode})
            </select>

</mapper>
