<?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.OaTaskCountMapper">

    <!-- 关联查询sql -->
    <sql id="selectSql">
        SELECT a.*
        FROM oa_task_count a
        <where>
            <if test="param.taskCountId != null">
                AND a.task_count_id = #{param.taskCountId}
            </if>
            <if test="param.userId != null">
                AND a.user_id = #{param.userId}
            </if>
            <if test="param.pending != null">
                AND a.pending = #{param.pending}
            </if>
            <if test="param.unused != null">
                AND a.unused = #{param.unused}
            </if>
            <if test="param.completed != null">
                AND a.completed = #{param.completed}
            </if>
            <if test="param.today != null">
                AND a.today = #{param.today}
            </if>
            <if test="param.month != null">
                AND a.month = #{param.month}
            </if>
            <if test="param.year != null">
                AND a.year = #{param.year}
            </if>
            <if test="param.total != null">
                AND a.total = #{param.total}
            </if>
            <if test="param.organizationId != null">
                AND a.organization_id = #{param.organizationId}
            </if>
            <if test="param.roleId != null">
                AND a.role_id = #{param.roleId}
            </if>
            <if test="param.roleCode != null">
                AND a.role_code LIKE CONCAT('%', #{param.roleCode}, '%')
            </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.OaTaskCount">
        <include refid="selectSql"></include>
    </select>

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

</mapper>
