studentDAO.xml 2.82 KB
Newer Older
罗绍泽 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
<?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.gaowj.business.student.studentDAO">

	<insert id="insert_student" parameterType="map">
		insert into C_T_TEST(
		<trim prefix="" suffixOverrides=",">
			<foreach collection="infoListKey" item="key">
				${key},
			</foreach>
		</trim>
	      <![CDATA[ ) values( ]]>
		<trim prefix="" suffixOverrides=",">
			<foreach collection="infoList" item="value">
				#{value},
			</foreach>
		</trim>
	      <![CDATA[ ) ]]>
	</insert>

	<update id="update_student" parameterType="map">
	       <![CDATA[
            update C_T_TEST set 
         ]]>
		<trim prefix="" suffixOverrides=",">
			<foreach collection="info" item="info">
				${info.key} = #{info.value} ,
			</foreach>
		</trim>
		<where>
			<if test="UUID != null and UUID != ''">
				and UUID = #{UUID}
           </if>
		</where>
	</update>
	
	<delete id="delete_student" parameterType="list">
        <![CDATA[
            delete from  C_T_TEST where UUID IN
         ]]>
		<foreach collection="list" item="UUID" open="(" separator=","
			close=")">
			#{UUID} 
         </foreach>
	</delete>

	<select id="list_student" parameterType="map" resultType="upperCaseKeyMap">
	 <![CDATA[
	  select f.* 
	  from C_T_TEST f where 1=1 
     ]]>
		<if test="UUID != null and UUID != ''">
			and f.UUID = #{UUID}
        </if>
		<if test="START_TIME != null and START_TIME != ''">
			and f.CREATE_TIME &gt;= #{START_TIME} 
        </if>
		<if test="END_TIME != null and END_TIME != ''">
			and f.CREATE_TIME &lt;= #{END_TIME}
        </if>
        <if test="NAME != null and NAME != ''">
			and f.NAME like '%${NAME}%'
        </if>
        <if test="SEX != null and SEX != ''">
			and f.SEX = #{SEX}
        </if>
        <if test="NATION != null and NATION != ''">
			and f.NATION = #{NATION}
        </if>
        <if test="STATUS != null and STATUS != ''">
			and f.STATUS = #{STATUS}
        </if>
        
		order by f.CREATE_TIME DESC
	</select>

	<select id="listCount_student" parameterType="map" resultType="int">
	 <![CDATA[
	   select count(*) c from C_T_TEST f where 1=1 
     ]]>
		<if test="UUID != null and UUID != ''">
			and f.UUID = #{UUID}
        </if>
		<if test="START_TIME != null and START_TIME != ''">
			and f.CREATE_TIME &gt;= #{START_TIME} 
        </if>
		<if test="END_TIME != null and END_TIME != ''">
			and f.CREATE_TIME &lt;= #{END_TIME}
        </if>
        <if test="NAME != null and NAME != ''">
			and f.NAME like '%${NAME}%'
        </if>
        <if test="SEX != null and SEX != ''">
			and f.SEX = #{SEX}
        </if>
        <if test="NATION != null and NATION != ''">
			and f.NATION = #{NATION}
        </if>
        <if test="STATUS != null and STATUS != ''">
			and f.STATUS = #{STATUS}
        </if>
	</select>

</mapper>