<?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.ghy.worker.mapper.WorkerMapper">

    <resultMap id="WorkerResult" type="com.ghy.worker.domain.Worker">
        <result property="workerId"          column="worker_id"     />
        <result property="name"                column="name"     />
        <result property="account"             column="account"     />
        <result property="phone"               column="phone"     />
        <result property="openId"              column="open_id"     />
        <result property="password"              column="password"     />
        <result property="status"              column="status"     />
        <result property="deptName"             column="dept_name"/>
        <result property="deptId"             column="dept_id"/>
        <result property="workerLogoUrl"     column="worker_logo_url"     />
        <result property="leaderTeamRate"     column="leader_team_rate"     />
        <result property="leaderTeamMoney"     column="leader_team_money"     />
        <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="remark"              column="remark"        />
    </resultMap>

    <sql id="selectWorker">
        SELECT
            w.worker_id, w.name, w.account, w.phone, w.password, w.open_id, w.dept_id, sd.dept_name, w.status, w.worker_logo_url,
            w.leader_team_rate, w.leader_team_money, w.create_by, w.create_time, w.update_by, w.update_time, w.remark
        FROM worker w
        LEFT JOIN sys_dept sd ON w.dept_id = sd.dept_id
    </sql>

    <select id="getWorkerList" resultMap="WorkerResult">
        <include refid="selectWorker" />
    </select>


</mapper>