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

     <!-- 通用映射列 -->
    <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.River.RiverUserRelation">
                    <result column="id" property="id"/>
                    <result column="river_no" property="riverNo"/>
                    <result column="leader_no" property="leaderNo"/>
                    <result column="leader_name" property="leaderName"/>
                    <result column="handler_no" property="handlerNo"/>
                    <result column="handler_name" property="handlerName"/>
                    <result column="patrol_user_no"  property="patrolUserNo"/>
                    <result column="patrol_user_name" property="patrolUserName"/>
                    <result column="duty_user_no"  property="dutyUserNo"/>
                    <result column="duty_user_name" property="dutyUserName"/>
                    <result column="update_user_no" property="updateUserNo"/>
                    <result column="create_time" property="createTime"/>
                    <result column="update_time" property="updateTime"/>
            </resultMap>

    <!-- 通用数据库列 -->
    <sql id="Base_Column_List">
              id,
              river_no,
              leader_no,
              leader_name,
              handler_no,
              handler_name,
              patrol_user_no,
              patrol_user_name,
              duty_user_no,
              duty_user_name,
              update_user_no,
              create_time,
              update_time
          </sql>

    <select id="selectRiverByUserNo" resultType="com.newfiber.api.pc.model.River.RiverUserRelation">
        select
        <include refid="Base_Column_List"/>
        from river_user_relation rur
        where (rur.leader_no =#{userNo} or rur.duty_user_no = #{userNo} or rur.patrol_user_no = #{userNo} or rur.handler_no = #{userNo})
        group by rur.id,
        rur.river_no,
        rur.leader_no,
        rur.leader_name,
        rur.handler_no,
        rur.handler_name,
        rur.patrol_user_no,
        rur.patrol_user_name,
        rur.duty_user_no,
        rur.duty_user_name,
        rur.update_user_no,
        rur.create_time,
        rur.update_time
    </select>
</mapper>