admin_chrg 페이징/ 삭제 수정

This commit is contained in:
2023-03-28 16:52:44 +09:00
parent 0c8d3781fb
commit 393f802915
5 changed files with 91 additions and 32 deletions

View File

@@ -111,6 +111,8 @@ public interface CustMgtMapper {
/** 청구정보 카운트 조회.*/
int selectUserLmtListTotalCnt(UserLmtListReqDto userLmtListReqDto);
/** 충전관리 카운트 조회.*/
int cntChrgList(ChrgListReqDto chrgListReqDto);
/**충전관리 목록 조회*/
List<ChrgList> selectChrgList(ChrgListReqDto chrgListReqDto);
/** 충전관리 상세 조회 */

View File

@@ -1010,32 +1010,46 @@ public class CustMgtService {
public ChrgListResDto chrgList(ChrgListReqDto chrgListReqDto) {
CustMgtMapper custMgtMapper = sqlSessionMaster.getMapper(CustMgtMapper.class);
String nowPage = String.valueOf(chrgListReqDto.getPage());
int totalCnt = custMgtMapper.cntChrgList(chrgListReqDto);
if (totalCnt == 0) {
ChrgListRes chrgListRes = new ChrgListRes();
chrgListRes.setList(new ArrayList<>());
Paging paging = new Paging();
paging.setPage(nowPage);
paging.setTotalCnt(String.valueOf(totalCnt));
chrgListRes.setPaging(paging);
return new ChrgListResDto(ApiResponseCode.CM_NOT_FOUND, chrgListRes);
}
int page = chrgListReqDto.getPage();
int pagePerRows = chrgListReqDto.getPagePerRows();
page = (page - 1) * pagePerRows;
chrgListReqDto.setPage(page);
List<ChrgList> chrgList= custMgtMapper.selectChrgList(chrgListReqDto);
//for문
//1. 시작일을 가져온다
//2. 종료일을 가져온다
//3. 기간이라는 변수에 담아준다(형태를 잡아야함)"시작일"add String "~" add"종료일"(리스트,
for (int i = 0; i < chrgList.size(); i++) {
String startDt = chrgList.get(i).getStrtYm();
String endDt = chrgList.get(i).getEndYm();
logger.debug("startDt={} ", startDt);
logger.debug("endDt={} ", endDt);
// String chrgDate = startDt + "~" +endDt ;
chrgList.get(i).setChrgDate(startDt + "~" +endDt);
// logger.debug("chrgDate={} ", chrgDate);
}
ChrgListRes chrgListRes = new ChrgListRes();
chrgListRes.setList(chrgList);
logger.debug("chrgList={}",chrgList);
Paging paging = new Paging();
paging.setPage(nowPage);
paging.setTotalCnt(String.valueOf(totalCnt));
chrgListRes.setPaging(paging);
return new ChrgListResDto(ApiResponseCode.SUCCESS, chrgListRes);
}

View File

@@ -1144,25 +1144,18 @@
ENTR_NO = #{entrNo}
</update>
<!-- 충전관리 목록 조회 -->
<select id="selectChrgList" parameterType="kr.co.uplus.ez.api.custMgt.dto.ChrgListReqDto" resultType="kr.co.uplus.ez.api.custMgt.dto.ChrgList">
<select id="cntChrgList" parameterType="kr.co.uplus.ez.api.custMgt.dto.ChrgListReqDto" resultType="int">
SELECT
@ROWNUM := @ROWNUM + 1 AS NO
, eci.CUST_NM
, esu.USER_ID
, ecm.CHRG_DIV
, ecm.STRT_YM
, ecm.END_YM
, ecm.CHRG_AMT
, ecm.USE_YN
, eci.BIZRNO
, ecm.CHRG_SEQ
COUNT(*) AS TOTALCNT
FROM hubez_admin.EZ_CHARGE_MNG ecm
INNER JOIN hubez_common.EZ_SVC_USER esu ON esu.USER_SEQ = ecm.USER_SEQ
INNER JOIN hubez_common.EZ_CUST_INFO eci ON eci.CUST_SEQ = esu.CUST_SEQ
INNER JOIN hubez_common.EZ_SUBS_INFO esi ON esi.USER_SEQ = ecm.USER_SEQ
WHERE 1 = 1
AND ecm.USE_YN ='Y'
AND esi.SUBS_STTUS_CD ='02'
<if test="startDt != null and startDt != ''">
AND (ecm.STRT_YM <![CDATA[ >= ]]> STR_TO_DATE(concat(REPLACE(#{startDt}, '-', '' ),'000000') , '%Y%m')
</if>
@@ -1183,6 +1176,51 @@
ORDER BY ecm.CHRG_SEQ DESC
</select>
<!-- 충전관리 목록 조회 -->
<select id="selectChrgList" parameterType="kr.co.uplus.ez.api.custMgt.dto.ChrgListReqDto" resultType="kr.co.uplus.ez.api.custMgt.dto.ChrgList">
SELECT
@ROWNUM := @ROWNUM + 1 AS NO
,A.*
FROM (
SELECT
eci.CUST_NM
, esu.USER_ID
, ecm.CHRG_DIV
, ecm.STRT_YM
, ecm.END_YM
, ecm.CHRG_AMT
, ecm.USE_YN
, eci.BIZRNO
, ecm.CHRG_SEQ
FROM hubez_admin.EZ_CHARGE_MNG ecm
INNER JOIN hubez_common.EZ_SVC_USER esu ON esu.USER_SEQ = ecm.USER_SEQ
INNER JOIN hubez_common.EZ_CUST_INFO eci ON eci.CUST_SEQ = esu.CUST_SEQ
INNER JOIN hubez_common.EZ_SUBS_INFO esi ON esi.USER_SEQ = ecm.USER_SEQ
WHERE 1 = 1
AND ecm.USE_YN ='Y'
AND esi.SUBS_STTUS_CD ='02'
<if test="startDt != null and startDt != ''">
AND (ecm.STRT_YM <![CDATA[ >= ]]> STR_TO_DATE(concat(REPLACE(#{startDt}, '-', '' ),'000000') , '%Y%m')
</if>
<if test="endDt != null and endDt != ''">
OR ecm.END_YM <![CDATA[ <= ]]> STR_TO_DATE(concat(REPLACE(#{endDt}, '-', '' ),'235959'), '%Y%m'))
</if>
<if test="searchType1 != null and searchType1 != ''">
<if test="searchType1 == '01' and searchText1 != null and searchText1 != ''">
AND UPPER(eci.CUST_NM) LIKE UPPER(CONCAT('%', #{searchText1}, '%'))
</if>
<if test="searchType1 == '02' and searchText1 != null and searchText1 != ''">
AND UPPER(eci.BIZRNO) LIKE UPPER(CONCAT('%', #{searchText1}, '%'))
</if>
<if test="searchType1 == '03' and searchText1 != null and searchText1 != ''">
AND UPPER(esu.USER_ID) LIKE UPPER(CONCAT('%', #{searchText1}, '%'))
</if>
</if>
ORDER BY ecm.CHRG_SEQ DESC
LIMIT #{page}, #{pagePerRows}) A, ( SELECT @ROWNUM := #{page} ) AS R
</select>
<!-- 충전관리 상세 조회 -->
<select id="selectChrgDetail" parameterType="kr.co.uplus.ez.api.custMgt.dto.ChrgDetailReqDto" resultType="kr.co.uplus.ez.api.custMgt.dto.ChrgDetail">
SELECT