|
@@ -0,0 +1,146 @@
|
|
1
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
3
|
+
|
|
4
|
+<mapper namespace="com.oqpo.api.mapper.stinfo.ItemUnitMapper">
|
|
5
|
+
|
|
6
|
+ <select id="selectItemUnitGridList" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
|
|
7
|
+ select /*selectItemUnitGridList*/
|
|
8
|
+ iunit.brand_unit_unq_no, iunit.brand_id, iunit.item_id, iunit.item_nm, iunit.spply_id,
|
|
9
|
+ iunit.spply_nm, date_format(iunit.cont_stt_dt,'%Y.%m.%d') as cont_stt_dt, date_format(iunit.cont_end_dt,'%Y.%m.%d') as cont_end_dt,
|
|
10
|
+ iunit.curr, fn_code_nm('CURR', iunit.curr) as curr_nm, iunit.unit, fn_code_nm('DSTRBT_COST_UNIT', iunit.unit) as unit,
|
|
11
|
+ iunit.unit_amt, iunit.lead_time, iunit.spply_item_id,
|
|
12
|
+ iunit.unit_st_cd, fn_code_nm('UNIT_ST_CD', iunit.unit_st_cd) as unit_st_nm, iunit.stdd_qyt
|
|
13
|
+ from brand_item_unit_info iunit
|
|
14
|
+ join item_base_info item on iunit.brand_id = item.brand_id and iunit.item_id = item.item_id
|
|
15
|
+ left outer join item_class_ptcl iclas on item.item_id = iclas.item_id
|
|
16
|
+ join item_class_mgnt mclas on iclas.item_class_mgnt_no = mclas.item_class_mgnt_no
|
|
17
|
+ where iunit.brand_id = #{sBrandId}
|
|
18
|
+ <if test="fromDt != null and fromDt != '' and toDt != null and toDt != ''">
|
|
19
|
+ and iunit.cont_stt_dt <![CDATA[ >= ]]> #{fromDt}
|
|
20
|
+ and iunit.cont_end_dt <![CDATA[ <= ]]> #{toDt}
|
|
21
|
+ </if>
|
|
22
|
+ <if test="sUnitStCd != null and sUnitStCd != ''">
|
|
23
|
+ and iunit.unit_st_cd = #{sUnitStCd}
|
|
24
|
+ </if>
|
|
25
|
+ <if test="sBrandNm != null and sSpplyId != ''">
|
|
26
|
+ and iunit.spply_id = #{sSpplyId}
|
|
27
|
+ </if>
|
|
28
|
+ <if test="sClass1 != null and sClass1 != ''">
|
|
29
|
+ and iclas.item_class1 = #{sClass1}
|
|
30
|
+ </if>
|
|
31
|
+ <if test="sClass2 != null and sClass2 != ''">
|
|
32
|
+ and iclas.item_class2 = #{sClass2}
|
|
33
|
+ </if>
|
|
34
|
+ <if test="sClass3 != null and sClass3 != ''">
|
|
35
|
+ and iclas.item_class3 = #{sClass3}
|
|
36
|
+ </if>
|
|
37
|
+ <if test="sClass4 != null and sClass4 != ''">
|
|
38
|
+ and iclas.item_class4 = #{sClass4}
|
|
39
|
+ </if>
|
|
40
|
+ <if test="sClass4 != null and sClass4 != ''">
|
|
41
|
+ and iunit.item_id like concat('%',#{sItemNm},'%') or iunit.item_nm like concat('%',#{sItemNm},'%')
|
|
42
|
+ </if>
|
|
43
|
+ <choose>
|
|
44
|
+ <when test="gridRequest.sidx != null and gridRequest.sidx != ''">
|
|
45
|
+ <if test="gridRequest.sidx == 'VIEW_NUM'.toString()">
|
|
46
|
+ <if test="gridRequest.sord == 'asc'.toString()">
|
|
47
|
+ order by iunit.item_nm asc
|
|
48
|
+ </if>
|
|
49
|
+ <if test="gridRequest.sord == 'desc'.toString()">
|
|
50
|
+ order by iunit.item_nm desc
|
|
51
|
+ </if>
|
|
52
|
+ </if>
|
|
53
|
+ </when>
|
|
54
|
+ <otherwise>
|
|
55
|
+ order by iunit.item_nm asc
|
|
56
|
+ </otherwise>
|
|
57
|
+ </choose>
|
|
58
|
+ <if test="gridRequest.pagingYn == true">
|
|
59
|
+ limit #{gridRequest.gridFirst}, #{gridRequest.gridSize}
|
|
60
|
+ </if>
|
|
61
|
+ </select>
|
|
62
|
+
|
|
63
|
+ <select id="selectItemUnitGridCnt" resultType="int">
|
|
64
|
+ select /*selectBrandGridCnt*/
|
|
65
|
+ count(*)
|
|
66
|
+ from brand_item_unit_info iunit
|
|
67
|
+ join item_base_info item on iunit.brand_id = item.brand_id and iunit.item_id = item.item_id
|
|
68
|
+ left outer join item_class_ptcl iclas on item.item_id = iclas.item_id
|
|
69
|
+ join item_class_mgnt mclas on iclas.item_class_mgnt_no = mclas.item_class_mgnt_no
|
|
70
|
+ where iunit.brand_id = #{sBrandId}
|
|
71
|
+ <if test="fromDt != null and fromDt != '' and toDt != null and toDt != ''">
|
|
72
|
+ and iunit.cont_stt_dt <![CDATA[ >= ]]> #{fromDt}
|
|
73
|
+ and iunit.cont_end_dt <![CDATA[ <= ]]> #{toDt}
|
|
74
|
+ </if>
|
|
75
|
+ <if test="sUnitStCd != null and sUnitStCd != ''">
|
|
76
|
+ and iunit.unit_st_cd = #{sUnitStCd}
|
|
77
|
+ </if>
|
|
78
|
+ <if test="sBrandNm != null and sSpplyId != ''">
|
|
79
|
+ and iunit.spply_id = #{sSpplyId}
|
|
80
|
+ </if>
|
|
81
|
+ <if test="sClass1 != null and sClass1 != ''">
|
|
82
|
+ and iclas.item_class1 = #{sClass1}
|
|
83
|
+ </if>
|
|
84
|
+ <if test="sClass2 != null and sClass2 != ''">
|
|
85
|
+ and iclas.item_class2 = #{sClass2}
|
|
86
|
+ </if>
|
|
87
|
+ <if test="sClass3 != null and sClass3 != ''">
|
|
88
|
+ and iclas.item_class3 = #{sClass3}
|
|
89
|
+ </if>
|
|
90
|
+ <if test="sClass4 != null and sClass4 != ''">
|
|
91
|
+ and iclas.item_class4 = #{sClass4}
|
|
92
|
+ </if>
|
|
93
|
+ <if test="sClass4 != null and sClass4 != ''">
|
|
94
|
+ and iunit.item_id like concat('%',#{sItemNm},'%') or iunit.item_nm like concat('%',#{sItemNm},'%')
|
|
95
|
+ </if>
|
|
96
|
+ </select>
|
|
97
|
+
|
|
98
|
+ <select id="selectItemUnitInfo" resultType="com.oqpo.api.entity.stinfo.ItemUnitEntity">
|
|
99
|
+ select /*selectItemUnitInfo*/
|
|
100
|
+ iunit.brand_unit_unq_no, iunit.brand_id, fn_brand_nm(iunit.brand_id) as brand_nm, iunit.item_id, iunit.item_nm, iunit.spply_id,
|
|
101
|
+ iunit.spply_nm, date_format(iunit.cont_stt_dt,'%Y.%m.%d') as cont_stt_dt, date_format(iunit.cont_end_dt,'%Y.%m.%d') as cont_end_dt,
|
|
102
|
+ iunit.curr, fn_code_nm('CURR', iunit.curr) as curr_nm, iunit.unit, fn_code_nm('DSTRBT_COST_UNIT', iunit.unit) as unit,
|
|
103
|
+ iunit.unit_amt, iunit.lead_time, iunit.spply_item_id,
|
|
104
|
+ iunit.unit_st_cd, fn_code_nm('UNIT_ST_CD', iunit.unit_st_cd) as unit_st_nm, iunit.stdd_qyt,
|
|
105
|
+ iunit.store_sale_stdd_qty, iunit.store_sale_unit_amt, iunit.short_cont_file_no
|
|
106
|
+ from brand_item_unit_info iunit
|
|
107
|
+ where iunit.brand_id = #{brandId}
|
|
108
|
+ and iunit.brand_unit_unq_no = #{brandUnitUnqNo}
|
|
109
|
+ </select>
|
|
110
|
+
|
|
111
|
+ <insert id="insertItemUnitInfo" >
|
|
112
|
+ insert into brand_item_unit_info
|
|
113
|
+ (brand_unit_unq_no, brand_id, item_id, item_nm, spply_id,
|
|
114
|
+ spply_nm, cont_stt_dt, cont_end_dt, curr, unit,
|
|
115
|
+ unit_amt, lead_time, dlv_cndt, short_cont_file_no, spply_item_id,
|
|
116
|
+ unit_st_cd, stdd_qyt, store_sale_stdd_qty, store_sale_unit_amt,
|
|
117
|
+ sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
|
|
118
|
+ values
|
|
119
|
+ (#{entity.brandUnitUnqNo}, #{entity.brandId}, #{entity.itemId}, #{entity.itemNm}, #{entity.spplyId},
|
|
120
|
+ #{entity.spplyNm}, #{entity.contSttDt}, #{entity.contEndDt}, #{entity.curr}, #{entity.unit},
|
|
121
|
+ #{entity.unitAmt}, #{entity.leadTime}, #{entity.dlvCndt}, #{entity.shortContFileNo}, #{entity.spplyItemId},
|
|
122
|
+ #{entity.unitStCd}, #{entity.stddQyt}, #{entity.storeSaleStddQty}, #{entity.storeSaleUnitAmt},
|
|
123
|
+ now(), #{userId}, now(), #{userId})
|
|
124
|
+ </insert>
|
|
125
|
+
|
|
126
|
+ <update id="updateItemUnitInfo">
|
|
127
|
+ update brand_item_unit_info
|
|
128
|
+ set cont_stt_dt = #{entity.contSttDt},
|
|
129
|
+ cont_end_dt = #{entity.contEndDt},
|
|
130
|
+ curr = #{entity.curr},
|
|
131
|
+ unit = #{entity.unit},
|
|
132
|
+ unit_amt = #{entity.unitAmt},
|
|
133
|
+ lead_time = #{entity.leadTime},
|
|
134
|
+ dlv_cndt = #{entity.dlvCndt},
|
|
135
|
+ short_cont_file_no = #{entity.shortContFileNo},
|
|
136
|
+ unit_st_cd = #{entity.unitStCd},
|
|
137
|
+ stdd_qyt = #{entity.stddQyt},
|
|
138
|
+ store_sale_stdd_qty = #{entity.storeSaleStddQty},
|
|
139
|
+ store_sale_unit_amt = #{entity.storeSaleUnitAmt},
|
|
140
|
+ sys_chg_dttm = now(),
|
|
141
|
+ sys_chg_id = #{userId}
|
|
142
|
+ where brand_id = #{entity.brandId}
|
|
143
|
+ and brand_unit_unq_no = #{entity.brandUnitUnqNo}
|
|
144
|
+ </update>
|
|
145
|
+
|
|
146
|
+</mapper>
|