메뉴배너 관련 수정
This commit is contained in:
@@ -14,6 +14,7 @@ public interface MenuMapper {
|
||||
MenuBanner getBannerDetail(Long id);
|
||||
List<Message> getMessage(Long id);
|
||||
List<MenuBanner> getScheduleBannerList();
|
||||
int getMaxOrderId();
|
||||
|
||||
void insertBanner(MenuRequest mailRequest);
|
||||
void insertMessage(Map map);
|
||||
|
||||
@@ -29,6 +29,8 @@ public class MenuBanner {
|
||||
private LocalDateTime endDt;
|
||||
@JsonProperty("is_link")
|
||||
private boolean isLink;
|
||||
@JsonProperty("order_id")
|
||||
private Integer orderId;
|
||||
|
||||
@JsonProperty("create_by")
|
||||
private String createBy;
|
||||
|
||||
@@ -25,6 +25,8 @@ public class MenuRequest {
|
||||
private boolean isLink;
|
||||
@JsonProperty("link_list")
|
||||
private List<Message> linkList;
|
||||
@JsonProperty("order_id")
|
||||
private Integer orderId;
|
||||
|
||||
@JsonProperty("create_by")
|
||||
private Long createBy;
|
||||
|
||||
@@ -149,6 +149,9 @@ public class MenuService {
|
||||
public MenuResponse postBanner(MenuRequest menuRequest){
|
||||
menuRequest.setCreateBy(CommonUtils.getAdmin().getId());
|
||||
|
||||
int maxOrderId = menuMapper.getMaxOrderId();
|
||||
menuRequest.setOrderId(maxOrderId+1);
|
||||
|
||||
menuMapper.insertBanner(menuRequest);
|
||||
|
||||
long banner_id = menuRequest.getId();
|
||||
@@ -163,7 +166,8 @@ public class MenuService {
|
||||
File file = fileUtils.loadFileObject(temp_file);
|
||||
String fileUri = "";
|
||||
try{
|
||||
fileUri = s3Service.uploadFile(file, CommonConstants.S3_MENU_BANNER_DIRECTORY + banner_id, contentType);
|
||||
String directory = String.format("%s/%s-%d", CommonConstants.S3_MENU_BANNER_DIRECTORY, CommonConstants.S3_MENU_BANNER_DIRECTORY, banner_id);
|
||||
fileUri = s3Service.uploadFile(file, directory, contentType);
|
||||
}catch (S3Exception e) {
|
||||
log.error("S3 오류: {}", e.getMessage());
|
||||
throw new RestApiException(CommonCode.ERROR.getHttpStatus(), ErrorCode.ERROR_FILE_S3_UPLOAD.getMessage());
|
||||
|
||||
@@ -5,7 +5,7 @@ public class CommonConstants {
|
||||
public static final String FALSE = "False";
|
||||
public static final String NONE = "None";
|
||||
public static final String SCHEDULE = "Schedule";
|
||||
public static final int BATTLE_SERVER_WAIT_TIME = 600; // (seconds) 이벤트 홍보시간이 300초인데 여유있게 처리하게 하기위해 600으로 준다.
|
||||
public static final int BATTLE_SERVER_WAIT_TIME = 300; // (seconds) 이벤트 홍보시간이 300초인데 여유있게 처리하게 하기위해 600으로 준다.
|
||||
public static final int BATTLE_INSTANCE_ID = 1017007;
|
||||
public static final String CALIUM_ITEM_CODE = "19010003";
|
||||
public static final String CALIVERSE_CODE = "CALIVERSE";
|
||||
@@ -16,7 +16,7 @@ public class CommonConstants {
|
||||
public static final String LAND_EVENT = "event";
|
||||
public static final String SYSTEM_MAIL_LAND_TRANS_KEY = "LandTrans";
|
||||
public static final int DYNAMODB_PAGING_SIZE = 30;
|
||||
public static final String S3_MENU_BANNER_DIRECTORY = "banner-";
|
||||
public static final String S3_MENU_BANNER_DIRECTORY = "menuBanner";
|
||||
public static final String GUID = "GUID";
|
||||
public static final String NICKNAME = "NICKNAME";
|
||||
public static final String EMAIL = "EMAIL";
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.caliverse.admin.global.common.constants;
|
||||
|
||||
public class MetadataConstants {
|
||||
public static final String JSON_LIST_TEXT_STRING = "TextStringMetaDataList";
|
||||
public static final String JSON_LIST_ITEM = "ItemMetaDataList";
|
||||
public static final String JSON_LIST_CLOTH_TYPE = "ClothEquipTypeDataList";
|
||||
public static final String JSON_LIST_TOOL = "ToolMetaDataList";
|
||||
public static final String JSON_LIST_BAN_WORD = "BanWordMetaDataList";
|
||||
public static final String JSON_LIST_QUEST = "QuestMetaDataList";
|
||||
public static final String JSON_LIST_BUILDING = "BuildingMetaDataList";
|
||||
public static final String JSON_LIST_LAND = "LandMetaDataList";
|
||||
public static final String JSON_LIST_BATTLE_CONFIG = "BattleFFAConfigMetaDataList";
|
||||
public static final String JSON_LIST_BATTLE_REWARD = "BattleFFARewardMetaDataList";
|
||||
public static final String JSON_LIST_SYSTEM_META = "SystemMailMetaDataList";
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
<result property="status" column="status"/>
|
||||
<result property="startDt" column="start_dt"/>
|
||||
<result property="endDt" column="end_dt"/>
|
||||
<result property="orderId" column="order_id"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createDt" column="create_dt"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
@@ -21,43 +22,61 @@
|
||||
|
||||
<!--리스트 조회-->
|
||||
<select id="getBannerList" resultMap="MenuResultMap" parameterType="map">
|
||||
SELECT (@row_number:=@row_number + 1) AS row_num , c.*
|
||||
FROM (
|
||||
SELECT
|
||||
a.id
|
||||
, a.title
|
||||
, a.is_link
|
||||
, a.status
|
||||
, a.start_dt
|
||||
, a.end_dt
|
||||
, (SELECT email FROM admin WHERE id = a.create_by ) AS create_by
|
||||
, a.create_dt
|
||||
, (SELECT email FROM admin WHERE id = a.update_by ) AS update_by
|
||||
, a.update_dt
|
||||
FROM menu_banner a
|
||||
WHERE 1 = 1
|
||||
AND a.deleted = 0
|
||||
SELECT * FROM (
|
||||
SELECT (@row_number:=@row_number + 1) AS row_num, c.*
|
||||
FROM (
|
||||
SELECT
|
||||
a.id,
|
||||
a.title,
|
||||
a.is_link,
|
||||
CASE
|
||||
WHEN NOW() < a.start_dt THEN 'WAIT'
|
||||
WHEN NOW() >= a.start_dt AND NOW() <= a.end_dt THEN 'RUNNING'
|
||||
WHEN NOW() > a.end_dt THEN 'FINISH'
|
||||
END AS status,
|
||||
a.start_dt,
|
||||
a.end_dt,
|
||||
a.order_id,
|
||||
(SELECT email FROM admin WHERE id = a.create_by) AS create_by,
|
||||
a.create_dt,
|
||||
(SELECT email FROM admin WHERE id = a.update_by) AS update_by,
|
||||
a.update_dt
|
||||
FROM menu_banner a
|
||||
WHERE 1 = 1
|
||||
AND a.deleted = 0
|
||||
|
||||
<if test="search_data != null and search_data != ''">
|
||||
AND a.title LIKE CONCAT('%',#{searchData},'%')
|
||||
</if>
|
||||
<if test="search_data != null and search_data != ''">
|
||||
AND a.title LIKE CONCAT('%',#{searchData},'%')
|
||||
</if>
|
||||
|
||||
<if test="status != null and status != ''">
|
||||
<choose>
|
||||
<when test="status != 'ALL' ">
|
||||
AND a.status = #{status}
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
<choose>
|
||||
<when test="status != 'ALL'">
|
||||
AND CASE
|
||||
WHEN NOW() < a.start_dt THEN 'WAIT'
|
||||
WHEN NOW() >= a.start_dt AND NOW() <= a.end_dt THEN 'RUNNING'
|
||||
WHEN NOW() > a.end_dt THEN 'FINISH'
|
||||
END = #{status}
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="start_dt != null and start_dt != '' and end_dt !=null and end_dt!= ''">
|
||||
AND a.start_dt >= #{startDate, jdbcType=TIMESTAMP}
|
||||
AND a.end_dt <= #{endDate, jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
|
||||
ORDER BY a.create_dt
|
||||
)c
|
||||
, (SELECT @row_number:=0) AS t
|
||||
<if test="start_dt != null and start_dt != '' and end_dt !=null and end_dt!= ''">
|
||||
AND a.start_dt >= #{startDate, jdbcType=TIMESTAMP}
|
||||
AND a.end_dt <= #{endDate, jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
) c,
|
||||
(SELECT @row_number:=0) AS t
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN c.status = 'RUNNING' THEN 0
|
||||
WHEN c.status = 'WAIT' THEN 1
|
||||
WHEN c.status = 'FINISH' THEN 2
|
||||
ELSE 3
|
||||
END,
|
||||
c.order_id,
|
||||
c.create_dt
|
||||
) result
|
||||
<if test="orderby != null and orderby != ''">
|
||||
ORDER BY row_num ${orderby}
|
||||
</if>
|
||||
@@ -77,7 +96,12 @@
|
||||
, a.is_link
|
||||
, a.start_dt
|
||||
, a.end_dt
|
||||
, a.status
|
||||
, CASE
|
||||
WHEN NOW() < a.start_dt THEN 'WAIT'
|
||||
WHEN NOW() >= a.start_dt AND NOW() <= a.end_dt THEN 'RUNNING'
|
||||
WHEN NOW() > a.end_dt THEN 'FINISH'
|
||||
END AS status
|
||||
, a.order_id
|
||||
, (SELECT email FROM admin WHERE id = a.create_by ) AS create_by
|
||||
, a.create_dt
|
||||
, (SELECT email FROM admin WHERE id = a.update_by ) AS update_by
|
||||
@@ -88,16 +112,22 @@
|
||||
</select>
|
||||
|
||||
<select id="getMessage" parameterType="java.lang.Long" resultMap="MessageResultMap" >
|
||||
SELECT
|
||||
*
|
||||
SELECT *
|
||||
FROM message
|
||||
WHERE target_id = #{id}
|
||||
AND type = 'BANNER'
|
||||
</select>
|
||||
|
||||
<select id="getMaxOrderId" resultType="java.lang.Integer">
|
||||
SELECT COALESCE(MAX(order_id), 0)
|
||||
FROM menu_banner
|
||||
WHERE deleted = 0
|
||||
AND NOW() <= end_dt
|
||||
</select>
|
||||
|
||||
<insert id="insertBanner" parameterType="com.caliverse.admin.domain.request.MenuRequest" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO menu_banner (title, is_link, start_dt, end_dt)
|
||||
VALUES (#{title}, #{isLink}, #{startDt}, #{endDt})
|
||||
INSERT INTO menu_banner (title, is_link, start_dt, end_dt, order_id)
|
||||
VALUES (#{title}, #{isLink}, #{startDt}, #{endDt}, #{orderId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertMessage" parameterType="map">
|
||||
@@ -112,6 +142,7 @@
|
||||
, send_type =#{sendType}
|
||||
, mail_type = #{mailType}
|
||||
, send_dt = #{sendDt}
|
||||
, order_id = #{orderId}
|
||||
, update_by = #{updateBy}
|
||||
, update_dt = NOW()
|
||||
WHERE id = #{id}
|
||||
|
||||
Reference in New Issue
Block a user