<?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.ruoyi.project.benyi.mapper.ByChildLearndevelopmentFamilyMapper">

    <resultMap type="ByChildLearndevelopmentFamily" id="ByChildLearndevelopmentFamilyResult">
        <result property="id" column="id"/>
        <result property="childid" column="childid"/>
        <result property="schoolid" column="schoolid"/>
        <result property="classid" column="classid"/>
        <result property="xnxq" column="xnxq"/>
        <result property="zpimgs" column="zpimgs"/>
        <result property="zpimgremarks" column="zpimgremarks"/>
        <result property="shimgs" column="shimgs"/>
        <result property="shimgsremarks" column="shimgsremarks"/>
        <result property="yqsj" column="yqsj"/>
        <result property="yqsjremarks" column="yqsjremarks"/>
        <result property="jspy" column="jspy"/>
        <result property="jspyremarks" column="jspyremarks"/>
        <result property="createuserid" column="createuserid"/>
        <result property="createTime" column="create_time"/>
    </resultMap>

    <sql id="selectByChildLearndevelopmentFamilyVo">
        select a.id, a.childid, a.xnxq, a.zpimgs, a.zpimgremarks, a.shimgs, a.shimgsremarks, a.yqsj, a.yqsjremarks, a.jspy, a.jspyremarks, a.createuserid, a.create_time,b.schoolid, b.classid from by_child_learndevelopment_family  a left join by_child b on a.childid=b.id
    </sql>

    <select id="selectByChildLearndevelopmentFamilyList" parameterType="ByChildLearndevelopmentFamily"
            resultMap="ByChildLearndevelopmentFamilyResult">
        <include refid="selectByChildLearndevelopmentFamilyVo"/>
        <where>
            <if test="childid != null ">and a.childid = #{childid}</if>
            <if test="schoolid != null ">and b.schoolid = #{schoolid}</if>
            <if test="classid != null  and classid != ''">and b.classid = #{classid}</if>
            <if test="xnxq != null  and xnxq != ''">and a.xnxq = #{xnxq}</if>
            <if test="zpimgs != null  and zpimgs != ''">and a.zpimgs = #{zpimgs}</if>
            <if test="zpimgremarks != null  and zpimgremarks != ''">and a.zpimgremarks = #{zpimgremarks}</if>
            <if test="shimgs != null  and shimgs != ''">and a.shimgs = #{shimgs}</if>
            <if test="shimgsremarks != null  and shimgsremarks != ''">and a.shimgsremarks = #{shimgsremarks}</if>
            <if test="yqsj != null  and yqsj != ''">and a.yqsj = #{yqsj}</if>
            <if test="yqsjremarks != null  and yqsjremarks != ''">and a.yqsjremarks = #{yqsjremarks}</if>
            <if test="jspy != null  and jspy != ''">and a.jspy = #{jspy}</if>
            <if test="jspyremarks != null  and jspyremarks != ''">and a.jspyremarks = #{jspyremarks}</if>
            <if test="createuserid != null ">and a.createuserid = #{createuserid}</if>
            <if test="id != null ">and a.id = #{id}</if>
        </where>
    </select>

    <select id="selectByChildLearndevelopmentFamilyById" parameterType="Long"
            resultMap="ByChildLearndevelopmentFamilyResult">
        <include refid="selectByChildLearndevelopmentFamilyVo"/>
        where a.id = #{id}
    </select>

    <insert id="insertByChildLearndevelopmentFamily" parameterType="ByChildLearndevelopmentFamily">
        insert into by_child_learndevelopment_family
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null ">id,</if>
            <if test="childid != null ">childid,</if>
            <if test="xnxq != null  and xnxq != ''">xnxq,</if>
            <if test="zpimgs != null  and zpimgs != ''">zpimgs,</if>
            <if test="zpimgremarks != null  and zpimgremarks != ''">zpimgremarks,</if>
            <if test="shimgs != null  and shimgs != ''">shimgs,</if>
            <if test="shimgsremarks != null  and shimgsremarks != ''">shimgsremarks,</if>
            <if test="yqsj != null  and yqsj != ''">yqsj,</if>
            <if test="yqsjremarks != null  and yqsjremarks != ''">yqsjremarks,</if>
            <if test="jspy != null  and jspy != ''">jspy,</if>
            <if test="jspyremarks != null  and jspyremarks != ''">jspyremarks,</if>
            <if test="createuserid != null ">createuserid,</if>
            <if test="createTime != null ">create_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null ">#{id},</if>
            <if test="childid != null ">#{childid},</if>
            <if test="xnxq != null  and xnxq != ''">#{xnxq},</if>
            <if test="zpimgs != null  and zpimgs != ''">#{zpimgs},</if>
            <if test="zpimgremarks != null  and zpimgremarks != ''">#{zpimgremarks},</if>
            <if test="shimgs != null  and shimgs != ''">#{shimgs},</if>
            <if test="shimgsremarks != null  and shimgsremarks != ''">#{shimgsremarks},</if>
            <if test="yqsj != null  and yqsj != ''">#{yqsj},</if>
            <if test="yqsjremarks != null  and yqsjremarks != ''">#{yqsjremarks},</if>
            <if test="jspy != null  and jspy != ''">#{jspy},</if>
            <if test="jspyremarks != null  and jspyremarks != ''">#{jspyremarks},</if>
            <if test="createuserid != null ">#{createuserid},</if>
            <if test="createTime != null ">#{createTime},</if>
        </trim>
    </insert>

    <update id="updateByChildLearndevelopmentFamily" parameterType="ByChildLearndevelopmentFamily">
        update by_child_learndevelopment_family
        <trim prefix="SET" suffixOverrides=",">
            <if test="childid != null ">childid = #{childid},</if>
            <if test="xnxq != null  and xnxq != ''">xnxq = #{xnxq},</if>
            <if test="zpimgs != null  and zpimgs != ''">zpimgs = #{zpimgs},</if>
            <if test="zpimgremarks != null  and zpimgremarks != ''">zpimgremarks = #{zpimgremarks},</if>
            <if test="shimgs != null  and shimgs != ''">shimgs = #{shimgs},</if>
            <if test="shimgsremarks != null  and shimgsremarks != ''">shimgsremarks = #{shimgsremarks},</if>
            <if test="yqsj != null  and yqsj != ''">yqsj = #{yqsj},</if>
            <if test="yqsjremarks != null  and yqsjremarks != ''">yqsjremarks = #{yqsjremarks},</if>
            <if test="jspy != null  and jspy != ''">jspy = #{jspy},</if>
            <if test="jspyremarks != null  and jspyremarks != ''">jspyremarks = #{jspyremarks},</if>
            <if test="createuserid != null ">createuserid = #{createuserid},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteByChildLearndevelopmentFamilyById" parameterType="Long">
        delete from by_child_learndevelopment_family where id = #{id}
    </delete>

    <delete id="deleteByChildLearndevelopmentFamilyByIds" parameterType="String">
        delete from by_child_learndevelopment_family where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>