Compare commits
49
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b4089ef59 | ||
|
|
20c3e1f422 | ||
|
|
3b19d9e930 | ||
|
|
5fd11e9caf | ||
|
|
0b98dcdfe9 | ||
|
|
b373cbbe46 | ||
|
|
acd97c7b9b | ||
|
|
118bdb1666 | ||
|
|
944de228f7 | ||
|
|
25c9cd4dfc | ||
|
|
882cd226ec | ||
|
|
feb4d7af66 | ||
|
|
d75ab1ed5f | ||
|
|
a501eb7443 | ||
|
|
19941d9480 | ||
|
|
cd3d522d4f | ||
|
|
181c5078e9 | ||
|
|
e97f46e6b4 | ||
|
|
c0f89deb83 | ||
|
|
ce695463d3 | ||
|
|
83c683d473 | ||
|
|
9555474b0b | ||
|
|
a150f9e017 | ||
|
|
ecd2fa1c33 | ||
|
|
e3236d262d | ||
|
|
c8e2e16ba5 | ||
|
|
99b44faf09 | ||
|
|
b3e3cbf84b | ||
|
|
0aee11d824 | ||
|
|
fcf358a768 | ||
|
|
619369104c | ||
|
|
4f1408b9d0 | ||
|
|
029eea70cc | ||
|
|
22b1e65385 | ||
|
|
2170c48763 | ||
|
|
c2d1c48aae | ||
|
|
e14958c643 | ||
|
|
da288338cd | ||
|
|
ea430f2468 | ||
|
|
f76f79744a | ||
|
|
19daaff907 | ||
|
|
db94d8f932 | ||
|
|
53618fe362 | ||
|
|
523edffc4e | ||
|
|
c7ddb1a8b0 | ||
|
|
45c9fc814a | ||
|
|
407dc13ac4 | ||
|
|
0c06bf16c2 | ||
|
|
1db39e77d3 |
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<groupId>com.imyeyu.timiserverapi</groupId>
|
<groupId>com.imyeyu.timiserverapi</groupId>
|
||||||
<artifactId>TimiServerAPI</artifactId>
|
<artifactId>TimiServerAPI</artifactId>
|
||||||
<version>1.0.39</version>
|
<version>1.0.38</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>TimiServerAPI</name>
|
<name>TimiServerAPI</name>
|
||||||
<description>imyeyu.com API</description>
|
<description>imyeyu.com API</description>
|
||||||
|
|||||||
@@ -15,12 +15,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@@ -30,30 +26,11 @@ import java.util.Map;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RequestMapping("/setting")
|
@RequestMapping("/system/setting")
|
||||||
public class SettingController {
|
public class SettingController {
|
||||||
|
|
||||||
private final SettingService service;
|
private final SettingService service;
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询公开配置映射
|
|
||||||
*
|
|
||||||
* @param bizType 业务类型
|
|
||||||
* @param bizId 业务 ID,可为空
|
|
||||||
* @param code 配置代码列表,可为空
|
|
||||||
* @return 公开配置映射
|
|
||||||
*/
|
|
||||||
@JsonView(ResponseView.Public.class)
|
|
||||||
@RequestRateLimit
|
|
||||||
@RequestMapping("/map")
|
|
||||||
public Map<String, Setting> map(
|
|
||||||
@RequestParam String bizType,
|
|
||||||
@RequestParam(required = false) String bizId,
|
|
||||||
@RequestParam(required = false) List<String> code
|
|
||||||
) {
|
|
||||||
return service.mapPublic(bizType, bizId, code);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询配置列表
|
* 查询配置列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ public class Notify extends UUIDEntity {
|
|||||||
/** 业务类型 */
|
/** 业务类型 */
|
||||||
private String bizType;
|
private String bizType;
|
||||||
|
|
||||||
/** 业务提醒类型 */
|
/** 提醒业务类型 */
|
||||||
private String bizRemindedType;
|
private String bizRemindedType;
|
||||||
|
|
||||||
/** 业务提醒查重键 */
|
/** 提醒业务 ID */
|
||||||
private String bizRemindedKey;
|
private String bizRemindedId;
|
||||||
|
|
||||||
/** 参数 */
|
/** 参数 */
|
||||||
private String args;
|
private String args;
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ package com.imyeyu.api.modules.common.mapper;
|
|||||||
|
|
||||||
import com.imyeyu.api.modules.common.entity.Notify;
|
import com.imyeyu.api.modules.common.entity.Notify;
|
||||||
import com.imyeyu.api.modules.common.vo.NotifyManagementItem;
|
import com.imyeyu.api.modules.common.vo.NotifyManagementItem;
|
||||||
import com.imyeyu.spring.mapper.BaseMapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
import com.imyeyu.spring.mapper.BaseMapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -15,8 +16,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface NotifyMapper extends BaseMapper<Notify, String> {
|
public interface NotifyMapper extends BaseMapper<Notify, String> {
|
||||||
|
|
||||||
/// 原子创建业务提醒
|
/// 查询业务提醒是否已创建
|
||||||
int insertIfAbsent(Notify notify);
|
@Select("SELECT EXISTS (SELECT 1 FROM `notify` WHERE `biz_type` = #{bizType} AND `biz_reminded_type` = #{bizRemindedType} AND `biz_reminded_id` = #{bizRemindedId} AND `deleted_at` IS NULL)")
|
||||||
|
boolean existsByBizReminded(@Param("bizType") String bizType, @Param("bizRemindedType") String bizRemindedType, @Param("bizRemindedId") String bizRemindedId);
|
||||||
|
|
||||||
/// 分页查询管理端通知
|
/// 分页查询管理端通知
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package com.imyeyu.api.modules.common.mapper;
|
|||||||
import com.imyeyu.api.modules.common.entity.Setting;
|
import com.imyeyu.api.modules.common.entity.Setting;
|
||||||
import com.imyeyu.spring.mapper.BaseMapper;
|
import com.imyeyu.spring.mapper.BaseMapper;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统配置
|
* 系统配置
|
||||||
*
|
*
|
||||||
@@ -12,6 +10,4 @@ import java.util.List;
|
|||||||
* @since 2021-07-20 22:26
|
* @since 2021-07-20 22:26
|
||||||
*/
|
*/
|
||||||
public interface SettingMapper extends BaseMapper<Setting, String> {
|
public interface SettingMapper extends BaseMapper<Setting, String> {
|
||||||
|
|
||||||
List<Setting> selectPublicByQuery(String bizType, String bizId, List<String> codeList);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,13 @@ import com.imyeyu.spring.service.BaseService;
|
|||||||
*/
|
*/
|
||||||
public interface NotifyService extends BaseService<Notify, String> {
|
public interface NotifyService extends BaseService<Notify, String> {
|
||||||
|
|
||||||
/// 原子创建业务提醒,重复查重键不会创建通知详情
|
/// 查询业务提醒是否已创建
|
||||||
///
|
///
|
||||||
/// @param notify 通知
|
/// @param bizType 业务类型
|
||||||
void createIfAbsent(Notify notify);
|
/// @param bizRemindedType 被提醒业务类型
|
||||||
|
/// @param bizRemindedId 被提醒业务 ID
|
||||||
|
/// @return true 为已创建
|
||||||
|
boolean existsByBizReminded(String bizType, String bizRemindedType, String bizRemindedId);
|
||||||
|
|
||||||
/// 分页查询当前用户创建的通知
|
/// 分页查询当前用户创建的通知
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import com.imyeyu.java.TimiJava;
|
|||||||
import com.imyeyu.spring.service.BaseService;
|
import com.imyeyu.spring.service.BaseService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置服务
|
* 配置服务
|
||||||
@@ -25,16 +24,6 @@ public interface SettingService extends BaseService<Setting, String> {
|
|||||||
|
|
||||||
List<Setting> listByBizId(String bizType, String bizId);
|
List<Setting> listByBizId(String bizType, String bizId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询公开配置映射
|
|
||||||
*
|
|
||||||
* @param bizType 业务类型
|
|
||||||
* @param bizId 业务 ID,可为空
|
|
||||||
* @param code 配置代码列表,可为空
|
|
||||||
* @return 公开配置映射
|
|
||||||
*/
|
|
||||||
Map<String, Setting> mapPublic(String bizType, String bizId, List<String> code);
|
|
||||||
|
|
||||||
default List<Setting> listBySettingSupport(SettingSupport settingSupport) {
|
default List<Setting> listBySettingSupport(SettingSupport settingSupport) {
|
||||||
String bizType = settingSupport.getClass().getSimpleName().toUpperCase();
|
String bizType = settingSupport.getClass().getSimpleName().toUpperCase();
|
||||||
return listByBizId(bizType, settingSupport.getId());
|
return listByBizId(bizType, settingSupport.getId());
|
||||||
|
|||||||
+47
-42
@@ -7,8 +7,9 @@ import com.imyeyu.api.modules.common.mapper.NotifyMapper;
|
|||||||
import com.imyeyu.api.modules.common.service.NotifyDetailService;
|
import com.imyeyu.api.modules.common.service.NotifyDetailService;
|
||||||
import com.imyeyu.api.modules.common.service.NotifyService;
|
import com.imyeyu.api.modules.common.service.NotifyService;
|
||||||
import com.imyeyu.api.modules.common.vo.NotifyManagementItem;
|
import com.imyeyu.api.modules.common.vo.NotifyManagementItem;
|
||||||
import com.imyeyu.api.modules.system.audit.AuditOperation;
|
import com.imyeyu.api.modules.system.entity.Logger;
|
||||||
import com.imyeyu.api.modules.system.audit.OperationAudit;
|
import com.imyeyu.api.modules.system.service.LoggerService;
|
||||||
|
import com.imyeyu.api.modules.user.service.UserLoginService;
|
||||||
import com.imyeyu.java.TimiJava;
|
import com.imyeyu.java.TimiJava;
|
||||||
import com.imyeyu.java.bean.timi.TimiCode;
|
import com.imyeyu.java.bean.timi.TimiCode;
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
@@ -16,13 +17,12 @@ import com.imyeyu.spring.bean.Page;
|
|||||||
import com.imyeyu.spring.bean.PageResult;
|
import com.imyeyu.spring.bean.PageResult;
|
||||||
import com.imyeyu.spring.mapper.BaseMapper;
|
import com.imyeyu.spring.mapper.BaseMapper;
|
||||||
import com.imyeyu.spring.service.AbstractEntityService;
|
import com.imyeyu.spring.service.AbstractEntityService;
|
||||||
import com.imyeyu.utils.Time;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知服务实现
|
* 通知服务实现
|
||||||
@@ -30,10 +30,13 @@ import java.util.UUID;
|
|||||||
* @author 夜雨
|
* @author 夜雨
|
||||||
* @since 2026-05-13 14:46
|
* @since 2026-05-13 14:46
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class NotifyServiceImplement extends AbstractEntityService<Notify, String> implements NotifyService {
|
public class NotifyServiceImplement extends AbstractEntityService<Notify, String> implements NotifyService {
|
||||||
|
|
||||||
|
private final LoggerService loggerService;
|
||||||
|
private final UserLoginService userLoginService;
|
||||||
private final NotifyDetailService detailService;
|
private final NotifyDetailService detailService;
|
||||||
|
|
||||||
private final NotifyMapper mapper;
|
private final NotifyMapper mapper;
|
||||||
@@ -43,54 +46,44 @@ public class NotifyServiceImplement extends AbstractEntityService<Notify, String
|
|||||||
return mapper;
|
return mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean existsByBizReminded(String bizType, String bizRemindedType, String bizRemindedId) {
|
||||||
|
return mapper.existsByBizReminded(bizType, bizRemindedType, bizRemindedId);
|
||||||
|
}
|
||||||
|
|
||||||
/// 创建通知并级联创建通知详情
|
/// 创建通知并级联创建通知详情
|
||||||
///
|
///
|
||||||
/// @param notify 通知
|
/// @param notify 通知
|
||||||
@OperationAudit(AuditOperation.COMMON_NOTIFY_CREATE)
|
|
||||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
||||||
@Override
|
@Override
|
||||||
public void create(Notify notify) {
|
public void create(Notify notify) {
|
||||||
prepareCreate(notify);
|
Logger logger = new Logger(Logger.Module.COMMON, "COMMON_NOTIFY_CREATE");
|
||||||
super.create(notify);
|
try {
|
||||||
createDetails(notify);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 原子创建业务提醒并级联创建通知详情
|
|
||||||
///
|
|
||||||
/// @param notify 通知
|
|
||||||
@OperationAudit(AuditOperation.COMMON_NOTIFY_CREATE)
|
|
||||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
|
||||||
@Override
|
|
||||||
public void createIfAbsent(Notify notify) {
|
|
||||||
prepareCreate(notify);
|
|
||||||
if (mapper.insertIfAbsent(notify) == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
createDetails(notify);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 校验并补全通知创建字段
|
|
||||||
///
|
|
||||||
/// @param notify 通知
|
|
||||||
private void prepareCreate(Notify notify) {
|
|
||||||
TimiException.required(notify, "未找到通知");
|
TimiException.required(notify, "未找到通知");
|
||||||
TimiException.required(notify.getDetailList(), "未找到通知详情列表");
|
TimiException.required(notify.getDetailList(), "未找到通知详情列表");
|
||||||
notify.setId(TimiJava.defaultIfEmpty(notify.getId(), UUID.randomUUID().toString()));
|
|
||||||
notify.setCreatedBy(TimiJava.defaultIfEmpty(notify.getCreatedBy(), TimiJava.ZERO_UUID));
|
|
||||||
notify.setCreatedAt(TimiJava.defaultIfNull(notify.getCreatedAt(), Time.now()));
|
|
||||||
notify.setUpdatedAt(null);
|
|
||||||
notify.setDeletedAt(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 创建通知详情
|
notify.setCreatedBy(TimiJava.defaultIfEmpty(notify.getCreatedBy(), TimiJava.ZERO_UUID));
|
||||||
///
|
super.create(notify);
|
||||||
/// @param notify 通知
|
|
||||||
private void createDetails(Notify notify) {
|
|
||||||
for (NotifyDetail detail : notify.getDetailList()) {
|
for (NotifyDetail detail : notify.getDetailList()) {
|
||||||
detail.setNotifyId(notify.getId());
|
detail.setNotifyId(notify.getId());
|
||||||
detail.setSendFrom(TimiJava.defaultIfEmpty(detail.getSendFrom(), TimiJava.ZERO_UUID));
|
detail.setSendFrom(TimiJava.defaultIfEmpty(detail.getSendFrom(), TimiJava.ZERO_UUID));
|
||||||
detailService.create(detail);
|
detailService.create(detail);
|
||||||
}
|
}
|
||||||
|
logger.setLevel(Logger.Level.INFO);
|
||||||
|
logger.setResult(notify.getId());
|
||||||
|
} catch (TimiException e) {
|
||||||
|
logger.setLevel(Logger.Level.WARN);
|
||||||
|
logger.setException(e.getMessage());
|
||||||
|
throw e;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.setLevel(Logger.Level.ERROR);
|
||||||
|
logger.setException(TimiJava.serializeThrowable(e));
|
||||||
|
log.error("创建通知失败", e);
|
||||||
|
throw new TimiException(TimiCode.ERROR, "创建通知失败", e);
|
||||||
|
} finally {
|
||||||
|
loggerService.create(logger);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 分页查询当前用户创建的通知
|
/// 分页查询当前用户创建的通知
|
||||||
@@ -127,8 +120,6 @@ public class NotifyServiceImplement extends AbstractEntityService<Notify, String
|
|||||||
/// @param notifyId 通知 ID
|
/// @param notifyId 通知 ID
|
||||||
/// @param userId 用户 ID
|
/// @param userId 用户 ID
|
||||||
@Override
|
@Override
|
||||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
|
||||||
@OperationAudit(AuditOperation.COMMON_NOTIFY_DELETE)
|
|
||||||
public void deleteManagement(String notifyId, String userId) {
|
public void deleteManagement(String notifyId, String userId) {
|
||||||
getManagement(notifyId, userId);
|
getManagement(notifyId, userId);
|
||||||
delete(notifyId);
|
delete(notifyId);
|
||||||
@@ -139,7 +130,6 @@ public class NotifyServiceImplement extends AbstractEntityService<Notify, String
|
|||||||
/// @param notifyId 通知 ID
|
/// @param notifyId 通知 ID
|
||||||
/// @param userId 用户 ID
|
/// @param userId 用户 ID
|
||||||
@Override
|
@Override
|
||||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
|
||||||
public void cancelManagement(String notifyId, String userId) {
|
public void cancelManagement(String notifyId, String userId) {
|
||||||
getManagement(notifyId, userId);
|
getManagement(notifyId, userId);
|
||||||
cancel(notifyId);
|
cancel(notifyId);
|
||||||
@@ -148,10 +138,11 @@ public class NotifyServiceImplement extends AbstractEntityService<Notify, String
|
|||||||
/// 删除通知并级联软删除通知详情
|
/// 删除通知并级联软删除通知详情
|
||||||
///
|
///
|
||||||
/// @param notifyId 通知 ID
|
/// @param notifyId 通知 ID
|
||||||
@OperationAudit(AuditOperation.COMMON_NOTIFY_DELETE)
|
|
||||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
||||||
@Override
|
@Override
|
||||||
public void delete(String notifyId) {
|
public void delete(String notifyId) {
|
||||||
|
Logger logger = new Logger(Logger.Module.COMMON, "COMMON_NOTIFY_DELETE");
|
||||||
|
try {
|
||||||
TimiException.required(notifyId, "未找到通知 ID");
|
TimiException.required(notifyId, "未找到通知 ID");
|
||||||
TimiException.required(get(notifyId), "未找到通知");
|
TimiException.required(get(notifyId), "未找到通知");
|
||||||
List<NotifyDetail> detailList = detailService.listByNotifyId(notifyId);
|
List<NotifyDetail> detailList = detailService.listByNotifyId(notifyId);
|
||||||
@@ -159,6 +150,20 @@ public class NotifyServiceImplement extends AbstractEntityService<Notify, String
|
|||||||
detailService.delete(detail.getId());
|
detailService.delete(detail.getId());
|
||||||
}
|
}
|
||||||
super.delete(notifyId);
|
super.delete(notifyId);
|
||||||
|
logger.setLevel(Logger.Level.INFO);
|
||||||
|
logger.setResult(notifyId);
|
||||||
|
} catch (TimiException e) {
|
||||||
|
logger.setLevel(Logger.Level.WARN);
|
||||||
|
logger.setException(e.getMessage());
|
||||||
|
throw e;
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.setLevel(Logger.Level.ERROR);
|
||||||
|
logger.setException(TimiJava.serializeThrowable(e));
|
||||||
|
log.error("删除通知失败", e);
|
||||||
|
throw new TimiException(TimiCode.ERROR, "删除通知失败", e);
|
||||||
|
} finally {
|
||||||
|
loggerService.create(logger);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 取消通知中尚未成功发送的通知详情
|
/// 取消通知中尚未成功发送的通知详情
|
||||||
|
|||||||
-8
@@ -17,8 +17,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统配置服务实现
|
* 系统配置服务实现
|
||||||
@@ -55,12 +53,6 @@ public class SettingServiceImplement extends AbstractEntityService<Setting, Stri
|
|||||||
return mapper.selectAllByExample(example);
|
return mapper.selectAllByExample(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Setting> mapPublic(String bizType, String bizId, List<String> code) {
|
|
||||||
TimiException.required(bizType, "not found bizType");
|
|
||||||
return mapper.selectPublicByQuery(bizType, bizId, code).stream().collect(Collectors.toMap(Setting::getCode, Function.identity()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
@Transactional(TimiServerDBConfig.ROLLBACKER)
|
||||||
@Override
|
@Override
|
||||||
public void updateByBizId(String bizType, String bizId, List<Setting> list) {
|
public void updateByBizId(String bizType, String bizId, List<Setting> list) {
|
||||||
|
|||||||
@@ -55,5 +55,5 @@ public interface GaoCustomerMapper extends BaseMapper<GaoCustomer, String> {
|
|||||||
/// @param customerId 客户 ID
|
/// @param customerId 客户 ID
|
||||||
/// @param delta 变化量
|
/// @param delta 变化量
|
||||||
@Update("UPDATE `gao_customer` SET `invited_count` = GREATEST(IFNULL(`invited_count`, 0) + #{delta}, 0), `updated_at` = " + UNIX_TIME + " WHERE `id` = #{customerId}" + NOT_DELETE)
|
@Update("UPDATE `gao_customer` SET `invited_count` = GREATEST(IFNULL(`invited_count`, 0) + #{delta}, 0), `updated_at` = " + UNIX_TIME + " WHERE `id` = #{customerId}" + NOT_DELETE)
|
||||||
void updateInvitedCountDelta(String customerId, Long delta);
|
void updateInvitedCountDelta(@Param("customerId") String customerId, @Param("delta") Long delta);
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-3
@@ -103,17 +103,20 @@ public class GaoOrderReminderServiceImplement implements GaoOrderReminderService
|
|||||||
log.warn("GAO 订单提醒跳过不存在的店长用户: storeId[{}], userId[{}]", storeId, manager.getUserId());
|
log.warn("GAO 订单提醒跳过不存在的店长用户: storeId[{}], userId[{}]", storeId, manager.getUserId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String remindedKey = "%s:%s:%s:%s".formatted(LocalDate.now(ZoneId.of(ZONE_ID)), storeId, manager.getUserId(), reminderType);
|
String remindedId = "%s:%s:%s:%s".formatted(LocalDate.now(ZoneId.of(ZONE_ID)), storeId, manager.getUserId(), reminderType);
|
||||||
|
if (notifyService.existsByBizReminded(NOTIFY_BIZ_TYPE, reminderType, remindedId)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
long sendAt = Time.now();
|
long sendAt = Time.now();
|
||||||
Notify notify = new Notify();
|
Notify notify = new Notify();
|
||||||
notify.setBizType(NOTIFY_BIZ_TYPE);
|
notify.setBizType(NOTIFY_BIZ_TYPE);
|
||||||
notify.setBizRemindedType(reminderType);
|
notify.setBizRemindedType(reminderType);
|
||||||
notify.setBizRemindedKey(remindedKey);
|
notify.setBizRemindedId(remindedId);
|
||||||
notify.setDetailList(List.of(
|
notify.setDetailList(List.of(
|
||||||
createInternalDetail(manager.getUserId(), content, sendAt),
|
createInternalDetail(manager.getUserId(), content, sendAt),
|
||||||
createSmsDetail(user.getPhoneNo(), customerNames, action, content, sendAt)
|
createSmsDetail(user.getPhoneNo(), customerNames, action, content, sendAt)
|
||||||
));
|
));
|
||||||
notifyService.createIfAbsent(notify);
|
notifyService.create(notify);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("GAO 订单提醒发送失败: storeId[{}], userId[{}], reminderType[{}]", storeId, manager.getUserId(), reminderType, e);
|
log.error("GAO 订单提醒发送失败: storeId[{}], userId[{}], reminderType[{}]", storeId, manager.getUserId(), reminderType, e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.imyeyu.api.modules.gao.vo;
|
package com.imyeyu.api.modules.gao.vo;
|
||||||
|
|
||||||
import com.imyeyu.api.modules.gao.entity.GaoCustomer;
|
import com.imyeyu.java.bean.BasePage;
|
||||||
import com.imyeyu.spring.bean.Page;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -13,7 +12,7 @@ import java.util.List;
|
|||||||
/// @since 2026-08-13
|
/// @since 2026-08-13
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class GaoCustomerPage extends Page<GaoCustomer> {
|
public class GaoCustomerPage extends BasePage {
|
||||||
|
|
||||||
/// 门店 ID
|
/// 门店 ID
|
||||||
private String storeId;
|
private String storeId;
|
||||||
|
|||||||
@@ -1,51 +1,66 @@
|
|||||||
package com.imyeyu.api.modules.system.audit;
|
package com.imyeyu.api.modules.system.audit;
|
||||||
|
|
||||||
import com.imyeyu.api.modules.system.entity.Logger;
|
import com.imyeyu.api.modules.system.entity.Logger;
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/// 操作审计编码
|
/// 操作审计编码
|
||||||
///
|
///
|
||||||
/// @author Codex
|
/// @author Codex
|
||||||
/// @since 2026-09-09
|
/// @since 2026-09-09
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum AuditOperation {
|
public enum AuditOperation {
|
||||||
|
|
||||||
COMMON_NOTIFY_CREATE(Logger.Module.COMMON),
|
GAO_CUSTOMER_PACKAGE_PURCHASE(Logger.Module.GAO, "GAO_CUSTOMER_PACKAGE_PURCHASE"),
|
||||||
COMMON_NOTIFY_DELETE(Logger.Module.COMMON),
|
GAO_CUSTOMER_PACKAGE_CANCEL(Logger.Module.GAO, "GAO_CUSTOMER_PACKAGE_CANCEL"),
|
||||||
GAO_CUSTOMER_PACKAGE_PURCHASE(Logger.Module.GAO),
|
GAO_SALES_ORDER_PAYMENT_RECEIVE(Logger.Module.GAO, "GAO_SALES_ORDER_PAYMENT_RECEIVE"),
|
||||||
GAO_CUSTOMER_PACKAGE_CANCEL(Logger.Module.GAO),
|
GAO_SALES_ORDER_PAYMENT_VERIFY(Logger.Module.GAO, "GAO_SALES_ORDER_PAYMENT_VERIFY"),
|
||||||
GAO_SALES_ORDER_PAYMENT_RECEIVE(Logger.Module.GAO),
|
GAO_SALES_ORDER_REFUND(Logger.Module.GAO, "GAO_SALES_ORDER_REFUND"),
|
||||||
GAO_SALES_ORDER_PAYMENT_VERIFY(Logger.Module.GAO),
|
GAO_SALES_ORDER_CONFIRM_NO_REFUND(Logger.Module.GAO, "GAO_SALES_ORDER_CONFIRM_NO_REFUND"),
|
||||||
GAO_SALES_ORDER_REFUND(Logger.Module.GAO),
|
GAO_SALES_ORDER_FUND_REVOKE(Logger.Module.GAO, "GAO_SALES_ORDER_FUND_REVOKE"),
|
||||||
GAO_SALES_ORDER_CONFIRM_NO_REFUND(Logger.Module.GAO),
|
GAO_ORDER_FULFILLMENT_CREATE(Logger.Module.GAO, "GAO_ORDER_FULFILLMENT_CREATE"),
|
||||||
GAO_SALES_ORDER_FUND_REVOKE(Logger.Module.GAO),
|
GAO_ORDER_FULFILLMENT_PREPARE_STOCK(Logger.Module.GAO, "GAO_ORDER_FULFILLMENT_PREPARE_STOCK"),
|
||||||
GAO_ORDER_FULFILLMENT_CREATE(Logger.Module.GAO),
|
GAO_ORDER_FULFILLMENT_VERIFY(Logger.Module.GAO, "GAO_ORDER_FULFILLMENT_VERIFY"),
|
||||||
GAO_ORDER_FULFILLMENT_PREPARE_STOCK(Logger.Module.GAO),
|
GAO_ORDER_FULFILLMENT_REJECT(Logger.Module.GAO, "GAO_ORDER_FULFILLMENT_REJECT"),
|
||||||
GAO_ORDER_FULFILLMENT_VERIFY(Logger.Module.GAO),
|
GAO_ORDER_FULFILLMENT_CANCEL(Logger.Module.GAO, "GAO_ORDER_FULFILLMENT_CANCEL"),
|
||||||
GAO_ORDER_FULFILLMENT_REJECT(Logger.Module.GAO),
|
GAO_ORDER_FULFILLMENT_REVOKE(Logger.Module.GAO, "GAO_ORDER_FULFILLMENT_REVOKE"),
|
||||||
GAO_ORDER_FULFILLMENT_CANCEL(Logger.Module.GAO),
|
GAO_PACKAGE_CONFIG_CREATE(Logger.Module.GAO, "GAO_PACKAGE_CONFIG_CREATE"),
|
||||||
GAO_ORDER_FULFILLMENT_REVOKE(Logger.Module.GAO),
|
GAO_PACKAGE_CONFIG_UPDATE(Logger.Module.GAO, "GAO_PACKAGE_CONFIG_UPDATE"),
|
||||||
GAO_PACKAGE_CONFIG_CREATE(Logger.Module.GAO),
|
GAO_PACKAGE_CONFIG_DELETE(Logger.Module.GAO, "GAO_PACKAGE_CONFIG_DELETE"),
|
||||||
GAO_PACKAGE_CONFIG_UPDATE(Logger.Module.GAO),
|
GAO_PRODUCT_CATEGORY_SORT(Logger.Module.GAO, "GAO_PRODUCT_CATEGORY_SORT"),
|
||||||
GAO_PACKAGE_CONFIG_DELETE(Logger.Module.GAO),
|
GAO_PRODUCT_CATEGORY_CREATE(Logger.Module.GAO, "GAO_PRODUCT_CATEGORY_CREATE"),
|
||||||
GAO_PRODUCT_CATEGORY_SORT(Logger.Module.GAO),
|
GAO_PRODUCT_CATEGORY_UPDATE(Logger.Module.GAO, "GAO_PRODUCT_CATEGORY_UPDATE"),
|
||||||
GAO_PRODUCT_CATEGORY_CREATE(Logger.Module.GAO),
|
GAO_PRODUCT_CATEGORY_DISABLE(Logger.Module.GAO, "GAO_PRODUCT_CATEGORY_DISABLE"),
|
||||||
GAO_PRODUCT_CATEGORY_UPDATE(Logger.Module.GAO),
|
GAO_PRODUCT_CREATE(Logger.Module.GAO, "GAO_PRODUCT_CREATE"),
|
||||||
GAO_PRODUCT_CATEGORY_DISABLE(Logger.Module.GAO),
|
GAO_PRODUCT_UPDATE(Logger.Module.GAO, "GAO_PRODUCT_UPDATE"),
|
||||||
GAO_PRODUCT_CREATE(Logger.Module.GAO),
|
GAO_PRODUCT_DISABLE(Logger.Module.GAO, "GAO_PRODUCT_DISABLE"),
|
||||||
GAO_PRODUCT_UPDATE(Logger.Module.GAO),
|
GAO_PRODUCT_STOCK_INITIAL_IN(Logger.Module.GAO, "GAO_PRODUCT_STOCK_INITIAL_IN"),
|
||||||
GAO_PRODUCT_DISABLE(Logger.Module.GAO),
|
GAO_PRODUCT_STOCK_MANUAL_IN(Logger.Module.GAO, "GAO_PRODUCT_STOCK_MANUAL_IN"),
|
||||||
GAO_PRODUCT_STOCK_INITIAL_IN(Logger.Module.GAO),
|
GAO_PRODUCT_STOCK_MANUAL_OUT(Logger.Module.GAO, "GAO_PRODUCT_STOCK_MANUAL_OUT"),
|
||||||
GAO_PRODUCT_STOCK_MANUAL_IN(Logger.Module.GAO),
|
GAO_PRODUCT_STOCK_MANUAL_REVOKE(Logger.Module.GAO, "GAO_PRODUCT_STOCK_MANUAL_REVOKE"),
|
||||||
GAO_PRODUCT_STOCK_MANUAL_OUT(Logger.Module.GAO),
|
GAO_PRODUCT_STOCK_STOCKTAKE_GAIN(Logger.Module.GAO, "GAO_PRODUCT_STOCK_STOCKTAKE_GAIN"),
|
||||||
GAO_PRODUCT_STOCK_MANUAL_REVOKE(Logger.Module.GAO),
|
GAO_PRODUCT_STOCK_STOCKTAKE_LOSS(Logger.Module.GAO, "GAO_PRODUCT_STOCK_STOCKTAKE_LOSS"),
|
||||||
GAO_PRODUCT_STOCK_STOCKTAKE_GAIN(Logger.Module.GAO),
|
GAO_SALES_ORDER_DIRECT_PRODUCT_CREATE(Logger.Module.GAO, "GAO_SALES_ORDER_DIRECT_PRODUCT_CREATE"),
|
||||||
GAO_PRODUCT_STOCK_STOCKTAKE_LOSS(Logger.Module.GAO),
|
GAO_SALES_ORDER_UPDATE(Logger.Module.GAO, "GAO_SALES_ORDER_UPDATE"),
|
||||||
GAO_SALES_ORDER_DIRECT_PRODUCT_CREATE(Logger.Module.GAO),
|
GAO_SALES_ORDER_CANCEL(Logger.Module.GAO, "GAO_SALES_ORDER_CANCEL");
|
||||||
GAO_SALES_ORDER_UPDATE(Logger.Module.GAO),
|
|
||||||
GAO_SALES_ORDER_CANCEL(Logger.Module.GAO);
|
|
||||||
|
|
||||||
final Logger.Module module;
|
private final Logger.Module module;
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
|
||||||
|
AuditOperation(Logger.Module module, String code) {
|
||||||
|
this.module = module;
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 获取日志模块
|
||||||
|
///
|
||||||
|
/// @return 日志模块
|
||||||
|
public Logger.Module getModule() {
|
||||||
|
return module;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 获取操作编码
|
||||||
|
///
|
||||||
|
/// @return 操作编码
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.imyeyu.api.modules.system.audit;
|
package com.imyeyu.api.modules.system.audit;
|
||||||
|
|
||||||
import com.imyeyu.api.modules.system.entity.Logger;
|
import com.imyeyu.api.modules.system.entity.Logger;
|
||||||
import com.imyeyu.java.TimiJava;
|
|
||||||
import com.imyeyu.java.bean.timi.TimiException;
|
import com.imyeyu.java.bean.timi.TimiException;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -39,7 +38,7 @@ public class OperationAuditAspect {
|
|||||||
public Object around(ProceedingJoinPoint joinPoint, OperationAudit operationAudit) throws Throwable {
|
public Object around(ProceedingJoinPoint joinPoint, OperationAudit operationAudit) throws Throwable {
|
||||||
AuditOperation operation = operationAudit.value();
|
AuditOperation operation = operationAudit.value();
|
||||||
Object[] arguments = joinPoint.getArgs();
|
Object[] arguments = joinPoint.getArgs();
|
||||||
Logger logger = new Logger(operation.getModule(), operation.name());
|
Logger logger = new Logger(operation.getModule(), operation.getCode());
|
||||||
logger.setContent(payloadSerializer.serializeArguments(arguments));
|
logger.setContent(payloadSerializer.serializeArguments(arguments));
|
||||||
long startNanos = System.nanoTime();
|
long startNanos = System.nanoTime();
|
||||||
try {
|
try {
|
||||||
@@ -57,9 +56,9 @@ public class OperationAuditAspect {
|
|||||||
throw e;
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.setLevel(Logger.Level.ERROR);
|
logger.setLevel(Logger.Level.ERROR);
|
||||||
logger.setException(TimiJava.serializeThrowable(e));
|
logger.setException(serializeThrowable(e));
|
||||||
logger.setDuration(duration(startNanos));
|
logger.setDuration(duration(startNanos));
|
||||||
log.error("业务操作失败: {}", operation.name(), e);
|
log.error("业务操作失败: {}", operation.getCode(), e);
|
||||||
record(logger);
|
record(logger);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
@@ -80,4 +79,12 @@ public class OperationAuditAspect {
|
|||||||
}
|
}
|
||||||
return (int) Math.max(0L, millis);
|
return (int) Math.max(0L, millis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String serializeThrowable(Throwable throwable) {
|
||||||
|
java.io.StringWriter stringWriter = new java.io.StringWriter();
|
||||||
|
try (java.io.PrintWriter printWriter = new java.io.PrintWriter(stringWriter)) {
|
||||||
|
throwable.printStackTrace(printWriter);
|
||||||
|
}
|
||||||
|
return stringWriter.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
ALTER TABLE `notify`
|
|
||||||
CHANGE COLUMN `biz_reminded_id` `biz_reminded_key` VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '业务提醒查重键',
|
|
||||||
ADD COLUMN `biz_reminded_active_key` TINYINT(1) GENERATED ALWAYS AS (IF(`deleted_at` IS NULL, 1, NULL)) STORED COMMENT '未删除查重键' INVISIBLE AFTER `deleted_at`,
|
|
||||||
DROP INDEX `idx_biz_reminded_created`,
|
|
||||||
ADD INDEX `idx_biz_reminded_key_created`(`biz_type` ASC, `biz_reminded_type` ASC, `biz_reminded_key` ASC, `created_at` ASC) USING BTREE;
|
|
||||||
|
|
||||||
UPDATE `notify` target
|
|
||||||
INNER JOIN (
|
|
||||||
SELECT
|
|
||||||
id,
|
|
||||||
ROW_NUMBER() OVER (
|
|
||||||
PARTITION BY biz_type, biz_reminded_type, biz_reminded_key
|
|
||||||
ORDER BY created_at DESC, id DESC
|
|
||||||
) AS rn
|
|
||||||
FROM `notify`
|
|
||||||
WHERE deleted_at IS NULL
|
|
||||||
AND biz_type IS NOT NULL
|
|
||||||
AND biz_reminded_type IS NOT NULL
|
|
||||||
AND biz_reminded_key IS NOT NULL
|
|
||||||
) duplicate ON duplicate.id = target.id
|
|
||||||
SET target.deleted_at = UNIX_TIMESTAMP() * 1000
|
|
||||||
WHERE duplicate.rn > 1;
|
|
||||||
|
|
||||||
ALTER TABLE `notify`
|
|
||||||
ADD UNIQUE INDEX `uk_biz_reminded_key_active`(`biz_type` ASC, `biz_reminded_type` ASC, `biz_reminded_key` ASC, `biz_reminded_active_key` ASC) USING BTREE;
|
|
||||||
@@ -1,31 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper namespace="com.imyeyu.api.modules.common.mapper.NotifyMapper">
|
<mapper namespace="com.imyeyu.api.modules.common.mapper.NotifyMapper">
|
||||||
<insert id="insertIfAbsent">
|
|
||||||
INSERT INTO `notify` (
|
|
||||||
`id`,
|
|
||||||
`biz_type`,
|
|
||||||
`biz_reminded_type`,
|
|
||||||
`biz_reminded_key`,
|
|
||||||
`args`,
|
|
||||||
`created_by`,
|
|
||||||
`created_at`,
|
|
||||||
`updated_at`,
|
|
||||||
`deleted_at`
|
|
||||||
) VALUES (
|
|
||||||
#{id},
|
|
||||||
#{bizType},
|
|
||||||
#{bizRemindedType},
|
|
||||||
#{bizRemindedKey},
|
|
||||||
#{args},
|
|
||||||
#{createdBy},
|
|
||||||
#{createdAt},
|
|
||||||
#{updatedAt},
|
|
||||||
#{deletedAt}
|
|
||||||
)
|
|
||||||
ON DUPLICATE KEY UPDATE `id` = `id`
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<select id="selectManagementPage" resultType="com.imyeyu.api.modules.common.vo.NotifyManagementItem">
|
<select id="selectManagementPage" resultType="com.imyeyu.api.modules.common.vo.NotifyManagementItem">
|
||||||
SELECT
|
SELECT
|
||||||
n.`id`,
|
n.`id`,
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
||||||
<mapper namespace="com.imyeyu.api.modules.common.mapper.SettingMapper">
|
|
||||||
<select id="selectPublicByQuery" resultType="com.imyeyu.api.modules.common.entity.Setting">
|
|
||||||
SELECT *
|
|
||||||
FROM `setting`
|
|
||||||
WHERE `biz_type` = #{bizType}
|
|
||||||
AND `is_private` = 0
|
|
||||||
<if test="bizId != null and bizId != ''">
|
|
||||||
AND `biz_id` = #{bizId}
|
|
||||||
</if>
|
|
||||||
<if test="codeList != null and !codeList.isEmpty()">
|
|
||||||
AND `code` IN
|
|
||||||
<foreach collection="codeList" item="code" separator="," open="(" close=")">
|
|
||||||
#{code}
|
|
||||||
</foreach>
|
|
||||||
</if>
|
|
||||||
AND (`deleted_at` IS NULL OR FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000) < `deleted_at`)
|
|
||||||
</select>
|
|
||||||
</mapper>
|
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
</if>
|
</if>
|
||||||
AND `deleted_at` IS NULL
|
AND `deleted_at` IS NULL
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<sql id="queryWhere">
|
<sql id="queryWhere">
|
||||||
`c`.`deleted_at` IS NULL
|
`c`.`deleted_at` IS NULL
|
||||||
<if test="storeId != null and storeId != ''">
|
<if test="storeId != null and storeId != ''">
|
||||||
@@ -63,18 +64,7 @@
|
|||||||
FROM `gao_customer` `c`
|
FROM `gao_customer` `c`
|
||||||
WHERE
|
WHERE
|
||||||
<include refid="queryWhere"/>
|
<include refid="queryWhere"/>
|
||||||
<choose>
|
|
||||||
<when test="orderMap != null and !orderMap.isEmpty()">
|
|
||||||
ORDER BY
|
|
||||||
<foreach collection="orderMap" index="key" item="value" separator=",">
|
|
||||||
<bind name="underscoreKey" value="@com.imyeyu.utils.Text@camelCase2underscore(key)"/>
|
|
||||||
${underscoreKey} ${value}
|
|
||||||
</foreach>
|
|
||||||
</when>
|
|
||||||
<otherwise>
|
|
||||||
ORDER BY `c`.`created_at` DESC, `c`.`id` DESC
|
ORDER BY `c`.`created_at` DESC, `c`.`id` DESC
|
||||||
</otherwise>
|
|
||||||
</choose>
|
|
||||||
LIMIT #{offset}, #{limit}
|
LIMIT #{offset}, #{limit}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user