Newer
Older
huludao / src / main / resources / mapper / WaterloggingPointMapper.xml
<?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.newfiber.api.pc.dao.WaterloggingPointMapper">

    <!-- 通用查询映射结果 -->
    <resultMap type="com.newfiber.api.pc.model.entity.WaterloggingPoint" id="WaterloggingPointResult">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="floodPerson" column="flood_person"/>
        <result property="floodPersonPhone" column="flood_person_phone"/>
        <result property="trafficPerson" column="traffic_person"/>
        <result property="trafficPersonPhone" column="traffic_person_phone"/>
        <result property="preHandlePic" column="pre_handle_pic"/>
        <result property="afterHandlePic" column="after_handle_pic"/>
        <result property="description" column="description"/>
        <result property="remark" column="remark"/>
        <result property="status" column="status"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        t.id
    	, t.name
    	, t.flood_person
    	, t.flood_person_phone
    	, t.traffic_person
    	, t.traffic_person_phone
    	, t.pre_handle_pic
    	, t.after_handle_pic
    	, t.description
    	, t.remark
    	, t.status
    	, t.del_flag
    	, t.create_by
    	, t.create_time
    	, t.update_by
    	, t.update_time
	</sql>

    <sql id="Where_Condition">
        <if test="request.name != null and request.name != ''">
            and t.name = #{request.name}
        </if>
        <if test="request.floodPerson != null and request.floodPerson != ''">
            and t.flood_person = #{request.floodPerson}
        </if>
        <if test="request.floodPersonPhone != null and request.floodPersonPhone != ''">
            and t.flood_person_phone = #{request.floodPersonPhone}
        </if>
        <if test="request.trafficPerson != null and request.trafficPerson != ''">
            and t.traffic_person = #{request.trafficPerson}
        </if>
        <if test="request.trafficPersonPhone != null and request.trafficPersonPhone != ''">
            and t.traffic_person_phone = #{request.trafficPersonPhone}
        </if>
        <if test="request.preHandlePic != null and request.preHandlePic != ''">
            and t.pre_handle_pic = #{request.preHandlePic}
        </if>
        <if test="request.afterHandlePic != null and request.afterHandlePic != ''">
            and t.after_handle_pic = #{request.afterHandlePic}
        </if>
        <if test="request.description != null and request.description != ''">
            and t.description = #{request.description}
        </if>
        <if test="request.status != null and request.status != ''">
            and t.status = #{request.status}
        </if>
    </sql>

    <sql id="Join_Table">

    </sql>

    <select id="selectByCondition" resultMap="WaterloggingPointResult">
        select
        <include refid="Base_Column_List"/>
        from meet_waterlogging_point t
        <include refid="Join_Table"/>
        where t.del_flag = 0
        <include refid="Where_Condition"/>
        order by t.${request.orderBy}
    </select>

    <select id="selectOneById" resultMap="WaterloggingPointResult">
        select
        <include refid="Base_Column_List"/>
        from meet_waterlogging_point t
        <include refid="Join_Table"/>
        where t.id = #{id} and t.del_flag = 0
    </select>

</mapper>