TOrderMapper.xml 6.15 KB
Newer Older
李灿灿's avatar
李灿灿 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
<?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.yifu.cloud.plus.v1.yifu.order.mapper.TOrderMapper">

    <resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.order.entity.TOrder">
            <id property="id" column="ID" jdbcType="VARCHAR"/>
            <result property="orderNo" column="ORDER_NO" jdbcType="VARCHAR"/>
            <result property="customerName" column="CUSTOMER_NAME" jdbcType="VARCHAR"/>
            <result property="deptName" column="DEPT_NAME" jdbcType="VARCHAR"/>
            <result property="deptNo" column="DEPT_NO" jdbcType="VARCHAR"/>
            <result property="orderStatus" column="ORDER_STATUS" jdbcType="TINYINT"/>
            <result property="orderContent" column="ORDER_CONTENT" jdbcType="VARCHAR"/>
            <result property="createName" column="CREATE_NAME" jdbcType="VARCHAR"/>
            <result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
            <result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
            <result property="updateName" column="UPDATE_NAME" jdbcType="VARCHAR"/>
            <result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
            <result property="deleteFlag" column="DELETE_FLAG" jdbcType="TINYINT"/>
    </resultMap>

    <sql id="Base_Column_List">
        ID,ORDER_NO,CUSTOMER_NAME,
        DEPT_NAME,DEPT_NO,ORDER_STATUS,
        ORDER_CONTENT,CREATE_NAME,CREATE_TIME,
        UPDATE_BY,UPDATE_NAME,UPDATE_TIME,
        DELETE_FLAG
    </sql>
李灿灿's avatar
李灿灿 committed
30 31

	<select id="getOrderPageList" resultType="com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO">
huyuchen's avatar
huyuchen committed
32 33 34 35 36 37 38 39 40
		select a.id as id,
		a.ORDER_NO as orderNo,
		a.CREATE_TIME as createTime,
		a.CREATE_NAME as createName,
		a.CUSTOMER_NAME as customerName,
		a.DEPT_NAME as deptName,
		a.DEPT_NO as deptNo,
		a.ORDER_STATUS as orderStatus
		from t_order a
huyuchen's avatar
huyuchen committed
41
		left join t_order_handler h on h.ORDER_NO = a.ORDER_NO
huyuchen's avatar
huyuchen committed
42
		where a.DELETE_FLAG = 0
李灿灿's avatar
李灿灿 committed
43
		<if test="param.orderNo != null and param.orderNo.trim() != ''">
huyuchen's avatar
huyuchen committed
44
			and a.ORDER_NO = #{param.orderNo}
李灿灿's avatar
李灿灿 committed
45 46
		</if>
		<if test="param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''">
huyuchen's avatar
huyuchen committed
47
			and a.CREATE_TIME <![CDATA[ >= ]]>  concat(#{param.startDate}, ' 00:00:00') and a.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
李灿灿's avatar
李灿灿 committed
48 49
		</if>
		<if test="param.createName != null and param.createName.trim() != ''">
huyuchen's avatar
huyuchen committed
50
			and a.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
51 52
		</if>
		<if test="param.customerName != null and param.customerName.trim() != ''">
huyuchen's avatar
huyuchen committed
53
			and a.CUSTOMER_NAME = #{param.customerName}
李灿灿's avatar
李灿灿 committed
54 55
		</if>
		<if test="param.deptName != null and param.deptName.trim() != ''">
huyuchen's avatar
huyuchen committed
56
			and a.DEPT_NAME = #{param.deptName}
李灿灿's avatar
李灿灿 committed
57 58
		</if>
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
huyuchen's avatar
huyuchen committed
59
			and a.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
60 61
		</if>
		<if test="param.orderStatus != null">
huyuchen's avatar
huyuchen committed
62
			and a.ORDER_STATUS = #{param.orderStatus}
李灿灿's avatar
李灿灿 committed
63
		</if>
huyuchen's avatar
huyuchen committed
64 65 66 67 68
		<if test="param.authSql != null and param.authSql.trim() != ''">
			${param.authSql}
		</if>
		GROUP BY a.ID
		ORDER BY a.CREATE_TIME DESC
李灿灿's avatar
李灿灿 committed
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
	</select>

	<select id="getOrderListBySelect" resultType="com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO">
		select t.id as id,
		t.ORDER_NO as orderNo,
		t.CREATE_TIME as createTime,
		t.CREATE_NAME as createName,
		t.CUSTOMER_NAME as customerName,
		t.DEPT_NAME as deptName,
		t.DEPT_NO as deptNo,
		t.ORDER_STATUS as orderStatus
		from t_order t
		where t.DELETE_FLAG = 0 and t.id in
		<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
			#{item}
		</foreach>
85
		ORDER BY t.CREATE_TIME DESC
李灿灿's avatar
李灿灿 committed
86 87 88
	</select>

	<select id="getOrderList" resultType="com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO">
huyuchen's avatar
huyuchen committed
89 90 91 92 93 94 95 96 97 98 99
		select a.id as id,
		a.ORDER_NO as orderNo,
		a.CREATE_TIME as createTime,
		a.CREATE_NAME as createName,
		a.CUSTOMER_NAME as customerName,
		a.DEPT_NAME as deptName,
		a.DEPT_NO as deptNo,
		a.ORDER_STATUS as orderStatus
		from t_order a
		left join t_order_handler h on h.ORDER_NO = a.ORDER_NO
		where a.DELETE_FLAG = 0
李灿灿's avatar
李灿灿 committed
100
		<if test="param.orderNo != null and param.orderNo.trim() != ''">
huyuchen's avatar
huyuchen committed
101
			and a.ORDER_NO = #{param.orderNo}
李灿灿's avatar
李灿灿 committed
102 103
		</if>
		<if test="param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''">
huyuchen's avatar
huyuchen committed
104
			and a.CREATE_TIME <![CDATA[ >= ]]>  concat(#{param.startDate}, ' 00:00:00') and a.CREATE_TIME <![CDATA[ <= ]]> concat(#{param.endDate}, ' 23:59:59')
李灿灿's avatar
李灿灿 committed
105 106
		</if>
		<if test="param.createName != null and param.createName.trim() != ''">
huyuchen's avatar
huyuchen committed
107
			and a.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
108 109
		</if>
		<if test="param.customerName != null and param.customerName.trim() != ''">
huyuchen's avatar
huyuchen committed
110
			and a.CUSTOMER_NAME = #{param.customerName}
李灿灿's avatar
李灿灿 committed
111 112
		</if>
		<if test="param.deptName != null and param.deptName.trim() != ''">
huyuchen's avatar
huyuchen committed
113
			and a.DEPT_NAME = #{param.deptName}
李灿灿's avatar
李灿灿 committed
114 115
		</if>
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
huyuchen's avatar
huyuchen committed
116
			and a.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
117 118
		</if>
		<if test="param.orderStatus != null">
huyuchen's avatar
huyuchen committed
119
			and a.ORDER_STATUS = #{param.orderStatus}
李灿灿's avatar
李灿灿 committed
120
		</if>
huyuchen's avatar
huyuchen committed
121 122 123 124 125
		<if test="param.authSql != null and param.authSql.trim() != ''">
			${param.authSql}
		</if>
		GROUP BY a.ID
		ORDER BY a.CREATE_TIME DESC
李灿灿's avatar
李灿灿 committed
126 127
	</select>

李灿灿's avatar
李灿灿 committed
128 129 130 131 132 133 134 135 136 137 138 139 140 141
	<select id="getOrderDetailById" resultType="com.yifu.cloud.plus.v1.yifu.order.vo.OrderDetailVO">
		select
			   t.CREATE_NAME as createName,
			   t.CREATE_TIME as createTime,
			   t.DEPT_NO as deptNo,
			   t.DEPT_NAME as deptName,
			   t.ORDER_NO as orderNo,
			   t.CUSTOMER_NAME as customerName,
			   t.ORDER_STATUS as orderStatus,
		       t.ORDER_CONTENT as orderContent
		from t_order t
		where t.ID = #{id}
	</select>

李灿灿's avatar
李灿灿 committed
142 143
	<select id="getOrderReplyPageList" resultType="com.yifu.cloud.plus.v1.yifu.order.vo.OrderReplyListVO">
		select
144 145 146 147 148
		    t.ID as id,
			t.ORDER_NO as orderNo,
			t.CREATE_NAME as createName,
			t.CREATE_TIME as createTime,
			t.REPLY_CONTENT as replyContent
李灿灿's avatar
李灿灿 committed
149 150 151 152 153 154
		from t_order_reply t
		where t.DELETE_FLAG = 0
		and t.ORDER_NO = #{orderNo}
		ORDER BY t.CREATE_TIME DESC
	</select>

李灿灿's avatar
李灿灿 committed
155
</mapper>