<?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.SystemConfigMapper">

	<insert id="saveSystemConfig" parameterType="cn.pluss.platform.entity.SystemConfig">
       	insert into tb_pluss_systemconfig(propertyKey,propertyValue,propertyDesc,propertyIndex,systemId)VALUES(#{propertyKey,jdbcType=VARCHAR},#{propertyValue,jdbcType=VARCHAR},#{propertyDesc,jdbcType=VARCHAR},#{propertyIndex,jdbcType=VARCHAR},#{systemId,jdbcType=VARCHAR})
   	</insert>
   	
   	
	<insert id="saveSystemConfigBatch">
       	insert into tb_pluss_systemconfig
       	(propertyKey,propertyValue,propertyDesc,propertyIndex,systemId)
       	VALUES
       	<foreach collection="list" item="item" index="index" separator=",">
     	 (#{item.propertyKey},#{item.propertyValue},#{item.propertyDesc},#{item.propertyIndex},#{item.systemId})
     	</foreach>
   	</insert>
   	
   	

	<select id="querySystemConfig" parameterType="cn.pluss.platform.entity.SystemConfig" resultType="cn.pluss.platform.entity.SystemConfig">

		 select * from tb_pluss_systemconfig 
		<where>
		    <if test="id != null">
		       AND id = #{id}
		    </if>
		    <if test="propertyKey != null">
		       AND  propertyKey = #{propertyKey}
		    </if>
		    <if test="propertyValue != null">
		        AND propertyValue = #{propertyValue}
		    </if>
		    <if test="propertyDesc != null">
		        AND propertyDesc = #{propertyDesc}
		    </if>
		      <if test="propertyIndex != null">
		        AND propertyIndex = #{propertyIndex}
		    </if>
		      <if test="systemId != null">
		        AND systemId = #{systemId}
		    </if>
		 </where>
	</select>
	
	
	<select id="querySystemConfigList" parameterType="cn.pluss.platform.entity.SystemConfig" resultType="cn.pluss.platform.entity.SystemConfig">

		 select * from tb_pluss_systemconfig 
		<where>
		  	<if test="id != null">
		        AND id = #{id}
		    </if>
		    <if test="propertyKey != null">
		        AND propertyKey = #{propertyKey}
		    </if>
		    <if test="propertyValue != null">
		        AND propertyValue = #{propertyValue}
		    </if>
		    <if test="propertyDesc != null">
		        AND propertyDesc = #{propertyDesc}
		    </if>
		      <if test="propertyIndex != null">
		        AND propertyIndex = #{propertyIndex}
		    </if>
		     <if test="systemId != null">
		        AND systemId = #{systemId}
		    </if>
		 </where>
	</select>
	
	<update id="updateSystemConfig" parameterType="cn.pluss.platform.entity.SystemConfig">
	    update tb_pluss_systemconfig 
	    <set>
	    	<if test="propertyKey != null">
		         propertyKey = #{propertyKey},
		    </if>
		    <if test="propertyValue != null">
		         propertyValue = #{propertyValue},
		    </if>
		    <if test="propertyDesc != null">
		         propertyDesc = #{propertyDesc},
		    </if>
		      <if test="propertyIndex != null">
		         propertyIndex = #{propertyIndex},
		    </if>
		     <if test="systemId != null">
				 systemId = #{systemId}
		    </if>
		  </set>
	   where id = #{id}
	</update>
	
	
	
	<delete id="deleteSystemConfig" parameterType="cn.pluss.platform.entity.SystemConfig">
        delete from tb_pluss_systemconfig where id = #{id}  
	</delete>  
	
	
	<select id="querySystemConfigPage" parameterType="java.util.Map" resultType="cn.pluss.platform.entity.SystemConfig">

		 select * from tb_pluss_systemconfig 
		<where>
		    <if test="id != null">
		         id = #{id}
		    </if>
		    <if test="propertyKey != null">
		         propertyKey = #{propertyKey}
		    </if>
		    <if test="propertyValue != null">
		        AND propertyValue = #{propertyValue}
		    </if>
		    <if test="propertyDesc != null">
		        AND propertyDesc = #{propertyDesc}
		    </if>
		      <if test="propertyIndex != null">
		        AND propertyIndex = #{propertyIndex}
		    </if>
		     <if test="systemId != null">
		        AND systemId = #{systemId}
		    </if>
		 </where>
		 order by id desc limit #{pageSize} offset #{offset}
	</select>
	
	<select id="querySystemConfigPageCount" parameterType="java.util.Map" resultType="java.lang.Integer">

		 select count(*) from tb_pluss_systemconfig 
		<where>
		    <if test="id != null">
		         id = #{id}
		    </if>
		    <if test="propertyKey != null">
		         propertyKey = #{propertyKey}
		    </if>
		    <if test="propertyValue != null">
		        AND propertyValue = #{propertyValue}
		    </if>
		    <if test="propertyDesc != null">
		        AND propertyDesc = #{propertyDesc}
		    </if>
		      <if test="propertyIndex != null">
		        AND propertyIndex = #{propertyIndex}
		    </if>
		     <if test="systemId != null">
		        AND systemId = #{systemId}
		    </if>
		 </where>
	</select>
	
	
	
	
</mapper>