TOrderMapper.xml 10.2 KB
Newer Older
李灿灿's avatar
李灿灿 committed
1 2 3 4 5
<?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">
wangzb's avatar
wangzb committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
		<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.order.entity.TOrder">
			<result property="id" column="ID" jdbcType="VARCHAR"/>
			<result property="orderNo" column="ORDER_NO" jdbcType="VARCHAR"/>
			<result property="customerName" column="CUSTOMER_NAME" jdbcType="VARCHAR"/>
			<result property="deptId" column="DEPT_ID" 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"/>
huyuchen's avatar
huyuchen committed
21
			<result property="level" column="LEVEL" jdbcType="VARCHAR"/>
wangzb's avatar
wangzb committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
			<result property="department" column="DEPARTMENT" jdbcType="VARCHAR"/>
			<result property="customerGrade" column="CUSTOMER_GRADE" jdbcType="VARCHAR"/>
			<result property="urgencyExtent" column="URGENCY_EXTENT" jdbcType="VARCHAR"/>
			<result property="serviceType" column="SERVICE_TYPE" jdbcType="VARCHAR"/>
			<result property="serviceProject" column="SERVICE_PROJECT" jdbcType="VARCHAR"/>
			<result property="demand" column="DEMAND" jdbcType="VARCHAR"/>
			<result property="handleUser" column="HANDLE_USER" jdbcType="VARCHAR"/>
			<result property="status" column="STATUS" jdbcType="VARCHAR"/>
			<result property="salaryFlag" column="SALARY_FLAG" jdbcType="VARCHAR"/>
			<result property="salaryName" column="SALARY_NAME" jdbcType="VARCHAR"/>
			<result property="salaryIdcard" column="SALARY_IDCARD" jdbcType="VARCHAR"/>
			<result property="salaryExpenses" column="SALARY_EXPENSES" jdbcType="VARCHAR"/>
			<result property="wageFlag" column="WAGE_FLAG" jdbcType="VARCHAR"/>
			<result property="wageName" column="WAGE_NAME" jdbcType="VARCHAR"/>
			<result property="wageIdcard" column="WAGE_IDCARD" jdbcType="VARCHAR"/>
			<result property="wageExpenses" column="WAGE_EXPENSES" jdbcType="VARCHAR"/>
			<result property="socialFlag" column="SOCIAL_FLAG" jdbcType="VARCHAR"/>
			<result property="socialName" column="SOCIAL_NAME" jdbcType="VARCHAR"/>
			<result property="socialIdcard" column="SOCIAL_IDCARD" jdbcType="VARCHAR"/>
			<result property="socialExpenses" column="SOCIAL_EXPENSES" jdbcType="VARCHAR"/>
			<result property="fundFlag" column="FUND_FLAG" jdbcType="VARCHAR"/>
			<result property="fundName" column="FUND_NAME" jdbcType="VARCHAR"/>
			<result property="fundIdcard" column="FUND_IDCARD" jdbcType="VARCHAR"/>
			<result property="fundExpenses" column="FUND_EXPENSES" jdbcType="VARCHAR"/>
			<result property="insuranceFlag" column="INSURANCE_FLAG" jdbcType="VARCHAR"/>
			<result property="insuranceName" column="INSURANCE_NAME" jdbcType="VARCHAR"/>
			<result property="insuranceIdcard" column="INSURANCE_IDCARD" jdbcType="VARCHAR"/>
			<result property="insuranceExpenses" column="INSURANCE_EXPENSES" jdbcType="VARCHAR"/>
			<result property="withholdingFlag" column="WITHHOLDING_FLAG" jdbcType="VARCHAR"/>
			<result property="withholdingName" column="WITHHOLDING_NAME" jdbcType="VARCHAR"/>
			<result property="withholdingIdcard" column="WITHHOLDING_IDCARD" jdbcType="VARCHAR"/>
			<result property="withholdingExpenses" column="WITHHOLDING_EXPENSES" jdbcType="VARCHAR"/>
			<result property="collectionFlag" column="COLLECTION_FLAG" jdbcType="VARCHAR"/>
			<result property="collectionName" column="COLLECTION_NAME" jdbcType="VARCHAR"/>
			<result property="collectionIdcard" column="COLLECTION_IDCARD" jdbcType="VARCHAR"/>
			<result property="collectionExpenses" column="COLLECTION_EXPENSES" jdbcType="VARCHAR"/>
			<result property="noTaxFlag" column="NO_TAX_FLAG" jdbcType="VARCHAR"/>
			<result property="noTaxName" column="NO_TAX_NAME" jdbcType="VARCHAR"/>
			<result property="noTaxIdcard" column="NO_TAX_IDCARD" jdbcType="VARCHAR"/>
			<result property="noTaxExpenses" column="NO_TAX_EXPENSES" jdbcType="VARCHAR"/>
			<result property="otherFlag" column="OTHER_FLAG" jdbcType="VARCHAR"/>
			<result property="otherName" column="OTHER_NAME" jdbcType="VARCHAR"/>
			<result property="otherIdcard" column="OTHER_IDCARD" jdbcType="VARCHAR"/>
			<result property="otherExpenses" column="OTHER_EXPENSES" jdbcType="VARCHAR"/>
		</resultMap>
李灿灿's avatar
李灿灿 committed
67

wangzb's avatar
wangzb committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
		<sql id="Base_Column_List">
			ID,ORDER_NO,CUSTOMER_NAME,
			DEPT_ID,DEPT_NAME,DEPT_NO,
			ORDER_STATUS,ORDER_CONTENT,CREATE_NAME,
			CREATE_TIME,UPDATE_BY,UPDATE_NAME,
			UPDATE_TIME,DELETE_FLAG,LEVEL,
			DEPARTMENT,CUSTOMER_GRADE,URGENCY_EXTENT,
			SERVICE_TYPE,SERVICE_PROJECT,DEMAND,
			HANDLE_USER,STATUS,SALARY_FLAG,
			SALARY_NAME,SALARY_IDCARD,SALARY_EXPENSES,
			WAGE_FLAG,WAGE_NAME,WAGE_IDCARD,
			WAGE_EXPENSES,SOCIAL_FLAG,SOCIAL_NAME,
			SOCIAL_IDCARD,SOCIAL_EXPENSES,FUND_FLAG,
			FUND_NAME,FUND_IDCARD,FUND_EXPENSES,
			INSURANCE_FLAG,INSURANCE_NAME,INSURANCE_IDCARD,
			INSURANCE_EXPENSES,WITHHOLDING_FLAG,WITHHOLDING_NAME,
			WITHHOLDING_IDCARD,WITHHOLDING_EXPENSES,COLLECTION_FLAG,
			COLLECTION_NAME,COLLECTION_IDCARD,COLLECTION_EXPENSES,
			NO_TAX_FLAG,NO_TAX_NAME,NO_TAX_IDCARD,
			NO_TAX_EXPENSES,OTHER_FLAG,OTHER_NAME,
			OTHER_IDCARD,OTHER_EXPENSES
		</sql>
李灿灿's avatar
李灿灿 committed
90 91

	<select id="getOrderPageList" resultType="com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO">
huyuchen's avatar
huyuchen committed
92 93 94 95 96 97 98
		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,
huyuchen's avatar
huyuchen committed
99
		a.LEVEL as level,
huyuchen's avatar
huyuchen committed
100 101
		a.ORDER_STATUS as orderStatus
		from t_order a
huyuchen's avatar
huyuchen committed
102
		left join t_order_handler h on h.ORDER_NO = a.ORDER_NO
huyuchen's avatar
huyuchen committed
103
		where a.DELETE_FLAG = 0
李灿灿's avatar
李灿灿 committed
104
		<if test="param.orderNo != null and param.orderNo.trim() != ''">
huyuchen's avatar
huyuchen committed
105
			and a.ORDER_NO = #{param.orderNo}
李灿灿's avatar
李灿灿 committed
106 107
		</if>
		<if test="param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''">
huyuchen's avatar
huyuchen committed
108
			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
109 110
		</if>
		<if test="param.createName != null and param.createName.trim() != ''">
huyuchen's avatar
huyuchen committed
111
			and a.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
112 113
		</if>
		<if test="param.customerName != null and param.customerName.trim() != ''">
huyuchen's avatar
huyuchen committed
114
			and a.CUSTOMER_NAME = #{param.customerName}
李灿灿's avatar
李灿灿 committed
115 116
		</if>
		<if test="param.deptName != null and param.deptName.trim() != ''">
huyuchen's avatar
huyuchen committed
117
			and a.DEPT_NAME = #{param.deptName}
李灿灿's avatar
李灿灿 committed
118 119
		</if>
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
huyuchen's avatar
huyuchen committed
120
			and a.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
121 122
		</if>
		<if test="param.orderStatus != null">
huyuchen's avatar
huyuchen committed
123
			and a.ORDER_STATUS = #{param.orderStatus}
李灿灿's avatar
李灿灿 committed
124
		</if>
huyuchen's avatar
huyuchen committed
125
		<if test="param.level != null and param.level.trim() != ''">
huyuchen's avatar
huyuchen committed
126 127
			and a.LEVEL = #{param.level}
		</if>
huyuchen's avatar
huyuchen committed
128 129 130 131 132
		<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
133 134 135 136 137 138 139 140 141 142
	</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,
huyuchen's avatar
huyuchen committed
143
		t.LEVEL as level,
李灿灿's avatar
李灿灿 committed
144 145 146 147 148 149
		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>
150
		ORDER BY t.CREATE_TIME DESC
李灿灿's avatar
李灿灿 committed
151 152 153
	</select>

	<select id="getOrderList" resultType="com.yifu.cloud.plus.v1.yifu.order.vo.OrderListVO">
huyuchen's avatar
huyuchen committed
154 155 156 157 158 159 160
		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,
huyuchen's avatar
huyuchen committed
161
		a.LEVEL as level,
huyuchen's avatar
huyuchen committed
162 163 164 165
		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
166
		<if test="param.orderNo != null and param.orderNo.trim() != ''">
huyuchen's avatar
huyuchen committed
167
			and a.ORDER_NO = #{param.orderNo}
李灿灿's avatar
李灿灿 committed
168 169
		</if>
		<if test="param.startDate != null and param.startDate.trim() != '' and param.endDate != null and param.endDate.trim() != ''">
huyuchen's avatar
huyuchen committed
170
			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
171 172
		</if>
		<if test="param.createName != null and param.createName.trim() != ''">
huyuchen's avatar
huyuchen committed
173
			and a.CREATE_NAME like concat('%',replace(replace(#{param.createName},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
174 175
		</if>
		<if test="param.customerName != null and param.customerName.trim() != ''">
huyuchen's avatar
huyuchen committed
176
			and a.CUSTOMER_NAME = #{param.customerName}
李灿灿's avatar
李灿灿 committed
177 178
		</if>
		<if test="param.deptName != null and param.deptName.trim() != ''">
huyuchen's avatar
huyuchen committed
179
			and a.DEPT_NAME = #{param.deptName}
李灿灿's avatar
李灿灿 committed
180 181
		</if>
		<if test="param.deptNo != null and param.deptNo.trim() != ''">
huyuchen's avatar
huyuchen committed
182
			and a.DEPT_NO like concat('%',replace(replace(#{param.deptNo},'_','\_'),'%','\%'),'%')
李灿灿's avatar
李灿灿 committed
183 184
		</if>
		<if test="param.orderStatus != null">
huyuchen's avatar
huyuchen committed
185
			and a.ORDER_STATUS = #{param.orderStatus}
李灿灿's avatar
李灿灿 committed
186
		</if>
huyuchen's avatar
huyuchen committed
187
		<if test="param.level != null and param.level.trim() != ''">
huyuchen's avatar
huyuchen committed
188 189
			and a.LEVEL = #{param.level}
		</if>
huyuchen's avatar
huyuchen committed
190 191 192 193 194
		<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
195 196
	</select>

李灿灿's avatar
李灿灿 committed
197 198
	<select id="getOrderDetailById" resultType="com.yifu.cloud.plus.v1.yifu.order.vo.OrderDetailVO">
		select
wangzb's avatar
wangzb committed
199
			  t.*
李灿灿's avatar
李灿灿 committed
200 201 202 203
		from t_order t
		where t.ID = #{id}
	</select>

李灿灿's avatar
李灿灿 committed
204 205
	<select id="getOrderReplyPageList" resultType="com.yifu.cloud.plus.v1.yifu.order.vo.OrderReplyListVO">
		select
206 207 208 209 210
		    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
211 212 213 214 215 216
		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
217
</mapper>