<?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="cn.wisenergy.mapper.WorkCentreMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkCentre">
        <id column="id" property="id" />
        <result column="centre_name" property="centreName" />
        <result column="centre-manager_id" property="centreManagerId" />
        <result column="create_time" property="createTime" />
        <result column="modify_time" property="modifyTime" />
    </resultMap>

    <sql id="vals">
        id, centre_name, centre_manager_id, create_time, modify_time
    </sql>
    <update id="updateManagerIdIsNullById">
        UPDATE work_centre
        SET centre_manager_id = NULL
        WHERE id = #{id}
    </update>

    <select id="getByManagerId" resultMap="BaseResultMap" parameterType="integer">
        select <include refid="vals"/>
        from work_centre
        where centre_manager_id = #{userId}
    </select>

</mapper>