EmployeeCreditTransactionMapper.xml 3.26 KB
<?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.lecuntao.ordering.wosaicustomization.dal.EmployeeCreditTransactionMapper">

    <sql id="whereForFindList">
    </sql>

    <sql id="whereForSearchList">
        AND
        (
            1=0
        )
    </sql>

    <select id="find" resultMap="employeeCreditTransactionPO">
        SELECT
            <include refid="entityColumnList"/>
        FROM
        customization.`CUX_EMPLOYEE_CREDIT_TRANSACTION`
        WHERE
            `IS_DELETED`=0
            AND `TENANT_ID`=#{ passport.tenantId }
            <include refid="whereForFindList" />
        <if test="request.pageSize !=0">
            LIMIT #{ request.beginItemIndex }, #{ request.pageSize }
        </if>
    </select>

    <select id="findCount" resultType="java.lang.Long">
        SELECT
            COUNT(*)
        FROM
        customization.`CUX_EMPLOYEE_CREDIT_TRANSACTION`
        WHERE
            `IS_DELETED`=0
            AND `TENANT_ID`=#{ passport.tenantId }
            <include refid="whereForFindList" />
    </select>

    <select id="search" resultMap="employeeCreditTransactionPO">
        SELECT
            <include refid="entityColumnList"/>
        FROM
        customization.`CUX_EMPLOYEE_CREDIT_TRANSACTION`
        WHERE
            `IS_DELETED`=0
            AND `TENANT_ID`=#{ passport.tenantId }
            <if test="request.keyword !=null">
                <include refid="whereForSearchList" />
            </if>
        <if test="request.pageSize !=0">
            LIMIT #{ request.beginItemIndex }, #{ request.pageSize }
        </if>
    </select>

    <select id="searchCount" resultType="java.lang.Long">
        SELECT
            COUNT(*)
        FROM
        customization.`CUX_EMPLOYEE_CREDIT_TRANSACTION`
        WHERE
            `IS_DELETED`=0
            AND `TENANT_ID`=#{ passport.tenantId }
            <if test="request.keyword !=null">
                <include refid="whereForSearchList" />
            </if>
    </select>

    <select id="existByCode" resultType="java.lang.Long">
        SELECT
            COUNT(*)
        FROM
            customization.`CUX_EMPLOYEE_CREDIT_TRANSACTION`
        WHERE
            `IS_DELETED`=0
            AND `TENANT_ID`=#{ passport.tenantId }
            AND `ID` != #{id}
            AND `CODE` = #{code}
    </select>

    <update id="update">
        UPDATE
            customization.`CUX_EMPLOYEE_CREDIT_TRANSACTION`
        SET
            `TYPE`=#{ request.type },
            `EMPLOYEE_ID`=#{ request.employeeId },
            `EMPLOYEE_NAME`=#{ request.employeeName },
            `ORGANIZATION_ID`=#{ request.organizationId },
            `ORGANIZATION_NAME`=#{ request.organizationName },
            `PRIOR_CREDIT`=#{ request.priorCredit },
            `CREDIT`=#{ request.credit },
            `POST_CREDIT`=#{ request.postCredit },
            `LAST_UPDATED_BY`=#{ passport.userId },
            `LAST_UPDATE_TIME`=SYSDATE(),
            `ROW_VERSION`=#{ request.rowVersion }+1
        WHERE
            `IS_DELETED`=0
            AND `TENANT_ID`=#{ passport.tenantId }
            AND `ID` = #{ request.id }
            AND `ROW_VERSION` = #{ request.rowVersion }
    </update>


</mapper>