|
4 | 4 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
5 | 5 | <mapper namespace="purchaseApplyServiceDaoImpl"> |
6 | 6 |
|
| 7 | + |
| 8 | + <resultMap type="com.java110.dto.purchaseApply.PurchaseApplyDto" id="applyMap"> |
| 9 | + <id column="applyOrderId" property="applyOrderId"/> |
| 10 | + <result column="description" property="description"/> |
| 11 | + <result column="resOrderType" property="resOrderType"/> |
| 12 | + <result column="statusCd" property="statusCd"/> |
| 13 | + <result column="state" property="state"/> |
| 14 | + <result column="storeId" property="storeId"/> |
| 15 | + <result column="userName" property="userName"/> |
| 16 | + <result column="bId" property="bId"/> |
| 17 | + <result column="userId" property="userId"/> |
| 18 | + <result column="createTime" property="createTime"/> |
| 19 | + <result column="stateName" property="stateName"/> |
| 20 | + <!-- 一对多关系 --> |
| 21 | + <collection property="purchaseApplyDetailVo" ofType="com.java110.vo.api.purchaseApply.PurchaseApplyDetailVo" javaType="java.util.ArrayList"> |
| 22 | + <id property="id" column="id"/> |
| 23 | + <result property="applyOrderId" column="applyOrderId"/> |
| 24 | + <result property="resId" column="resId"/> |
| 25 | + <result property="quantity" column="quantity"/> |
| 26 | + <result property="resName" column="resName"/> |
| 27 | + <result property="remark" column="remark"/> |
| 28 | + <result property="resCode" column="resCode"/> |
| 29 | + <result property="price" column="price"/> |
| 30 | + <result property="stock" column="stock"/> |
| 31 | + </collection> |
| 32 | + </resultMap> |
| 33 | + |
7 | 34 | <!-- 保存采购申请信息 add by wuxw 2018-07-03 --> |
8 | 35 | <insert id="saveBusinessPurchaseApplyInfo" parameterType="Map"> |
9 | 36 | insert into business_purchase_apply |
|
144 | 171 | t.res_order_type resOrderType,t.description, |
145 | 172 | t.apply_order_id applyOrderId,t.status_cd statusCd,t.state, |
146 | 173 | t.store_id storeId,t.user_name userName, |
147 | | - t.b_id bId,t.user_id userId,t.create_time createTime,d.name stateName |
148 | | - from purchase_apply t inner join t_dict d on t.state = d.status_cd and d.table_name = 'purchase_apply' and d.table_columns = 'state' |
| 174 | + t.b_id bId,t.user_id userId,t.create_time createTime,d.name stateName, |
| 175 | + from purchase_apply t |
| 176 | + inner join t_dict d on t.state = d.status_cd and d.table_name = 'purchase_apply' and d.table_columns = 'state' |
149 | 177 | where 1 =1 |
150 | 178 | <if test="resOrderType !=null and resOrderType != ''"> |
151 | 179 | and t.res_order_type= #{resOrderType} |
|
179 | 207 |
|
180 | 208 | </select> |
181 | 209 |
|
| 210 | + |
| 211 | + |
| 212 | + <select id="getPurchaseApplyInfo2" parameterType="Map" resultMap="applyMap"> |
| 213 | + select |
| 214 | + t.res_order_type resOrderType,t.description, |
| 215 | + t.apply_order_id applyOrderId,t.status_cd statusCd,t.state, |
| 216 | + t.store_id storeId,t.user_name userName, |
| 217 | + t.b_id bId,t.user_id userId,t.create_time createTime,d.name stateName, |
| 218 | + de.apply_order_id applyOrderId,de.res_id resId,de.quantity,de.remark,de.id,rs.res_name resName,rs.price,rs.stock,rs.res_code resCode |
| 219 | + from purchase_apply t |
| 220 | + inner join t_dict d on t.state = d.status_cd and d.table_name = 'purchase_apply' and d.table_columns = 'state' |
| 221 | + inner join purchase_apply_detail de on de.apply_order_id = t.apply_order_id |
| 222 | + inner join resource_store rs on de.res_id = rs.res_id |
| 223 | + |
| 224 | + where 1 =1 |
| 225 | + <if test="resOrderType !=null and resOrderType != ''"> |
| 226 | + and t.res_order_type= #{resOrderType} |
| 227 | + </if> |
| 228 | + <if test="description !=null and description != ''"> |
| 229 | + and t.description= #{description} |
| 230 | + </if> |
| 231 | + <if test="applyOrderId !=null and applyOrderId != ''"> |
| 232 | + and t.apply_order_id= #{applyOrderId} |
| 233 | + </if> |
| 234 | + <if test="userName !=null and userName != ''"> |
| 235 | + and t.user_name like concat('%',#{userName},'%') |
| 236 | + </if> |
| 237 | + <if test="statusCd !=null and statusCd != ''"> |
| 238 | + and t.status_cd= #{statusCd} |
| 239 | + </if> |
| 240 | + <if test="state !=null and state != ''"> |
| 241 | + and t.state= #{state} |
| 242 | + </if> |
| 243 | + <if test="storeId !=null and storeId != ''"> |
| 244 | + and t.store_id= #{storeId} |
| 245 | + </if> |
| 246 | + <if test="bId !=null and bId != ''"> |
| 247 | + and t.b_id= #{bId} |
| 248 | + </if> |
| 249 | + |
| 250 | + order by t.create_time desc |
| 251 | + <if test="page != -1 and page != null "> |
| 252 | + limit #{page}, #{row} |
| 253 | + </if> |
| 254 | + |
| 255 | + </select> |
182 | 256 | <!-- 查询采购明细 --> |
183 | 257 | <select id="getPurchaseApplyDetailInfo" parameterType="Map" resultType="Map"> |
184 | 258 | select |
|
0 commit comments