PushAnsweringDataMapper.xml 1.11 KB
<?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.subsidy.mapper.PushAnsweringDataMapper">

    <select id="insertAnswerData">
        insert into push_answering_data (class_id,ask_id,create_date,update_date)
        VALUES (#{classId},#{userId}, #{question}, #{answer})
    </select>

    <select id="answerList" resultType="long">
        	SELECT
                t2.id AS 答疑id
            FROM
                answering_question t2
                left join class_dict t3 on t2.class_id = t3.id
                LEFT JOIN push_answering_data t1 ON t1.class_id = t2.class_id
                AND t1.ask_id = t2.ask_id
                AND t1.create_date = t2.create_date
                AND t1.update_date = t2.update_date
            WHERE
                t2.delete_date IS NULL
                AND DATE_FORMAT( DATE_ADD( t2.update_date, interval 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
                AND t1.create_date IS NULL
                and t3.class_type = 0

    </select>
</mapper>