<?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.jeeplus.test.jobPosion.mapper.PositionLogMapper">
  <resultMap id="BaseResultMap" type="com.jeeplus.test.jobPosion.domain.PositionLog">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="create_by" jdbcType="VARCHAR" property="createBy" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
    <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
    <result column="type" jdbcType="VARCHAR" property="type" />
    <result column="operation_type" jdbcType="VARCHAR" property="operationType" />
    <result column="operation_content" jdbcType="VARCHAR" property="operationContent" />
    <result column="operation_result" jdbcType="VARCHAR" property="operationResult" />
    <result column="remote_addr" jdbcType="VARCHAR" property="remoteAddr" />
    <result column="access_location" jdbcType="VARCHAR" property="accessLocation" />
  </resultMap>
  <sql id="Base_Column_List">
    pl.id,
    pl.create_by,
    pl.create_date,
    pl.update_by,
    pl.update_date,
    pl.remarks,
    pl.del_flag,
    pl.`type`,
    pl.operation_type,
    pl.operation_content,
    pl.operation_result,
    pl.remote_addr,
    pl.access_location
  </sql>

  <sql id="Sql">
    pl.id,
    pl.create_date,
    pl.update_by,
    pl.update_date,
    pl.remarks,
    pl.del_flag,
    pl.operation_type,
    pl.operation_content,
    pl.operation_result,
    pl.remote_addr,
    pl.access_location
  </sql>

  <select id="findList" resultType="com.jeeplus.test.jobPosion.domain.PositionLog">
    select
    <include refid="Sql"></include>,
    CASE
        WHEN pl.`type` = '1' THEN '职务类型'
        WHEN pl.`type` = '2' THEN '职务'
        WHEN pl.`type` = '3' THEN '职位'
    END `type`,
    su.login_name as create_by
    from position_log pl
    left join sys_user su on su.id = pl.create_by
    ${ew.customSqlSegment}
    order by pl.create_date desc
  </select>
</mapper>