Newer
Older
newfiber-termite / newfiber-termites / newfiber-termites-dataup / src / main / resources / mapper / termite / JingchuConfigMapper.xml
@xiongkai xiongkai on 11 Jun 2 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.JingchuConfigMapper">

    <!-- 通用查询映射结果 -->
    <resultMap type="com.newfiber.termite.domain.JingchuConfig" id="JingchuConfigResult">
        <result property="id" column="id"/>
        <result property="sn" column="sn"/>
        <result property="deviceId" column="device_id"/>
        <result property="deviceName" column="device_name"/>
        <result property="electricity" column="electricity"/>
        <result property="mnNo" column="mn_no"/>
        <result property="order" column="order"/>
        <result property="stationId" column="station_id"/>
        <result property="stationName" column="station_name"/>
        <result property="uploadConfirmFlag" column="upload_confirm_flag"/>
        <result property="remark" column="remark"/>
        <result property="status" column="status"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="delFlag" column="del_flag"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        t.id
    	, t.sn
    	, t.device_id
    	, t.device_name
    	, t.electricity
    	, t.mn_no
    	, t.order
    	, t.station_id
    	, t.station_name
        , t.upload_confirm_flag
    	, t.remark
    	, t.status
    	, t.create_by
    	, t.create_time
    	, t.update_by
    	, t.update_time
    	, t.del_flag
	</sql>

    <sql id="Where_Condition">
        <if test="request.sn != null and request.sn != ''">
            and t.sn = #{request.sn}
        </if>
        <if test="request.deviceId != null and request.deviceId != ''">
            and t.device_id = #{request.deviceId}
        </if>
        <if test="request.mnNo != null and request.mnNo != ''">
            and t.mn_no = #{request.mnNo}
        </if>
        <if test="request.stationId != null and request.stationId != ''">
            and t.station_id = #{request.stationId}
        </if>
    </sql>

    <sql id="Join_Table">

    </sql>

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

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

</mapper>