Newer
Older
huludao / src / main / resources / mapper / SpecialistInfoMapper.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.newfiber.api.pc.dao.SpecialistInfoMapper">
  <resultMap id="BaseResultMap" type="com.newfiber.api.pc.model.entity.SpecialistInfo">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="company_name" jdbcType="VARCHAR" property="companyName" />
    <result column="position" jdbcType="VARCHAR" property="position" />
    <result column="school" jdbcType="VARCHAR" property="school" />
    <result column="phone" jdbcType="VARCHAR" property="phone" />
    <result column="description" jdbcType="VARCHAR" property="description" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <collection property="specialistFile" ofType="com.newfiber.api.pc.model.entity.SpecialistFile">
      <id column="fid" jdbcType="BIGINT" property="id" />
      <result column="specialist_id" jdbcType="BIGINT" property="specialistId" />
      <result column="file_path" jdbcType="VARCHAR" property="filePath" />
      <result column="file_name" jdbcType="VARCHAR" property="fileName" />
      <result column="createTime2" jdbcType="TIMESTAMP" property="createTime" />
    </collection>
  </resultMap>
  <sql id="Base_Column_List">
    id, name, company_name, position, school, phone, description, create_time, update_time
  </sql>


  <select id="listFor" resultMap="BaseResultMap">
    SELECT spi.id,spi.name,spi.company_name,spi.position,spi.school,spi.phone,spi.description,spi.create_time,spi.update_time,
    spf.id as fid,spf.specialist_id,spf.file_name,spf.file_path,spf.create_time as createTime2
    FROM `specialist_info` as spi
    left join specialist_file spf on spi.id = spf.specialist_id
    where 1=1
    <if test="name != null and name != ''">
      and spi.name like concat('%',#{name},'%')
    </if>
    order by spi.update_time desc
  </select>
</mapper>