PersonRelationsMapper.xml 2.49 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="cn.com.glsx.dj.mindworkplate.mapper.warning.PersonRelationsMapper" >
  <resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.warning.PersonRelations" >
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="msg_id" property="msgId" jdbcType="INTEGER" />
    <result column="source_type" property="sourceType" jdbcType="BIT" />
    <result column="staff_id" property="staffId" jdbcType="VARCHAR" />
    <result column="staff_name" property="staffName" jdbcType="VARCHAR" />
    <result column="staff_phone" property="staffPhone" jdbcType="VARCHAR" />
    <result column="created_time" property="createdTime" jdbcType="TIMESTAMP" />
    <result column="created_by" property="createdBy" jdbcType="VARCHAR" />
    <result column="updated_time" property="updatedTime" jdbcType="TIMESTAMP" />
    <result column="updated_by" property="updatedBy" jdbcType="VARCHAR" />
    <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR" />
      <result column="director_type" property="directorType" jdbcType="BIT" />
  </resultMap>
  <sql id="Base_Column_List" >
    <!--
      WARNING - @mbg.generated
    -->
    id, msg_id, source_type, staff_id, staff_name, staff_phone, created_time, created_by, 
    updated_time, updated_by, deleted_flag, director_type
  </sql>
  <select id="findAllPersonRelations"
          resultType="cn.com.glsx.dj.mindworkplate.response.warning.WarningMsgStaffRes">

    SELECT staff_id as staffId,staff_name as staffName FROM early_warning_person_relations WHERE source_type = #{sourceType}
    GROUP BY staff_id
  </select>

  <!-- 根据消息id查询预警关联人员信息 -->
    <select id="listPersonRelationsByMsgId" parameterType="list" resultMap="BaseResultMap">
      select pr.id,
             pr.msg_id,
             pr.source_type,
             pr.staff_id,
             pr.staff_name,
             pr.staff_phone,
             pr.created_time,
             pr.created_by,
             pr.updated_time,
             pr.updated_by
      from early_warning_person_relations pr
      where pr.deleted_flag = 'N'
      <if test="msgIdList != null and msgIdList.size() > 0">
        and pr.msg_id in
        <foreach collection="msgIdList" open="(" close=")" separator="," item="item">
          #{item}
        </foreach>
      </if>
    </select>
</mapper>