Newer
Older
newfiber-termite / newfiber-termites / newfiber-termites-dataup / src / main / resources / mapper / termite / ProjectInfoMapper.xml
@liuyuanye liuyuanye on 3 Sep 3 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.newfiber.termite.mapper.ProjectInfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap type="com.newfiber.termite.domain.ProjectInfo" id="ProjectInfoResult">
        <result property="id" column="id"/>
        <result property="projectCode" column="project_code"/>
        <result property="projectName" column="project_name"/>
        <result property="uploadApi" column="upload_api"/>
        <result property="fieldExplain" column="field_explain"/>
        <result property="remark" column="remark"/>
        <result property="productionUsers" column="production_users"/>
        <result property="installUsers" column="install_users"/>
        <result property="analysisUsers" column="analysis_users"/>
        <result property="centerPoint" column="center_point"/>
        <result property="status" column="status"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        t.id
        , t.project_code
    	, t.project_name
    	, t.upload_api
    	, t.field_explain
    	, t.remark
        , t.production_users
        , t.install_users
        , t.analysis_users
        , t.center_point
    	, t.status
    	, t.del_flag
    	, t.create_by
    	, t.create_time
    	, t.update_by
    	, t.update_time
    </sql>

    <sql id="Where_Condition">
        <if test="request.projectName != null and request.projectName != ''">
            and t.project_name like concat('%', #{request.projectName}, '%')
        </if>
        <if test="request.projectCode != null and request.projectCode != ''">
            and t.project_code =#{request.projectCode}
        </if>
    </sql>

    <sql id="Join_Table">

    </sql>

    <select id="selectByCondition" resultMap="ProjectInfoResult">
        select
        <include refid="Base_Column_List"/>
        from ter_project_info t
        <include refid="Join_Table"/>
        where t.del_flag = 0
        <include refid="Where_Condition"/>
        order by t.${request.orderBy}
    </select>

    <select id="selectOneById" resultMap="ProjectInfoResult">
        select
        <include refid="Base_Column_List"/>
        from ter_project_info t
        <include refid="Join_Table"/>
        where t.id = #{id} and t.del_flag = 0
    </select>


    <select id="selectUploadApiBySn" resultType="com.newfiber.termite.domain.ProjectInfo">
        select
            DISTINCT
            tb.project_code as projectCode
                   , tb.project_name as projectName
                   , tb.upload_api  as  uploadApi
                   , tb.field_explain  as fieldExplain
        from  ter_device_info ta
                  left join ter_project_info tb on ta.project_code=tb.project_code
        where ta.sn = #{sn}
    </select>
</mapper>