OrderBackSMapper.xml 4.84 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.zteits.order.mapper.smapper.OrderBackSMapper">
    <resultMap id="BaseResultMap" type="com.zteits.order.domain.OrderBack">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="order_id" property="orderId" jdbcType="VARCHAR"/>
        <result column="order_big_type" property="orderBigType" jdbcType="INTEGER"/>
        <result column="order_state" property="orderState" jdbcType="INTEGER"/>
        <result column="order_dicount_fee" property="orderDicountFee" jdbcType="BIGINT"/>
        <result column="order_act_fee" property="orderActFee" jdbcType="BIGINT"/>
        <result column="order_total_fee" property="orderTotalFee" jdbcType="BIGINT"/>
        <result column="car_number" property="carNumber" jdbcType="VARCHAR"/>
        <result column="pl_no" property="plNo" jdbcType="VARCHAR"/>
        <result column="pl_name" property="plName" jdbcType="VARCHAR"/>
        <result column="back_emp_id" property="backEmpId" jdbcType="VARCHAR"/>
        <result column="back_emp_name" property="backEmpName" jdbcType="VARCHAR"/>
        <result column="data_state" property="dataState" jdbcType="INTEGER"/>
        <result column="create_emp_id" property="createEmpId" jdbcType="VARCHAR"/>
        <result column="create_emp_name" property="createEmpName" jdbcType="VARCHAR"/>
        <result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
        <result column="modfiy_emp_id" property="modfiyEmpId" jdbcType="VARCHAR"/>
        <result column="modfiy_emp_name" property="modfiyEmpName" jdbcType="VARCHAR"/>
        <result column="modfiy_date" property="modfiyDate" jdbcType="TIMESTAMP"/>
        <result column="remark" property="remark" jdbcType="VARCHAR"/>
        <result column="invoice_state" jdbcType="INTEGER" property="invoiceState" />
        <result column="org_id" jdbcType="BIGINT" property="orgId" />
        <result column="org_name" jdbcType="VARCHAR" property="orgName" />
        <result column="back_type" jdbcType="INTEGER" property="backType" />
    </resultMap>
    <sql id="Base_Column_List">
    id, order_id, order_big_type, order_state, order_dicount_fee, order_act_fee, order_total_fee, 
    car_number, pl_no, pl_name, back_emp_id, back_emp_name, data_state, create_emp_id, 
    create_emp_name, create_date, modfiy_emp_id, modfiy_emp_name, modfiy_date, remark, invoice_state,
    org_id, org_name, back_type
  </sql>

    <select id="pageQueryBackOrderByCondition"
            parameterType="com.zteits.clouds.api.dto.order.backorder.param.BackOrderPageQueryByContidionReq"
            resultMap="BaseResultMap">

        SELECT
        <include refid="Base_Column_List"/>
        FROM order_back
        <where>
            data_state = 1
            <if test="orderIds != null and orderIds.size >0 ">
                AND order_id IN
                <foreach collection="orderIds" item="orderId" index="index" open="(" close=")" separator=",">
                    #{orderId}
                </foreach>
            </if>
            <if test="carNumber != null">
                AND car_number LIKE concat ('%',#{carNumber},'%')
            </if>
            <if test="orderBigType != null">
                AND order_big_type = #{orderBigType}
            </if>
            <if test="plNos != null and plNos.size >0">
                AND pl_no IN
                <foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
                    #{plNo}
                </foreach>
            </if>
            <if test="orderStates != null and orderStates.size >0">
                AND order_state IN
                <foreach collection="orderStates" open="(" close=")" item="orderState" separator=",">
                    #{orderState}
                </foreach>
            </if>
            <if test="orgId != null">
                AND org_id = #{orgId}
            </if>
        </where>
        ORDER BY create_date desc
    </select>

    <select id="queryBackOrderId" resultType="com.zteits.order.domain.OrderBack">
        SELECT
         a.id                   as id,
         a.order_id             as orderId,
         a.order_state          as orderState,
         a.terminal_source      as terminalSource,
         a.order_dicount_fee    as orderDicountFee,
         a.order_act_fee        as orderActFee,
         a.order_total_fee      as orderTotalFee,
         a.car_number           as carNumber,
         a.org_id               as orgId,
         a.back_type            as backType
        FROM order_back a ,order_back_detail b
        <where>
            a.order_id = b.order_id
            and a.data_state = 1
            and b.data_state = 1
            and a.order_state in (40,50)
            and b.rlt_order_id = #{orderId}
        </where>
    </select>
</mapper>