GraduationMapper.xml 2.05 KB
Newer Older
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
<?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.wisenergy.mapper.GraduationMapper">
    <resultMap id="graduationMap" type="cn.wisenergy.model.app.Graduation">
        <id column="id" property="id"/>
        <result column="school_name" property="schoolName"/>
        <result column="position" property="position"/>
        <result column="describe" property="describe"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <sql id="table">
        graduation
    </sql>

    <sql id="cols_all">
        id,
        <include refid="cols_exclude_id"/>
    </sql>

    <sql id="cols_exclude_id">
        school_name,`position`,`describe`,create_time,update_time
    </sql>

    <sql id="vals">
        #{schoolName},#{position},#{describe},now(),now()
    </sql>

    <sql id="updateCondition">
        <if test="schoolName != null">school_name =#{schoolName},</if>
        <if test="position != null">`position` =#{position},</if>
        <if test="describe != null">`describe` =#{describe},</if>
        update_time =now()
    </sql>

    <sql id="criteria">
        <if test="schoolName != null">and school_name =#{schoolName},</if>
        <if test="position != null">and `position` =#{position},</if>
        <if test="describe != null">and `describe` =#{describe},</if>
        <if test="createTime != null">and create_time >= #{createTime}</if>
        <if test="updateTime != null">and #{updateTime} >= update_time</if>
    </sql>

    <update id="edit" parameterType="cn.wisenergy.model.app.Graduation">
        UPDATE
        <include refid="table"/>
        <set>
            <include refid="updateCondition"/>
        </set>
        <where>
            id = #{id}
        </where>
    </update>

    <select id="getList" resultMap="graduationMap">
        select
        <include refid="cols_all"/>
        from
        <include refid="table"/>
    </select>

</mapper>