<?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.unis.importantNews.modular.singrainbureaunotice.mapper.BizSinGrainBureauNoticeMapper">

    <select id="batchUpdateStatus" parameterType="java.util.Map">
        UPDATE biz_sin_grain_bureau_notice
        SET status = #{status}
        WHERE id = #{id}
    </select>

    <select id="findPage" resultType="java.util.Map">
    select * from (
        (SELECT id,title, notice_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time,'lsjgggl' type
         FROM biz_sin_grain_bureau_notice
        WHERE MATCH(title,notice_content) AGAINST (#{title}))
        UNION
        (SELECT id,title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time,'tzgggl' type
        FROM biz_sin_notice_announcement
        WHERE MATCH(title,announcement_content) AGAINST (#{title}))
        UNION
        (SELECT id,document_name title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time,'xzgfwj' type
        FROM biz_og_administrative_document
        WHERE MATCH(document_name,announcement_content) AGAINST (#{title}))

        UNION
        (SELECT id,enterprise_name title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time,'xzxk' type
        FROM biz_og_administrative_license
        WHERE MATCH(enterprise_name,announcement_content) AGAINST (#{title}))

        UNION
        (SELECT id,punished_entity title, case_summary nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time ,'xzcf' type
        FROM biz_og_administrative_penalty
        WHERE MATCH(punished_entity,case_summary) AGAINST (#{title}))

        UNION
        (SELECT id,title title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time ,'gknb' type
        FROM biz_og_annual_report
        WHERE MATCH(title,announcement_content) AGAINST (#{title}))

        UNION
        (SELECT id,title title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time ,'lzyj' type
        FROM biz_og_duty_basis
        WHERE MATCH(title,announcement_content) AGAINST (#{title}))

        UNION
        (SELECT id,title title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time ,'czyjs' type
        FROM biz_og_financial_budget
        WHERE MATCH(title,announcement_content) AGAINST (#{title}))

        UNION
        (SELECT id,title title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time ,'ghjh' type
        FROM biz_og_plan
        WHERE MATCH(title,announcement_content) AGAINST (#{title}))

        UNION
        (SELECT id,document_name title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time ,'zcwj' type
        FROM biz_og_policy_file
        WHERE MATCH(document_name,announcement_content) AGAINST (#{title}))

        UNION
        (SELECT id,'' title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time ,'zcjdgl' type
        FROM biz_og_policy_interpretation
        WHERE MATCH(announcement_content) AGAINST (#{title}))

        UNION
        (SELECT id,title title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time ,'zdgkwj' type
        FROM biz_og_proactive_disclosure
        WHERE MATCH(title,announcement_content) AGAINST (#{title}))

        UNION
        (SELECT id,title title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time ,'gkzn' type
        FROM biz_og_public_guidance
        WHERE MATCH(title,announcement_content) AGAINST (#{title}))

        UNION
        (SELECT id,document_name title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time ,'gkzd' type
        FROM biz_og_public_system
        WHERE MATCH(document_name,announcement_content) AGAINST (#{title}))

        UNION
        (SELECT id,title title, announcement_content nr,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') create_time ,'gznb' type
        FROM biz_og_work_annual_report
        WHERE MATCH(title,announcement_content) AGAINST (#{title}))
            )a ORDER BY a.create_time desc
    </select>
</mapper>