Newer
Older
huludao / src / main / resources / mapper / project / FactoryBaseDataMapper.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.xf.huludao.project.dao.FactoryBaseDataMapper">

    <!-- 通用映射列 -->
    <resultMap id="BaseResultMap" type="com.xf.huludao.project.entity.FactoryBaseData">
        <result column="id" property="id"/>
        <result column="factory_name" property="factoryName"/>
        <result column="factory_code" property="factoryCode"/>
        <result column="lon" property="lon"/>
        <result column="lat" property="lat"/>
        <result column="address" property="address"/>
        <result column="duty_person" property="dutyPerson"/>
        <result column="duty_person_phone" property="dutyPersonPhone"/>
        <result column="factory_scale" property="factoryScale"/>
        <result column="treatment_process" property="treatmentProcess"/>
        <result column="factory_create_time" property="factoryCreateTime"/>
        <result column="pic_info" property="picInfo"/>
        <result column="create_time" property="createTime"/>
        <result column="create_user" property="createUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="status" property="status"/>
        <result column="create_dept" property="createDept"/>
    </resultMap>

    <!-- 通用数据库列 -->
    <sql id="Base_Column_List">
              id,
              factory_name,
              factory_code,
              lon,
              lat,
              address,
              duty_person,
              duty_person_phone,
              factory_scale,
              treatment_process,
              factory_create_time,
              pic_info,
              create_time,
              create_user,
              update_time,
              update_user,
              is_deleted,
              status,
              create_dept
          </sql>

    <sql id="Where_Condition">
        <if test="request.id != null and request.id != ''">
            and id = #{request.id}
        </if>
        <if test="request.factoryCode != null and request.factoryCode != ''">
            and factory_code like concat('%',#{request.factoryCode},'%')
        </if>
        <if test="request.factoryName != null and request.factoryName != ''">
            and factory_name like concat('%',#{request.factoryName},'%')
        </if>
        <if test="request.lon != null and request.lon != ''">
            and lon = #{request.lon}
        </if>
        <if test="request.lat != null and request.lat != ''">
            and lat = #{request.lat}
        </if>
        <if test="request.address != null and request.address != ''">
            and address = #{request.address}
        </if>
        <if test="request.dutyPerson != null and request.dutyPerson != ''">
            and duty_person = #{request.dutyPerson}
        </if>
        <if test="request.dutyPersonPhone != null and request.dutyPersonPhone != ''">
            and duty_person_phone = #{request.dutyPersonPhone}
        </if>
        <if test="request.factoryScale != null and request.factoryScale != ''">
            and factory_scale = #{request.factoryScale}
        </if>
        <if test="request.treatmentProcess != null and request.treatmentProcess != ''">
            and treatment_process = #{request.treatmentProcess}
        </if>
        <if test="request.factoryCreateTime != null and request.factoryCreateTime != ''">
            and factory_create_time = #{request.factoryCreateTime}
        </if>
        <if test="request.picInfo != null and request.picInfo != ''">
            and pic_info = #{request.picInfo}
        </if>
        <if test="request.createTime != null and request.createTime != ''">
            and create_time = #{request.createTime}
        </if>
        <if test="request.createUser != null and request.createUser != ''">
            and create_user = #{request.createUser}
        </if>
        <if test="request.updateTime != null and request.updateTime != ''">
            and update_time = #{request.updateTime}
        </if>
        <if test="request.updateUser != null and request.updateUser != ''">
            and update_user = #{request.updateUser}
        </if>
        <if test="request.isDeleted != null and request.isDeleted != ''">
            and is_deleted = #{request.isDeleted}
        </if>
        <if test="request.status != null and request.status != ''">
            and status = #{request.status}
        </if>
        <if test="request.createDept != null and request.createDept != ''">
            and create_dept = #{request.createDept}
        </if>
    </sql>

    <select id="selectByCondition" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from factory_base_data
        where is_deleted = 0
        <include refid="Where_Condition"/>
        order by update_time desc
    </select>

    <select id="exportFactoryBaseData" resultType="com.xf.huludao.project.entity.FactoryBaseData">
        SELECT * FROM factory_base_data ${ew.customSqlSegment}
    </select>
</mapper>