WorkLeaveMapper.xml 1.5 KB
Newer Older
nie'hong's avatar
nie'hong 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
<?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.WorkLeaveMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkLeave">
        <id column="id" property="id"/>
        <result column="user_id" property="userId"/>
        <result column="type_id" property="typeId"/>
        <result column="start_date" property="startDate"/>
        <result column="end_date" property="endDate"/>
        <result column="des" property="des"/>
        <result column="create_time" property="createTime"/>
        <result column="modify_time" property="modifyTime"/>
    </resultMap>

    <sql id="vals">
       #{id},#{userId},#{typeId},#{startDate},#{endDate},#{des},#{createTime},#{modifyTime}
    </sql>

    <sql id="cols_exclude_id">
       user_id, type_id, start_date, end_date, des, create_time, modify_time
    </sql>

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

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

    <insert id="insert" useGeneratedKeys="true" keyProperty="id">
    insert into <include refid="table"/>(<include refid="cols"/> )
    value (<include refid="vals"/> )
    </insert>

    <select id="getListByUserId" resultMap="BaseResultMap">
    select <include refid="cols"/>
    from <include refid="table"/>
    where user_id = #{userId}
    order by start_date DESC
    </select>

</mapper>