InfoMarketInformationMapper.xml 10.3 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.chinagas.modules.insight.mapper.InfoMarketInformationMapper">
    <resultMap type="com.chinagas.modules.insight.domian.InfoMarketInformation" id="InfoMarketInformationResult">
        <result property="infoId" column="info_id"/>
        <result property="title" column="title"/>
        <result property="organizeId" column="organize_id"/>
        <result property="organizeName" column="organize_name"/>
        <result property="address" column="address"/>
        <result property="plateName" column="plate_name"/>
        <result property="keyword" column="keyword"/>
        <result property="publishTime" column="publish_time"/>
        <result property="submitTime" column="submit_time"/>
        <result property="details" column="details"/>
        <result property="publishStatus" column="publish_status"/>
        <result property="sysCtime" column="sys_ctime"/>
        <result property="sysUtime" column="sys_utime"/>
        <result property="createBy" column="create_by"/>
        <result property="updateBy" column="update_by"/>
        <result property="deleteFlag" column="delete_flag"/>
        <result property="pictureUrl" column="picture_url"/>
    </resultMap>

    <sql id="selectInfoMarketInformationVo">
        select info_id,
               title,
               organize_id,
               organize_name,
               picture_url,
               address,
               plate_name,
               keyword,
               publish_time,
               submit_time,
               details,
               publish_status,
               sys_ctime,
               sys_utime,
               create_by,
               update_by,
               delete_flag
        from info_market_information
    </sql>

    <select id="selectInfoMarketInformationList" parameterType="com.chinagas.modules.insight.vo.InfoMarketInformationVO"
            resultMap="InfoMarketInformationResult">
        <include refid="selectInfoMarketInformationVo"/>
        <where>
            <if test="title != null  and title != ''">and title like concat('%', #{title}, '%')</if>
            <if test="organizeId != null  and organizeId != ''">and organize_id REGEXP #{organizeId}</if>
            <if test="pictureUrl != null  and pictureUrl != ''">and picture_url = #{pictureUrl}</if>
            <if test="organizeName != null and organizeName != ''">and organize_name REGEXP #{organizeName}</if>
            <if test="address != null  and address != ''">and address = #{address}</if>
            <if test="plateNameList != null ">and plate_name in
                <foreach item="plate_name" collection="plateNameList" open="(" separator="," close=")">
                    #{plate_name}
                </foreach>
            </if>
            <if test="keywordList != null ">
                <foreach item="keyword" collection="keywordList" open="and (" close=")" separator="or">
                    find_in_set(#{keyword}, keyword)
                </foreach>
            </if>
            <if test="publishTime != null ">and publish_time = #{publishTime}</if>
            <if test="publishTimeBegin != null and publishTimeEnd != null">
                and publish_time between #{publishTimeBegin} and #{publishTimeEnd}
            </if>
            <if test="submitTime != null ">and submit_time = #{submitTime}</if>
            <if test="details != null  and details != ''">and details = #{details}</if>
            <if test="publishStatusList != null ">and publish_status in
                <foreach item="publish_status" collection="publishStatusList" open="(" separator="," close=")">
                    #{publish_status}
                </foreach>
            </if>
            <if test="sysCtime != null ">and sys_ctime = #{sysCtime}</if>
            <if test="sysUtime != null ">and sys_utime = #{sysUtime}</if>
            and delete_flag = 0 order by sys_ctime DESC
        </where>
    </select>

    <select id="selectInfoMarketInformationByInfoId" parameterType="Long" resultMap="InfoMarketInformationResult">
        <include refid="selectInfoMarketInformationVo"/>
        where info_id = #{infoId}
    </select>

    <insert id="insertInfoMarketInformation" parameterType="com.chinagas.modules.insight.domian.InfoMarketInformation">
        insert into info_market_information
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="infoId != null">info_id,</if>
            <if test="title != null and title != ''">title,</if>
            <if test="organizeId != null and organizeId != ''">organize_id,</if>
            <if test="organizeName != null and organizeName != ''">organize_name,</if>
            <if test="pictureUrl != null and pictureUrl != ''">picture_url,</if>
            <if test="address != null and address != ''">address,</if>
            <if test="plateName != null">plate_name,</if>
            <if test="keyword != null">keyword,</if>
            <if test="publishTime != null">publish_time,</if>
            <if test="submitTime != null">submit_time,</if>
            <if test="details != null and details != ''">details,</if>
            <if test="publishStatus != null">publish_status,</if>
            <if test="sysCtime != null">sys_ctime,</if>
            <if test="sysUtime != null">sys_utime,</if>
            <if test="createBy != null and createBy != ''">create_by,</if>
            <if test="updateBy != null and updateBy != ''">update_by,</if>
            <if test="deleteFlag != null">delete_flag,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="infoId != null">#{infoId},</if>
            <if test="title != null and title != ''">#{title},</if>
            <if test="organizeId != null and organizeId != ''">#{organizeId},</if>
            <if test="organizeName != null and organizeName !=''">#{organizeName},</if>
            <if test="pictureUrl != null and pictureUrl !=''">#{pictureUrl},</if>
            <if test="address != null and address != ''">#{address},</if>
            <if test="plateName != null">#{plateName},</if>
            <if test="keyword != null">#{keyword},</if>
            <if test="publishTime != null">#{publishTime},</if>
            <if test="submitTime != null">#{submitTime},</if>
            <if test="details != null and details != ''">#{details},</if>
            <if test="publishStatus != null">#{publishStatus},</if>
            <if test="sysCtime != null">#{sysCtime},</if>
            <if test="sysUtime != null">#{sysUtime},</if>
            <if test="createBy != null and createBy != ''">#{createBy},</if>
            <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
            <if test="deleteFlag != null">#{deleteFlag},</if>
        </trim>
    </insert>

    <update id="updateInfoMarketInformation" parameterType="com.chinagas.modules.insight.domian.InfoMarketInformation">
        update info_market_information
        <trim prefix="SET" suffixOverrides=",">
            <if test="title != null and title != ''">title = #{title},</if>
            <if test="organizeId != null and organizeId != ''">organize_id = #{organizeId},</if>
            <if test="organizeName != null and organizeName != ''">organize_name = #{organizeName},</if>
            <if test="pictureUrl != null and pictureUrl != ''">picture_url = #{pictureUrl},</if>
            <if test="address != null and address != ''">address = #{address},</if>
            <if test="plateName != null">plate_name = #{plateName},</if>
            <if test="keyword != null">keyword = #{keyword},</if>
            <if test="publishTime != null">publish_time = #{publishTime},</if>
            <if test="submitTime != null">submit_time = #{submitTime},</if>
            <if test="details != null and details != ''">details = #{details},</if>
            <if test="publishStatus != null">publish_status = #{publishStatus},</if>
            <if test="sysCtime != null">sys_ctime = #{sysCtime},</if>
            <if test="sysUtime != null">sys_utime = #{sysUtime},</if>
            <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            <if test="deleteFlag != null">delete_flag = #{deleteFlag},</if>
        </trim>
        where info_id = #{infoId}
    </update>

    <delete id="deleteInfoMarketInformationByInfoId" parameterType="Long">
        delete
        from info_market_information
        where info_id = #{infoId}
    </delete>

    <delete id="deleteInfoMarketInformationByInfoIds" parameterType="String">
        update info_market_information set delete_flag = 1
        where info_id in
        <foreach item="infoId" collection="array" open="(" separator="," close=")">
            #{infoId}
        </foreach>
    </delete>

    <insert id="insertOrUpdate" parameterType="com.chinagas.modules.insight.domian.InfoMarketInformation">
        insert into info_market_information(title,
                                            organize_id,
                                            organize_name,
                                            picture_url,
                                            address,
                                            plate_name,
                                            keyword,
                                            publish_time,
                                            submit_time,
                                            details,
                                            create_by) value
            ( #{title},
            #{organizeId},
            #{organizeName},
            #{pictureUrl},
            #{address},
            #{plateName},
            #{keyword},
            #{publishTime},
            #{submitTime},
            #{details},
            #{createBy}
            )
        ON DUPLICATE KEY
        UPDATE
            TITLE = #{title},
            ORGANIZE_ID = #{organizeId},
            ORGANIZE_NAME = #{organizeName},
            PICTURE_URL = #{pictureUrl},
            ADDRESS = #{address},
            PLATE_NAME = #{plateName},
            KEYWORD = #{keyword},
            PUBLISH_TIME = #{publishTime},
            SUBMIT_TIME = #{submitTime},
            DETAILS = #{details},
            CREATE_BY = #{createBy}

    </insert>


</mapper>