<?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.cw.projectRecords.mapper.CwManHourManagementMapper">

    <select id="findList" resultType="com.jeeplus.test.cw.projectRecords.service.dto.CwManHourManagementDTO">
        select
        p.id as "projectId",
        p.project_name as "projectName",
        p.project_number as "projectNumber",
        psu.name as "projectMasterName",
        a.id as "id",
        a.create_by as "createBy.id",
        su.name as "createBy.name",
        a.create_date as "createDate",
        a.plan_start_date as "planStartDate",
        a.plan_end_date as "planEndDate",
        a.status as "status"
        from cw_man_hour_management a
        left join cw_project_records p on a.project_id = p.id
        left join sys_user psu on psu.id = p.project_master_id
        left join sys_user su on a.create_by = su.id
        ${ew.customSqlSegment}
    </select>

    <select id="queryById" resultType="com.jeeplus.test.cw.projectRecords.service.dto.CwManHourManagementDTO">
        select
        p.id as "projectId",
        p.project_name as "projectName",
        p.project_number as "projectNumber",
        psu.name as "projectMasterName",
        a.id as "id",
        a.create_by as "createBy.id",
        su.name as "createBy.name",
        a.create_date as "createDate",
        a.plan_start_date as "planStartDate",
        a.plan_end_date as "planEndDate",
        a.status as "status"
        from cw_man_hour_management a
        left join cw_project_records p on a.project_id = p.id
        left join sys_user psu on psu.id = p.project_master_id
        left join sys_user su on a.create_by = su.id
        where a.del_flag = '0' and a.id = ${id}
    </select>

    <update id="delete">
        update cw_man_hour_management
        set del_flag = 0
        where id = #{id}
    </update>

    <update id="updateStatus">
        update cw_man_hour_management
        set status = 1
        where id = #{id}
    </update>
</mapper>
