Newer
Older
huludao / src / main / resources / mapper / RiverManage / PatrolManageBaseRelationMapper.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.RiverManage.PatrolManageBaseRelationMapper">

     <!-- 通用映射列 -->
    <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.River.PatrolManageBaseRelation">
                    <result column="id" property="id"/>
                    <result column="patrol_type" property="patrolType"/>
                    <result column="st_code"  property="stCode"/>
                    <result column="bind_no" property="bindNo"/>
                    <result column="project_name" property="projectName"/>
                    <result column="create_time" property="createTime"/>
                    <result column="update_time" property="updateTime"/>
            </resultMap>

    <!-- 通用数据库列 -->
    <sql id="Base_Column_List">
              id,
              patrol_type,
              st_code,
              bind_no,
              project_name,
              create_time,
              update_time
          </sql>

    <select id="selectByStCode" resultType="com.newfiber.api.pc.model.River.PatrolManageBaseRelation">
        SELECT
        pmbr.id,
        pmbr.patrol_type,
        pmbr.st_code,
        pmbr.bind_no,
        pmb.project_name,
        pmbr.create_time,
        pmbr.update_time
        from patrol_manage_base_relation pmbr
        where 1=1
        <if test="patrolType != null">
            and pmbr.patrol_type = #{patrolType}
        </if>
        <if test="siteNo != null">
            and pmbr.siteNo = #{siteNo}
        </if>
        group by pmbr.id,
        pmbr.patrol_type,
        pmbr.st_code,
        pmbr.bind_no,
        pmb.project_name,
        pmbr.create_time,
        pmbr.update_time limit 1
    </select>
</mapper>