<?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.springblade.modules.mdjftj.mapper.MdjfTjMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="mdjftjResultMap" type="org.springblade.modules.mdjftj.entity.MdjfTjEntity">
        <result column="id" property="id"/>
        <result column="jf_id" property="jfId"/>
        <result column="tjsj" property="tjsj"/>
        <result column="tjdd" property="tjdd"/>
        <result column="rssh" property="rssh"/>
        <result column="cwss" property="cwss"/>
        <result column="tjxq" property="tjxq"/>
        <result column="tjzt" property="tjzt"/>
        <result column="fj" property="fj"/>
        <result column="tjsxr" property="tjsxr"/>
        <result column="tjjgzp" property="tjjgzp"/>
        <result column="sbdw" property="sbdw"/>
    </resultMap>


    <select id="selectmdjfTjPage" resultType="org.springblade.modules.mdjftj.vo.MdjfTjVO">
        SELECT
            *
        FROM
            mdjf_tj
        WHERE
            is_deleted = 0
        AND jf_id :: text = #{params.jfId}
        ORDER BY mdjf_tj.tjsj DESC
    </select>


    <select id="exportmdjfTj" resultType="org.springblade.modules.mdjftj.excel.MdjfTjExcel">
        SELECT * FROM mdjf_tj ${ew.customSqlSegment}
    </select>

    <select id="selectZf" resultType="org.springblade.modules.system.entity.Dept">
        select * from blade_dept where is_deleted = 0 and parent_id :: text = #{deptId} and dept_category = 13
    </select>

<!--    回访后修改调节状态-->
    <update id="updateByHf">
        update mdjf_tj set tjzt = #{tjzt} where jf_id = #{jfId}
    </update>

    <insert id="saveMdjfTjJl">
        INSERT INTO jdrh.mdjf_tj
        (id, jf_id, tjsj, tjdd, rssh, cwss, tjxq, tjzt, fj, tjsxr, tjjgzp, create_user, create_dept, create_time, update_user, update_time, status, is_deleted, sbdw, bmmc, lkyy)
        VALUES(#{id},
            #{jfId},
            #{tjsj},
            #{tjdd},
            #{rssh},
            #{cwss},
            #{tjxq},
            #{tjzt},
            #{fj},
            #{tjsxr},
            #{tjjgzp},
            #{createUser},
            #{createDept},
            #{createTime},
            #{updateUser},
            #{updateTime},
            #{status},
            #{isDeleted},
            #{sbdw},
            #{bmmc},
            #{lkyy});
    </insert>
</mapper>
