3달간 수정 사항

This commit is contained in:
comicgum
2026-09-04 23:52:28 +09:00
parent d26eb50875
commit 4187407e96
110 changed files with 4439 additions and 2456 deletions
@@ -54,12 +54,12 @@ public class JwtProvider {
/*
public String createAccessToken(Long gid, String user_id, String nick_name, Long permission, Long biz_group_id) {
public String createAccessToken(Long gid, String user_id, String name, Long permission, Long biz_group_id) {
Date now = new Date();
return Jwts.builder()
.setSubject(gid.toString())
.claim("user_id", user_id)
.claim("nick_name", nick_name)
.claim("name", name)
.claim("permission", permission)
.claim("biz_group_id", biz_group_id)
.setIssuedAt(now)
@@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.MultipartFile;
//import static org.mockito.Answers.values;
import java.io.File;
import java.math.BigInteger;
import java.text.SimpleDateFormat;
@@ -146,7 +148,8 @@ public class _AG {
if (qeuryResult == null || qeuryResult.size() == 0)
return 0L;
return (Long)qeuryResult.get(0).get(strColName);
//return (Long)qeuryResult.get(0).get(strColName);
return (Long)qeuryResult.get(0).values().iterator().next();
}
static public String getIpAddr(HttpServletRequest request) {
@@ -188,7 +191,7 @@ public class _AG {
//JWT Auth
static public boolean isSkipAuthUri(String uri) {
if (uri.compareTo("/api/miss-slot.do") == 0 ||
if (uri.compareTo("/api/miss-column_no.do") == 0 ||
uri.compareTo("/api/terminal-state.do") == 0 ||
uri.compareTo("/api/sign-in.do") == 0 ||
uri.compareTo("/api/sval2.do") == 0 ||
@@ -203,17 +206,17 @@ public class _AG {
UserInfo principal = new UserInfo(
Long.parseLong(claims.getSubject()),
claims.get("user_id", String.class),
claims.get("nick_name", String.class),
claims.get("name", String.class),
claims.get("permission", Number.class),
claims.get("biz_group_id", Number.class)
);
return principal;
}
static public Map<String, Object> createUserInfoMap(String user_id, String nick_name, Long permission, Long biz_group_id) {
static public Map<String, Object> createUserInfoMap(String user_id, String name, Long permission, Long biz_group_id) {
Map<String, Object> map = new HashMap<>();
map.put("user_id", user_id);
map.put("nick_name", nick_name);
map.put("name", name);
map.put("permission", permission);
map.put("biz_group_id", biz_group_id);
return map;
@@ -233,8 +236,8 @@ public class _AG {
// 사업자번호 검증
static public boolean isValidBusinessNumber(String input) {
//return true; //TestCode
return true;
/*
String digits = input.replaceAll("\\D", "");
if (digits.length() != 10) {
return false;
@@ -252,5 +255,6 @@ public class _AG {
int checkDigit = (10 - (sum % 10)) % 10;
return checkDigit == Character.getNumericValue(digits.charAt(9));
*/
}
}
@@ -12,4 +12,5 @@ public class CtErrorCode {
static public final int INVALID_USER = -9;
static public final int ALREADY_EXIST = -11;
static public final int THIRDPARTY_ERROR = -12;
static public final int PERMISSION_DENIED = -13;
}
@@ -0,0 +1,48 @@
package com.handong.smartservice.component;
public class Permission {
static public final Long PERM_ALL = 0xffffffffL; // 4294967295
static public final Long PERM_GROUP = 0x2L;
static public final Long PERM_TID = 0x4L;
static public final Long PERM_CANCEL = 0x8L;
static public Boolean hasGroup(Long permission) {
return (permission & PERM_GROUP) == PERM_GROUP;
}
static public Boolean hasUid1(Long permission) {
return (permission & PERM_TID) == PERM_TID;
}
static public Boolean hasCancel(Long permission) {
return (permission & PERM_CANCEL) == PERM_CANCEL;
}
private Long value = 0x0L;
public Long get() {
return value;
}
public void setGroup(Boolean perm_group) {
if (perm_group)
value |= PERM_GROUP;
else
value &= ~PERM_GROUP;
}
public void setUid1(Boolean perm_uid1) {
if (perm_uid1)
value |= PERM_TID;
else
value &= ~PERM_TID;
}
public void setCancel(Boolean perm_cancel) {
if (perm_cancel)
value |= PERM_CANCEL;
else
value &= ~PERM_CANCEL;
}
}
@@ -1,5 +1,7 @@
package com.handong.smartservice.component;
import org.springframework.security.core.context.SecurityContextHolder;
public class UserInfo {
private final Long gid;
@@ -8,10 +10,14 @@ public class UserInfo {
private final Long permission;
private final Long bizGroupId;
public UserInfo(Long gid, String user_id, String nick_name, Number permission, Number bizGroupId) {
static public UserInfo getCurr() {
return (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
}
public UserInfo(Long gid, String user_id, String name, Number permission, Number bizGroupId) {
this.gid = gid;
this.userId = user_id;
this.nickName = nick_name;
this.nickName = name;
this.permission = permission != null ? permission.longValue() : 0L;
this.bizGroupId = bizGroupId != null ? bizGroupId.longValue() : 0L;
}
@@ -51,12 +51,13 @@ class AccountController {
Boolean is_excel = _AG.toBoolean(body.get("is_excel"));
Boolean is_group_access = _AG.toBoolean(body.get("is_group_access"));
String nick_name = body.get("nick_name");
String name = body.get("name");
String phone = body.get("phone");
String user_id = body.get("user_id");
String email = body.get("email");
Long biz_group_id = _AG.toLong(body.get("biz_group_id"));
Map<String, Object> mapResult = accountService.getAccountList(offset, limit, date_start, date_end, is_excel, is_group_access, user_id, email, nick_name, biz_group_id);
Map<String, Object> mapResult = accountService.getAccountList(offset, limit, date_start, date_end, is_excel, is_group_access, user_id, email, name, phone, biz_group_id);
if (is_excel) {
List<Map<String, String>> list = (List<Map<String, String>>)mapResult.get("list");
@@ -66,7 +67,7 @@ class AccountController {
}
String[] arrHeader = {"등록일", "그룹", "아이디", "닉네임", "이메일", "상태"};
String[] arrColumn = {"reg_time", "biz_group_name", "user_id", "nick_name", "email", "state"};
String[] arrColumn = {"reg_time", "biz_group_name", "user_id", "name", "email", "state"};
CtExcelMaker.makeExcelResponse(request, response, "계정목록", arrHeader, arrColumn, list, null);
return null;
@@ -83,17 +84,21 @@ class AccountController {
String user_id = body.get("user_id");
String user_pw = body.get("user_pw");
String email = body.get("email");
String nick_name = body.get("nick_name");
String name = body.get("name");
String phone = body.get("phone");
Long state = _AG.toLong(body.get("state"));
Long biz_group_id = _AG.toLong(body.get("biz_group_id"));
Long new_biz_group_id = _AG.toLong(body.get("new_biz_group_id"));
Boolean perm_group = _AG.toBoolean(body.get("perm_group"));
Boolean perm_uid1 = _AG.toBoolean(body.get("perm_uid1"));
Boolean perm_cancel = _AG.toBoolean(body.get("perm_cancel"));
if (user_id == null || user_id.isEmpty()) {
result.setErrCode(ErrorCode.INVALID_PARAMETER);
return result;
}
result = accountService.addOrModifyAccount(isModify, gid, user_id, user_pw, email, nick_name, state, biz_group_id, new_biz_group_id);
result = accountService.addOrModifyAccount(isModify, gid, user_id, user_pw, email, name, phone, state, biz_group_id, new_biz_group_id, perm_group, perm_uid1, perm_cancel);
return result;
}
@@ -69,7 +69,7 @@ class AuthController {
Long gid = (Long)mapAccount.get("gid");
logger.info("gid: " + gid);
String nick_name = (String)mapAccount.get("nick_name");
String name = (String)mapAccount.get("name");
Long permission = (Long)mapAccount.get("permission");
Long biz_group_id = (Long)mapAccount.get("biz_group_id");
String encPw = (String)mapAccount.get("user_pw");
@@ -83,8 +83,8 @@ class AuthController {
return result;
}
//mapAccount.put("sval1", jwtProvider.createAccessToken(gid, user_id, nick_name, permission, biz_group_id));
mapAccount.put("sval1", jwtProvider.createAccessToken(gid, _AG.createUserInfoMap(user_id, nick_name, permission, biz_group_id)));
//mapAccount.put("sval1", jwtProvider.createAccessToken(gid, user_id, name, permission, biz_group_id));
mapAccount.put("sval1", jwtProvider.createAccessToken(gid, _AG.createUserInfoMap(user_id, name, permission, biz_group_id)));
String refreshToken = jwtProvider.createRefreshToken(gid);
/*
@@ -109,11 +109,11 @@ class AuthController {
@RequestMapping(value = "/sign-out.do", method = RequestMethod.POST)
public CtResponse signOut(HttpServletRequest request, HttpServletResponse response,
@RequestBody Map<String, String> body, Authentication authentication) {
@RequestBody Map<String, String> body) {
logger.info("req: " + request.getRequestURI());
Long gid = _AG.toLong(body.get("gid"));
UserInfo userInfo = (UserInfo)authentication.getPrincipal();
UserInfo userInfo = UserInfo.getCurr();
CtResponse result = new CtResponse();
if (gid != userInfo.getGid()) {
@@ -156,11 +156,11 @@ class AuthController {
}
String user_id = (String)mapAccount.get("user_id");
String nick_name = (String)mapAccount.get("user_id");
String name = (String)mapAccount.get("user_id");
Long permission = (Long)mapAccount.get("permission");
Long biz_group_id = (Long)mapAccount.get("biz_group_id");
//String newAccessToken = jwtProvider.createAccessToken(gid, user_id, nick_name, permission, biz_group_id);
String newAccessToken = jwtProvider.createAccessToken(gid, _AG.createUserInfoMap(user_id, nick_name, permission, biz_group_id));
//String newAccessToken = jwtProvider.createAccessToken(gid, user_id, name, permission, biz_group_id);
String newAccessToken = jwtProvider.createAccessToken(gid, _AG.createUserInfoMap(user_id, name, permission, biz_group_id));
mapAccount.put("sval1", newAccessToken);
@@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.*;
import com.handong.smartservice._AG;
import com.handong.smartservice.component.CtResponse;
import com.handong.smartservice.component.ErrorCode;
import com.handong.smartservice.component.Permission;
import com.handong.smartservice.component.UserInfo;
import com.handong.smartservice.mapper.BizGroupMapper;
import com.handong.smartservice.service.BizGroupService;
@@ -68,6 +70,12 @@ class BizGroupController {
public CtResponse addOrModifyBizGroup(boolean isModify, HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, String> body) {
CtResponse result = new CtResponse();
UserInfo userInfo = UserInfo.getCurr();
if (Permission.hasGroup(userInfo.getPermission()) == false) {
result.setErrCode(ErrorCode.PERMISSION_DENIED);
return result;
}
Long biz_group_id = _AG.toLong(body.get("biz_group_id"));
Long pid = _AG.toLong(body.get("pid"));
Long top_group_id = _AG.toLong(body.get("top_group_id"));
@@ -116,10 +124,17 @@ class BizGroupController {
@RequestMapping(value = "/remove-biz-group.do", method = RequestMethod.POST)
public CtResponse removeBizGroup(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, String> body) {
logger.info("req: " + request.getRequestURI());
String ids = body.get("ids");
CtResponse result = new CtResponse();
CtResponse result = bizGroupService.removeBizGroup(ids);
return result;
UserInfo userInfo = UserInfo.getCurr();
if (Permission.hasGroup(userInfo.getPermission()) == false) {
result.setErrCode(ErrorCode.PERMISSION_DENIED);
return result;
}
String ids = body.get("ids");
return bizGroupService.removeBizGroup(ids);
}
@@ -49,11 +49,13 @@ class DeviceController {
Boolean is_group_access = _AG.toBoolean(body.get("is_group_access"));
Long biz_group_id = _AG.toLong(body.get("biz_group_id"));
String name = body.get("name");
String name = body.get("device_name");
String uid1 = body.get("uid1");
String conn_state = body.get("conn_state");
String date_start = body.get("date_start");
String date_end = body.get("date_end");
Map<String, Object> mapResult = deviceService.getDeviceList(is_excel, offset, limit, is_group_access, biz_group_id, name, date_start, date_end);
Map<String, Object> mapResult = deviceService.getDeviceList(is_excel, offset, limit, is_group_access, biz_group_id, name, uid1, conn_state, date_start, date_end);
if (is_excel) {
List<Map<String, String>> list = (List<Map<String, String>>)mapResult.get("list");
@@ -1,6 +1,7 @@
package com.handong.smartservice.controller.api;
import com.handong.smartservice._AG;
import com.handong.smartservice.component.CtExcelMaker;
import com.handong.smartservice.component.CtResponse;
import com.handong.smartservice.component.ErrorCode;
import com.handong.smartservice.service.ErrorHistoryService;
@@ -13,6 +14,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@@ -44,9 +46,20 @@ class ErrorHistoryController {
String date_end = body.get("date_end");
String uid1 = body.get("uid1");
Long uid1_type = _AG.toLong(body.get("uid1_type"));
String slot = body.get("slot");
String column_no = body.get("column_no");
Map<String, Object> mapResult = errorHistoryService.getErrorHistoryList(is_excel, offset, limit, date_start, date_end, uid1, uid1_type, slot);
Map<String, Object> mapResult = errorHistoryService.getErrorHistoryList(is_excel, offset, limit, date_start, date_end, uid1, uid1_type, column_no);
if (is_excel) {
List<Map<String, String>> list = (List<Map<String, String>>)mapResult.get("list");
String[] arrHeader = {"발생일시", "단말기 TID", "벤더", "컬럼번호"};
String[] arrColumn = {"reg_time", "uid1", "uid1_type", "column_no"};
CtExcelMaker.makeExcelResponse(request, response, "기기에러내역", arrHeader, arrColumn, list, null);
return null;
}
result.put("result", mapResult);
return result;
}
@@ -64,17 +77,17 @@ class ErrorHistoryController {
return result;
}
@RequestMapping(value = "/miss-slot.do", method = RequestMethod.POST)
public CtResponse missSlot(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, String> body) {
@RequestMapping(value = "/miss-column.do", method = RequestMethod.POST)
public CtResponse missColumn(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, String> body) {
logger.info("req: " + request.getRequestURI());
CtResponse result = new CtResponse();
String uid1 = body.get("uid1");
Long uid1_type = _AG.toLong(body.get("uid1_type"));
String slot = body.get("slot");
String column_no = body.get("column_no");
Map<String, Object> mapResult = errorHistoryService.missSlot(uid1, uid1_type, slot);
Map<String, Object> mapResult = errorHistoryService.missColumn(uid1, uid1_type, column_no);
result.put("result", mapResult);
return result;
}
@@ -0,0 +1,148 @@
package com.handong.smartservice.controller.api;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import com.handong.smartservice._AG;
import com.handong.smartservice.component.CtExcelMaker;
import com.handong.smartservice.component.CtResponse;
import com.handong.smartservice.service.GamderService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
//TempCode - 겜더 화면 확인용. 응답은 GamderService의 하드코딩 데이터다.
@RestController
@RequestMapping("/api")
class GamderController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final GamderService gamderService;
public GamderController(GamderService gamderService) {
this.gamderService = gamderService;
}
// 단말기 단가설정 //////////////////////////////////////////////////////////
//
@RequestMapping(value = "/get-device-price.do", method = RequestMethod.POST)
public CtResponse getDevicePrice(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, String> body) {
logger.info("req: " + request.getRequestURI());
CtResponse result = new CtResponse();
Long device_id = _AG.toLong(body.get("device_id"));
result.put("result", gamderService.getDevicePriceList(device_id));
return result;
}
// prices가 배열이라 Map<String, Object>로 받는다.
@RequestMapping(value = "/manage-device-price.do", method = RequestMethod.POST)
public CtResponse manageDevicePrice(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> body) {
logger.info("req: " + request.getRequestURI());
Object objDeviceId = body.get("device_id");
Long device_id = _AG.toLong(objDeviceId == null ? "" : String.valueOf(objDeviceId));
List<Object> prices = (List<Object>)body.get("prices");
return gamderService.manageDevicePrice(device_id, prices);
}
@RequestMapping(value = "/pay-device-service.do", method = RequestMethod.POST)
public CtResponse payDeviceService(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, String> body) {
logger.info("req: " + request.getRequestURI());
Long device_id = _AG.toLong(body.get("device_id"));
Long service_pulse = _AG.toLong(body.get("service_pulse"));
String memo = _AG.safeStr(body.get("memo"));
return gamderService.payDeviceService(device_id, service_pulse, memo);
}
// 경품 //////////////////////////////////////////////////////////////////
//
@RequestMapping(value = "/get-prize.do", method = RequestMethod.POST)
public CtResponse getPrize(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, String> body) {
logger.info("req: " + request.getRequestURI());
CtResponse result = new CtResponse();
Boolean is_excel = _AG.toBoolean(body.get("is_excel"));
Long offset = _AG.toLong(body.get("offset"));
Long limit = _AG.toLong(body.get("limit"));
if (limit > 100)
limit = 100L;
String device_name = body.get("device_name");
String store_code = body.get("store_code");
Long state = _AG.toLong(body.get("state"));
String date_start = body.get("date_start");
String date_end = body.get("date_end");
Map<String, Object> mapResult = gamderService.getPrizeList(is_excel, offset, limit, device_name, store_code, state, date_start, date_end);
if (is_excel) {
List<Map<String, String>> list = (List<Map<String, String>>)mapResult.get("list");
String[] arrHeader = {"당첨일시", "매장코드", "기기코드", "기기이름", "경품 출구", "단가 이름", "금액", "상태"};
String[] arrColumn = {"reg_time", "store_code", "machine_code", "device_name", "exit_no", "price_name", "amount", "state"};
CtExcelMaker.makeExcelResponse(request, response, "경품당첨내역", arrHeader, arrColumn, list, null);
return null;
}
result.put("result", mapResult);
return result;
}
@RequestMapping(value = "/cancel-prize.do", method = RequestMethod.POST)
public CtResponse cancelPrize(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, String> body) {
logger.info("req: " + request.getRequestURI());
String prize_id = _AG.safeStr(body.get("prize_id"));
return gamderService.cancelPrize(prize_id);
}
// 버튼 색상 //////////////////////////////////////////////////////////////
//
@RequestMapping(value = "/get-button-color.do", method = RequestMethod.POST)
public CtResponse getButtonColor(HttpServletRequest request, HttpServletResponse response) {
logger.info("req: " + request.getRequestURI());
CtResponse result = new CtResponse();
result.put("result", gamderService.getButtonColorList());
return result;
}
// colors가 배열이라 Map<String, Object>로 받는다.
@RequestMapping(value = "/manage-button-color.do", method = RequestMethod.POST)
public CtResponse manageButtonColor(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> body) {
logger.info("req: " + request.getRequestURI());
List<Object> colors = (List<Object>)body.get("colors");
return gamderService.manageButtonColor(colors);
}
@RequestMapping(value = "/apply-button-color.do", method = RequestMethod.POST)
public CtResponse applyButtonColor(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, String> body) {
logger.info("req: " + request.getRequestURI());
Long seq = _AG.toLong(body.get("seq"));
Long button_color = _AG.toLong(body.get("button_color"));
return gamderService.applyButtonColor(seq, button_color);
}
}
@@ -129,7 +129,7 @@ class GoodsController {
CtResponse result = new CtResponse();
Long device_id = _AG.toLong(body.get("device_id"));
String slot = body.get("slot");
String column_no = body.get("column_no");
Long goods_id = _AG.toLong(body.get("goods_id"));
if (device_id == 0) {
@@ -137,7 +137,7 @@ class GoodsController {
return result;
}
Map<String, Object> mapResult = goodsService.getDeviceGoodsList(device_id, slot, goods_id);
Map<String, Object> mapResult = goodsService.getDeviceGoodsList(device_id, column_no, goods_id);
result.put("result", mapResult);
return result;
}
@@ -51,13 +51,14 @@ class SalesController {
String date_start = body.get("date_start");
String date_end = body.get("date_end");
Long biz_group_id = _AG.toLong(body.get("biz_group_id"));
Boolean query_uid1 = _AG.toBoolean(body.get("query_uid1"));
String uid1 = body.get("uid1");
String device_name = body.get("device_name");
Long approval_type = _AG.toLong(body.get("approval_type"));
Long date_type = _AG.toLong(body.get("date_type"));
Map<String, Object> mapResult = salesService.getSalesList(is_excel, offset, limit, is_group_access, biz_group_id, date_start, date_end,
uid1, device_name, approval_type, date_type);
query_uid1, uid1, device_name, approval_type, date_type);
if (is_excel) {
List<Map<String, String>> list = (List<Map<String, String>>)mapResult.get("list");
@@ -11,6 +11,7 @@ import com.handong.smartservice._AG;
import com.handong.smartservice.component.CtExcelMaker;
import com.handong.smartservice.component.CtResponse;
import com.handong.smartservice.component.ErrorCode;
import com.handong.smartservice.component.UserInfo;
import com.handong.smartservice.service.TerminalService;
import jakarta.servlet.http.HttpServletRequest;
@@ -35,6 +36,19 @@ class TerminalController {
this.terminalService = terminalService;
}
@RequestMapping(value = "/list-uid1.do", method = RequestMethod.POST)
public CtResponse listUid1(HttpServletRequest request, HttpServletResponse response, @RequestBody(required = false) Map<String, String> body) {
logger.info("req: " + request.getRequestURI());
CtResponse result = new CtResponse();
UserInfo userInfo = UserInfo.getCurr();
Map<String, Object> mapResult = terminalService.listUid1(0L, 1000L, userInfo.getBizGroupId());
result.put("result", mapResult);
return result;
}
@RequestMapping(value = "/get-terminal.do", method = RequestMethod.POST)
public CtResponse getTerminalList(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, String> body) {
logger.info("req: " + request.getRequestURI());
@@ -52,6 +52,7 @@ class TransactionController {
String date_start = body.get("date_start");
String date_end = body.get("date_end");
Long biz_group_id = _AG.toLong(body.get("biz_group_id"));
String device_name = body.get("device_name");
String uid1 = body.get("uid1");
Long uid1_type = _AG.toLong(body.get("uid1_type"));
String type = body.get("type");
@@ -59,12 +60,12 @@ class TransactionController {
String approval = body.get("approval");
String pay_name = body.get("pay_name");
String pay_vendor = body.get("pay_vendor");
String slot = body.get("slot");
String column_no = body.get("column_no");
String code = body.get("code");
String goods_name = body.get("goods_name");
Map<String, Object> mapResult = transactionService.getTransactionList(is_excel, offset, limit, is_group_access, biz_group_id, date_start, date_end,
uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, code, goods_name);
device_name, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, code, goods_name);
if (is_excel) {
List<Map<String, String>> list = (List<Map<String, String>>)mapResult.get("list");
@@ -74,7 +75,7 @@ class TransactionController {
}
String[] arrHeader = {"거래시간", "단말기 TID", "금액", "결제유형", "승인번호", "컬럼번호", "상품코드", "상품명", "결제서비스업체"};
String[] arrColumn = {"order_time", "uid1", "amount", "type", "approval", "slot", "code", "goods_name", "pay_vendor"};
String[] arrColumn = {"order_time", "uid1", "amount", "type", "approval", "column_no", "code", "goods_name", "pay_vendor"};
CtExcelMaker.makeExcelResponse(request, response, "거래내역목록", arrHeader, arrColumn, list, null);
return null;
@@ -105,12 +106,12 @@ class TransactionController {
String approval = body.get("approval");
String pay_name = body.get("pay_name");
String pay_vendor = body.get("pay_vendor");
String slot = body.get("slot");
String column_no = body.get("column_no");
String code = body.get("code");
String goods_name = body.get("goods_name");
Map<String, Object> mapResult = transactionService.getUndefinedTransactionList(is_excel, offset, limit, date_start, date_end,
uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, code, goods_name);
uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, code, goods_name);
result.put("result", mapResult);
return result;
}
@@ -130,7 +131,7 @@ class TransactionController {
"approval": "33",
"pay_name": " HANA",
"pay_vendor": "HANA",
"slot": "01"
"column_no": "01"
}'
*/
@@ -143,18 +144,18 @@ class TransactionController {
String approval = body.get("approval");
String pay_name = body.get("pay_name");
String pay_vendor = body.get("pay_vendor");
String slot = body.get("slot");
String column_no = body.get("column_no");
//String code = body.get("code");
//String goods_name = body.get("goods_name");
String pay_unique_num = body.get("pay_unique_num");
String pay_order_time = body.get("pay_order_time");
if (uid1 == null || uid1_type == null || type == null || amount == null || slot == null) {
if (uid1 == null || uid1_type == null || type == null || amount == null || column_no == null) {
result.setErrCode(ErrorCode.INVALID_PARAMETER);
return result;
}
result = transactionService.addTransaction(uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, pay_unique_num, pay_order_time);
result = transactionService.addTransaction(uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, pay_unique_num, pay_order_time);
return result;
}
}
@@ -10,14 +10,14 @@ import java.util.Map;
public interface AccountMapper {
List<Map<String, Object>> selectAccount(Boolean isCount, Boolean is_excel, Long offset, Long limit,
String date_start, String date_end, Long gid, String user_id, String email, String nick_name, Long biz_group_id);
String date_start, String date_end, Long gid, String user_id, String email, String name, String phone, Long biz_group_id);
List<Map<String, Object>> selectAccount2(Boolean isCount, Long offset, Long limit,
String date_start, String date_end, Boolean is_excel, Long gid, String user_id, String email, String nick_name, Long biz_group_id);
String date_start, String date_end, Boolean is_excel, Long gid, String user_id, String email, String name, String phone, Long biz_group_id);
int insertAccount(Map<String, Object> params);
int updateAccount(Long gid, String user_pw, String nick_name, String email, Long state, Long biz_group_id);
int updateAccount(Long gid, String user_pw, String name, String phone, String email, Long state, Long biz_group_id, Long permission);
int changeState(List<Long> ids, int state);
}
@@ -10,10 +10,10 @@ import java.util.Map;
@Mapper
public interface DeviceMapper {
List<Map<String, Object>> selectDevice(Boolean isCount, boolean is_excel, Long offset, Long limit, Boolean is_group_access,
Long biz_group_id, String name, String date_start, String date_end);
Long biz_group_id, String name, String uid1, String conn_state, String date_start, String date_end);
List<Map<String, Object>> selectDevice2(Boolean isCount, boolean is_excel, Long offset, Long limit,
Long biz_group_id, String name, String date_start, String date_end);
Long biz_group_id, String name, String uid1, String conn_state, String date_start, String date_end);
Map<String, Object> selectDeviceById(Long device_id);
@@ -9,9 +9,9 @@ import java.util.Map;
@Mapper
public interface ErrorHistoryMapper {
List<Map<String, Object>> selectErrorHistory(Boolean isCount, Boolean is_excel, Long offset, Long limit,
String date_start, String date_end, String uid1, Long uid1_type, String slot);
String date_start, String date_end, String uid1, Long uid1_type, String column_no);
List<Map<String, Object>> selectErrorHistoryByState(Long state);
int insertErrorHistory(String uid1, Long uid1_type, String slot);
int insertErrorHistory(String uid1, Long uid1_type, String column_no);
}
@@ -16,7 +16,7 @@ public interface GoodsMapper {
Map<String, Object> selectExistGoods(Long biz_group_id, String code, String name);
Map<String, Object> selectGoodsByUid1(String uid1, Long uid1_type, String slot);
Map<String, Object> selectGoodsByUid1(String uid1, Long uid1_type, String column_no);
int insertGoods(Map<String, Object> params);
@@ -25,10 +25,10 @@ public interface GoodsMapper {
int deleteGoods(List<Long> ids);
//
List<Map<String, Object>> selectDeviceGoods(Long device_id, String slot, Long goods_id);
List<Map<String, Object>> selectDeviceGoods(Long device_id, String column_no, Long goods_id);
int insertDeviceGoods(Long device_id, List<Map<String, String>> device_goods);
int updateDeviceGoodsPlusInventory(String approval);
int updateDeviceGoodsMinusInventory(Long device_id, String slot);
int updateDeviceGoodsMinusInventory(Long device_id, String column_no);
int deleteDeviceGoods(Long device_id, List<Map<String, String>> device_goods);
List<Map<String, Object>> selectGoodsTemplateByBizGroupId(Long biz_group_id);
@@ -10,6 +10,8 @@ import java.util.Map;
@Mapper
public interface TerminalMapper {
List<Map<String, Object>> selectUid1(Long offset, Long limit, Long biz_group_id);
List<Map<String, Object>> selectTerminal(Boolean isCount, Boolean is_excel, Long offset, Long limit, Boolean is_group_access,
Long biz_group_id, String name, Long state, String date_start, String date_end);
@@ -1,7 +1,6 @@
package com.handong.smartservice.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@@ -10,18 +9,20 @@ import java.util.Map;
public interface TransactionMapper {
List<Map<String, Object>> selectTransaction(Boolean isCount, Boolean is_excel, Long offset, Long limit, Boolean is_group_access,
Long biz_group_id, String date_start, String date_end, String uid1, Long uid1_type, String type, Long amount,
String approval, String pay_name, String pay_vendor, String slot, String code, String goods_name);
Long biz_group_id, String date_start, String date_end, String device_name, String uid1, Long uid1_type, String type, Long amount,
String approval, String pay_name, String pay_vendor, String column_no, String code, String goods_name);
List<Map<String, Object>> selectTransactionBizGroup0(Boolean isCount, Boolean is_excel, Long offset, Long limit,
String date_start, String date_end, String uid1, Long uid1_type, String type, Long amount, String approval,
String pay_name, String pay_vendor, String slot, String code, String goods_name);
String date_start, String date_end, String device_name, String uid1, Long uid1_type, String type, Long amount, String approval,
String pay_name, String pay_vendor, String column_no, String code, String goods_name);
List<Map<String, Object>> selectTransaction2(Boolean isCount, Boolean is_excel, Long offset, Long limit, Boolean is_group_access,
Long biz_group_id, String date_start, String date_end, String uid1);
List<Map<String, Object>> selectTransaction3(Boolean isCount, Boolean is_excel, Long offset, Long limit, Boolean is_group_access,
Long biz_group_id, String date_start, String date_end, String uid1, String device_name, Long approval_type, Long date_type);
Long biz_group_id, String date_start, String date_end, Boolean query_uid1, String uid1, String device_name, Long approval_type, Long date_type);
Map<String, Object> selectTransactionSum(Boolean is_group_access, Long biz_group_id, String date_start, String date_end);
int insertTransaction(Map<String, Object> params);
}
@@ -1,5 +1,8 @@
package com.handong.smartservice.service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -10,6 +13,7 @@ import com.handong.smartservice._AG;
import com.handong.smartservice.component.CtResponse;
import com.handong.smartservice.component.DbLogger;
import com.handong.smartservice.component.ErrorCode;
import com.handong.smartservice.component.Permission;
import com.handong.smartservice.component.UserInfo;
import org.springframework.security.core.Authentication;
@@ -22,6 +26,8 @@ import com.handong.smartservice.mapper.AccountMapper;
@Service
public class AccountService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final AccountMapper accountMapper;
private final PasswordEncoder passwordEncoder;
@@ -38,7 +44,7 @@ public class AccountService {
}
List<Map<String, Object>> listMap = (List<Map<String, Object>>)accountMapper.selectAccount(false, false, 0L, 1L,
null, null, gid, user_id, null, null, 0L);
null, null, gid, user_id, null, null, null, 0L);
if (listMap.size() == 0)
result.put("result", null);
@@ -48,26 +54,28 @@ public class AccountService {
return result;
}
public Map<String, Object> getAccountList(Long offset, Long limit, String date_start, String date_end, Boolean is_excel, Boolean is_group_access, String user_id, String email, String nick_name, Long biz_group_id) {
public Map<String, Object> getAccountList(Long offset, Long limit, String date_start, String date_end, Boolean is_excel, Boolean is_group_access, String user_id, String email, String name, String phone, Long biz_group_id) {
Map<String, Object> mapResult = new HashMap<>();
//if (is_group_access) {
List<Map<String, Object>> listMap = (List<Map<String, Object>>)accountMapper.selectAccount2(false, offset, limit,
date_start, date_end, is_excel, 0L, user_id, email, nick_name, biz_group_id);
date_start, date_end, is_excel, 0L, user_id, email, name, phone, biz_group_id);
mapResult.put("list", listMap);
Long totalCount = _AG.getNumberFromQuery("COUNT(*)", accountMapper.selectAccount2(true, offset, limit,
date_start, date_end, is_excel, 0L, user_id, email, nick_name, biz_group_id));
date_start, date_end, is_excel, 0L, user_id, email, name, phone, biz_group_id));
mapResult.put("totalCount", totalCount);
mapResult.put("offset", offset);
return mapResult;
}
public CtResponse addOrModifyAccount(boolean isModify, Long gid, String user_id, String user_pw, String email, String nick_name, Long state, Long biz_group_id, Long new_biz_group_id) {
public CtResponse addOrModifyAccount(boolean isModify, Long gid, String user_id, String user_pw, String email, String name, String phone,Long state,
Long biz_group_id, Long new_biz_group_id, Boolean perm_group, Boolean perm_uid1, Boolean perm_cancel) {
CtResponse result = new CtResponse();
UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
//UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserInfo userInfo = UserInfo.getCurr();
String enc_pw = passwordEncoder.encode(user_pw);
@@ -80,8 +88,14 @@ public class AccountService {
return result;
}
//accountMapper.updateAccount(gid, user_pw, nick_name, email, state, biz_group_id);
accountMapper.updateAccount(gid, enc_pw, nick_name, email, state, biz_group_id);
Permission permission = new Permission();
permission.setGroup(perm_group);
permission.setUid1(perm_uid1);
permission.setCancel(perm_cancel);
//logger.debug("[TRACE1], permission = {}", permission.get());
//accountMapper.updateAccount(gid, user_pw, name, email, state, biz_group_id);
accountMapper.updateAccount(gid, enc_pw, name, phone, email, state, biz_group_id, permission.get());
DbLogger.insert(2L, "계정정보 수정", userInfo.getGid());
}
else {
@@ -94,15 +108,21 @@ public class AccountService {
params.put("user_id", user_id);
//params.put("user_pw", user_pw);
params.put("user_pw", enc_pw);
params.put("nick_name", nick_name);
params.put("name", name);
params.put("phone", phone);
params.put("email", email);
params.put("state", state);
params.put("biz_group_id", biz_group_id);
if (biz_group_id == 667) //TempCode
params.put("permission", 1L);
else
params.put("permission", 2L);
params.put("permission", Permission.PERM_ALL);
else {
Permission permission = new Permission();
permission.setGroup(perm_group);
permission.setUid1(perm_uid1);
permission.setCancel(perm_cancel);
params.put("permission", permission.get());
}
if (accountMapper.insertAccount(params) == 0) {
result.setErrCode(ErrorCode.INVALID_PARAMETER);
@@ -20,7 +20,9 @@ import com.handong.smartservice._AG;
import com.handong.smartservice.component.CtResponse;
import com.handong.smartservice.component.DbLogger;
import com.handong.smartservice.component.ErrorCode;
import com.handong.smartservice.component.Permission;
import com.handong.smartservice.component.RcTreeBizGroup;
import com.handong.smartservice.component.UserInfo;
import com.handong.smartservice.mapper.BizGroupMapper;
import com.handong.smartservice.mapper.OperatingHistoryMapper;
@@ -41,7 +41,8 @@ public class DeviceService {
this.deviceMapper = deviceMapper;
}
public Map<String, Object> getDeviceList(Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id, String name, String date_start, String date_end) {
public Map<String, Object> getDeviceList(Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id,
String name, String uid1, String conn_state, String date_start, String date_end) {
Map<String, Object> mapResult = new HashMap<>();
//OldVer
@@ -53,26 +54,27 @@ public class DeviceService {
// biz_group_id = (Long)listForTopId.get(0).get("biz_group_id");
// }
//}
if (is_group_access) {
List<Map<String, Object>> listMap = (List<Map<String, Object>>)deviceMapper.selectDevice(false, is_excel, offset, limit, is_group_access,
biz_group_id, name, date_start, date_end);
biz_group_id, name, uid1, conn_state, date_start, date_end);
mapResult.put("list", listMap);
if (is_excel == false) {
Long totalCount = _AG.getNumberFromQuery("COUNT(*)", deviceMapper.selectDevice(true, is_excel, offset, limit, is_group_access,
biz_group_id, name, date_start, date_end));
biz_group_id, name, uid1, conn_state, date_start, date_end));
mapResult.put("totalCount", totalCount);
mapResult.put("offset", offset);
}
}
else {
List<Map<String, Object>> listMap = (List<Map<String, Object>>)deviceMapper.selectDevice2(false, is_excel, offset, limit,
biz_group_id, name, date_start, date_end);
biz_group_id, name, uid1, conn_state, date_start, date_end);
mapResult.put("list", listMap);
if (is_excel == false) {
Long totalCount = _AG.getNumberFromQuery("COUNT(*)", deviceMapper.selectDevice2(true, is_excel, offset, limit,
biz_group_id, name, date_start, date_end));
biz_group_id, name, uid1, conn_state, date_start, date_end));
mapResult.put("totalCount", totalCount);
mapResult.put("offset", offset);
}
@@ -84,7 +86,7 @@ public class DeviceService {
public CtResponse addOrModifyDevice(boolean isModify, Long biz_group_id, Long new_biz_group_id, Long device_id, Long terminal_id, String name, String uid1, String manager_name) {
CtResponse result = new CtResponse();
UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserInfo userInfo = UserInfo.getCurr();
if (isModify) {
if (device_id == 0) {
@@ -154,7 +156,7 @@ public class DeviceService {
}
DbLogger.insert(2L, "무인기기 추가, 기기명: " + name + "TID: " + uid1, userInfo.getGid());
Long new_device_id = _AG.toLong((BigInteger)params.get("device_id"));
Long new_device_id = _AG.toLong((BigInteger)params.get("device_id"));
if (deviceMapper.insertDeviceBizGroup(biz_group_id, new_device_id) == 0) {
result.setErrCode(ErrorCode.INVALID_PARAMETER);
@@ -172,7 +174,7 @@ public class DeviceService {
public CtResponse removeDevice(Long biz_group_id, Long device_id) {
CtResponse result = new CtResponse();
UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserInfo userInfo = UserInfo.getCurr();
//terminalMapper.updateTerminalRemoveDevice(device_id);
Map<String, Object> mapTerminal = terminalMapper.selectTerminalByDeviceId(device_id);
@@ -10,8 +10,12 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -29,34 +33,73 @@ public class ErrorHistoryService {
}
public Map<String, Object> getErrorHistoryList(Boolean is_excel, Long offset, Long limit, String date_start, String date_end,
String uid1, Long uid1_type, String slot) {
String uid1, Long uid1_type, String column_no) {
Map<String, Object> mapResult = new HashMap<>();
List<Map<String, Object>> listMap = (List<Map<String, Object>>)errorHistoryMapper.selectErrorHistory(false, is_excel, offset, limit,
date_start, date_end, uid1, uid1_type, slot);
mapResult.put("list", listMap);
date_start, date_end, uid1, uid1_type, column_no);
Long totalCount = _AG.getNumberFromQuery("COUNT(*)", errorHistoryMapper.selectErrorHistory(true, is_excel, offset, limit,
date_start, date_end, uid1, uid1_type, slot));
date_start, date_end, uid1, uid1_type, column_no));
//TempCode - 실제 데이터가 없을 때만 화면 확인용 하드코딩 데이터를 내려준다. 삭제해도 동작에 문제 없음.
if (listMap == null || listMap.isEmpty()) {
listMap = makeSampleErrorHistory();
totalCount = (long)listMap.size();
int from = (int)Math.min(offset == null ? 0 : offset, listMap.size());
int to = (int)Math.min(from + (limit == null ? 20 : limit), listMap.size());
if (is_excel == false)
listMap = new ArrayList<>(listMap.subList(from, to));
}
//
mapResult.put("list", listMap);
mapResult.put("totalCount", totalCount);
mapResult.put("offset", offset);
return mapResult;
}
//TempCode - 화면 확인용 샘플. 프론트의 convertDateTime2()가 파싱하도록 ISO 형식으로 내려준다.
private static final DateTimeFormatter TEMP_DT = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
private List<Map<String, Object>> makeSampleErrorHistory() {
String[] arrUid1 = { "1234567", "1234568", "2345671", "2345672" };
List<Map<String, Object>> list = new ArrayList<>();
for (int i = 0; i < 27; i++) {
Map<String, Object> m = new LinkedHashMap<>();
m.put("error_history_id", 5000 + i);
m.put("reg_time", LocalDateTime.now().minusMinutes(i * 53L + 7).format(TEMP_DT));
m.put("uid1", arrUid1[i % arrUid1.length]);
m.put("uid1_type", (i % 2) + 1);
m.put("column_no", String.format("%02d", (i % 12) + 1));
list.add(m);
}
return list;
}
public Map<String, Object> getMiss(Long state) {
Map<String, Object> mapResult = new HashMap<>();
List<Map<String, Object>> listMap = errorHistoryMapper.selectErrorHistoryByState(1L);
//TempCode - 실제 데이터가 없을 때만 화면 확인용 하드코딩 데이터를 내려준다. 삭제해도 동작에 문제 없음.
if (listMap == null || listMap.isEmpty())
listMap = new ArrayList<>(makeSampleErrorHistory().subList(0, 6));
//
mapResult.put("list", listMap);
return mapResult;
}
public CtResponse missSlot(String uid1, Long uid1_type, String slot) {
public CtResponse missColumn(String uid1, Long uid1_type, String column_no) {
CtResponse result = new CtResponse();
errorHistoryMapper.insertErrorHistory(uid1, uid1_type, slot);
DbLogger.insert(1L, "물품 미투출 TID: " + uid1 + ", 컬럼번호: " + slot, 2L);
errorHistoryMapper.insertErrorHistory(uid1, uid1_type, column_no);
DbLogger.insert(1L, "물품 미투출 TID: " + uid1 + ", 컬럼번호: " + column_no, 2L);
return result;
}
@@ -0,0 +1,210 @@
package com.handong.smartservice.service;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import com.handong.smartservice.component.CtResponse;
//TempCode - 겜더 화면 확인용 하드코딩 데이터. DB 연동 시 이 클래스 전체를 실제 mapper 호출로 교체한다.
@Service
public class GamderService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private static final DateTimeFormatter DT = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
// 프론트의 convertDateTime2()가 new Date(str)로 파싱하므로 ISO 형식으로 내려준다.
private static String ago(int minutes) {
return LocalDateTime.now().minusMinutes(minutes).format(DT);
}
// 단말기 단가설정 //////////////////////////////////////////////////////////
//
private static Map<String, Object> price(int seq, int pay_type, int amount, int in_pulse, int out_pulse,
boolean use_service, int service_pulse, String price_name, int button_color,
int check_time, int pulse_interval) {
Map<String, Object> m = new LinkedHashMap<>();
m.put("seq", seq);
m.put("pay_type", pay_type);
m.put("amount", amount);
m.put("in_pulse", in_pulse);
m.put("out_pulse", out_pulse);
m.put("use_service", use_service);
m.put("service_pulse", service_pulse);
m.put("price_name", price_name);
m.put("button_color", button_color);
m.put("check_time", check_time);
m.put("pulse_interval", pulse_interval);
return m;
}
public Map<String, Object> getDevicePriceList(Long device_id) {
Map<String, Object> mapResult = new HashMap<>();
List<Map<String, Object>> list = new ArrayList<>();
// 코인(1) / 지폐(2) / 카드(3)
list.add(price(1, 1, 500, 1, 0, false, 0, "코인 500", 1, 0, 0));
list.add(price(2, 1, 1000, 2, 0, false, 0, "코인 1000", 1, 0, 0));
list.add(price(3, 2, 5000, 5, 0, true, 1, "지폐 5000", 1, 150, 80));
list.add(price(4, 2, 10000, 10, 0, true, 2, "지폐 10000", 1, 150, 80));
list.add(price(5, 3, 1000, 0, 2, false, 0, "카드 1000", 7, 0, 0));
list.add(price(6, 3, 5000, 0, 10, true, 1, "카드 5000", 5, 0, 0));
list.add(price(7, 3, 10000, 0, 20, true, 3, "카드 10000", 8, 200, 100));
mapResult.put("list", list);
return mapResult;
}
public CtResponse manageDevicePrice(Long device_id, List<Object> prices) {
logger.info("manageDevicePrice, device_id: {}, count: {}", device_id, prices == null ? 0 : prices.size());
return new CtResponse();
}
public CtResponse payDeviceService(Long device_id, Long service_pulse, String memo) {
logger.info("payDeviceService, device_id: {}, service_pulse: {}, memo: {}", device_id, service_pulse, memo);
return new CtResponse();
}
// 경품 //////////////////////////////////////////////////////////////////
//
private static final int PRIZE_STATE_WIN = 1;
private static final int PRIZE_STATE_CANCEL = 2;
private static final String[] PRIZE_DEVICE_NAMES = {
"인형뽑기 1호기", "인형뽑기 2호기", "펀치머신", "레이싱 게임기", "농구 게임기", "메달 게임기",
};
private static final String[] PRIZE_PRICE_NAMES = {
"카드 1000", "카드 5000", "지폐 5000", "코인 1000",
};
// 조회 조건과 무관하게 같은 목록을 만들어 두고 페이징만 적용한다.
private List<Map<String, Object>> makePrizeList() {
List<Map<String, Object>> list = new ArrayList<>();
for (int i = 0; i < 23; i++) {
Map<String, Object> m = new LinkedHashMap<>();
m.put("prize_id", String.valueOf(1000 + i));
m.put("reg_time", ago(i * 37 + 5));
m.put("store_code", "0001");
m.put("machine_code", String.format("%04d", (i % 6) + 1));
m.put("device_name", PRIZE_DEVICE_NAMES[i % PRIZE_DEVICE_NAMES.length]);
m.put("exit_no", (i % 3) + 1);
m.put("price_name", PRIZE_PRICE_NAMES[i % PRIZE_PRICE_NAMES.length]);
m.put("amount", ((i % 5) + 1) * 1000);
// 5번째마다 취소 건을 섞어 상태 표시를 확인할 수 있게 한다.
m.put("state", (i % 5 == 4) ? PRIZE_STATE_CANCEL : PRIZE_STATE_WIN);
list.add(m);
}
return list;
}
public Map<String, Object> getPrizeList(Boolean is_excel, Long offset, Long limit, String device_name,
String store_code, Long state, String date_start, String date_end) {
Map<String, Object> mapResult = new HashMap<>();
List<Map<String, Object>> all = makePrizeList();
// 상태 조건만 실제로 걸러준다. (나머지 조건은 하드코딩 데이터라 무시)
if (state != null && state != 0) {
List<Map<String, Object>> filtered = new ArrayList<>();
for (Map<String, Object> m : all) {
if (((Integer)m.get("state")).longValue() == state)
filtered.add(m);
}
all = filtered;
}
long totalWin = 0, totalAmount = 0, cancelCount = 0, cancelAmount = 0;
for (Map<String, Object> m : all) {
int amount = (Integer)m.get("amount");
if ((Integer)m.get("state") == PRIZE_STATE_CANCEL) {
cancelCount++;
cancelAmount += amount;
}
else {
totalWin++;
totalAmount += amount;
}
}
Map<String, Object> sum = new LinkedHashMap<>();
sum.put("total_count", totalWin);
sum.put("total_amount", totalAmount);
sum.put("cancel_count", cancelCount);
sum.put("net_amount", totalAmount - cancelAmount);
mapResult.put("sum", sum);
// 엑셀은 페이징 없이 전체를 내린다. (기존 목록 API와 동일한 규칙)
List<Map<String, Object>> list;
if (is_excel) {
list = all;
}
else {
int from = (int)Math.min(offset == null ? 0 : offset, all.size());
int to = (int)Math.min(from + (limit == null ? 10 : limit), all.size());
list = new ArrayList<>(all.subList(from, to));
}
mapResult.put("list", list);
mapResult.put("totalCount", (long)all.size());
mapResult.put("offset", offset);
return mapResult;
}
public CtResponse cancelPrize(String prize_id) {
logger.info("cancelPrize, prize_id: {}", prize_id);
return new CtResponse();
}
// 버튼 색상 //////////////////////////////////////////////////////////////
//
private static Map<String, Object> color(String value, String label, String color) {
Map<String, Object> m = new LinkedHashMap<>();
m.put("value", value);
m.put("label", label);
m.put("color", color);
return m;
}
public Map<String, Object> getButtonColorList() {
Map<String, Object> mapResult = new HashMap<>();
List<Map<String, Object>> list = new ArrayList<>();
list.add(color("1", "빨강", "#e02b20"));
list.add(color("2", "주황", "#f79009"));
list.add(color("3", "노랑", "#eaaa08"));
list.add(color("4", "연두", "#84cc16"));
list.add(color("5", "초록", "#12b76a"));
list.add(color("6", "청록", "#06aed4"));
list.add(color("7", "파랑", "#2e90fa"));
list.add(color("8", "남색", "#465fff"));
list.add(color("9", "보라", "#7a5af8"));
list.add(color("10", "분홍", "#ee46bc"));
mapResult.put("list", list);
return mapResult;
}
public CtResponse manageButtonColor(List<Object> colors) {
logger.info("manageButtonColor, count: {}", colors == null ? 0 : colors.size());
return new CtResponse();
}
public CtResponse applyButtonColor(Long seq, Long button_color) {
logger.info("applyButtonColor, seq: {}, button_color: {}", seq, button_color);
return new CtResponse();
}
}
@@ -68,7 +68,7 @@ public class GoodsService {
public CtResponse addOrModifyGoods(boolean isModify, Long biz_group_id, Long goods_id, String code, String name, Long price, Long inventory, String vendor) {
CtResponse result = new CtResponse();
UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserInfo userInfo = UserInfo.getCurr();
if (isModify) {
if (goods_id == 0) {
@@ -120,7 +120,7 @@ public class GoodsService {
}
//
public Map<String, Object> getDeviceGoodsList(Long device_id, String slot, Long goods_id) {
public Map<String, Object> getDeviceGoodsList(Long device_id, String column_no, Long goods_id) {
Map<String, Object> mapResult = new HashMap<>();
Map<String, Object> mapDevice = deviceMapper.selectDeviceById(device_id);
@@ -129,7 +129,7 @@ public class GoodsService {
List<Map<String, Object>> listMap = (List<Map<String, Object>>)goodsMapper.selectGoodsByDevice(false, device_id);
mapResult.put("goods_list", listMap);
List<Map<String, Object>> listMap2 = (List<Map<String, Object>>)goodsMapper.selectDeviceGoods(device_id, slot, goods_id);
List<Map<String, Object>> listMap2 = (List<Map<String, Object>>)goodsMapper.selectDeviceGoods(device_id, column_no, goods_id);
mapResult.put("device_goods_list", listMap2);
if (listMap.size() > 0) {
@@ -143,7 +143,7 @@ public class GoodsService {
public CtResponse addDeviceGoods(Long device_id, List<Map<String, String>> device_goods) {
CtResponse result = new CtResponse();
UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserInfo userInfo = UserInfo.getCurr();
if (goodsMapper.insertDeviceGoods(device_id, device_goods) == 0) {
result.setErrCode(ErrorCode.QUERY_ERROR);
@@ -155,7 +155,7 @@ public class GoodsService {
public CtResponse deleteDeviceGoods(Long device_id, List<Map<String, String>> device_goods) {
CtResponse result = new CtResponse();
UserInfo userInfo = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserInfo userInfo = UserInfo.getCurr();
//for (Map<String, Object> item : device_goods) {
// item.put("device_id", device_id);
@@ -192,7 +192,7 @@ public class GoodsService {
Map<String, Object> element = new HashMap<>();
element.put("goods_template_element_id", item.get("goods_template_element_id"));
element.put("slot", item.get("slot"));
element.put("column_no", item.get("column_no"));
element.put("goods_id", item.get("goods_id"));
element.put("inventory", item.get("inventory"));
element.put("idx", item.get("idx"));
@@ -25,17 +25,23 @@ import com.handong.smartservice.mapper.GoodsMapper;
public class SalesService {
private final TransactionMapper transactionMapper;
/*
private final BizGroupMapper bizGroupMapper;
public SalesService(TransactionMapper transactionMapper, BizGroupMapper bizGroupMapper) {
this.transactionMapper = transactionMapper;
this.bizGroupMapper = bizGroupMapper;
}
*/
public SalesService(TransactionMapper transactionMapper) {
this.transactionMapper = transactionMapper;
}
public Map<String, Object> getSalesList(Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id, String date_start, String date_end,
String uid1, String device_name, Long approval_type, Long date_type) {
Boolean query_uid1, String uid1, String device_name, Long approval_type, Long date_type) {
Map<String, Object> mapResult = new HashMap<>();
/*
if (is_group_access == false) {
List<Map<String, Object>> listForTopId = bizGroupMapper.selectBizGroup(biz_group_id, false, 0L, 1L, null, null, null, null, null, null, null);
if (listForTopId != null && listForTopId.size() > 0) {
@@ -44,13 +50,18 @@ public class SalesService {
biz_group_id = (Long)listForTopId.get(0).get("biz_group_id");
}
}
*/
Map<String, Object> mapSum = (Map<String, Object>)transactionMapper.selectTransactionSum(is_group_access,
biz_group_id, date_start, date_end);
mapResult.put("sum", mapSum);
List<Map<String, Object>> listMap = (List<Map<String, Object>>)transactionMapper.selectTransaction3(false, is_excel, offset, limit, is_group_access,
biz_group_id, date_start, date_end, uid1, device_name, approval_type, date_type);
biz_group_id, date_start, date_end, query_uid1, uid1, device_name, approval_type, date_type);
mapResult.put("list", listMap);
Long totalCount = _AG.getNumberFromQuery("COUNT(*)", transactionMapper.selectTransaction3(true, is_excel, offset, limit, is_group_access,
biz_group_id, date_start, date_end, uid1, device_name, approval_type, date_type));
biz_group_id, date_start, date_end, query_uid1, uid1, device_name, approval_type, date_type));
mapResult.put("totalCount", totalCount);
mapResult.put("offset", offset);
return mapResult;
@@ -42,6 +42,15 @@ public class TerminalService {
this.bizGroupMapper = bizGroupMapper;
}
public Map<String, Object> listUid1(Long offset, Long limit, Long biz_group_id) {
Map<String, Object> mapResult = new HashMap<>();
List<Map<String, Object>> listMap = (List<Map<String, Object>>)terminalMapper.selectUid1(offset, limit, biz_group_id);
mapResult.put("list", listMap);
return mapResult;
}
public Map<String, Object> getTerminalList(Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id, Long state, String date_start, String date_end) {
Map<String, Object> mapResult = new HashMap<>();
@@ -38,7 +38,7 @@ public class TransactionService {
}
public Map<String, Object> getTransactionList(Boolean is_excel, Long offset, Long limit, Boolean is_group_access, Long biz_group_id, String date_start, String date_end,
String uid1, Long uid1_type, String type, Long amount, String approval, String pay_name, String pay_vendor, String slot, String code, String goods_name) {
String device_name, String uid1, Long uid1_type, String type, Long amount, String approval, String pay_name, String pay_vendor, String column_no, String code, String goods_name) {
Map<String, Object> mapResult = new HashMap<>();
/*
@@ -53,32 +53,32 @@ public class TransactionService {
*/
List<Map<String, Object>> listMap = (List<Map<String, Object>>)transactionMapper.selectTransaction(false, is_excel, offset, limit, is_group_access,
biz_group_id, date_start, date_end, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, code, goods_name);
biz_group_id, date_start, date_end, device_name, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, code, goods_name);
mapResult.put("list", listMap);
Long totalCount = _AG.getNumberFromQuery("COUNT(*)", transactionMapper.selectTransaction(true, is_excel, offset, limit, is_group_access,
biz_group_id, date_start, date_end, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, code, goods_name));
biz_group_id, date_start, date_end, device_name, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, code, goods_name));
mapResult.put("totalCount", totalCount);
mapResult.put("offset", offset);
return mapResult;
}
public Map<String, Object> getUndefinedTransactionList(Boolean is_excel, Long offset, Long limit, String date_start, String date_end,
String uid1, Long uid1_type, String type, Long amount, String approval, String pay_name, String pay_vendor, String slot, String code, String goods_name) {
String uid1, Long uid1_type, String type, Long amount, String approval, String pay_name, String pay_vendor, String column_no, String code, String goods_name) {
Map<String, Object> mapResult = new HashMap<>();
List<Map<String, Object>> listMap = (List<Map<String, Object>>)transactionMapper.selectTransactionBizGroup0(
false, is_excel, offset, limit, date_start, date_end, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, code, goods_name);
false, is_excel, offset, limit, date_start, date_end, null, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, code, goods_name);
mapResult.put("list", listMap);
Long totalCount = _AG.getNumberFromQuery("COUNT(*)", transactionMapper.selectTransactionBizGroup0(
true, is_excel, offset, limit, date_start, date_end, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, slot, code, goods_name));
true, is_excel, offset, limit, date_start, date_end, null, uid1, uid1_type, type, amount, approval, pay_name, pay_vendor, column_no, code, goods_name));
mapResult.put("totalCount", totalCount);
mapResult.put("offset", offset);
return mapResult;
}
public CtResponse addTransaction(String uid1, Long uid1_type, String type, Long amount, String approval, String pay_name, String pay_vendor, String slot, String pay_unique_num, String pay_order_time) {
public CtResponse addTransaction(String uid1, Long uid1_type, String type, Long amount, String approval, String pay_name, String pay_vendor, String column_no, String pay_unique_num, String pay_order_time) {
CtResponse result = new CtResponse();
Long biz_group_id = 0L;
Long device_id = 0L;
@@ -99,8 +99,8 @@ public class TransactionService {
}
}
//select uid1, uid1_type -> device_id ->device_goods (slot) -> goods_id
Map<String, Object> goods = goodsMapper.selectGoodsByUid1(uid1, uid1_type, slot);
//select uid1, uid1_type -> device_id ->device_goods (column_no) -> goods_id
Map<String, Object> goods = goodsMapper.selectGoodsByUid1(uid1, uid1_type, column_no);
if (goods != null) {
device_id = (Long)goods.get("device_id");
}
@@ -115,7 +115,7 @@ public class TransactionService {
params.put("pay_unique_num", pay_unique_num);
params.put("pay_name", pay_name);
params.put("pay_vendor", pay_vendor);
params.put("slot", slot);
params.put("column_no", column_no);
params.put("biz_group_id", biz_group_id);
params.put("device_id", device_id);
@@ -127,7 +127,7 @@ public class TransactionService {
params.put("code", goods.get("code"));
params.put("price", goods.get("price"));
goodsMapper.updateDeviceGoodsMinusInventory((Long)goods.get("device_id"), slot);
goodsMapper.updateDeviceGoodsMinusInventory((Long)goods.get("device_id"), column_no);
}
transactionMapper.insertTransaction(params);
@@ -6,37 +6,40 @@
<select id="selectAccount" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
AC.gid, AC.user_id, AC.reg_time, AC.user_pw, AC.biz_group_id, AC.user_pw_time, AC.nick_name, AC.email, AC.state, AC.permission
AC.gid, AC.user_id, AC.reg_time, AC.user_pw, AC.biz_group_id, AC.user_pw_time, AC.name, AC.phone, AC.email, AC.state, AC.permission
</otherwise>
</choose>
FROM account AS AC
WHERE state != 2
<if test="biz_group_id != 0">
<if test='biz_group_id != 0'>
AND AC.biz_group_id = #{biz_group_id}
</if>
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(AC.reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(AC.reg_time) &lt;= #{date_end}
</if>
<if test="gid != 0">
<if test='gid != 0'>
AND AC.gid = #{gid}
</if>
<if test="user_id != null and user_id != ''">
<if test='user_id != null and user_id != ""'>
AND AC.user_id = #{user_id}
</if>
<if test="email != null and email != ''">
<if test='email != null and email != ""'>
AND AC.email like CONCAT(#{email}, '%')
</if>
<if test="nick_name != null and nick_name != ''">
AND AC.nick_name like CONCAT(#{nick_name}, '%')
<if test='name != null and name != ""'>
AND AC.name like CONCAT(#{name}, '%')
</if>
<if test="isCount == false and is_excel == false">
<if test='phone != null and phone != ""'>
AND AC.phone like CONCAT(#{phone}, '%')
</if>
<if test='isCount == false and is_excel == false'>
ORDER BY gid DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -61,35 +64,38 @@
)
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
AC.gid, AC.user_id, AC.reg_time, AC.user_pw, AC.biz_group_id, GT.name AS biz_group_name, AC.user_pw_time, AC.nick_name, AC.email, AC.state, AC.permission
AC.gid, AC.user_id, AC.reg_time, AC.user_pw, AC.biz_group_id, GT.name AS biz_group_name, AC.user_pw_time, AC.name, AC.phone, AC.email, AC.state, AC.permission
</otherwise>
</choose>
FROM account AS AC
JOIN group_tree GT ON GT.biz_group_id = AC.biz_group_id
WHERE state != 2
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(AC.reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(AC.reg_time) &lt;= #{date_end}
</if>
<if test="gid != 0">
<if test='gid != 0'>
AND AC.gid = #{gid}
</if>
<if test="user_id != null and user_id != ''">
<if test='user_id != null and user_id != ""'>
AND AC.user_id = #{user_id}
</if>
<if test="email != null and email != ''">
AND AC.email like CONCAT(#{email}, '%')
<if test='email != null and email != ""'>
AND AC.email like CONCAT('%', #{email}, '%')
</if>
<if test="nick_name != null and nick_name != ''">
AND AC.nick_name like CONCAT(#{nick_name}, '%')
<if test='name != null and name != ""'>
AND AC.name like CONCAT('%', #{name}, '%')
</if>
<if test="isCount == false and is_excel == false">
<if test='phone != null and phone != ""'>
AND AC.phone like CONCAT(#{phone}, '%')
</if>
<if test='isCount == false and is_excel == false'>
ORDER BY gid DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -98,37 +104,41 @@
INSERT INTO account
<trim prefix="(" suffix=")" suffixOverrides=",">
user_id, user_pw,
<if test="nick_name != null and nick_name != ''">nick_name,</if>
<if test="email != null and email != ''">email,</if>
<if test="state != 0">state,</if>
<if test="biz_group_id != 0">biz_group_id,</if>
<if test="permission != 0">permission,</if>
<if test='name != null and name != ""'>name,</if>
<if test='phone != null and phone != ""'>phone,</if>
<if test='email != null and email != ""'>email,</if>
<if test='state != 0'>state,</if>
<if test='biz_group_id != 0'>biz_group_id,</if>
<if test='permission != 0'>permission,</if>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{user_id}, #{user_pw},
<if test="nick_name != null and nick_name != ''">#{nick_name},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="state != 0">#{state},</if>
<if test="biz_group_id != 0">#{biz_group_id},</if>
<if test="permission != 0">#{permission},</if>
<if test='name != null and name != ""'>#{name},</if>
<if test='phone != null and phone != ""'>#{phone},</if>
<if test='email != null and email != ""'>#{email},</if>
<if test='state != 0'>#{state},</if>
<if test='biz_group_id != 0'>#{biz_group_id},</if>
<if test='permission != 0'>#{permission},</if>
</trim>
</insert>
<update id="updateAccount">
UPDATE account
<set>
<if test="user_pw != null and user_pw != ''">user_pw = #{user_pw},</if>
<if test="nick_name != null and nick_name != ''">nick_name = #{nick_name},</if>
<if test="email != null and email != ''">email = #{email},</if>
<if test="state != 0">state = #{state},</if>
<if test="biz_group_id != 0">biz_group_id = #{biz_group_id},</if>
<if test='user_pw != null and user_pw != ""'>user_pw = #{user_pw},</if>
<if test='name != null and name != ""'>name = #{name},</if>
<if test='phone != null and phone != ""'>phone = #{phone},</if>
<if test='email != null and email != ""'>email = #{email},</if>
<if test='state != 0'>state = #{state},</if>
<if test='biz_group_id != 0'>biz_group_id = #{biz_group_id},</if>
<if test='permission != 0'>permission = #{permission}</if>
</set>
WHERE gid = #{gid}
</update>
<update id="changeState">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
UPDATE account
SET state=#{state}
WHERE gid IN
@@ -6,7 +6,7 @@
<select id="selectBizGroup" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
@@ -15,31 +15,28 @@
</choose>
FROM biz_group AS BG
WHERE state != 2
<if test="name != null and name != ''">
AND name like CONCAT(#{name}, '%')
</if>
<if test="biz_group_id != 0">
<if test='biz_group_id != 0'>
AND biz_group_id = #{biz_group_id}
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(reg_time) &lt;= #{date_end}
</if>
<if test="name != null and name != ''">
AND name like CONCAT(#{name}, '%')
<if test='name != null and name != ""'>
AND name like CONCAT('%', #{name}, '%')
</if>
<if test="biz_reg_num != null and biz_reg_num != ''">
AND biz_reg_num like CONCAT(#{biz_reg_num}, '%')
<if test='biz_reg_num != null and biz_reg_num != ""'>
AND biz_reg_num like CONCAT('%', #{biz_reg_num}, '%')
</if>
<if test="email != null and email != ''">
AND email like CONCAT(#{email}, '%')
<if test='email != null and email != ""'>
AND email like CONCAT('%', #{email}, '%')
</if>
<if test="phone != null and phone != ''">
AND phone like CONCAT(#{phone}, '%')
<if test='phone != null and phone != ""'>
AND phone like CONCAT('%', #{phone}, '%')
</if>
<if test="address != null and address != ''">
AND address like CONCAT(#{address}, '%')
<if test='address != null and address != ""'>
AND address like CONCAT('%', #{address}, '%')
</if>
<if test="isCount == false">
<if test='isCount == false'>
ORDER BY biz_group_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -48,7 +45,7 @@
SELECT biz_group_id
FROM biz_group
WHERE state != 2 AND biz_reg_num = #{biz_reg_num}
<if test="biz_group_id != 0">
<if test='biz_group_id != 0'>
AND biz_group_id != #{biz_group_id}
</if>
LIMIT 1
@@ -77,38 +74,38 @@
<insert id="insertBizGroup" parameterType="map" useGeneratedKeys="true" keyProperty="biz_group_id">
INSERT INTO biz_group
<choose>
<when test="pid == 0">
<when test='pid == 0'>
<trim prefix="(" suffix=")" suffixOverrides=",">
name, biz_reg_num, gid
<if test="email != null and email != ''">, email</if>
<if test="phone != null and phone != ''">, phone</if>
<if test="ceo != null and ceo != ''">, ceo</if>
<if test="address != null and address != ''">, address</if>
<if test='email != null and email != ""'>, email</if>
<if test='phone != null and phone != ""'>, phone</if>
<if test='ceo != null and ceo != ""'>, ceo</if>
<if test='address != null and address != ""'>, address</if>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{name}, #{biz_reg_num}, #{gid}
<if test="email != null and email != ''">, #{email}</if>
<if test="phone != null and phone != ''">, #{phone}</if>
<if test="ceo != null and ceo != ''">, #{ceo}</if>
<if test="address != null and address != ''">, #{address}</if>
<if test='email != null and email != ""'>, #{email}</if>
<if test='phone != null and phone != ""'>, #{phone}</if>
<if test='ceo != null and ceo != ""'>, #{ceo}</if>
<if test='address != null and address != ""'>, #{address}</if>
</trim>
</when>
<otherwise>
<trim prefix="(" suffix=")" suffixOverrides=",">
top_group_id, pid, name, biz_reg_num, gid
<if test="email != null and email != ''">, email</if>
<if test="phone != null and phone != ''">, phone</if>
<if test="ceo != null and ceo != ''">, ceo</if>
<if test="address != null and address != ''">, address</if>
<if test='email != null and email != ""'>, email</if>
<if test='phone != null and phone != ""'>, phone</if>
<if test='ceo != null and ceo != ""'>, ceo</if>
<if test='address != null and address != ""'>, address</if>
</trim>
SELECT
COALESCE(TGI.top_group_id, #{pid}) AS top_group_id,
#{pid}, #{name}, #{biz_reg_num}, #{gid}
<if test="email != null and email != ''">, #{email}</if>
<if test="phone != null and phone != ''">, #{phone}</if>
<if test="ceo != null and ceo != ''">, #{ceo}</if>
<if test="address != null and address != ''">, #{address}</if>
<if test='email != null and email != ""'>, #{email}</if>
<if test='phone != null and phone != ""'>, #{phone}</if>
<if test='ceo != null and ceo != ""'>, #{ceo}</if>
<if test='address != null and address != ""'>, #{address}</if>
FROM (
SELECT top_group_id
FROM biz_group
@@ -122,19 +119,19 @@
<update id="updateBizGroup">
UPDATE biz_group
<set>
<if test="name != null and name != ''">name = #{name},</if>
<if test="biz_reg_num != null and biz_reg_num != ''">biz_reg_num = #{biz_reg_num},</if>
<if test="email != null and email != ''">email = #{email},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="ceo != null and ceo != ''">ceo = #{ceo},</if>
<if test="address != null and address != ''">address = #{address},</if>
<if test="pid != 0">pid = #{pid},</if>
<if test='name != null and name != ""'>name = #{name},</if>
<if test='biz_reg_num != null and biz_reg_num != ""'>biz_reg_num = #{biz_reg_num},</if>
<if test='email != null and email != ""'>email = #{email},</if>
<if test='phone != null and phone != ""'>phone = #{phone},</if>
<if test='ceo != null and ceo != ""'>ceo = #{ceo},</if>
<if test='address != null and address != ""'>address = #{address},</if>
<if test='pid != 0'>pid = #{pid},</if>
</set>
WHERE biz_group_id = #{biz_group_id}
</update>
<update id="changeStateBizGroup">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
UPDATE biz_group
SET state = #{state}
WHERE biz_group_id IN
@@ -145,7 +142,7 @@
</update>
<!--
<delete id="deleteBizGroup">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
DELETE FROM biz_group
WHERE biz_group_id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -158,7 +155,7 @@
<update id="changePidBizGroup">
UPDATE biz_group
<choose>
<when test="new_pid != null">
<when test='new_pid != null'>
SET pid = #{new_pid}
</when>
<otherwise>
@@ -172,7 +169,7 @@
</update>
<update id="changeState">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
UPDATE biz_group
SET state = #{state}
WHERE biz_group_id IN
@@ -235,27 +232,27 @@
) AS hasChildren
FROM biz_group BG
WHERE BG.state != 2 AND BG.pid is null
<if test="top_group_id != 0">
<if test='top_group_id != 0'>
AND (BG.biz_group_id = #{top_group_id} OR BG.top_group_id = #{top_group_id})
</if>
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(BG.reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(BG.reg_time) &lt;= #{date_end}
</if>
<if test="name != null and name != ''">
AND BG.name like CONCAT(#{name}, '%')
<if test='name != null and name != ""'>
AND BG.name like CONCAT('%', #{name}, '%')
</if>
<if test="biz_reg_num != null and biz_reg_num != ''">
AND BG.biz_reg_num like CONCAT(#{biz_reg_num}, '%')
<if test='biz_reg_num != null and biz_reg_num != ""'>
AND BG.biz_reg_num like CONCAT('%', #{biz_reg_num}, '%')
</if>
</select>
<select id="selectBizGroupChildTree" resultType="map">
SELECT
<choose>
<when test="queryAll == true">
<when test='queryAll == true'>
BG.biz_group_id, BG.top_group_id, BG.reg_time, BG.name, BG.biz_reg_num, BG.email, BG.phone, BG.ceo, BG.address,
</when>
<otherwise>
@@ -270,20 +267,20 @@
) AS hasChildren
FROM biz_group BG
WHERE BG.state != 2 AND BG.pid = #{pid}
<if test="top_group_id != 0">
<if test='top_group_id != 0'>
AND BG.top_group_id = #{top_group_id}
</if>
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(BG.reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(BG.reg_time) &lt;= #{date_end}
</if>
<if test="name != null and name != ''">
AND BG.name like CONCAT(#{name}, '%')
<if test='name != null and name != ""'>
AND BG.name like CONCAT('%', #{name}, '%')
</if>
<if test="biz_reg_num != null and biz_reg_num != ''">
AND BG.biz_reg_num like CONCAT(#{biz_reg_num}, '%')
<if test='biz_reg_num != null and biz_reg_num != ""'>
AND BG.biz_reg_num like CONCAT('%', #{biz_reg_num}, '%')
</if>
</select>
@@ -291,7 +288,7 @@
WITH RECURSIVE group_tree AS (
SELECT
<choose>
<when test="queryAll == true">
<when test='queryAll == true'>
BG.biz_group_id, BG.pid, BG.top_group_id, BG.reg_time, BG.name, BG.biz_reg_num, BG.email, BG.phone, BG.ceo, BG.address,
</when>
<otherwise>
@@ -306,24 +303,24 @@
) AS hasChildren
FROM biz_group BG
WHERE BG.state != 2
<if test="biz_group_id != 0">
<if test='biz_group_id != 0'>
AND BG.biz_group_id = #{biz_group_id}
</if>
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(BG.reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(BG.reg_time) &lt;= #{date_end}
</if>
<if test="name != null and name != ''">
AND BG.name like CONCAT(#{name}, '%')
<if test='name != null and name != ""'>
AND BG.name like CONCAT('%', #{name}, '%')
</if>
<if test="biz_reg_num != null and biz_reg_num != ''">
AND BG.biz_reg_num like CONCAT(#{biz_reg_num}, '%')
<if test='biz_reg_num != null and biz_reg_num != ""'>
AND BG.biz_reg_num like CONCAT('%', #{biz_reg_num}, '%')
</if>
<choose>
<when test="biz_group_id != 0">
<when test='biz_group_id != 0'>
UNION ALL
</when>
<otherwise>
@@ -333,7 +330,7 @@
SELECT
<choose>
<when test="queryAll == true">
<when test='queryAll == true'>
BG.biz_group_id, BG.pid, BG.top_group_id, BG.reg_time, BG.name, BG.biz_reg_num, BG.email, BG.phone, BG.ceo, BG.address,
</when>
<otherwise>
@@ -7,7 +7,7 @@
<select id="selectDevice" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
@@ -19,26 +19,26 @@
JOIN biz_group AS BG ON BG.biz_group_id = DBG.biz_group_id
LEFT JOIN terminal AS T ON T.device_id = D.device_id
WHERE D.state != 2 AND ( BG.biz_group_id = #{biz_group_id}
<if test="is_group_access == false">
<if test='is_group_access == false'>
OR BG.top_group_id = #{biz_group_id}
</if>
)
<if test="name != null and name != ''">
<if test='name != null and name != ""'>
AND D.name = #{name}
</if>
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(D.reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(D.reg_time) &lt;= #{date_end}
</if>
<if test="isCount == false and is_excel == false">
<if test='isCount == false and is_excel == false'>
ORDER BY D.device_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
-->
<select id="selectDevice" resultType="map">
<if test="is_group_access == false">
<if test='is_group_access == false'>
WITH target_group AS (
WITH RECURSIVE group_tree AS (
SELECT
@@ -62,7 +62,7 @@
</if>
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
@@ -75,23 +75,32 @@
LEFT JOIN terminal AS T ON T.device_id = D.device_id
WHERE D.state != 2 AND
<choose>
<when test="is_group_access == false">
<when test='is_group_access == false'>
DBG.biz_group_id IN ( SELECT biz_group_id FROM target_group )
</when>
<otherwise>
DBG.biz_group_id = #{biz_group_id}
</otherwise>
</choose>
<if test="name != null and name != ''">
AND D.name = #{name}
<if test='name != null and name != ""'>
AND D.name like CONCAT('%', #{name}, '%')
</if>
<if test="date_start != null and date_start != ''">
<if test='uid1 != null and uid1 != ""'>
AND T.uid1 = #{uid1}
</if>
<if test='conn_state != null and conn_state == "1"'>
AND T.connect_time IS NOT NULL AND T.disconnect_time IS NOT NULL AND T.connect_time &lt;= T.disconnect_time
</if>
<if test='conn_state != null and conn_state == "4"'>
AND T.connect_time IS NOT NULL AND T.disconnect_time IS NOT NULL AND T.connect_time &gt; T.disconnect_time
</if>
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(D.reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(D.reg_time) &lt;= #{date_end}
</if>
<if test="isCount == false and is_excel == false">
<if test='isCount == false and is_excel == false'>
ORDER BY D.device_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -116,7 +125,7 @@
)
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
@@ -128,16 +137,25 @@
JOIN group_tree GT ON DBG.biz_group_id = GT.biz_group_id
LEFT JOIN terminal AS T ON T.device_id = D.device_id
WHERE D.state != 2
<if test="name != null and name != ''">
AND D.name = #{name}
<if test='name != null and name != ""'>
AND D.name like CONCAT('%', #{name}, '%')
</if>
<if test="date_start != null and date_start != ''">
<if test='uid1 != null and uid1 != ""'>
AND T.uid1 = #{uid1}
</if>
<if test='conn_state != null and conn_state == "1"'>
AND T.connect_time IS NOT NULL AND T.disconnect_time IS NOT NULL AND T.connect_time &gt;= T.disconnect_time
</if>
<if test='conn_state != null and conn_state == "4"'>
AND T.connect_time IS NOT NULL AND T.disconnect_time IS NOT NULL AND T.connect_time &lt; T.disconnect_time
</if>
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(D.reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(D.reg_time) &lt;= #{date_end}
</if>
<if test="isCount == false and is_excel == false">
<if test='isCount == false and is_excel == false'>
ORDER BY D.device_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -185,38 +203,35 @@
device_id, name, uid1
FROM device
WHERE state != 2
<if test="device_id != 0">
<if test='device_id != 0'>
AND device_id != #{device_id}
</if>
<if test="name != null and name != ''">
<if test='name != null and name != ""'>
AND name = #{name}
</if>
LIMIT 1
</select>
<insert id="insertDevice"
parameterType="map"
useGeneratedKeys="true"
keyProperty="device_id">
<insert id="insertDevice" parameterType="map" useGeneratedKeys="true" keyProperty="device_id">
INSERT INTO device
<trim prefix="(" suffix=")" suffixOverrides=",">
name, gid, state,
<if test="manager_name != null and manager_name != ''">manager_name,</if>
<if test='manager_name != null and manager_name != ""'>manager_name,</if>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{name}, #{gid}, #{state},
<if test="manager_name != null and manager_name != ''">#{manager_name},</if>
<if test='manager_name != null and manager_name != ""'>#{manager_name},</if>
</trim>
</insert>
<update id="updateDevice">
UPDATE device
<set>
<if test="name != null and name != ''">name = #{name},</if>
<if test="uid1 != null and uid1 != ''">uid1 = #{uid1},</if>
<if test="manager_name != null and manager_name != ''">manager_name = #{manager_name},</if>
<if test="gid != null and gid != ''">gid = #{gid},</if>
<if test='name != null and name != ""'>name = #{name},</if>
<if test='uid1 != null and uid1 != ""'>uid1 = #{uid1},</if>
<if test='manager_name != null and manager_name != ""'>manager_name = #{manager_name},</if>
<if test='gid != null and gid != ""'>gid = #{gid},</if>
</set>
WHERE device_id = #{device_id}
</update>
@@ -232,7 +247,7 @@
</update>
<update id="changeStateDevice">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
UPDATE device
SET state = #{state}
WHERE device_id IN
@@ -244,7 +259,7 @@
<delete id="deleteDevice">
<!--
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
DELETE FROM device
WHERE device_id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -6,32 +6,32 @@
<select id="selectErrorHistory" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
EH.error_history_id, EH.reg_time, EH.uid1, EH.uid1_type, EH.slot
EH.error_history_id, EH.reg_time, EH.uid1, EH.uid1_type, EH.column_no
</otherwise>
</choose>
FROM error_history EH
WHERE 1=1
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(EH.reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(EH.reg_time) &lt;= #{date_end}
</if>
<if test="uid1 != null and uid1 != ''">
AND EH.uid1 like CONCAT('%', #{uid1}, '%')
<if test='uid1 != null and uid1 != ""'>
AND EH.uid1 = #{uid1}
</if>
<if test="isCount == false and is_excel == false">
<if test='isCount == false and is_excel == false'>
ORDER BY EH.error_history_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
<select id="selectErrorHistoryByState" resultType="map">
SELECT
EH.error_history_id, EH.reg_time, EH.uid1, EH.uid1_type, EH.slot
EH.error_history_id, EH.reg_time, EH.uid1, EH.uid1_type, EH.column_no
FROM error_history EH
WHERE EH.state = #{state}
</select>
@@ -39,11 +39,11 @@
<insert id="insertErrorHistory">
INSERT INTO error_history
<trim prefix="(" suffix=")" suffixOverrides=",">
uid1, uid1_type, slot,
uid1, uid1_type, column_no,
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{uid1}, #{uid1_type}, #{slot},
#{uid1}, #{uid1_type}, #{column_no},
</trim>
</insert>
@@ -6,7 +6,7 @@
<select id="selectGoods" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
@@ -16,29 +16,29 @@
FROM goods AS G
JOIN biz_group AS BG ON BG.biz_group_id = G.biz_group_id
WHERE G.state != 2 AND ( BG.biz_group_id = #{biz_group_id}
<if test="is_group_access == false">
<if test='is_group_access == false'>
OR BG.top_group_id = #{biz_group_id}
</if>
)
<if test="code != null and code != ''">
<if test='code != null and code != ""'>
AND G.code = #{code}
</if>
<if test="name != null and name != ''">
AND G.name = #{name}
<if test='name != null and name != ""'>
AND G.name like CONCAT('%', #{name}, '%')
</if>
<if test="state != 0">
<if test='state != 0'>
AND G.state = #{state}
</if>
<if test="vendor != null and vendor != ''">
<if test='vendor != null and vendor != ""'>
AND G.vendor = #{vendor}
</if>
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(G.reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(G.reg_time) &lt;= #{date_end}
</if>
<if test="isCount == false and is_excel == false">
<if test='isCount == false and is_excel == false'>
ORDER BY G.goods_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -74,7 +74,7 @@
ON BG.biz_group_id = G.biz_group_id
WHERE G.state != 2 AND (
BG.biz_group_id = (SELECT biz_group_id FROM target_group)
<if test="is_group_access == false">
<if test='is_group_access == false'>
OR BG.top_group_id = (SELECT biz_group_id FROM target_group)
</if>
)
@@ -117,14 +117,14 @@
SELECT goods_id
FROM goods
WHERE 1=1
<if test="biz_group_id != 0">
<if test='biz_group_id != 0'>
AND biz_group_id = #{biz_group_id}
</if>
AND ( false
<if test="code != null and code != ''">
<if test='code != null and code != ""'>
OR code = #{code}
</if>
<if test="name != null and name != ''">
<if test='name != null and name != ""'>
OR name = #{name}
</if>
)
@@ -145,7 +145,7 @@
G.vendor,
G.opt,
DG.device_id,
DG.slot,
DG.column_no,
DG.price AS device_goods_price,
DG.inventory AS device_goods_inventory
FROM terminal AS T
@@ -154,7 +154,7 @@
JOIN goods AS G ON G.goods_id = DG.goods_id
WHERE T.uid1 = #{uid1}
AND T.type = #{uid1_type}
AND DG.slot = #{slot}
AND DG.column_no = #{column_no}
AND T.state != 2
AND D.state != 2
AND G.state != 2
@@ -165,30 +165,30 @@
INSERT INTO goods
<trim prefix="(" suffix=")" suffixOverrides=",">
biz_group_id, code, name, price, inventory, gid,
<if test="vendor != null and vendor != ''">vendor,</if>
<if test='vendor != null and vendor != ""'>vendor,</if>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{biz_group_id}, #{code}, #{name}, #{price}, #{inventory}, #{gid},
<if test="vendor != null and vendor != ''">#{vendor},</if>
<if test='vendor != null and vendor != ""'>#{vendor},</if>
</trim>
</insert>
<update id="updateGoods">
UPDATE goods
<set>
<if test="code != null and code != ''">code = #{code},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="price != null">price = #{price},</if>
<if test="inventory != null">inventory = #{inventory},</if>
<if test="vendor != null and vendor != ''">vendor = #{vendor},</if>
<if test="gid != 0">gid = #{gid},</if>
<if test='code != null and code != ""'>code = #{code},</if>
<if test='name != null and name != ""'>name = #{name},</if>
<if test='price != null'>price = #{price},</if>
<if test='inventory != null'>inventory = #{inventory},</if>
<if test='vendor != null and vendor != ""'>vendor = #{vendor},</if>
<if test='gid != 0'>gid = #{gid},</if>
</set>
WHERE goods_id = #{goods_id}
</update>
<delete id="deleteGoods">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
DELETE FROM goods
WHERE goods_id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -199,21 +199,21 @@
<select id="selectDeviceGoods" resultType="map">
SELECT
DG.device_id, DG.slot, G.goods_id, DG.idx, DG.inventory, G.reg_time, G.name, G.code, G.price, G.vendor, G.state, DG.inventory_max, DG.inventory_alarm
DG.device_id, DG.column_no, G.goods_id, DG.idx, DG.inventory, G.reg_time, G.name, G.code, G.price, G.vendor, G.state, DG.inventory_max, DG.inventory_alarm
FROM goods AS G
JOIN device_goods AS DG ON DG.goods_id = G.goods_id
WHERE G.state != 2 AND DG.device_id = #{device_id}
ORDER BY DG.slot ASC
ORDER BY DG.column_no ASC
</select>
<insert id="insertDeviceGoods">
<if test="device_goods != null and device_goods.size > 0">
<if test='device_goods != null and device_goods.size > 0'>
INSERT INTO device_goods (
device_id, slot, goods_id, price, inventory, idx, inventory_max, inventory_alarm
device_id, column_no, goods_id, price, inventory, idx, inventory_max, inventory_alarm
) VALUES
<foreach collection="device_goods" item="item" separator=",">
(
#{device_id}, #{item.slot}, #{item.goods_id}, #{item.price}, #{item.inventory}, #{item.idx}, #{item.inventory_max}, #{item.inventory_alarm}
#{device_id}, #{item.column_no}, #{item.goods_id}, #{item.price}, #{item.inventory}, #{item.idx}, #{item.inventory_max}, #{item.inventory_alarm}
)
</foreach>
</if>
@@ -223,7 +223,7 @@
UPDATE device_goods dg
JOIN transactions t
ON dg.device_id = t.device_id
AND dg.slot = t.slot
AND dg.column_no = t.column_no
SET dg.inventory = dg.inventory + 1
WHERE t.approval = #{approval}
</update>
@@ -233,16 +233,16 @@
<set>
inventory = inventory - 1
</set>
WHERE device_id = #{device_id} AND slot = #{slot}
WHERE device_id = #{device_id} AND column_no = #{column_no}
</update>
<update id="updateDeviceGoodsInventory">
<choose>
<when test="type == 'D4'">
<when test='type == "D4"'>
UPDATE device_goods dg
JOIN transactions t
ON dg.device_id = t.device_id
AND dg.slot = t.slot
AND dg.column_no = t.column_no
SET dg.inventory = dg.inventory + 1
WHERE t.approval = #{approval}
</when>
@@ -251,17 +251,17 @@
<set>
inventory = inventory - 1
</set>
WHERE device_id = #{device_id} AND slot = #{slot}
WHERE device_id = #{device_id} AND column_no = #{column_no}
</otherwise>
</choose>
</update>
<delete id="deleteDeviceGoods">
<if test="device_goods != null and device_goods.size > 0">
<if test='device_goods != null and device_goods.size > 0'>
DELETE FROM device_goods
WHERE device_id = #{device_id} AND slot IN
WHERE device_id = #{device_id} AND column_no IN
<foreach collection="device_goods" item="item" open="(" separator="," close=")">
#{item.slot}
#{item.column_no}
</foreach>
</if>
</delete>
@@ -269,7 +269,7 @@
<select id="selectGoodsTemplateByBizGroupId" resultType="map">
SELECT
GTE.goods_template_element_id,
GTE.slot,
GTE.column_no,
GTE.goods_id,
GTE.inventory,
GTE.inventory_max,
@@ -291,7 +291,7 @@
<select id="selectGoodsTemplateById" resultType="map">
SELECT
GTE.goods_template_element_id,
GTE.slot,
GTE.column_no,
GTE.goods_id,
GTE.inventory,
GTE.inventory_max,
@@ -326,13 +326,13 @@
</insert>
<insert id="insertGoodsTemplateElements">
<if test="goods_template_elements != null and goods_template_elements.size > 0">
<if test='goods_template_elements != null and goods_template_elements.size > 0'>
INSERT INTO goods_template_element (
slot, goods_id, inventory, goods_template_id,idx,inventory_max,inventory_alarm
column_no, goods_id, inventory, goods_template_id,idx,inventory_max,inventory_alarm
) VALUES
<foreach collection="goods_template_elements" item="item" separator=",">
(
#{item.slot}, #{item.goods_id}, #{item.inventory}, #{goods_template_id}, #{item.idx}, #{item.inventory_max}, #{item.inventory_alarm}
#{item.column_no}, #{item.goods_id}, #{item.inventory}, #{goods_template_id}, #{item.idx}, #{item.inventory_max}, #{item.inventory_alarm}
)
</foreach>
</if>
@@ -341,7 +341,7 @@
<update id="updateGoodsTemplate">
UPDATE goods_template
<set>
<if test="name != null and name != ''">name = #{name},</if>
<if test='name != null and name != ""'>name = #{name},</if>
</set>
WHERE goods_template_id = #{goods_template_id}
</update>
@@ -6,7 +6,7 @@
<select id="selectLocation" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
@@ -15,22 +15,22 @@
</choose>
FROM location AS BG
WHERE state != 2
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(reg_time) &lt;= #{date_end}
</if>
<if test="name != null and name != ''">
AND name like CONCAT(#{name}, '%')
<if test='name != null and name != ""'>
AND name like CONCAT('%', #{name}, '%')
</if>
<if test="description != null and description != ''">
AND description like CONCAT(#{description}, '%')
<if test='description != null and description != ""'>
AND description like CONCAT('%', #{description}, '%')
</if>
<if test="address != null and address != ''">
AND address like CONCAT(#{address}, '%')
<if test='address != null and address != ""'>
AND address like CONCAT('%', #{address}, '%')
</if>
<if test="isCount == false">
<if test='isCount == false'>
ORDER BY location_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -49,32 +49,32 @@
INSERT INTO location
<trim prefix="(" suffix=")" suffixOverrides=",">
name, gid,
<if test="description != null and description != ''">description,</if>
<if test="address != null and address != ''">address,</if>
<if test="pid != 0">pid,</if>
<if test='description != null and description != ""'>description,</if>
<if test='address != null and address != ""'>address,</if>
<if test='pid != 0'>pid,</if>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{name}, #{gid},
<if test="description != null and description != ''">#{description},</if>
<if test="address != null and address != ''">#{address},</if>
<if test="pid != 0">#{pid},</if>
<if test='description != null and description != ""'>#{description},</if>
<if test='address != null and address != ""'>#{address},</if>
<if test='pid != 0'>#{pid},</if>
</trim>
</insert>
<update id="updateLocation">
UPDATE location
<set>
<if test="name != null and name != ''">name = #{name},</if>
<if test="description != null and description != ''">description = #{description},</if>
<if test="address != null and address != ''">address = #{address},</if>
<if test="pid != 0">pid = #{pid},</if>
<if test='name != null and name != ""'>name = #{name},</if>
<if test='description != null and description != ""'>description = #{description},</if>
<if test='address != null and address != ""'>address = #{address},</if>
<if test='pid != 0'>pid = #{pid},</if>
</set>
WHERE location_id = #{location_id}
</update>
<update id="changeStateLocation">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
UPDATE location
SET state = #{state}
WHERE location_id IN
@@ -87,7 +87,7 @@
<update id="changePidLocation">
UPDATE location
<choose>
<when test="new_pid != null">
<when test='new_pid != null'>
SET pid = #{new_pid}
</when>
<otherwise>
@@ -101,7 +101,7 @@
</update>
<update id="changeState">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
UPDATE location
SET state=#{state}
WHERE location_id IN
@@ -160,22 +160,22 @@
SELECT location_id, reg_time, name, description, address
FROM location
WHERE state != 2
<if test="(name == null || name == '') and (description == null || description == '')">
<if test='(name == null || name == "") and (description == null || description == "")'>
AND pid is null
</if>
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(reg_time) &lt;= #{date_end}
</if>
<if test="name != null and name != ''">
<if test='name != null and name != ""'>
AND name like CONCAT(#{name}, '%')
</if>
<if test="description != null and description != ''">
<if test='description != null and description != ""'>
AND description like CONCAT(#{description}, '%')
</if>
<if test="address != null and address != ''">
<if test='address != null and address != ""'>
AND address like CONCAT(#{address}, '%')
</if>
</select>
@@ -183,7 +183,7 @@
<select id="selectLocationChildTree" resultType="map">
SELECT
<choose>
<when test="queryAll == true">
<when test='queryAll == true'>
location_id, reg_time, name, description, address
</when>
<otherwise>
@@ -192,19 +192,19 @@
</choose>
FROM location
WHERE state != 2 AND pid = #{pid}
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(reg_time) &lt;= #{date_end}
</if>
<if test="name != null and name != ''">
<if test='name != null and name != ""'>
AND name like CONCAT(#{name}, '%')
</if>
<if test="description != null and description != ''">
<if test='description != null and description != ""'>
AND description like CONCAT(#{description}, '%')
</if>
<if test="address != null and address != ''">
<if test='address != null and address != ""'>
AND address like CONCAT(#{address}, '%')
</if>
</select>
@@ -12,7 +12,7 @@
<select id="selectNotice" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
@@ -21,19 +21,19 @@
</choose>
FROM notice AS RB
WHERE state != 2
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(reg_time) &lt;= #{date_end}
</if>
<if test="title != null and title != ''">
<if test='title != null and title != ""'>
AND title like CONCAT(#{title}, '%')
</if>
<if test="content != null and content != ''">
<if test='content != null and content != ""'>
AND content like CONCAT(#{content}, '%')
</if>
<if test="isCount == false">
<if test='isCount == false'>
ORDER BY notice_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -52,14 +52,14 @@
<update id="updateNotice">
UPDATE notice
<set>
<if test="title != null and title != ''">title = #{title},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test='title != null and title != ""'>title = #{title},</if>
<if test='content != null and content != ""'>content = #{content},</if>
</set>
WHERE notice_id = #{notice_id}
</update>
<update id="changeStateNotice">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
UPDATE notice
SET state = #{state}
WHERE notice_id IN
@@ -70,7 +70,7 @@
</update>
<!--
<delete id="deleteNotice">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
DELETE FROM resource_board
WHERE resource_board_id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -6,26 +6,26 @@
<select id="selectOperatingHistory" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
OH.operating_history_id, OH.reg_time, OH.type, OH.action, A.gid, A.user_id, A.nick_name
OH.operating_history_id, OH.reg_time, OH.type, OH.action, A.gid, A.user_id, A.name
</otherwise>
</choose>
FROM operating_history OH
JOIN account A ON A.gid = OH.gid
WHERE 1=1
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(OH.reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(OH.reg_time) &lt;= #{date_end}
</if>
<if test="action != null and action != ''">
<if test='action != null and action != ""'>
AND OH.action like CONCAT('%', #{action}, '%')
</if>
<if test="isCount == false and is_excel == false">
<if test='isCount == false and is_excel == false'>
ORDER BY OH.operating_history_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -6,24 +6,24 @@
<sql id="ordersWhere">
<where>
AND o.state != 2
<if test="param.order_id != null and param.order_id != ''">
<if test='param.order_id != null and param.order_id != ""'>
AND o.order_id = #{param.order_id}
</if>
<if test="param.biz_group_name != null and param.biz_group_name != ''">
<if test='param.biz_group_name != null and param.biz_group_name != ""'>
AND b.name LIKE CONCAT('%', #{param.biz_group_name}, '%')
</if>
<if test="param.name != null and param.name != ''">
<if test='param.name != null and param.name != ""'>
AND CONCAT(a.last_name, a.first_name)
LIKE CONCAT('%', #{param.name}, '%')
</if>
<if test="param.date_start != null and param.date_start != ''">
<if test='param.date_start != null and param.date_start != ""'>
AND o.reg_time &gt;= #{param.date_start}
</if>
<if test="param.date_end != null and param.date_end != ''">
<if test='param.date_end != null and param.date_end != ""'>
AND o.reg_time &lt;= #{param.date_end}
</if>
</where>
@@ -31,7 +31,7 @@
<select id="selectOrders" parameterType="map" resultType="map">
<choose>
<when test="isCount == true">
<when test='isCount == true'>
SELECT
o.*,
CONCAT(a.last_name, a.first_name) AS submitter,
@@ -60,69 +60,69 @@
INSERT INTO orders
<trim prefix="(" suffix=")" suffixOverrides=",">
biz_group_id,
<if test="state != null and state != ''">state,</if>
<if test="is_doc_accept != null">is_doc_accept,</if>
<if test="is_tid != null">is_tid,</if>
<if test="is_card != null">is_card,</if>
<if test="is_samchip != null">is_samchip,</if>
<if test="is_comm_open != null">is_comm_open,</if>
<if test="is_shipping != null">is_shipping,</if>
<if test="is_tested != null">is_tested,</if>
<if test="is_parcel != null">is_parcel,</if>
<if test="order_time != null and order_time != ''">order_time,</if>
<if test="goods_list_id != null and goods_list_id != ''">goods_list_id,</if>
<if test="delivery_address != null and delivery_address != ''">delivery_address,</if>
<if test="delivery_recv_name != null and delivery_recv_name != ''">delivery_recv_name,</if>
<if test="delivery_recv_phone != null and delivery_recv_phone != ''">delivery_recv_phone,</if>
<if test="delivery_invoice_no != null and delivery_invoice_no != ''">delivery_invoice_no,</if>
<if test="delivery_company != null and delivery_company != ''">delivery_company,</if>
<if test="delivery_req_time != null and delivery_req_time != ''">delivery_req_time,</if>
<if test="gid != null and gid != ''">gid</if>
<if test='state != null and state != ""'>state,</if>
<if test='is_doc_accept != null'>is_doc_accept,</if>
<if test='is_tid != null'>is_tid,</if>
<if test='is_card != null'>is_card,</if>
<if test='is_samchip != null'>is_samchip,</if>
<if test='is_comm_open != null'>is_comm_open,</if>
<if test='is_shipping != null'>is_shipping,</if>
<if test='is_tested != null'>is_tested,</if>
<if test='is_parcel != null'>is_parcel,</if>
<if test='order_time != null and order_time != ""'>order_time,</if>
<if test='goods_list_id != null and goods_list_id != ""'>goods_list_id,</if>
<if test='delivery_address != null and delivery_address != ""'>delivery_address,</if>
<if test='delivery_recv_name != null and delivery_recv_name != ""'>delivery_recv_name,</if>
<if test='delivery_recv_phone != null and delivery_recv_phone != ""'>delivery_recv_phone,</if>
<if test='delivery_invoice_no != null and delivery_invoice_no != ""'>delivery_invoice_no,</if>
<if test='delivery_company != null and delivery_company != ""'>delivery_company,</if>
<if test='delivery_req_time != null and delivery_req_time != ""'>delivery_req_time,</if>
<if test='gid != null and gid != ""'>gid</if>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{biz_group_id},
<if test="state != null and state != ''">#{state},</if>
<if test="is_doc_accept != null">#{is_doc_accept},</if>
<if test="is_tid != null">#{is_tid},</if>
<if test="is_card != null">#{is_card},</if>
<if test="is_samchip != null">#{is_samchip},</if>
<if test="is_comm_open != null">#{is_comm_open},</if>
<if test="is_shipping != null">#{is_shipping},</if>
<if test="is_tested != null">#{is_tested},</if>
<if test="is_parcel != null">#{is_parcel},</if>
<if test="order_time != null and order_time != ''">#{order_time},</if>
<if test="goods_list_id != null and goods_list_id != ''">#{goods_list_id},</if>
<if test="delivery_address != null and delivery_address != ''">#{delivery_address},</if>
<if test="delivery_recv_name != null and delivery_recv_name != ''">#{delivery_recv_name},</if>
<if test="delivery_recv_phone != null and delivery_recv_phone != ''">#{delivery_recv_phone},</if>
<if test="delivery_invoice_no != null and delivery_invoice_no != ''">#{delivery_invoice_no},</if>
<if test="delivery_company != null and delivery_company != ''">#{delivery_company},</if>
<if test="delivery_req_time != null and delivery_req_time != ''">#{delivery_req_time},</if>
<if test="gid != null and gid != ''">#{gid}</if>
<if test='state != null and state != ""'>#{state},</if>
<if test='is_doc_accept != null'>#{is_doc_accept},</if>
<if test='is_tid != null'>#{is_tid},</if>
<if test='is_card != null'>#{is_card},</if>
<if test='is_samchip != null'>#{is_samchip},</if>
<if test='is_comm_open != null'>#{is_comm_open},</if>
<if test='is_shipping != null'>#{is_shipping},</if>
<if test='is_tested != null'>#{is_tested},</if>
<if test='is_parcel != null'>#{is_parcel},</if>
<if test='order_time != null and order_time != ""'>#{order_time},</if>
<if test='goods_list_id != null and goods_list_id != ""'>#{goods_list_id},</if>
<if test='delivery_address != null and delivery_address != ""'>#{delivery_address},</if>
<if test='delivery_recv_name != null and delivery_recv_name != ""'>#{delivery_recv_name},</if>
<if test='delivery_recv_phone != null and delivery_recv_phone != ""'>#{delivery_recv_phone},</if>
<if test='delivery_invoice_no != null and delivery_invoice_no != ""'>#{delivery_invoice_no},</if>
<if test='delivery_company != null and delivery_company != ""'>#{delivery_company},</if>
<if test='delivery_req_time != null and delivery_req_time != ""'>#{delivery_req_time},</if>
<if test='gid != null and gid != ""'>#{gid}</if>
</trim>
</insert>
<update id="updateOrders" parameterType="map">
UPDATE orders
<set>
<if test="biz_group_id != null and biz_group_id != ''">biz_group_id = #{biz_group_id},</if>
<if test="state != null and state != ''">state = #{state},</if>
<if test="is_doc_accept != null">is_doc_accept = #{is_doc_accept},</if>
<if test="is_tid != null">is_tid = #{is_tid},</if>
<if test="is_card != null">is_card = #{is_card},</if>
<if test="is_samchip != null">is_samchip = #{is_samchip},</if>
<if test="is_comm_open != null">is_comm_open = #{is_comm_open},</if>
<if test="is_shipping != null">is_shipping = #{is_shipping},</if>
<if test="is_tested != null">is_tested = #{is_tested},</if>
<if test="is_parcel != null">is_parcel = #{is_parcel},</if>
<if test="goods_list_id != null and goods_list_id != ''">goods_list_id = #{goods_list_id},</if>
<if test="delivery_address != null and delivery_address != ''">delivery_address = #{delivery_address},</if>
<if test="delivery_recv_name != null and delivery_recv_name != ''">delivery_recv_name = #{delivery_recv_name},</if>
<if test="delivery_recv_phone != null and delivery_recv_phone != ''">delivery_recv_phone = #{delivery_recv_phone},</if>
<if test="delivery_invoice_no != null and delivery_invoice_no != ''">delivery_invoice_no = #{delivery_invoice_no},</if>
<if test="delivery_company != null and delivery_company != ''">delivery_company = #{delivery_company},</if>
<!-- <if test="delivery_req_time != null and delivery_req_time != ''">delivery_req_time = #{delivery_req_time},</if> -->
<if test='biz_group_id != null and biz_group_id != ""'>biz_group_id = #{biz_group_id},</if>
<if test='state != null and state != ""'>state = #{state},</if>
<if test='is_doc_accept != null'>is_doc_accept = #{is_doc_accept},</if>
<if test='is_tid != null'>is_tid = #{is_tid},</if>
<if test='is_card != null'>is_card = #{is_card},</if>
<if test='is_samchip != null'>is_samchip = #{is_samchip},</if>
<if test='is_comm_open != null'>is_comm_open = #{is_comm_open},</if>
<if test='is_shipping != null'>is_shipping = #{is_shipping},</if>
<if test='is_tested != null'>is_tested = #{is_tested},</if>
<if test='is_parcel != null'>is_parcel = #{is_parcel},</if>
<if test='goods_list_id != null and goods_list_id != ""'>goods_list_id = #{goods_list_id},</if>
<if test='delivery_address != null and delivery_address != ""'>delivery_address = #{delivery_address},</if>
<if test='delivery_recv_name != null and delivery_recv_name != ""'>delivery_recv_name = #{delivery_recv_name},</if>
<if test='delivery_recv_phone != null and delivery_recv_phone != ""'>delivery_recv_phone = #{delivery_recv_phone},</if>
<if test='delivery_invoice_no != null and delivery_invoice_no != ""'>delivery_invoice_no = #{delivery_invoice_no},</if>
<if test='delivery_company != null and delivery_company != ""'>delivery_company = #{delivery_company},</if>
<!-- <if test='delivery_req_time != null and delivery_req_time != ""'>delivery_req_time = #{delivery_req_time},</if> -->
</set>
WHERE order_id = #{order_id}
</update>
@@ -12,7 +12,7 @@
<select id="selectResourceBoard" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
@@ -21,19 +21,19 @@
</choose>
FROM resource_board AS RB
WHERE state != 2
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(reg_time) &lt;= #{date_end}
</if>
<if test="title != null and title != ''">
<if test='title != null and title != ""'>
AND title like CONCAT(#{title}, '%')
</if>
<if test="content != null and content != ''">
<if test='content != null and content != ""'>
AND content like CONCAT(#{content}, '%')
</if>
<if test="isCount == false">
<if test='isCount == false'>
ORDER BY resource_board_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -52,14 +52,14 @@
<update id="updateResourceBoard">
UPDATE resource_board
<set>
<if test="title != null and title != ''">title = #{title},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test='title != null and title != ""'>title = #{title},</if>
<if test='content != null and content != ""'>content = #{content},</if>
</set>
WHERE resource_board_id = #{resource_board_id}
</update>
<update id="changeStateResourceBoard">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
UPDATE resource_board
SET state = #{state}
WHERE resource_board_id IN
@@ -70,7 +70,7 @@
</update>
<!--
<delete id="deleteResourceBoard">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
DELETE FROM resource_board
WHERE resource_board_id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -3,10 +3,39 @@
<mapper namespace="com.handong.smartservice.mapper.TerminalMapper">
<select id="selectUid1" resultType="map">
WITH target_group AS (
WITH RECURSIVE group_tree AS (
SELECT
BG1.biz_group_id,
1 AS depth
FROM biz_group BG1
WHERE BG1.state != 2 AND BG1.biz_group_id = #{biz_group_id}
UNION ALL
SELECT
BG2.biz_group_id,
GT.depth + 1
FROM biz_group BG2
INNER JOIN group_tree GT ON BG2.pid = GT.biz_group_id
WHERE BG2.state != 2 AND GT.depth &lt; 10
)
SELECT biz_group_id
FROM group_tree
)
SELECT T.name, T.uid1
FROM terminal AS T
JOIN terminal_biz_group AS TBG ON TBG.terminal_id = T.terminal_id
JOIN biz_group AS BG ON BG.biz_group_id = TBG.biz_group_id
WHERE T.state != 2 AND TBG.biz_group_id IN ( SELECT biz_group_id FROM target_group )
ORDER BY T.uid1 ASC LIMIT #{limit} OFFSET #{offset}
</select>
<select id="selectTerminal" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
@@ -17,23 +46,23 @@
JOIN terminal_biz_group AS TBG ON TBG.terminal_id = T.terminal_id
JOIN biz_group AS BG ON BG.biz_group_id = TBG.biz_group_id
WHERE T.state != 2 AND ( BG.biz_group_id = #{biz_group_id}
<if test="is_group_access == false">
<if test='is_group_access == false'>
OR BG.top_group_id = #{biz_group_id}
</if>
)
<if test="name != null and name != ''">
<if test='name != null and name != ""'>
AND T.name = #{name}
</if>
<if test="state != 0">
<if test='state != 0'>
AND T.state = #{state}
</if>
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(T.reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(T.reg_time) &lt;= #{date_end}
</if>
<if test="isCount == false and is_excel == false">
<if test='isCount == false and is_excel == false'>
ORDER BY T.terminal_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -66,14 +95,14 @@
FROM terminal
WHERE state != 2
AND ( false
<if test="name != null and name != ''">
<if test='name != null and name != ""'>
OR name = #{name}
</if>
<if test="uid1 != null and uid1 != ''">
<if test='uid1 != null and uid1 != ""'>
OR uid1 = #{uid1}
</if>
)
<if test="type != 0">
<if test='type != 0'>
AND type = #{type}
</if>
LIMIT 1
@@ -83,29 +112,29 @@
INSERT INTO terminal
<trim prefix="(" suffix=")" suffixOverrides=",">
name, uid1, gid,
<if test="state != null and state != 0">state,</if>
<if test="type != null and type != 0">type,</if>
<if test="manager_name != null and manager_name != ''">manager_name,</if>
<if test="device_id != null and device_id != 0">device_id,</if>
<if test='state != null and state != 0'>state,</if>
<if test='type != null and type != 0'>type,</if>
<if test='manager_name != null and manager_name != ""'>manager_name,</if>
<if test='device_id != null and device_id != 0'>device_id,</if>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
#{name}, #{uid1}, #{gid},
<if test="state != null and state != 0">#{state},</if>
<if test="type != null and type != 0">#{type},</if>
<if test="manager_name != null and manager_name != ''">#{manager_name},</if>
<if test="device_id != null and device_id != 0">#{device_id},</if>
<if test='state != null and state != 0'>#{state},</if>
<if test='type != null and type != 0'>#{type},</if>
<if test='manager_name != null and manager_name != ""'>#{manager_name},</if>
<if test='device_id != null and device_id != 0'>#{device_id},</if>
</trim>
</insert>
<update id="updateTerminal">
UPDATE terminal
<set>
<if test="name != null and name != ''">name = #{name},</if>
<if test="uid1 != null and uid1 != ''">uid1 = #{uid1},</if>
<if test="type != 0">type = #{type},</if>
<if test="manager_name != null and manager_name != ''">manager_name = #{manager_name},</if>
<if test="gid != 0">gid = #{gid},</if>
<if test='name != null and name != ""'>name = #{name},</if>
<if test='uid1 != null and uid1 != ""'>uid1 = #{uid1},</if>
<if test='type != 0'>type = #{type},</if>
<if test='manager_name != null and manager_name != ""'>manager_name = #{manager_name},</if>
<if test='gid != 0'>gid = #{gid},</if>
</set>
WHERE terminal_id = #{terminal_id}
</update>
@@ -127,7 +156,7 @@
</update>
<update id="changeStateTerminals">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
UPDATE terminal
SET state = #{state}
WHERE terminal_id IN
@@ -139,7 +168,7 @@
<delete id="deleteTerminal">
<!--
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
DELETE FROM terminal
WHERE terminal_id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -187,10 +216,10 @@
<update id="terminalState">
UPDATE terminal
<set>
<if test="state == 1">
<if test='state == 1'>
connect_time = NOW(),
</if>
<if test="state == 2">
<if test='state == 2'>
disconnect_time = NOW(),
</if>
</set>
@@ -7,11 +7,11 @@
<select id="selectTransaction" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
T.reg_time, T.order_time, T.amount, T.type, T.approval, T.uid1, T.pay_name, T.pay_vendor, T.slot, T.code, T.goods_name, T.pay_unique_num, T.order_time
T.reg_time, T.order_time, T.amount, T.type, T.approval, T.uid1, T.pay_name, T.pay_vendor, T.column_no, T.code, T.goods_name, T.pay_unique_num, T.order_time
</otherwise>
</choose>
FROM transactions AS T
@@ -19,23 +19,23 @@
JOIN terminal_biz_group TBG ON TBG.terminal_id = T2.terminal_id
JOIN biz_group AS BG ON BG.biz_group_id = TBG.biz_group_id
WHERE ( TBG.biz_group_id = #{biz_group_id}
<if test="is_group_access == false">
<if test='is_group_access == false'>
OR BG.top_group_id = #{biz_group_id}
</if>
)
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(T.reg_time) &lt;= #{date_end}
</if>
<if test="uid1 != null and uid1 != ''">
<if test='uid1 != null and uid1 != ""'>
AND T.uid1 = #{uid1}
</if>
<if test="isCount == false">
<if test='isCount == false'>
ORDER BY T.transaction_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
-->
<select id="selectTransaction" resultType="map">
<if test="is_group_access == false">
<if test='is_group_access == false'>
WITH target_group AS (
WITH RECURSIVE group_tree AS (
SELECT
@@ -59,35 +59,38 @@
</if>
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
T.reg_time, T.order_time, T.amount, T.type, T.approval, T.uid1, T.pay_name, T.pay_vendor, T.slot, T.code, T.goods_name, T.pay_unique_num, T.order_time
T.reg_time, T.order_time, D.name AS device_name, T.amount, T.type, T.approval, T.uid1, T.pay_name, T.pay_vendor, T.column_no, T.code, T.goods_name, T.pay_unique_num, T.order_time
</otherwise>
</choose>
FROM transactions AS T
JOIN device D ON T.device_id = D.device_id
WHERE
<choose>
<when test="is_group_access == false">
<when test='is_group_access == false'>
T.biz_group_id IN ( SELECT biz_group_id FROM target_group )
</when>
<otherwise>
T.biz_group_id = #{biz_group_id}
</otherwise>
</choose>
<if test="date_start != null and date_start != ''">AND #{date_start} &lt;= DATE(T.reg_time)</if>
<if test="date_end != null and date_end != ''">AND DATE(T.reg_time) &lt;= #{date_end}</if>
<if test="uid1 != null and uid1 != ''">AND T.uid1 = #{uid1}</if>
<if test="uid1_type != null and uid1_type != 0">AND T.uid1_type = #{uid1_type}</if>
<if test="type != null and type != ''">AND T.type = #{type}</if>
<if test="amount != null and amount != 0">AND T.amount = #{amount}</if>
<if test="approval != null and approval != ''">AND T.approval = #{approval}</if>
<if test="slot != null and slot != ''">AND T.slot = #{slot}</if>
<if test="code != null and code != ''">AND T.code = #{code}</if>
<if test="goods_name != null and goods_name != ''">AND T.goods_name = #{goods_name}</if>
<if test="pay_vendor != null and pay_vendor != ''">AND T.pay_vendor = #{pay_vendor}</if>
<if test="isCount == false and is_excel == false">
<if test='date_start != null and date_start != ""'>AND #{date_start} &lt;= DATE(T.reg_time)</if>
<if test='date_end != null and date_end != ""'>AND DATE(T.reg_time) &lt;= #{date_end}</if>
<if test='device_name != null and device_name != ""'>AND D.name like CONCAT('%', #{device_name}, '%')</if>
<if test='uid1 != null and uid1 != ""'>AND T.uid1 = #{uid1}</if>
<if test='uid1_type != null and uid1_type != 0'>AND T.uid1_type = #{uid1_type}</if>
<if test='type != null and type != ""'>AND T.type = #{type}</if>
<if test='amount != null and amount != 0'>AND T.amount = #{amount}</if>
<if test='approval != null and approval != ""'>AND T.approval = #{approval}</if>
<if test='column_no != null and column_no != ""'>AND T.column_no = #{column_no}</if>
<if test='code != null and code != ""'>AND T.code = #{code}</if>
<if test='goods_name != null and goods_name != ""'>AND T.goods_name like CONCAT('%', #{goods_name}, '%')</if>
<if test='pay_name != null and pay_name != ""'>AND T.pay_name like CONCAT('%', #{pay_name}, '%')</if>
<if test='pay_vendor != null and pay_vendor != ""'>AND T.pay_vendor like CONCAT('%', #{pay_vendor}, '%')</if>
<if test='isCount == false and is_excel == false'>
ORDER BY T.transaction_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -95,30 +98,31 @@
<select id="selectTransactionBizGroup0" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
T.reg_time, T.order_time, T.amount, T.type, T.approval, T.uid1, T.pay_name, T.pay_vendor, T.slot, T.code, T.goods_name, T.pay_unique_num, T.order_time
T.reg_time, T.order_time, T.amount, T.type, T.approval, T.uid1, T.pay_name, T.pay_vendor, T.column_no, T.code, T.goods_name, T.pay_unique_num, T.order_time
</otherwise>
</choose>
FROM transactions AS T
WHERE biz_group_id = 0
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(T.reg_time) &lt;= #{date_end}
</if>
<if test="date_start != null and date_start != ''">AND #{date_start} &lt;= DATE(T.reg_time)</if>
<if test="date_end != null and date_end != ''">AND DATE(T.reg_time) &lt;= #{date_end}</if>
<if test="uid1 != null and uid1 != ''">AND T.uid1 = #{uid1}</if>
<if test="uid1_type != null and uid1_type != 0">AND T.uid1_type = #{uid1_type}</if>
<if test="type != null and type != ''">AND T.type = #{type}</if>
<if test="amount != null and amount != 0">AND T.amount = #{amount}</if>
<if test="approval != null and approval != ''">AND T.approval = #{approval}</if>
<if test="slot != null and slot != ''">AND T.slot = #{slot}</if>
<if test="code != null and code != ''">AND T.code = #{code}</if>
<if test="goods_name != null and goods_name != ''">AND T.goods_name = #{goods_name}</if>
<if test="pay_vendor != null and pay_vendor != ''">AND T.pay_vendor = #{pay_vendor}</if>
<if test="isCount == false and is_excel == false">
<if test='date_start != null and date_start != ""'>AND #{date_start} &lt;= DATE(T.reg_time)</if>
<if test='date_end != null and date_end != ""'>AND DATE(T.reg_time) &lt;= #{date_end}</if>
<if test='uid1 != null and uid1 != ""'>AND T.uid1 = #{uid1}</if>
<if test='uid1_type != null and uid1_type != 0'>AND T.uid1_type = #{uid1_type}</if>
<if test='type != null and type != ""'>AND T.type = #{type}</if>
<if test='amount != null and amount != 0'>AND T.amount = #{amount}</if>
<if test='approval != null and approval != ""'>AND T.approval = #{approval}</if>
<if test='column_no != null and column_no != ""'>AND T.column_no = #{column_no}</if>
<if test='code != null and code != ""'>AND T.code = #{code}</if>
<if test='goods_name != null and goods_name != ""'>AND T.goods_name like CONCAT('%', #{goods_name}, '%')</if>
<if test='pay_name != null and pay_name != ""'>AND T.pay_name like CONCAT('%', #{pay_name}, '%')</if>
<if test='pay_vendor != null and pay_vendor != ""'>AND T.pay_vendor like CONCAT('%', #{pay_vendor}, '%')</if>
<if test='isCount == false and is_excel == false'>
ORDER BY T.transaction_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -127,7 +131,7 @@
<select id="selectTransaction3" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
@@ -152,24 +156,170 @@
JOIN device_biz_group DBG ON DBG.device_id = D.device_id
JOIN biz_group AS BG ON BG.biz_group_id = DBG.biz_group_id
WHERE ( DBG.biz_group_id = #{biz_group_id}
<if test="is_group_access == false">
<if test='is_group_access == false'>
OR BG.top_group_id = #{biz_group_id}
</if>
)
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(T.reg_time) &lt;= #{date_end}
</if>
<if test="uid1 != null and uid1 != ''">
<if test='uid1 != null and uid1 != ""'>
AND TER.uid1 = #{uid1}
</if>
GROUP BY DATE_FORMAT(STR_TO_DATE(T.order_time, '%y%m%d%H%i%s'), '%Y-%m-%d'), D.name, TER.uid1
<if test="isCount == false">
<if test='isCount == false'>
ORDER BY date, D.name;
</if>
</select>
-->
<select id="selectTransaction3" resultType="map">
<if test="is_group_access == false">
<if test='is_group_access == false'>
WITH target_group AS (
WITH RECURSIVE group_tree AS (
SELECT
BG1.biz_group_id,
1 AS depth
FROM biz_group BG1
WHERE BG1.state != 2 AND BG1.biz_group_id = #{biz_group_id}
UNION ALL
SELECT
BG2.biz_group_id,
GT.depth + 1
FROM biz_group BG2
INNER JOIN group_tree GT ON BG2.pid = GT.biz_group_id
WHERE BG2.state != 2 AND GT.depth &lt; 10
)
SELECT biz_group_id
FROM group_tree
)
</if>
<choose>
<when test='isCount == true'>
SELECT COUNT(*) AS total_count
FROM (
SELECT 1
</when>
<otherwise>
SELECT
<choose>
<when test='date_type == 2'>DATE_FORMAT(T.reg_time, '%Y-%m')</when>
<otherwise>DATE_FORMAT(T.reg_time, '%Y-%m-%d')</otherwise>
</choose> AS date,
<if test='query_uid1 == true'>
D.name AS device_name, T.uid1 AS uid1,
</if>
/* 카드 */
COUNT(CASE WHEN
<choose>
<when test='approval_type == 0'>T.type IN ('D1','D4','I1','I4')</when>
<when test='approval_type == 1'>T.type IN ('D1','I1')</when>
<when test='approval_type == 2'>T.type IN ('D4','I4')</when>
</choose>
THEN 1 END) AS card_count,
SUM(CASE WHEN
<choose>
<when test='approval_type == 0'>T.type IN ('D1','D4','I1','I4')</when>
<when test='approval_type == 1'>T.type IN ('D1','I1')</when>
<when test='approval_type == 2'>T.type IN ('D4','I4')</when>
</choose>
THEN T.amount ELSE 0 END) AS card_amount,
/* 현금 */
COUNT(CASE WHEN
<choose>
<when test='approval_type == 0'>T.type IN ('B1','B4')</when>
<when test='approval_type == 1'>T.type IN ('B1')</when>
<when test='approval_type == 2'>T.type IN ('B4')</when>
</choose>
THEN 1 END) AS cash_count,
SUM(CASE WHEN
<choose>
<when test='approval_type == 0'>T.type IN ('B1','B4')</when>
<when test='approval_type == 1'>T.type IN ('B1')</when>
<when test='approval_type == 2'>T.type IN ('B4')</when>
</choose>
THEN T.amount ELSE 0 END) AS cash_amount,
/* T머니 */
COUNT(CASE WHEN
<choose>
<when test='approval_type == 0'>T.type IN ('TM1','TM4')</when>
<when test='approval_type == 1'>T.type IN ('TM1')</when>
<when test='approval_type == 2'>T.type IN ('TM4')</when>
</choose>
THEN 1 END) AS tmoney_count,
SUM(CASE WHEN
<choose>
<when test='approval_type == 0'>T.type IN ('TM1','TM4')</when>
<when test='approval_type == 1'>T.type IN ('TM1')</when>
<when test='approval_type == 2'>T.type IN ('TM4')</when>
</choose>
THEN T.amount ELSE 0 END) AS tmoney_amount,
/* 캐시비 */
COUNT(CASE WHEN
<choose>
<when test='approval_type == 0'>T.type IN ('EB1','EB4')</when>
<when test='approval_type == 1'>T.type IN ('EB1')</when>
<when test='approval_type == 2'>T.type IN ('EB4')</when>
</choose>
THEN 1 END) AS cbee_count,
SUM(CASE WHEN
<choose>
<when test='approval_type == 0'>T.type IN ('EB1','EB4')</when>
<when test='approval_type == 1'>T.type IN ('EB1')</when>
<when test='approval_type == 2'>T.type IN ('EB4')</when>
</choose>
THEN T.amount ELSE 0 END) AS cbee_amount,
/* 합계 */
(
SUM(CASE WHEN T.type IN ('D1','D4','I1','I4') THEN T.amount ELSE 0 END) +
SUM(CASE WHEN T.type IN ('B1','B4') THEN T.amount ELSE 0 END) +
SUM(CASE WHEN T.type IN ('TM1','TM4') THEN T.amount ELSE 0 END) +
SUM(CASE WHEN T.type IN ('EB1','EB4') THEN T.amount ELSE 0 END)
) AS total
</otherwise>
</choose>
FROM transactions AS T
JOIN device D ON D.device_id = T.device_id
WHERE
<choose>
<when test='is_group_access == false'>
T.biz_group_id IN ( SELECT biz_group_id FROM target_group )
</when>
<otherwise>
T.biz_group_id = #{biz_group_id}
</otherwise>
</choose>
<if test='date_start != null and date_start != ""'>AND #{date_start} &lt;= DATE(T.reg_time)</if>
<if test='date_end != null and date_end != ""'>AND DATE(T.reg_time) &lt;= #{date_end}</if>
<if test='device_name != null and device_name != ""'>AND D.name like CONCAT('%', #{device_name}, '%')</if>
<if test='uid1 != null and uid1 != ""'>AND T.uid1 = #{uid1}</if>
GROUP BY
<choose>
<when test='date_type == 2'>DATE_FORMAT(T.reg_time, '%Y-%m')</when>
<otherwise>DATE_FORMAT(T.reg_time, '%Y-%m-%d')</otherwise>
</choose>
<if test='query_uid1 == true'>, D.name, T.uid1</if>
<choose>
<when test='isCount == true'>
HAVING COUNT(CASE WHEN T.type IN ('D1','D4','I1','I4','B1','B4','TM1','TM4','EB1','EB4') THEN 1 END) != 0
) AS counted
</when>
<otherwise>
<if test='isCount == false and is_excel == false'>
HAVING card_count != 0 OR cash_count != 0 OR tmoney_count != 0 OR cbee_count != 0
ORDER BY date DESC LIMIT #{limit} OFFSET #{offset}
</if>
</otherwise>
</choose>
</select>
<select id="selectTransactionSum" resultType="map">
<if test='is_group_access == false'>
WITH target_group AS (
WITH RECURSIVE group_tree AS (
SELECT
@@ -192,162 +342,84 @@
)
</if>
SELECT
<choose>
<when test="date_type == 2">DATE_FORMAT(T.reg_time, '%Y-%m')</when>
<otherwise>DATE_FORMAT(T.reg_time, '%Y-%m-%d')</otherwise>
</choose> AS date,
D.name AS device_name,
T.uid1 AS uid1,
/* 카드 */
COUNT(CASE
WHEN
<choose>
<when test="approval_type == 0">T.type IN ('D1','D4','I1','I4')</when>
<when test="approval_type == 1">T.type IN ('D1','I1')</when>
<when test="approval_type == 2">T.type IN ('D4','I4')</when>
</choose>
THEN 1 END) AS card_count,
SUM(CASE
WHEN
<choose>
<when test="approval_type == 0">T.type IN ('D1','D4','I1','I4')</when>
<when test="approval_type == 1">T.type IN ('D1','I1')</when>
<when test="approval_type == 2">T.type IN ('D4','I4')</when>
</choose>
THEN T.amount ELSE 0 END) AS card_amount,
SUM(T.type IN ('D1','D4','I1','I4')) AS card_count,
IFNULL(SUM(CASE WHEN T.type IN ('D1','D4','I1','I4') THEN T.amount ELSE 0 END), 0) AS card_amount,
/* 현금 */
COUNT(CASE
WHEN
<choose>
<when test="approval_type == 0">T.type IN ('B1','B4')</when>
<when test="approval_type == 1">T.type IN ('B1')</when>
<when test="approval_type == 2">T.type IN ('B4')</when>
</choose>
THEN 1 END) AS cash_count,
SUM(CASE
WHEN
<choose>
<when test="approval_type == 0">T.type IN ('B1','B4')</when>
<when test="approval_type == 1">T.type IN ('B1')</when>
<when test="approval_type == 2">T.type IN ('B4')</when>
</choose>
THEN T.amount ELSE 0 END) AS cash_amount,
SUM(T.type IN ('B1','B4')) AS cash_count,
IFNULL(SUM(CASE WHEN T.type IN ('B1','B4') THEN T.amount ELSE 0 END), 0) AS cash_amount,
/* T머니 */
COUNT(CASE
WHEN
<choose>
<when test="approval_type == 0">T.type IN ('TM1','TM4')</when>
<when test="approval_type == 1">T.type IN ('TM1')</when>
<when test="approval_type == 2">T.type IN ('TM4')</when>
</choose>
THEN 1 END) AS tmoney_count,
SUM(CASE
WHEN
<choose>
<when test="approval_type == 0">T.type IN ('TM1','TM4')</when>
<when test="approval_type == 1">T.type IN ('TM1')</when>
<when test="approval_type == 2">T.type IN ('TM4')</when>
</choose>
THEN T.amount ELSE 0 END) AS tmoney_amount,
SUM(T.type IN ('TM1','TM4')) AS tmoney_count,
IFNULL(SUM(CASE WHEN T.type IN ('TM1','TM4') THEN T.amount ELSE 0 END), 0) AS tmoney_amount,
/* 캐시비 */
COUNT(CASE
WHEN
<choose>
<when test="approval_type == 0">T.type IN ('EB1','EB4')</when>
<when test="approval_type == 1">T.type IN ('EB1')</when>
<when test="approval_type == 2">T.type IN ('EB4')</when>
</choose>
THEN 1 END) AS cbee_count,
SUM(CASE
WHEN
<choose>
<when test="approval_type == 0">T.type IN ('EB1','EB4')</when>
<when test="approval_type == 1">T.type IN ('EB1')</when>
<when test="approval_type == 2">T.type IN ('EB4')</when>
</choose>
THEN T.amount ELSE 0 END) AS cbee_amount,
SUM(T.type IN ('EB1','EB4')) AS cbee_count,
IFNULL(SUM(CASE WHEN T.type IN ('EB1','EB4') THEN T.amount ELSE 0 END), 0) AS cbee_amount,
/* 합계 */
(
SUM(CASE WHEN T.type IN ('D1','D4','I1','I4') THEN T.amount ELSE 0 END) +
SUM(CASE WHEN T.type IN ('B1','B4') THEN T.amount ELSE 0 END) +
SUM(CASE WHEN T.type IN ('TM1','TM4') THEN T.amount ELSE 0 END) +
SUM(CASE WHEN T.type IN ('EB1','EB4') THEN T.amount ELSE 0 END)
IFNULL(SUM(CASE WHEN T.type IN ('D1','D4','I1','I4') THEN T.amount ELSE 0 END), 0) +
IFNULL(SUM(CASE WHEN T.type IN ('B1','B4') THEN T.amount ELSE 0 END), 0) +
IFNULL(SUM(CASE WHEN T.type IN ('TM1','TM4') THEN T.amount ELSE 0 END), 0) +
IFNULL(SUM(CASE WHEN T.type IN ('EB1','EB4') THEN T.amount ELSE 0 END), 0)
) AS total
FROM transactions AS T
JOIN device D ON D.device_id = T.device_id
WHERE
<choose>
<when test="is_group_access == false">
<when test='is_group_access == false'>
T.biz_group_id IN ( SELECT biz_group_id FROM target_group )
</when>
<otherwise>
T.biz_group_id = #{biz_group_id}
</otherwise>
</choose>
<if test="date_start != null and date_start != ''">AND #{date_start} &lt;= DATE(T.reg_time)</if>
<if test="date_end != null and date_end != ''">AND DATE(T.reg_time) &lt;= #{date_end}</if>
GROUP BY
<choose>
<when test="date_type == 2">DATE_FORMAT(T.reg_time, '%Y-%m')</when>
<otherwise>DATE_FORMAT(T.reg_time, '%Y-%m-%d')</otherwise>
</choose>,
D.name,
T.uid1
<if test='date_start != null and date_start != ""'>AND #{date_start} &lt;= DATE(T.reg_time)</if>
<if test='date_end != null and date_end != ""'>AND DATE(T.reg_time) &lt;= #{date_end}</if>
HAVING card_count != 0 OR cash_count != 0 OR tmoney_count != 0 OR cbee_count != 0
ORDER BY
date DESC
</select>
<insert id="insertTransaction">
INSERT INTO transactions
<trim prefix="(" suffix=")" suffixOverrides=",">
reg_time, process,
<if test="biz_group_id != null">biz_group_id,</if>
<if test="device_id != null">device_id,</if>
<if test="uid1 != null and uid1 != ''">uid1,</if>
<if test="uid1_type != null and uid1_type != 0">uid1_type,</if>
<if test="order_time != null and order_time != ''">order_time,</if>
<if test="type != null and type != ''">type,</if>
<if test="amount != null and amount != 0">amount,</if>
<if test="approval != null and approval != ''">approval,</if>
<if test="pay_unique_num != null and pay_unique_num != ''">pay_unique_num,</if>
<if test="slot != null and slot != ''">slot,</if>
<if test="code != null and code != ''">code,</if>
<if test="goods_name != null and goods_name != ''">goods_name,</if>
<if test="price != null and price != 0">price,</if>
<if test="pay_name != null and pay_name != ''">pay_name,</if>
<if test="pay_vendor != null and pay_vendor != ''">pay_vendor</if>
<if test='biz_group_id != null'>biz_group_id,</if>
<if test='device_id != null'>device_id,</if>
<if test='uid1 != null and uid1 != ""'>uid1,</if>
<if test='uid1_type != null and uid1_type != 0'>uid1_type,</if>
<if test='order_time != null and order_time != ""'>order_time,</if>
<if test='type != null and type != ""'>type,</if>
<if test='amount != null and amount != 0'>amount,</if>
<if test='approval != null and approval != ""'>approval,</if>
<if test='pay_unique_num != null and pay_unique_num != ""'>pay_unique_num,</if>
<if test='column_no != null and column_no != ""'>column_no,</if>
<if test='code != null and code != ""'>code,</if>
<if test='goods_name != null and goods_name != ""'>goods_name,</if>
<if test='price != null and price != 0'>price,</if>
<if test='pay_name != null and pay_name != ""'>pay_name,</if>
<if test='pay_vendor != null and pay_vendor != ""'>pay_vendor</if>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
NOW(), 1,
<if test="biz_group_id != null">#{biz_group_id},</if>
<if test="device_id != null">#{device_id},</if>
<if test="uid1 != null and uid1 != ''">#{uid1},</if>
<if test="uid1_type != null and uid1_type != 0">#{uid1_type},</if>
<if test="order_time != null and order_time != ''">#{order_time},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="amount != null and amount != 0">#{amount},</if>
<if test="approval != null and approval != ''">#{approval},</if>
<if test="pay_unique_num != null and pay_unique_num != ''">#{pay_unique_num},</if>
<if test="slot != null and slot != ''">#{slot},</if>
<if test="code != null and code != ''">#{code},</if>
<if test="goods_name != null and goods_name != ''">#{goods_name},</if>
<if test="price != null and price != 0">#{price},</if>
<if test="pay_name != null and pay_name != ''">#{pay_name},</if>
<if test="pay_vendor != null and pay_vendor != ''">#{pay_vendor}</if>
<if test='biz_group_id != null'>#{biz_group_id},</if>
<if test='device_id != null'>#{device_id},</if>
<if test='uid1 != null and uid1 != ""'>#{uid1},</if>
<if test='uid1_type != null and uid1_type != 0'>#{uid1_type},</if>
<if test='order_time != null and order_time != ""'>#{order_time},</if>
<if test='type != null and type != ""'>#{type},</if>
<if test='amount != null and amount != 0'>#{amount},</if>
<if test='approval != null and approval != ""'>#{approval},</if>
<if test='pay_unique_num != null and pay_unique_num != ""'>#{pay_unique_num},</if>
<if test='column_no != null and column_no != ""'>#{column_no},</if>
<if test='code != null and code != ""'>#{code},</if>
<if test='goods_name != null and goods_name != ""'>#{goods_name},</if>
<if test='price != null and price != 0'>#{price},</if>
<if test='pay_name != null and pay_name != ""'>#{pay_name},</if>
<if test='pay_vendor != null and pay_vendor != ""'>#{pay_vendor}</if>
</trim>
</insert>
</mapper>
@@ -12,7 +12,7 @@
<select id="selectVoc" resultType="map">
SELECT
<choose>
<when test="isCount == true">
<when test='isCount == true'>
COUNT(*)
</when>
<otherwise>
@@ -21,19 +21,19 @@
</choose>
FROM voc AS RB
WHERE state != 2
<if test="date_start != null and date_start != ''">
<if test='date_start != null and date_start != ""'>
AND #{date_start} &lt;= DATE(reg_time)
</if>
<if test="date_end != null and date_end != ''">
<if test='date_end != null and date_end != ""'>
AND DATE(reg_time) &lt;= #{date_end}
</if>
<if test="title != null and title != ''">
<if test='title != null and title != ""'>
AND title like CONCAT(#{title}, '%')
</if>
<if test="content != null and content != ''">
<if test='content != null and content != ""'>
AND content like CONCAT(#{content}, '%')
</if>
<if test="isCount == false">
<if test='isCount == false'>
ORDER BY voc_id DESC LIMIT #{limit} OFFSET #{offset}
</if>
</select>
@@ -52,14 +52,14 @@
<update id="updateVoc">
UPDATE voc
<set>
<if test="title != null and title != ''">title = #{title},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test='title != null and title != ""'>title = #{title},</if>
<if test='content != null and content != ""'>content = #{content},</if>
</set>
WHERE voc_id = #{voc_id}
</update>
<update id="changeStateVoc">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
UPDATE voc
SET state = #{state}
WHERE voc_id IN
@@ -70,7 +70,7 @@
</update>
<!--
<delete id="deleteVoc">
<if test="ids != null and ids.size > 0">
<if test='ids != null and ids.size > 0'>
DELETE FROM voc
WHERE voc IN
<foreach collection="ids" item="id" open="(" separator="," close=")">