<?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.chushang.inspection.project.mapper.WrkProjectPaymentMapper">

  <select id="payMentData" resultType="com.chushang.inspection.project.vo.WrkProjectPaymentVO">
      select
      t2.project_name as projectName,
      t2.project_id as projectId,
      t2.project_concat as projectConcat,
      t2.project_phone as projectPhone,
      t2.dept_name as deptName,
      t1.contract_amount as contractAmount,
      t2.dept_id as deptId,
      t1.payment_amount as paymentAmount
      from
      wrk_project_contract t1 inner join wrk_project t2 on t1.project_id = t2.project_id
      <where>
          <if test="query.projectName != null and query.projectName != ''">
              AND t2.project_name like concat('%', #{query.projectName}, '%')
          </if>
          <if test="query.projectConcat != null">
              AND t2.project_concat = #{query.projectConcat}
          </if>
          <if test="query.projectPhone != null">
              AND t2.project_phone = #{query.projectPhone}
          </if>
          <if test="query.deptId != null">
              AND t2.dept_id = #{query.deptId}
          </if>
          <if test="1 == 1">
              ${query.sqlParam.get('dataScope')}
          </if>
      </where>

  </select>


    <select id="selectCountByUserId" resultType="com.chushang.inspection.project.vo.CountVO">
        select

        t1.contract_amount as contractAmount,
        t2.dept_id as deptId,
        t1.project_id as projectId,
        t2.project_name as projectName,
        from
        wrk_info t1 inner join wrk_project t2 on t1.project_id = t2.project_id
        <where>
            <if test="query.projectName != null and query.projectName != ''">
                AND t2.project_name like concat('%', #{query.projectName}, '%')
            </if>
            <if test="query.projectConcat != null">
                AND t2.project_concat = #{query.projectConcat}
            </if>
            <if test="query.projectPhone != null">
                AND t2.project_phone = #{query.projectPhone}
            </if>
            <if test="query.deptId != null">
                AND t2.dept_id = #{query.deptId}
            </if>
            <if test="1 == 1">
                ${query.sqlParam.get('dataScope')}
            </if>
        </where>
    </select>
</mapper>
