<?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="com.ozs.mdm.mapper.InterfaceDataProjectMapper">

	<insert id="addInterfaceProject" parameterType="com.ozs.mdm.dto.MdmInfoDataSourceInterfaceProjectDTO">

		INSERT INTO `mdm_info_data_source_interface_project` (
			  project_id,
			  project_name,
			  check_code,
			  update_time

			)
			VALUES
			(uuid(),#{projectName},#{checkCode},now())
	</insert>
	<select id="listInterfaceProject" resultType="com.ozs.mdm.dto.MdmInfoDataSourceInterfaceProjectDTO">
		SELECT
		mip.`project_id` AS projectId,
		mip.`project_name` AS projectName,
		mip.`check_code` AS checkCode,
		mip.`update_time` AS updateTime,
		mip.`operator_id` AS operatorId
		FROM
		`mdm_info_data_source_interface_project` mip
		WHERE 1 = 1
		<if test="projectName !=null &amp;&amp; projectName !=''">
			and mip.`project_name` like concat('%',#{projectName},'%')
		</if>
	</select>


	<select id="getInterfaceProjectById" resultType="com.ozs.mdm.dto.MdmInfoDataSourceInterfaceProjectDTO">
		SELECT
		mip.`project_id` AS projectId,
		mip.`project_name` AS projectName,
		mip.`check_code` AS checkCode,
		mip.`update_time` AS updateTime,
		mip.`operator_id` AS operatorId
		FROM
		`mdm_info_data_source_interface_project` mip
		WHERE mip.`project_id`=#{projectId}
	</select>
	<update id="updateInterfaceProjectById" parameterType="com.ozs.mdm.dto.MdmInfoDataSourceInterfaceProjectDTO">
		update mdm_info_data_source_interface_project set
		<if test="projectName !=null &amp;&amp; projectName !=''">
			project_name = #{projectName}
		</if>
		<if test="checkCode !=null &amp;&amp; checkCode !=''">
			,check_code = #{checkCode}
		</if>
		,update_time = now()
		<if test="operatorId !=null &amp;&amp; operatorId !=''">
			,operator_id = #{operatorId}
		</if>
		where project_id = #{projectId}
	</update>
	<delete id="deleteInterfaceProject" parameterType="java.lang.String">
		delete from
		mdm_info_data_source_interface_project where project_id = #{projectId}
	</delete>

</mapper>