<?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.gxwebsoft.oa.mapper.ProjectMapper">

    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM oa_project a
        <where>
            <if test="param.projectId != null">
                AND a.project_id = #{param.projectId}
            </if>
            <if test="param.projectName != null">
                AND a.project_name LIKE CONCAT('%', #{param.projectName}, '%')
            </if>
            <if test="param.projectCode != null">
                AND a.project_code LIKE CONCAT('%', #{param.projectCode}, '%')
            </if>
            <if test="param.projectCategory != null">
                AND a.project_category LIKE CONCAT('%', #{param.projectCategory}, '%')
            </if>
            <if test="param.projectAvatar != null">
                AND a.project_avatar LIKE CONCAT('%', #{param.projectAvatar}, '%')
            </if>
            <if test="param.url != null">
                AND a.url LIKE CONCAT('%', #{param.url}, '%')
            </if>
            <if test="param.urlDev != null">
                AND a.url_dev LIKE CONCAT('%', #{param.urlDev}, '%')
            </if>
            <if test="param.urlAdmin != null">
                AND a.url_admin LIKE CONCAT('%', #{param.urlAdmin}, '%')
            </if>
            <if test="param.account != null">
                AND a.account LIKE CONCAT('%', #{param.account}, '%')
            </if>
            <if test="param.money != null">
                AND a.money = #{param.money}
            </if>
            <if test="param.realMoney != null">
                AND a.real_money = #{param.realMoney}
            </if>
            <if test="param.annualFee != null">
                AND a.annual_fee = #{param.annualFee}
            </if>
            <if test="param.content != null">
                AND a.content LIKE CONCAT('%', #{param.content}, '%')
            </if>
            <if test="param.param != null">
                AND a.param LIKE CONCAT('%', #{param.param}, '%')
            </if>
            <if test="param.qrcode != null">
                AND a.qrcode LIKE CONCAT('%', #{param.qrcode}, '%')
            </if>
            <if test="param.customerName != null">
                AND a.customer_name LIKE CONCAT('%', #{param.customerName}, '%')
            </if>
            <if test="param.progress != null">
                AND a.progress = #{param.progress}
            </if>
            <if test="param.views != null">
                AND a.views = #{param.views}
            </if>
            <if test="param.status != null">
                AND a.status = #{param.status}
            </if>
            <if test="param.sortNumber != null">
                AND a.sort_number = #{param.sortNumber}
            </if>
            <if test="param.isCase != null">
                AND a.is_case = #{param.isCase}
            </if>
            <if test="param.commander != null">
                AND a.commander = #{param.commander}
            </if>
            <if test="param.userId != null">
                AND a.user_id = #{param.userId}
            </if>
            <if test="param.organizationId != null">
                AND a.organization_id = #{param.organizationId}
            </if>
            <if test="param.visibility != null">
                AND a.visibility LIKE CONCAT('%', #{param.visibility}, '%')
            </if>
            <if test="param.customerId != null">
                AND a.customer_id = #{param.customerId}
            </if>
            <if test="param.comments != null">
                AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
            </if>
            <if test="param.deleted != null">
                AND a.deleted = #{param.deleted}
            </if>
            <if test="param.deleted == null">
                AND a.deleted = 0
            </if>
            <if test="param.createTimeStart != null">
                AND a.create_time &gt;= #{param.createTimeStart}
            </if>
            <if test="param.createTimeEnd != null">
                AND a.create_time &lt;= #{param.createTimeEnd}
            </if>
        </where>
    </sql>

    <!-- 分页查询 -->
    <select id="selectPageRel" resultType="com.gxwebsoft.oa.entity.Project">
        <include refid="selectSql"></include>
    </select>

    <!-- 查询全部 -->
    <select id="selectListRel" resultType="com.gxwebsoft.oa.entity.Project">
        <include refid="selectSql"></include>
    </select>

</mapper>
