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

    <!-- 通用映射列 -->
    <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.River.PatrolManageProcess">
        <result column="id" property="id"/>
        <result column="patrol_type" property="patrolType"/>
        <result column="problem_id" property="problemId"/>
        <result column="operation_user_no" property="operationUserNo"/>
        <result column="next_user_no" property="nextUserNo"/>
        <result column="pic_no" property="picNo"/>
        <result column="description" property="description"/>
        <result column="state" property="state"/>
        <result column="state_desc" property="stateDesc"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <!-- 通用数据库列 -->
    <sql id="Base_Column_List">
              id,
              patrol_type,
              problem_id,
              operation_user_no,
              next_user_no,
              pic_no,
              description,
              state,
              state_desc,
              create_time,
              update_time,
          </sql>

    <resultMap id="processDto" type="com.newfiber.api.pc.model.River.PatrolManageProcessDto">
        <result column="id" property="id"/>
        <result column="patrol_type" property="patrolType"/>
        <result column="problem_id" property="problemId"/>
        <result column="operation_user_no" property="operationUserNo"/>
        <result column="operation_user_Name" property="operationUserName"/>
        <result column="next_user_no" property="nextUserNo"/>
        <result column="pic_no" property="picNo"/>
        <result column="description" property="description"/>
        <result column="state" property="state"/>
        <result column="state_desc" property="stateDesc"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <collection property="processPics" ofType="com.newfiber.api.pc.model.River.PartolManagePic">
            <id column="picId" jdbcType="BIGINT" property="id" />
            <result column="pNo" jdbcType="VARCHAR" property="picNo" />
            <result column="pic_name" jdbcType="VARCHAR" property="picName" />
            <result column="pic_address" jdbcType="VARCHAR" property="picAddress" />
            <result column="pUser" jdbcType="VARCHAR" property="createUserNo" />
            <result column="pTime" jdbcType="TIMESTAMP" property="createTime" />
            <result column="pType" jdbcType="TINYINT" property="type" />
        </collection>
    </resultMap>

    <select id="selectListByProblemId" resultMap="processDto">
       SELECT pms.id,pms.patrol_type,pms.problem_id,pms.operation_user_no,sui.user_name as operation_user_name,pms.next_user_no,
       pms.pic_no,pms.description,pms.state,pms.state_desc,pms.create_time,pms.update_time,
       pic.id as picId,pic.pic_no as pNo,pic.pic_name,pic.pic_address,
       pic.create_user_no as pUser,pic.create_time as pTime,pic.type as pType
       FROM `patrol_manage_process` pms
       left join partol_manage_pic pic on pms.pic_no = pic.pic_no
      left join huludao_main.sys_user_info sui on pms.operation_user_no = sui.user_no
       where pms.problem_id = #{problemId} order by pms.create_time asc,id asc
    </select>
</mapper>