<?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.tc.mapper.AssetLcMapper">

    <resultMap type="com.ruoyi.tc.entity.AssetLc" id="AssetLcMap">
        <result property="id" column="id" jdbcType="INTEGER"/>
        <result property="taskId" column="task_id" jdbcType="INTEGER"/>
        <result property="xfTime" column="xf_time" jdbcType="TIMESTAMP"/>
        <result property="dwhcTime" column="dwhc_time" jdbcType="TIMESTAMP"/>
        <result property="shbhTime" column="shbh_time" jdbcType="TIMESTAMP"/>
        <result property="dwcxhcTime" column="dwcxhc_time" jdbcType="TIMESTAMP"/>
        <result property="shtgTime" column="shtg_time" jdbcType="TIMESTAMP"/>
        <result property="ueserId" column="ueser_id" jdbcType="INTEGER"/>
        <result property="deptId" column="dept_id" jdbcType="INTEGER"/>
        <result property="createId" column="create_id" jdbcType="INTEGER"/>
        <result property="createBy" column="create_by" jdbcType="VARCHAR"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="updateId" column="update_id" jdbcType="INTEGER"/>
        <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
        <result property="version" column="version" jdbcType="VARCHAR"/>
        <result property="remark" column="remark" jdbcType="VARCHAR"/>
    </resultMap>

    <!--查询单个-->
    <select id="queryById" resultMap="AssetLcMap">
        select id,
               task_id,
               xf_time,
               dwhc_time,
               shbh_time,
               dwcxhc_time,
               shtg_time,
               ueser_i,
               ddept_id,
               create_id,
               create_by,
               create_time,
               update_id,
               update_by,
               update_time,
               version,
               remark
        from asset_lc
        where id = #{id}
    </select>

    <!--查询指定行数据-->
    <select id="queryAllByLimit" resultMap="AssetLcMap">
        select
        id,task_id,xf_time,dept_id,create_id,create_by,create_time,update_id,update_by,update_time,version,remark,assetName
        from asset_lc
        <where>
            <if test="id != null">
                and id = #{id}
            </if>
            <if test="taskId != null">
                and task_id = #{taskId}
            </if>
            <if test="xfTime != null">
                and xf_time = #{xfTime}
            </if>
            <if test="dwhcTime != null">
                and dwhc_time = #{dwhcTime}
            </if>
            <if test="shbhTime != null">
                and shbh_time = #{shbhTime}
            </if>
            <if test="dwcxhcTime != null">
                and dwcxhc_time = #{dwcxhcTime}
            </if>
            <if test="shtgTime != null">
                and shtg_time = #{shtgTime}
            </if>
            <if test="ueserId != null">
                and ueser_id = #{ueserId}
            </if>
            <if test="deptId != null">
                and dept_id = #{deptId}
            </if>
            <if test="createId != null">
                and create_id = #{createId}
            </if>
            <if test="createBy != null and createBy != ''">
                and create_by = #{createBy}
            </if>
            <if test="createTime != null">
                and create_time = #{createTime}
            </if>
            <if test="updateId != null">
                and update_id = #{updateId}
            </if>
            <if test="updateBy != null and updateBy != ''">
                and update_by = #{updateBy}
            </if>
            <if test="updateTime != null">
                and update_time = #{updateTime}
            </if>
            <if test="version != null and version != ''">
                and version = #{version}
            </if>
            <if test="remark != null and remark != ''">
                and remark = #{remark}
            </if>
        </where>
        limit #{pageable.offset}, #{pageable.pageSize}
    </select>

    <!--统计总行数-->
    <select id="count" resultType="java.lang.Long">
        select count(1)
        from asset_lc
        <where>
            <if test="id != null">
                and id = #{id}
            </if>
            <if test="taskId != null">
                and task_id = #{taskId}
            </if>
            <if test="xfTime != null">
                and xf_time = #{xfTime}
            </if>
            <if test="dwhcTime != null">
                and dwhc_time = #{dwhcTime}
            </if>
            <if test="shbhTime != null">
                and shbh_time = #{shbhTime}
            </if>
            <if test="dwcxhcTime != null">
                and dwcxhc_time = #{dwcxhcTime}
            </if>
            <if test="shtgTime != null">
                and shtg_time = #{shtgTime}
            </if>
            <if test="ueserId != null">
                and ueser_id = #{ueserId}
            </if>
            <if test="deptId != null">
                and dept_id = #{deptId}
            </if>
            <if test="createId != null">
                and create_id = #{createId}
            </if>
            <if test="createBy != null and createBy != ''">
                and create_by = #{createBy}
            </if>
            <if test="createTime != null">
                and create_time = #{createTime}
            </if>
            <if test="updateId != null">
                and update_id = #{updateId}
            </if>
            <if test="updateBy != null and updateBy != ''">
                and update_by = #{updateBy}
            </if>
            <if test="updateTime != null">
                and update_time = #{updateTime}
            </if>
            <if test="version != null and version != ''">
                and version = #{version}
            </if>
            <if test="remark != null and remark != ''">
                and remark = #{remark}
            </if>
        </where>
    </select>
    <select id="queryByPage" resultType="com.ruoyi.tc.entity.AssetLc">
        select
        id,task_id,xf_time,dept_id,create_id,create_by,create_time,update_id,update_by,update_time,version,remark,asset_name
        from asset_lc
        <where>

            <if test="req.taskId != null">
                and task_id = #{req.taskId}
            </if>

        </where>

    </select>

    <!--新增所有列-->
    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
        insert into asset_lc(task_id,xf_time,asset_name,ueser_id,dept_id,create_id,create_by,create_time,update_id,update_by,update_time,version,remark)
        values (#{taskId},#{xfTime},#{assetName},#{ueserId},#{deptId},#{createId},#{createBy},#{createTime},#{updateId},#{updateBy},#{updateTime},#{version},#{remark})
    </insert>

    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
        insert into
        asset_lc(task_idxf_timedwhc_timeshbh_timedwcxhc_timeshtg_timeueser_iddept_idcreate_idcreate_bycreate_timeupdate_idupdate_byupdate_timeversionremark)
        values
        <foreach collection="entities" item="entity" separator=",">
            (#{entity.taskId}#{entity.xfTime}#{entity.dwhcTime}#{entity.shbhTime}#{entity.dwcxhcTime}#{entity.shtgTime}#{entity.ueserId}#{entity.deptId}#{entity.createId}#{entity.createBy}#{entity.createTime}#{entity.updateId}#{entity.updateBy}#{entity.updateTime}#{entity.version}#{entity.remark})
        </foreach>
    </insert>

    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
        insert into
        asset_lc(task_idxf_timedwhc_timeshbh_timedwcxhc_timeshtg_timeueser_iddept_idcreate_idcreate_bycreate_timeupdate_idupdate_byupdate_timeversionremark)
        values
        <foreach collection="entities" item="entity" separator=",">
            (#{entity.taskId}#{entity.xfTime}#{entity.dwhcTime}#{entity.shbhTime}#{entity.dwcxhcTime}#{entity.shtgTime}#{entity.ueserId}#{entity.deptId}#{entity.createId}#{entity.createBy}#{entity.createTime}#{entity.updateId}#{entity.updateBy}#{entity.updateTime}#{entity.version}#{entity.remark})
        </foreach>
        on duplicate key update
        task_id = values(task_id)xf_time = values(xf_time)dwhc_time = values(dwhc_time)shbh_time =
        values(shbh_time)dwcxhc_time = values(dwcxhc_time)shtg_time = values(shtg_time)ueser_id =
        values(ueser_id)dept_id = values(dept_id)create_id = values(create_id)create_by = values(create_by)create_time =
        values(create_time)update_id = values(update_id)update_by = values(update_by)update_time =
        values(update_time)version = values(version)remark = values(remark)
    </insert>

    <!--通过主键修改数据-->
    <update id="update">
        update asset_lc
        <set>
            <if test="taskId != null">
                task_id = #{taskId},
            </if>
            <if test="xfTime != null">
                xf_time = #{xfTime},
            </if>
            <if test="dwhcTime != null">
                dwhc_time = #{dwhcTime},
            </if>
            <if test="shbhTime != null">
                shbh_time = #{shbhTime},
            </if>
            <if test="dwcxhcTime != null">
                dwcxhc_time = #{dwcxhcTime},
            </if>
            <if test="shtgTime != null">
                shtg_time = #{shtgTime},
            </if>
            <if test="ueserId != null">
                ueser_id = #{ueserId},
            </if>
            <if test="deptId != null">
                dept_id = #{deptId},
            </if>
            <if test="createId != null">
                create_id = #{createId},
            </if>
            <if test="createBy != null and createBy != ''">
                create_by = #{createBy},
            </if>
            <if test="createTime != null">
                create_time = #{createTime},
            </if>
            <if test="updateId != null">
                update_id = #{updateId},
            </if>
            <if test="updateBy != null and updateBy != ''">
                update_by = #{updateBy},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime},
            </if>
            <if test="version != null and version != ''">
                version = #{version},
            </if>
            <if test="remark != null and remark != ''">
                remark = #{remark},
            </if>
        </set>
        where id = #{id}
    </update>

    <!--通过主键删除-->
    <delete id="deleteById">
        delete
        from asset_lc
        where id = #{id}
    </delete>

</mapper>

