<?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="lingtao.net.dao.SysDictSearchProMapper">

	<select id="keyWordsList" parameterType="SysDictSearchPro" resultType="SysDictSearchPro">
		SELECT 
		  *
		FROM
		  sys_dict_search_pro 
		<where>
			<if test="proTypeLabel !=null and proTypeLabel != '' ">
				pro_type_label like '%${proTypeLabel}%'
			</if>
		</where>
	</select>
	
	<insert id="insertSelective" parameterType="SysDictSearchPro">
    	INSERT INTO sys_dict_search_pro
    	 (
		  id,
		  pro_type_label,
		  like_pro_type_label,
		  url,
		  status,
		  creator,
		  createDate
		) 
		VALUES
		(
		  NULL,
		  #{proTypeLabel},
		  #{likeProTypeLabel},
		  #{url},
		  #{status},
		  #{creator},
		  now()
		 ) 
    </insert>
    
    <update id="updateKeyWordById" parameterType="SysDictSearchPro">
	   	UPDATE 
		  	sys_dict_search_pro 
		SET
			<if test="likeProTypeLabel != null and likeProTypeLabel != ''">
			  	like_pro_type_label = #{likeProTypeLabel},
			</if>
			<if test="url != null and url != ''">
			  	url = #{url},
			</if>
		  	updateDate = now(),
		  	updater = #{updater}
		WHERE 
			id  = #{id} 
  	</update>
	
	<!-- 改变关键字状态 -->
  	<update id="changeKeyWordStatus">
		UPDATE 
	  		sys_dict_search_pro 
		SET
		  status = 
		  	CASE
		    WHEN 
		    	status = '1' 
		    THEN 
		    	'0' 
		    ELSE 
		    	'1' 
		  END 
		WHERE id = #{id} 
   </update>
</mapper>