<?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.house365.ws.dao.mapper.ProjectUserMapper">

    <resultMap id="infoMap" type="com.house365.beans.entity.ProjectUserEntity">
        <result property="id" column="id" />
        <result property="projectId" column="projectId" />
        <result property="projectCode" column="projectCode" />
        <result property="projectName" column="projectName" />
        <result property="userId" column="userId" />
        <result property="userName" column="userName" />
        <result property="createUserid" column="createUserid" />
        <result property="createUsername" column="createUsername" />
        <result property="createTime" column="createTime" />
        <result property="createIp" column="createIp" />
        <result property="updateUserid" column="updateUserid" />
        <result property="updateUsername" column="updateUsername" />
        <result property="updateTime" column="updateTime" />
        <result property="updateIp" column="updateIp" />
    </resultMap>

    <sql id="sqlId">
      id, projectId, projectCode, projectName, userId, userName, createUserid, createUsername, createTime,
      createIp, updateUserid, updateUsername, updateTime, updateIp
    </sql>

    <select id="queryByConditions" parameterType="map" resultMap="infoMap">
        SELECT *
        FROM project_user
        where 1 = 1
        <if test="contractCode != null and contractCode != '' ">
            AND contractCode = #{contractCode}
        </if>
        <if test="projectName != null and projectName != '' ">
            AND projectName = #{projectName}
        </if>
        <if test="userId != null and userId > 0 ">
            AND userId = #{userId}
        </if>
        <if test="projectId != null and projectId > 0 ">
            AND projectId = #{projectId}
        </if>
    </select>

    <select id="getById" parameterType="Integer" resultMap="infoMap">
        select *
        FROM project_user
        where id = #{id}
    </select>

</mapper>