NoticePersonMapper.xml 3.96 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="com.xiniunet.service.railway.dal.NoticePersonMapper">

    <resultMap id="NoticePersionPo" type="com.xiniunet.service.railway.po.NoticePersonPO">
        <id column="id" property="id" />
        <id column="tenant_id" property="tenantId" />
        <id column="type" property="type" />
        <id column="object1_type" property="object1Type" />
        <id column="object1_id" property="object1Id" />
        <id column="object1_name" property="object1Name" />
        <id column="object2_type" property="object2Type" />
        <id column="object2_id" property="object2Id" />
        <id column="object2_name" property="object2Name" />
        <id column="object3_type" property="object3Type" />
        <id column="object3_id" property="object3Id" />
        <id column="object3_name" property="object3Name" />
        <id column="user_id" property="userId" />
        <id column="user_name" property="userName" />
        <id column="user_email" property="userEmail" />
        <id column="user_mobile" property="userMobile" />
        <id column="is_active" property="isActive" />
        <id column="remark" property="remark" />
        <id column="role_code" property="roleCode" />
        <id column="row_version" property="rowVersion" />
        <id column="is_deleted" property="isDeleted" />
        <id column="created_by" property="createdBy" />
        <id column="creation_time" property="creationTime" />
        <id column="last_updated_by" property="lastUpdatedBy" />
        <id column="last_update_time" property="lastUpdateTime" />
    </resultMap>

    <sql id="entityColumnList">
        `id`, `tenant_id`, `type`,
        `object1_type`, `object1_id`, `object1_name`,
        `object2_type`, `object2_id`, `object2_name`,
        `object3_type`, `object3_id`, `object3_name`,
        `user_id`, `user_name`, `user_email`, `user_mobile`, `is_active`, `remark`, role_code,
        `row_version`,
        `is_deleted`,
        `created_by`,
        `creation_time`,
        `last_updated_by`,
        `last_update_time`
    </sql>

    <select id="queryPersonByLine" resultType="com.xiniunet.service.railway.po.NoticePersonPO">
        SELECT
           <include refid="entityColumnList"/>
        FROM
            MD_NOTICE_PERSON
        WHERE
            `type` = "event_by_line"
        AND object2_type IS NULL
        AND is_active = true
        AND is_deleted = 0
            <if test="objType1 != null and objType1 != ''">
                AND object1_type = #{objType1}
            </if>
            <if test="objId1 != null and objId1 != ''">
                AND object1_id = #{objId1}
            </if>
    </select>

    <select id="queryPersonByStation" resultType="com.xiniunet.service.railway.po.NoticePersonPO">
        SELECT
           <include refid="entityColumnList"/>
        FROM
            MD_NOTICE_PERSON
        WHERE
            `type` = "event_by_station"
        AND is_active = true
        AND is_deleted = 0
            <if test="objType1 != null and objType1 != ''">
                AND object1_type = #{objType1}
            </if>
            <if test="objId1 != null and objId1 != ''">
                AND object1_id = #{objId1}
            </if>
            <if test="objType2 != null and objType2 != ''">
                AND object2_type = #{objType2}
            </if>
            <if test="objId2 != null and objId2 != ''">
                AND object2_id = #{objId2}
            </if>
    </select>

    <select id="queryPersonByHotline" resultType="com.xiniunet.service.railway.po.NoticePersonPO">
        SELECT
        <include refid="entityColumnList"/>
        FROM
        MD_NOTICE_PERSON
        WHERE
        `type` = "hotline"
        AND (object1_type IS NULL or object1_type = '')
        AND (object2_type IS NULL or object2_type = '')
        AND is_active = true
        AND is_deleted = 0
    </select>
</mapper>