<?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.api.butlerApp.dao.butler.ButlerHousekeepingDao">

    <select id="list" parameterType="java.lang.Integer" resultType="com.api.vo.butlerApp.ButlerHousekeepingVo">
        select sh.*,concat(cb.no,'-',cbu.no,'-',cbue.room_number) as room_name,su.actual_name as create_name
        from sys_housekeeping as sh,sys_user as su,cpm_building_unit_estate as cbue,cpm_building_unit as cbu,cpm_building as cb
        where sh.create_id = su.id and sh.estate_id = cbue.id and cbue.building_unit_id = cbu.id and cbu.building_id = cb.id and sh.create_id = #{id}
        order by sh.create_date desc
    </select>

    <insert id="insert" parameterType="com.api.model.butlerApp.ButlerHousekeeping">
        insert into sys_housekeeping(
            estate_id,
            num,
            leader_name,
            leader_tel,
            content,
            create_id,
            create_date
        )values (
            #{estateId},
            #{num},
            #{leaderName},
            #{leaderTel},
            #{content},
            #{createId},
            #{createDate}
        )
    </insert>

</mapper>