<?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.ruoyi.oa.mapper.SysOaCostMapper">

    <resultMap type="com.ruoyi.oa.domain.SysOaCost" id="SysOaCostResult">
        <result property="costId" column="cost_id"/>
        <result property="projectId" column="project_id"/>
        <result property="cost" column="cost"/>
        <result property="costType" column="cost_type"/>
        <result property="remark" column="remark"/>
        <result property="createTime" column="create_time"/>
        <result property="createBy" column="create_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="delFlag" column="del_flag"/>
        <result property="materialId" column="material_id"/>
        <result property="userId" column="user_id"/>
        <result property="financeId" column="finance_id"/>
        <result property="claimId" column="claim_id"/>
    </resultMap>
    <select id="AllList" resultType="com.ruoyi.oa.domain.vo.SysOaCostAll">
    select op.project_id,op.project_name, cost, cost_type, oc.remark, oc.create_time, material_id, user_id, finance_id, claim_id
    from   sys_oa_cost oc
    left join sys_oa_project op on oc.project_id = op.project_id
    <where>
        <if test="projectName != null and projectName != ''">
            and op.project_name like concat('%',#{projectName},'%')
        </if>
        <if test="createTime != null and createTime != '' ">
            and oc.create_time like STR_TO_DATE(#{createTime}, '%Y-%m')
        </if>
        and del_flag is null
    </where>
    order by oc.update_time desc

    </select>
    <select id="getListByProjectId" resultType="com.ruoyi.oa.domain.SysOaCost">
        select * from sys_oa_cost where project_id = #{projectId} and del_flag is null
    </select>


</mapper>
