WorkCentreMapper.xml 1.07 KB
Newer Older
nie'hong's avatar
nie'hong committed
1 2 3 4 5 6
<?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" />
cq990612's avatar
cq990612 committed
7 8
        <result column="centre_name" property="centreName" />
        <result column="centre-manager_id" property="centreManagerId" />
nie'hong's avatar
nie'hong committed
9 10 11 12 13 14 15
        <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>
cq990612's avatar
cq990612 committed
16 17 18 19 20
    <update id="updateManagerIdIsNullById">
        UPDATE work_centre
        SET centre_manager_id = NULL
        WHERE id = #{id}
    </update>
nie'hong's avatar
nie'hong committed
21

nie'hong's avatar
nie'hong committed
22
    <select id="getByManagerId" resultMap="BaseResultMap" parameterType="integer">
nie'hong's avatar
nie'hong committed
23 24 25 26 27 28
        select <include refid="vals"/>
        from work_centre
        where centre_manager_id = #{userId}
    </select>

</mapper>