EmployeeCreditMapper.xml 3.3 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.EmployeeCreditMapper">

    <sql id="whereForFindList">
        <if test="request.employeeName!=null"> AND EMPLOYEE_NAME = #{ request.employeeName  }</if>
        <if test="request.type!=null"> AND TYPE &gt;=#{ request.type }</if>
    </sql>

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

    <select id="find" resultMap="employeeCreditPO">
        SELECT
            <include refid="entityColumnList"/>
        FROM
            customization.`CUX_EMPLOYEE_CREDIT`
        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`
        WHERE
            `IS_DELETED`=0
            AND `TENANT_ID`=#{ passport.tenantId }
            <include refid="whereForFindList" />
    </select>

    <select id="search" resultMap="employeeCreditPO">
        SELECT
            <include refid="entityColumnList"/>
        FROM
        customization.`CUX_EMPLOYEE_CREDIT`
        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`
        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`
        WHERE
            `IS_DELETED`=0
            AND `TENANT_ID`=#{ passport.tenantId }
            AND `ID` != #{id}
            AND `CODE` = #{code}
    </select>

    <update id="update">
        UPDATE
            customization.`CUX_EMPLOYEE_CREDIT`
        SET
            `TYPE`=#{ request.type },
            `EMPLOYEE_ID`=#{ request.employeeId },
            `EMPLOYEE_NAME`=#{ request.employeeName },
            `ORGANIZATION_ID`=#{ request.organizationId },
            `ORGANIZATION_NAME`=#{ request.organizationName },
            `INIT_CREDIT`=#{ request.initCredit },
            `CURRENT_CREDIT`=#{ request.currentCredit },
            `FROZEN_CREDIT`=#{ request.frozenCredit },
            `LAST_UPDATED_BY`=#{ passport.userId },
            `LAST_UPDATE_TIME`=SYSDATE(),
            `ROW_VERSION`=0
        WHERE
            `IS_DELETED`=0
            AND `TENANT_ID`=#{ passport.tenantId }
            AND `ID` = #{ request.id }
            AND `ROW_VERSION` = 0
    </update>


</mapper>