<?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.jeeplus.modules.test.validation.mapper.TestValidationMapper">

	<sql id="testValidationColumns">
		a.id AS "id",
		a.num AS "num",
		a.num2 AS "num2",
		a.str AS "str",
		a.email AS "email",
		a.url AS "url",
		a.new_date AS "newDate",
		a.remarks AS "remarks",
		a.c1 AS "c1",
		a.c2 AS "c2",
		a.c3 AS "c3",
		a.c4 AS "c4",
		a.c5 AS "c5",
		a.c6 AS "c6",
		a.en AS "en",
		a.zn AS "zn",
		a.enzn AS "enzn"
	</sql>

	<sql id="testValidationJoins">

	</sql>


	<select id="get" resultType="TestValidation" >
		SELECT
			<include refid="testValidationColumns"/>
		FROM test_validation a
		<include refid="testValidationJoins"/>
		WHERE a.id = #{id}
	</select>

	<select id="findList" resultType="TestValidation" >
		SELECT
			<include refid="testValidationColumns"/>
		FROM test_validation a
		<include refid="testValidationJoins"/>
		<where>
			
			${dataScope}
			<if test="num != null and num != ''">
				AND a.num = #{num}
			</if>
			<if test="num2 != null and num2 != ''">
				AND a.num2 = #{num2}
			</if>
		</where>
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
			</otherwise>
		</choose>
	</select>

	<select id="findAllList" resultType="TestValidation" >
		SELECT
			<include refid="testValidationColumns"/>
		FROM test_validation a
		<include refid="testValidationJoins"/>
		<where>
			
			${dataScope}
		</where>
		<choose>
			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
				ORDER BY ${page.orderBy}
			</when>
			<otherwise>
			</otherwise>
		</choose>
	</select>

	<insert id="insert">
		INSERT INTO test_validation(
			id,
			num,
			num2,
			str,
			email,
			url,
			new_date,
			remarks,
			c1,
			c2,
			c3,
			c4,
			c5,
			c6,
			en,
			zn,
			enzn
		) VALUES (
			#{id},
			#{num},
			#{num2},
			#{str},
			#{email},
			#{url},
			#{newDate},
			#{remarks},
			#{c1},
			#{c2},
			#{c3},
			#{c4},
			#{c5},
			#{c6},
			#{en},
			#{zn},
			#{enzn}
		)
	</insert>

	<update id="update">
		UPDATE test_validation SET
			num = #{num},
			num2 = #{num2},
			str = #{str},
			email = #{email},
			url = #{url},
			new_date = #{newDate},
			remarks = #{remarks},
			c1 = #{c1},
			c2 = #{c2},
			c3 = #{c3},
			c4 = #{c4},
			c5 = #{c5},
			c6 = #{c6},
			en = #{en},
			zn = #{zn},
			enzn = #{enzn}
		WHERE id = #{id}
	</update>


	<!--物理删除-->
	<update id="delete">
		DELETE FROM test_validation
		WHERE id = #{id}
	</update>

	<!--逻辑删除-->
	<update id="deleteByLogic">
		UPDATE test_validation SET
			del_flag = #{DEL_FLAG_DELETE}
		WHERE id = #{id}
	</update>


	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
	<select id="findUniqueByProperty" resultType="TestValidation" statementType="STATEMENT">
		select * FROM test_validation  where ${propertyName} = '${value}'
	</select>

</mapper>