<?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="org.jeecg.modules.basedata.mapper.FdMilestoneTemplateMapper">
    <select id="getCount" resultType="java.lang.Long">
        SELECT COUNT(1) FROM fd_milestone_template
    </select>

    <select id="getAllPage" resultType="org.jeecg.modules.basedata.entity.FdMilestoneTemplate">
        <bind name="pagecurr" value="(current-1)*size"></bind>
        SELECT id,name,description,create_time
        FROM fd_milestone_template
        where 1=1
        <if test="FdMilestoneTemplate.name!=null and FdMilestoneTemplate.name!=''">
            and f.name = #{FdMilestoneTemplate.name}
        </if>
        <if test="FdMilestoneTemplate.description!=null and FdMilestoneTemplate.description!=''">
            and f.description = #{FdMilestoneTemplate.description}
        </if>
        LIMIT #{pagecurr},#{size}
    </select>

    <select id="getByIdMilestoneTemplate" resultType="org.jeecg.modules.basedata.entity.FdMilestoneTemplate">
        select * from fd_milestone_template where id=#{id}
    </select>

    <update id="parentIdBatch" parameterType="java.util.List">
        <foreach collection="templateItemList" item="templateItem" index="index" open="" close="" separator=";">
            update fd_milestone_template_item
            <set>
                parent_id =#{templateItem.parentId}
            </set>
            <where>
                id=#{templateItem.id}
            </where>
        </foreach>
    </update>


</mapper>