123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <?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.oqpo.api.mapper.stockmng.StockCddMapper">
- <select id="selectStockCddGridList" resultType="com.oqpo.api.entity.stockmng.StckCddMgntInfoEntity">
- /* StockCddMapper.selectStockCddGridList */
- SELECT A.brand_id, FN_BRAND_NM(A.brand_id) AS brand_nm,
- C.store_id, FN_STORE_NM(A.brand_id, C.store_id) AS store_nm,
- A.whs_id, C.whs_nm, A.location, D.location_nm, A.item_id, E.item_nm, A.unit, A.stck_qty, A.prp_stck_qty,
- A.sft_stck_rt, A.cur_stck_rt
- FROM stck_mgnt_base_info A
- INNER JOIN whs_mgnt_base_info C ON A.brand_id = C.brand_id AND A.whs_id = C.whs_id
- INNER JOIN whs_mgnt_base_loc D ON A.brand_id = D.brand_id AND A.whs_id = D.whs_id AND A.location = D.location
- INNER JOIN item_base_info E ON A.item_id = E.item_id
- <if test="sItemClass1 != null and sItemClass1 != ''">
- INNER JOIN item_class_ptcl B ON A.item_id = B.item_id
- AND B.item_class1 = #{sItemClass1}
- <if test="sItemClass2 != null and sItemClass2 != ''">
- AND B.item_class2 = #{sItemClass2}
- <if test="sItemClass3 != null and sItemClass3 != ''">
- AND B.item_class3 = #{sItemClass3}
- <if test="sItemClass4 != null and sItemClass4 != ''">
- AND B.item_class4 = #{sItemClass4}
- </if>
- </if>
- </if>
- </if>
- WHERE A.brand_id = #{sBrandId}
- <if test="sStoreId != null and sStoreId != ''">
- AND C.store_id = #{sStoreId}
- </if>
- <if test="sWhsId != null and sWhsId != ''">
- AND A.whs_id = #{sWhsId}
- </if>
- <if test="sLocation != null and sLocation != ''">
- AND A.location = #{sLocation}
- </if>
- <if test="sItemId != null and sItemId != ''">
- AND A.item_id = #{sItemId}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- AND A.item_nm LIKE CONCAT('%',#{sItemNm},'%')
- </if>
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- ORDER BY A.item_id ASC
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- ORDER BY A.item_id DESC
- </if>
- </if>
- </when>
- <otherwise>
- ORDER BY A.item_id ASC
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectStockCddGridCnt" resultType="int">
- /* StockCddMapper.selectStockCddGridCnt */
- SELECT COUNT(*)
- FROM stck_mgnt_base_info A
- INNER JOIN whs_mgnt_base_info C ON A.brand_id = C.brand_id AND A.whs_id = C.whs_id
- INNER JOIN whs_mgnt_base_loc D ON A.brand_id = D.brand_id AND A.whs_id = D.whs_id AND A.location = D.location
- INNER JOIN item_base_info E ON A.item_id = E.item_id
- <if test="sItemClass1 != null and sItemClass1 != ''">
- INNER JOIN item_class_ptcl B ON A.item_id = B.item_id
- AND B.item_class1 = #{sItemClass1}
- <if test="sItemClass2 != null and sItemClass2 != ''">
- AND B.item_class2 = #{sItemClass2}
- <if test="sItemClass3 != null and sItemClass3 != ''">
- AND B.item_class3 = #{sItemClass3}
- <if test="sItemClass4 != null and sItemClass4 != ''">
- AND B.item_class4 = #{sItemClass4}
- </if>
- </if>
- </if>
- </if>
- WHERE A.brand_id = #{sBrandId}
- <if test="sStoreId != null and sStoreId != ''">
- AND C.store_id = #{sStoreId}
- </if>
- <if test="sWhsId != null and sWhsId != ''">
- AND A.whs_id = #{sWhsId}
- </if>
- <if test="sLocation != null and sLocation != ''">
- AND A.location = #{sLocation}
- </if>
- <if test="sItemId != null and sItemId != ''">
- AND A.item_id = #{sItemId}
- </if>
- <if test="sItemNm != null and sItemNm != ''">
- AND A.item_nm LIKE CONCAT('%',#{sItemNm},'%')
- </if>
- </select>
- <insert id="insertStckCddMgntInfo" >
- /* StockCddMapper.insertStckCddMgntInfo */
- INSERT INTO stck_cdd_mgnt_info
- (cdd_id, cdd_dt, cdd_tm, cdd_dvsn, cdd_mgr_nm, brand_id, store_id, whs_id, location, sys_reg_dttm,
- sys_reg_id, sys_chg_dttm, sys_chg_id)
- VALUES
- (#{entity.cddId}, #{entity.cddDt}, #{entity.cddTm}, #{entity.cddDvsn}, #{entity.cddMgrNm},
- #{entity.brandId}, #{entity.storeId}, #{entity.whsId}, #{entity.location},
- NOW(), #{userId}, NOW(), #{userId})
- </insert>
- <insert id="insertStckCddMgntDtl" >
- /* StockCddMapper.insertStckCddMgntDtl */
- INSERT INTO stck_cdd_mgnt_dtl
- (cdd_id, cdd_seq, item_id, unit, com_exst_qty, cdd_qty, chg_qty, sys_reg_dttm,
- sys_reg_id, sys_chg_dttm, sys_chg_id)
- VALUES
- (#{entity.cddId}, #{entity.cddSeq}, #{entity.itemId}, #{entity.unit}, #{entity.comExstQty}, #{entity.cddQty}, #{entity.chgQty},
- NOW(), #{userId}, NOW(), #{userId})
- </insert>
- <select id="selectStockCddMgntInfo" resultType="com.oqpo.api.entity.stockmng.StckCddMgntInfoEntity">
- /* StockCddMapper.selectStockCddMgntInfo */
- SELECT A.cdd_id, A.cdd_dt, A.cdd_tm, A.cdd_dvsn, A.cdd_mgr_nm,
- A.brand_id, FN_BRAND_NM(A.brand_id) AS brand_nm,
- A.store_id, FN_STORE_NM(A.brand_id, A.store_id) AS store_nm,
- A.whs_id, B.whs_nm, A.location, C.location_nm,
- DATE_FORMAT(A.sys_reg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_reg_dttm, A.sys_reg_id,
- DATE_FORMAT(A.sys_chg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_chg_dttm, A.sys_chg_id
- FROM stck_cdd_mgnt_info A
- INNER JOIN whs_mgnt_base_info B ON A.brand_id = B.brand_id AND A.whs_id = B.whs_id
- INNER JOIN whs_mgnt_base_loc C ON A.brand_id = C.brand_id AND A.whs_id = C.whs_id AND A.location = C.location
- WHERE A.cdd_id = #{cddId}
- </select>
- <select id="selectStockCddDtlGridList" resultType="com.oqpo.api.entity.stockmng.StckCddMgntDtlEntity">
- /* StockCddMapper.selectStockCddDtlGridList */
- SELECT A.cdd_id, A.cdd_seq, A.item_id, E.item_nm, A.unit, A.com_exst_qty, A.cdd_qty, A.chg_qty,
- B.brand_id, FN_BRAND_NM(B.brand_id) AS brand_nm,
- B.store_id, FN_STORE_NM(B.brand_id, B.store_id) AS store_nm,
- B.whs_id, C.whs_nm, B.location, D.location_nm
- FROM stck_cdd_mgnt_dtl A
- INNER JOIN stck_cdd_mgnt_info B ON A.cdd_id = B.cdd_id
- INNER JOIN whs_mgnt_base_info C ON B.brand_id = C.brand_id AND B.whs_id = C.whs_id
- INNER JOIN whs_mgnt_base_loc D ON B.brand_id = D.brand_id AND B.whs_id = D.whs_id AND B.location = D.location
- INNER JOIN item_base_info E ON A.item_id = E.item_id
- WHERE A.cdd_id = #{cddId}
- <choose>
- <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
- <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
- <if test="gridRequest.sord == 'asc'.toString()">
- ORDER BY A.cdd_seq ASC
- </if>
- <if test="gridRequest.sord == 'desc'.toString()">
- ORDER BY A.cdd_seq DESC
- </if>
- </if>
- </when>
- <otherwise>
- ORDER BY A.cdd_seq ASC
- </otherwise>
- </choose>
- <if test="gridRequest.pagingYn == true">
- limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
- </if>
- </select>
- <select id="selectStockCddDtlGridCnt" resultType="int">
- /* StockCddMapper.selectStockCddDtlGridCnt */
- SELECT COUNT(*)
- FROM stck_cdd_mgnt_dtl A
- INNER JOIN stck_cdd_mgnt_info B ON A.cdd_id = B.cdd_id
- INNER JOIN whs_mgnt_base_info C ON B.brand_id = C.brand_id AND B.whs_id = C.whs_id
- INNER JOIN whs_mgnt_base_loc D ON B.brand_id = D.brand_id AND B.whs_id = D.whs_id AND B.location = D.location
- INNER JOIN item_base_info E ON A.item_id = E.item_id
- WHERE A.cdd_id = #{cddId}
- </select>
- </mapper>
|