<?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.ZXC.lesson.dao.LessonUserDao">
<sql id="table">
user
</sql>
<sql id="insert_parm">
u_id,u_name,u_sex,u_age
</sql>
<sql id="query_parm">
u_id,u_name,u_sex,u_age,u_create_time,u_update_time
</sql>
<resultMap id="id" type="com.ZXC.lesson.model.LessonUser">
<id column="u_id" property="ID"/>
<result column="u_name" property="Name"/>
<result column="u_sex" property="Sex"/>
<result column="u_age" property="Age"/>
</resultMap>
<insert id="save" parameterType="com.ZXC.lesson.model.LessonUser"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO <include refid="table"/>
(<include refid="insert_parm"/>)
VALUES
(#{ID},#{Name},#{Sex},#{Age})
</insert>
<update id="update" parameterType="com.ZXC.lesson.model.LessonUser">
UPDATE <include refid="table"/>
<set>
<if test="Sex!=null">u_sex=#{Sex}</if>
<if test="Age!=null">u_age=#{age}</if>
</set>
</update>
<update id="delete" parameterType="com.ZXC.lesson.model.LessonUser">
UPDATE <include refid="table" />
SET is_delete=1
WHERE u_id=#{ID}
</update>
<select id="querybyid" parameterType="com.ZXC.lesson.model.LessonUser">
SELECT <include refid="query_parm"/>
FROM <include refid="table"/>
WHERE u_id=#{ID} AND is_delete=0
</select>
<select id="querylist" parameterType="com.ZXC.lesson.model.LessonUser">
SELECT <include refid="query_parm"/>
FROM <include refid="table"/>
WHERE id IN
<foreach collection="uid_list" open="(" close=")" item="uid" separator=",">
#{ID}
</foreach>
AND is_delete=0
</select>
</mapper>