You've already forked FrameTour-BE
feat(service): 批量获取景区和设备信息
- 在 DeviceRepository 中添加批量获取设备信息的方法 - 在 ScenicRepository 中添加批量获取景区信息的方法 - 修改 OrderServiceImpl,使用批量方法获取景区名称 - 移除多个 mapper 文件中冗余的景区信息查询
This commit is contained in:
@@ -17,6 +17,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@@ -165,4 +167,77 @@ public class DeviceRepository {
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取设备信息
|
||||
* @param deviceIds 设备ID列表
|
||||
* @return 设备ID到设备实体的映射
|
||||
*/
|
||||
public Map<Long, DeviceEntity> batchGetDevices(List<Long> deviceIds) {
|
||||
if (deviceIds == null || deviceIds.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
Map<Long, DeviceEntity> result = new HashMap<>();
|
||||
for (Long deviceId : deviceIds) {
|
||||
try {
|
||||
DeviceEntity device = getDevice(deviceId);
|
||||
if (device != null) {
|
||||
result.put(deviceId, device);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取设备信息失败: {}, 错误: {}", deviceId, e.getMessage());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量根据设备编号获取设备信息
|
||||
* @param deviceNos 设备编号列表
|
||||
* @return 设备编号到设备实体的映射
|
||||
*/
|
||||
public Map<String, DeviceEntity> batchGetDevicesByNo(List<String> deviceNos) {
|
||||
if (deviceNos == null || deviceNos.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
Map<String, DeviceEntity> result = new HashMap<>();
|
||||
for (String deviceNo : deviceNos) {
|
||||
try {
|
||||
DeviceEntity device = getDeviceByDeviceNo(deviceNo);
|
||||
if (device != null) {
|
||||
result.put(deviceNo, device);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("根据设备编号获取设备信息失败: {}, 错误: {}", deviceNo, e.getMessage());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取设备名称
|
||||
* @param deviceIds 设备ID列表
|
||||
* @return 设备ID到设备名称的映射
|
||||
*/
|
||||
public Map<Long, String> batchGetDeviceNames(List<Long> deviceIds) {
|
||||
if (deviceIds == null || deviceIds.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
Map<Long, String> result = new HashMap<>();
|
||||
for (Long deviceId : deviceIds) {
|
||||
try {
|
||||
DeviceEntity device = getDevice(deviceId);
|
||||
if (device != null) {
|
||||
result.put(deviceId, device.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("获取设备名称失败: {}, 错误: {}", deviceId, e.getMessage());
|
||||
result.put(deviceId, "未知设备");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@@ -25,6 +25,9 @@ import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class ScenicRepository {
|
||||
@@ -359,4 +362,79 @@ public class ScenicRepository {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取景区名称
|
||||
* @param scenicIds 景区ID列表
|
||||
* @return 景区ID到景区名称的映射
|
||||
*/
|
||||
public Map<Long, String> batchGetScenicNames(List<Long> scenicIds) {
|
||||
if (scenicIds == null || scenicIds.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
Map<Long, String> result = new HashMap<>();
|
||||
for (Long scenicId : scenicIds) {
|
||||
try {
|
||||
ScenicV2DTO scenic = getScenicBasic(scenicId);
|
||||
if (scenic != null) {
|
||||
result.put(scenicId, scenic.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 获取失败时使用默认值
|
||||
result.put(scenicId, "未知景区");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取景区完整信息
|
||||
* @param scenicIds 景区ID列表
|
||||
* @return 景区ID到景区实体的映射
|
||||
*/
|
||||
public Map<Long, ScenicEntity> batchGetScenics(List<Long> scenicIds) {
|
||||
if (scenicIds == null || scenicIds.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
Map<Long, ScenicEntity> result = new HashMap<>();
|
||||
for (Long scenicId : scenicIds) {
|
||||
try {
|
||||
ScenicEntity scenic = getScenic(scenicId);
|
||||
if (scenic != null) {
|
||||
result.put(scenicId, scenic);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 获取失败时记录日志但不中断处理
|
||||
System.err.println("获取景区信息失败: " + scenicId + ", 错误: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取景区基础信息DTO
|
||||
* @param scenicIds 景区ID列表
|
||||
* @return 景区ID到景区DTO的映射
|
||||
*/
|
||||
public Map<Long, ScenicV2DTO> batchGetScenicBasics(List<Long> scenicIds) {
|
||||
if (scenicIds == null || scenicIds.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
Map<Long, ScenicV2DTO> result = new HashMap<>();
|
||||
for (Long scenicId : scenicIds) {
|
||||
try {
|
||||
ScenicV2DTO scenic = getScenicBasic(scenicId);
|
||||
if (scenic != null) {
|
||||
result.put(scenicId, scenic);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 获取失败时记录日志但不中断处理
|
||||
System.err.println("获取景区基础信息失败: " + scenicId + ", 错误: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -53,6 +53,7 @@ import com.ycwl.basic.pay.adapter.IPayAdapter;
|
||||
import com.ycwl.basic.pay.entity.PayResponse;
|
||||
import com.ycwl.basic.repository.FaceRepository;
|
||||
import com.ycwl.basic.repository.PriceRepository;
|
||||
import com.ycwl.basic.repository.ScenicRepository;
|
||||
import com.ycwl.basic.repository.TemplateRepository;
|
||||
import com.ycwl.basic.repository.VideoRepository;
|
||||
import com.ycwl.basic.repository.VideoTaskRepository;
|
||||
@@ -129,6 +130,8 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Autowired
|
||||
private ScenicService scenicService;
|
||||
@Autowired
|
||||
private ScenicRepository scenicRepository;
|
||||
@Autowired
|
||||
private VideoMapper videoMapper;
|
||||
@Autowired
|
||||
private IVoucherService iVoucherService;
|
||||
@@ -139,7 +142,21 @@ public class OrderServiceImpl implements OrderService {
|
||||
public ApiResponse<PageInfo<OrderRespVO>> pageQuery(OrderReqQuery query) {
|
||||
PageHelper.startPage(query.getPageNum(), query.getPageSize());
|
||||
List<OrderRespVO> list = orderMapper.list(query);
|
||||
|
||||
// 批量获取景区名称
|
||||
List<Long> scenicIds = list.stream()
|
||||
.map(OrderRespVO::getScenicId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
Map<Long, String> scenicNames = scenicRepository.batchGetScenicNames(scenicIds);
|
||||
|
||||
list.forEach(item -> {
|
||||
// 设置景区名称
|
||||
if (item.getScenicId() != null) {
|
||||
item.setScenicName(scenicNames.get(item.getScenicId()));
|
||||
}
|
||||
|
||||
if (Integer.valueOf(-1).equals(item.getType())) {
|
||||
item.setGoodsName("一口价");
|
||||
item.setOrderType("一口价");
|
||||
@@ -181,8 +198,21 @@ public class OrderServiceImpl implements OrderService {
|
||||
public ApiResponse<PageInfo<OrderRespVO>> pageQueryDetail(OrderReqQuery query) {
|
||||
PageHelper.startPage(query.getPageNum(), query.getPageSize());
|
||||
List<OrderRespVO> list = orderMapper.listDetail(query);
|
||||
|
||||
// 批量获取景区名称
|
||||
List<Long> scenicIds = list.stream()
|
||||
.map(OrderRespVO::getScenicId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
Map<Long, String> scenicNames = scenicRepository.batchGetScenicNames(scenicIds);
|
||||
|
||||
for (OrderRespVO item : list) {
|
||||
item.setPrice(item.getPayPrice());
|
||||
// 设置景区名称
|
||||
if (item.getScenicId() != null) {
|
||||
item.setScenicName(scenicNames.get(item.getScenicId()));
|
||||
}
|
||||
}
|
||||
PageInfo<OrderRespVO> pageInfo = new PageInfo<>(list);
|
||||
return ApiResponse.success(pageInfo);
|
||||
@@ -191,8 +221,21 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Override
|
||||
public ApiResponse<List<OrderRespVO>> list(OrderReqQuery query) {
|
||||
List<OrderRespVO> list = orderMapper.list(query);
|
||||
|
||||
// 批量获取景区名称
|
||||
List<Long> scenicIds = list.stream()
|
||||
.map(OrderRespVO::getScenicId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
Map<Long, String> scenicNames = scenicRepository.batchGetScenicNames(scenicIds);
|
||||
|
||||
for (OrderRespVO item : list) {
|
||||
item.setPrice(item.getPayPrice());
|
||||
// 设置景区名称
|
||||
if (item.getScenicId() != null) {
|
||||
item.setScenicName(scenicNames.get(item.getScenicId()));
|
||||
}
|
||||
}
|
||||
return ApiResponse.success(list);
|
||||
}
|
||||
@@ -318,6 +361,18 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
});
|
||||
order.setGoodsList(goodsList);
|
||||
|
||||
// 设置景区名称
|
||||
if (order.getScenicId() != null) {
|
||||
try {
|
||||
String scenicName = scenicRepository.batchGetScenicNames(List.of(order.getScenicId()))
|
||||
.get(order.getScenicId());
|
||||
order.setScenicName(scenicName);
|
||||
} catch (Exception e) {
|
||||
log.warn("获取景区名称失败: {}", order.getScenicId(), e);
|
||||
}
|
||||
}
|
||||
|
||||
return ApiResponse.success(order);
|
||||
}
|
||||
|
||||
@@ -437,6 +492,22 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 批量获取景区名称
|
||||
List<Long> scenicIds = list.stream()
|
||||
.map(OrderAppRespVO::getScenicId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
Map<Long, String> scenicNames = scenicRepository.batchGetScenicNames(scenicIds);
|
||||
|
||||
// 设置景区名称
|
||||
list.forEach(order -> {
|
||||
if (order.getScenicId() != null) {
|
||||
order.setScenicName(scenicNames.get(order.getScenicId()));
|
||||
}
|
||||
});
|
||||
|
||||
PageInfo<OrderAppRespVO> pageInfo = new PageInfo<>(list);
|
||||
return ApiResponse.success(pageInfo);
|
||||
}
|
||||
@@ -444,6 +515,18 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Override
|
||||
public ApiResponse<OrderAppRespVO> appDetail(Long id) {
|
||||
OrderAppRespVO orderAppRespVO = orderMapper.appDetail(id);
|
||||
|
||||
// 设置景区名称
|
||||
if (orderAppRespVO != null && orderAppRespVO.getScenicId() != null) {
|
||||
try {
|
||||
String scenicName = scenicRepository.batchGetScenicNames(List.of(orderAppRespVO.getScenicId()))
|
||||
.get(orderAppRespVO.getScenicId());
|
||||
orderAppRespVO.setScenicName(scenicName);
|
||||
} catch (Exception e) {
|
||||
log.warn("获取景区名称失败: {}", orderAppRespVO.getScenicId(), e);
|
||||
}
|
||||
}
|
||||
|
||||
return ApiResponse.success(orderAppRespVO);
|
||||
}
|
||||
|
||||
@@ -484,7 +567,21 @@ public class OrderServiceImpl implements OrderService {
|
||||
public ApiResponse<PageInfo<OrderRespVO>> refundPageQuery(OrderReqQuery query) {
|
||||
PageHelper.startPage(query.getPageNum(), query.getPageSize());
|
||||
List<OrderRespVO> list = orderMapper.refundList(query);
|
||||
|
||||
// 批量获取景区名称
|
||||
List<Long> scenicIds = list.stream()
|
||||
.map(OrderRespVO::getScenicId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
Map<Long, String> scenicNames = scenicRepository.batchGetScenicNames(scenicIds);
|
||||
|
||||
list.forEach(item -> {
|
||||
// 设置景区名称
|
||||
if (item.getScenicId() != null) {
|
||||
item.setScenicName(scenicNames.get(item.getScenicId()));
|
||||
}
|
||||
|
||||
if (Integer.valueOf(-1).equals(item.getType())) {
|
||||
item.setGoodsName("一口价");
|
||||
item.setOrderType("一口价");
|
||||
|
@@ -42,7 +42,7 @@
|
||||
(select min(r.create_time) from broker_record r where r.broker_id = b.id) as first_broker_date,
|
||||
(select max(r.create_time) from broker_record r where r.broker_id = b.id) as last_broker_date,
|
||||
b.create_at, b.update_at
|
||||
from broker b left join scenic s on b.scenic_id = s.id
|
||||
from broker b
|
||||
<where>
|
||||
<if test="scenicId!= null">
|
||||
and b.scenic_id = #{scenicId}
|
||||
@@ -65,8 +65,8 @@
|
||||
</where>
|
||||
</select>
|
||||
<select id="getById" resultType="com.ycwl.basic.model.pc.broker.resp.BrokerRespVO">
|
||||
select b.id, scenic_id, s.name as scenicName, b.`name`, b.phone, b.broker_enable, b.broker_rate, b.status, b.create_at, b.update_at
|
||||
from broker b left join scenic s on b.scenic_id = s.id
|
||||
select b.id, scenic_id, b.`name`, b.phone, b.broker_enable, b.broker_rate, b.status, b.create_at, b.update_at
|
||||
from broker b
|
||||
where b.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
@@ -10,13 +10,12 @@
|
||||
</update>
|
||||
<select id="selectByQuery" resultType="com.ycwl.basic.model.pc.coupon.resp.CouponRespVO">
|
||||
SELECT
|
||||
c.id, scenic_id AS scenicId, s.name as scenicName,
|
||||
c.id, scenic_id AS scenicId,
|
||||
c.name AS name, c.description AS description, c.countdown AS countdown, c.broadcast,
|
||||
config_ids AS configIds, discount_price AS discountPrice,
|
||||
type, discount_type AS discountType,
|
||||
c.status, c.create_at
|
||||
FROM coupon c
|
||||
LEFT JOIN scenic s ON c.scenic_id = s.id
|
||||
<where>
|
||||
AND c.deleted = 0
|
||||
<if test="scenicId != null">AND scenic_id = #{scenicId}</if>
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<select id="listExtraDeviceByScenicId" resultType="com.ycwl.basic.model.pc.device.resp.DeviceRespVO">
|
||||
select d.id, d.ident as no, d.scenic_id, d.name, d.status, s.name as scenic_name
|
||||
from extra_device d
|
||||
left join scenic s on d.scenic_id = s.id
|
||||
|
||||
where d.scenic_id = #{scenicId}
|
||||
and d.status = 1
|
||||
</select>
|
||||
|
@@ -110,8 +110,7 @@
|
||||
oi.order_id AS orderId,
|
||||
oi.goods_id,
|
||||
msd.source_id,
|
||||
sc.id AS scenic_id,
|
||||
sc.name AS scenic_name,
|
||||
o.scenic_id AS scenic_id,
|
||||
CASE oi.goods_type
|
||||
WHEN '0' THEN mvd.cover_url
|
||||
WHEN '3' THEN mpd.url
|
||||
@@ -147,7 +146,6 @@
|
||||
END AS imgUrl
|
||||
FROM order_item oi
|
||||
LEFT JOIN `order` o ON oi.order_id = o.id
|
||||
LEFT JOIN scenic sc ON o.scenic_id = sc.id
|
||||
LEFT JOIN member_video_data mvd ON o.face_id = mvd.face_id AND oi.goods_id = mvd.video_id
|
||||
LEFT JOIN member_source_data msd ON o.face_id = msd.face_id AND oi.goods_id = msd.face_id AND msd.type = oi.goods_type
|
||||
LEFT JOIN member_photo_data mpd ON oi.goods_id = mpd.id AND mpd.type = oi.goods_type
|
||||
@@ -238,13 +236,12 @@
|
||||
delete from `order` where id = #{id}
|
||||
</delete>
|
||||
<select id="list" resultMap="PCBaseResultListMap">
|
||||
select o.id, o.scenic_id, s.name as scenic_name, o.member_id,m.nickname, m.uid, o.type, o.openid, o.face_id, f.face_url, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
select o.id, o.scenic_id, o.member_id,m.nickname, m.uid, o.type, o.openid, o.face_id, f.face_url, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
o.coupon_price,
|
||||
refund_reason, refund_status, o.`status`, refund_at, pay_at, cancel_at, o.create_at
|
||||
from `order` AS o
|
||||
left join face f on o.face_id = f.id
|
||||
left join member m on o.member_id = m.id
|
||||
left join scenic s on o.scenic_id = s.id
|
||||
<where>
|
||||
<if test="id!= null ">
|
||||
and o.id LIKE CONCAT('%',#{id},'%')
|
||||
@@ -312,13 +309,12 @@
|
||||
order by o.create_at desc
|
||||
</select>
|
||||
<select id="listDetail" resultMap="PCBaseResultMap">
|
||||
select o.id, o.scenic_id, s.name as scenic_name, o.member_id,m.nickname, m.uid, o.type, o.openid, o.face_id, f.face_url, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
select o.id, o.scenic_id, o.member_id,m.nickname, m.uid, o.type, o.openid, o.face_id, f.face_url, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
o.coupon_price,
|
||||
refund_reason, refund_status, o.`status`, refund_at, pay_at, cancel_at, o.create_at
|
||||
from `order` AS o
|
||||
left join face f on o.face_id = f.id
|
||||
left join member m on o.member_id = m.id
|
||||
left join scenic s on o.scenic_id = s.id
|
||||
<where>
|
||||
<if test="id!= null ">
|
||||
and o.id = #{id}
|
||||
@@ -378,14 +374,13 @@
|
||||
order by o.create_at desc
|
||||
</select>
|
||||
<select id="getById" resultMap="PCBaseResultMap">
|
||||
select o.id, o.scenic_id, s.name as scenic_name, o.member_id, o.type, o.openid, o.face_id, f.face_url, o.price, o.pay_price, o.remark, o.broker_id, o.promo_code, o.refund_reason,
|
||||
select o.id, o.scenic_id, o.member_id, o.type, o.openid, o.face_id, f.face_url, o.price, o.pay_price, o.remark, o.broker_id, o.promo_code, o.refund_reason,
|
||||
o.coupon_price,
|
||||
o.refund_status, o.status, o.create_at, o.update_at, o.pay_at, o.cancel_at, o.refund_at,
|
||||
m.nickname, m.uid
|
||||
from `order` o
|
||||
left join face f on o.face_id = f.id
|
||||
left join member m on m.id = o.member_id
|
||||
left join scenic s on o.scenic_id = s.id
|
||||
where o.id = #{id}
|
||||
</select>
|
||||
<select id="countByUserId" resultType="java.lang.Integer">
|
||||
@@ -397,10 +392,9 @@
|
||||
select o.id, o.member_id,o.openid, o.type, o.face_id, f.face_url, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
o.coupon_price,
|
||||
refund_reason, refund_status, o.`status`, o.create_at, refund_at, pay_at, cancel_at,
|
||||
sc.name scenicName
|
||||
o.scenic_id
|
||||
from `order` AS o
|
||||
left join face f on o.face_id = f.id
|
||||
left join scenic sc on o.scenic_id = sc.id
|
||||
<where>
|
||||
<if test="memberId!=null">
|
||||
and o.member_id=#{memberId}
|
||||
@@ -412,18 +406,16 @@
|
||||
select o.id, o.member_id, o.face_id,o.openid, o.type, o.price, o.slash_price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
o.coupon_price,
|
||||
refund_reason, refund_status, o.`status`, o.create_at, refund_at, pay_at, cancel_at,
|
||||
o.scenic_id, sc.name scenicName
|
||||
o.scenic_id
|
||||
from `order` AS o
|
||||
left join member m on o.member_id = m.id
|
||||
left join scenic sc on o.scenic_id = sc.id
|
||||
where o.id = #{id}
|
||||
</select>
|
||||
<select id="refundList" resultType="com.ycwl.basic.model.pc.order.resp.OrderRespVO">
|
||||
select o.id, o.scenic_id, s.name as scenic_name, o.member_id,m.nickname,m.uid as memberUid , o.type, o.openid, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
select o.id, o.scenic_id, o.member_id,m.nickname,m.uid as memberUid , o.type, o.openid, o.price, pay_price, remark, o.broker_id, o.promo_code,
|
||||
refund_reason, refund_status, o.`status`, refund_at, pay_at, cancel_at, o.create_at
|
||||
from `order` AS o
|
||||
left join member m on o.member_id = m.id
|
||||
left join scenic s on o.scenic_id = s.id
|
||||
<where>
|
||||
o.refund_status != 0
|
||||
<if test="id!= null ">
|
||||
|
@@ -34,14 +34,12 @@
|
||||
</delete>
|
||||
|
||||
<select id="getById" resultType="com.ycwl.basic.model.pc.price.resp.PriceConfigRespVO">
|
||||
select p.*, s.name as scenic_name from price_config p
|
||||
left join scenic s on s.id = p.scenic_id
|
||||
select p.* from price_config p
|
||||
where p.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="listByCondition" resultType="com.ycwl.basic.model.pc.price.resp.PriceConfigRespVO">
|
||||
select p.*, s.name as scenic_name from price_config p
|
||||
left join scenic s on s.id = p.scenic_id
|
||||
select p.* from price_config p
|
||||
<where>
|
||||
<if test="req.scenicId != null">
|
||||
and p.scenic_id = #{req.scenicId}
|
||||
|
@@ -33,44 +33,39 @@
|
||||
select * from print_task WHERE id = #{id}
|
||||
</select>
|
||||
<select id="listByScenicId" resultType="com.ycwl.basic.model.pc.printer.resp.PrinterResp">
|
||||
SELECT p.*, s.name as scenic_name
|
||||
SELECT p.*
|
||||
FROM printer p
|
||||
LEFT JOIN scenic s on s.id = p.scenic_id
|
||||
WHERE p.scenic_id = #{scenicId} and p.status = 1
|
||||
</select>
|
||||
<select id="listRelation" resultType="com.ycwl.basic.model.pc.printer.resp.MemberPrintResp">
|
||||
SELECT p.id, p.scenic_id as scenicId, s.name as scenicName, p.member_id as memberId,
|
||||
SELECT p.id, p.scenic_id as scenicId, p.member_id as memberId,
|
||||
p.orig_url as origUrl, p.crop_url as cropUrl, p.order_id as orderId, p.quantity,
|
||||
p.status, p.create_time as createTime, p.printer_id
|
||||
FROM member_print p
|
||||
LEFT JOIN scenic s ON s.id = p.scenic_id
|
||||
WHERE p.member_id = #{memberId} AND p.scenic_id = #{scenicId} AND p.status = 0
|
||||
</select>
|
||||
<select id="getUserPhoto" resultType="com.ycwl.basic.model.pc.printer.resp.MemberPrintResp">
|
||||
SELECT p.id, p.scenic_id, s.name as scenicName, p.member_id as memberId,
|
||||
SELECT p.id, p.scenic_id, p.member_id as memberId,
|
||||
p.member_id, p.orig_url as origUrl, p.crop_url as cropUrl, p.order_id as orderId, p.quantity,
|
||||
p.status, p.create_time as createTime, p.printer_id
|
||||
FROM member_print p
|
||||
LEFT JOIN scenic s ON s.id = p.scenic_id
|
||||
WHERE p.id = #{id} AND p.member_id = #{memberId} AND p.scenic_id = #{scenicId}
|
||||
</select>
|
||||
<select id="getUserPhotoByIds" resultType="com.ycwl.basic.model.pc.printer.resp.MemberPrintResp">
|
||||
SELECT p.id, p.scenic_id, s.name as scenicName, p.member_id as memberId,
|
||||
SELECT p.id, p.scenic_id, p.member_id as memberId,
|
||||
p.orig_url as origUrl, p.crop_url as cropUrl, p.order_id as orderId, p.quantity,
|
||||
p.status, p.create_time as createTime, p.printer_id
|
||||
FROM member_print p
|
||||
LEFT JOIN scenic s ON s.id = p.scenic_id
|
||||
WHERE p.id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="listRelationByOrderId" resultType="com.ycwl.basic.model.pc.printer.resp.MemberPrintResp">
|
||||
SELECT p.id, p.scenic_id as scenicId, s.name as scenicName, p.member_id as memberId,
|
||||
SELECT p.id, p.scenic_id as scenicId, p.member_id as memberId,
|
||||
p.orig_url as origUrl, p.crop_url as cropUrl, p.order_id as orderId, p.quantity,
|
||||
p.status, p.create_time as createTime, p.printer_id
|
||||
FROM member_print p
|
||||
LEFT JOIN scenic s ON s.id = p.scenic_id
|
||||
WHERE p.id in (select order_item.goods_id from order_item where order_item.order_id = #{orderId} and order_item.goods_type = 3)
|
||||
</select>
|
||||
|
||||
|
@@ -2,9 +2,9 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.ycwl.basic.profitsharing.mapper.ProfitSharingConfigMapper">
|
||||
<select id="list" resultType="com.ycwl.basic.profitsharing.dto.ProfitSharingConfigVO">
|
||||
SELECT c.*, s.name as scenic_name
|
||||
SELECT c.*
|
||||
FROM profit_sharing_config c
|
||||
left join scenic s on c.scenic_id = s.id
|
||||
|
||||
<where>
|
||||
<if test="scenicId != null">
|
||||
AND scenic_id = #{scenicId}
|
||||
|
@@ -14,9 +14,8 @@
|
||||
WHERE scenic_id = #{scenicId} AND order_id = #{orderId}
|
||||
</update>
|
||||
<select id="list" resultType="com.ycwl.basic.profitsharing.dto.ProfitSharingRecordRespVO">
|
||||
SELECT r.*, s.name as scenic_name
|
||||
SELECT r.*
|
||||
FROM profit_sharing_record r
|
||||
LEFT JOIN scenic s ON s.id = r.scenic_id
|
||||
<where>
|
||||
<if test="withDeleted != true">
|
||||
delete_time is null
|
||||
@@ -65,9 +64,8 @@
|
||||
GROUP BY order_id
|
||||
</select>
|
||||
<select id="listByOrderIds" resultType="com.ycwl.basic.profitsharing.dto.ProfitSharingRecordRespVO">
|
||||
SELECT r.*, s.name as scenic_name
|
||||
SELECT r.*
|
||||
FROM profit_sharing_record r
|
||||
LEFT JOIN scenic s ON s.id = r.scenic_id
|
||||
WHERE r.order_id IN
|
||||
<foreach collection="orderIds" item="orderId" open="(" close=")" separator=",">
|
||||
#{orderId}
|
||||
|
@@ -91,13 +91,13 @@
|
||||
select so.id, ms.scenic_id, device_id, ms.member_id, url, ms.is_free, so.create_time, so.update_time,sc.`name` as scenicName
|
||||
from member_source ms
|
||||
left join source so on ms.source_id = so.id
|
||||
left join scenic sc on sc.id = so.scenic_id
|
||||
|
||||
where so.id = #{id} and ms.member_id = #{userId} and so.id is not null
|
||||
</select>
|
||||
<select id="getById" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
||||
select so.id, scenic_id, device_id, url, video_url, so.create_time, so.update_time,sc.`name` as scenicName
|
||||
from source so
|
||||
left join scenic sc on sc.id = so.scenic_id
|
||||
|
||||
where so.id = #{id}
|
||||
</select>
|
||||
<select id="listGroupByType" resultType="com.ycwl.basic.model.pc.source.resp.SourceRespVO">
|
||||
@@ -141,7 +141,7 @@
|
||||
select so.id, ms.scenic_id, device_id, url, ms.is_free, so.create_time, so.update_time,sc.`name` as scenicName, ms.is_buy, video_url
|
||||
from member_source ms
|
||||
left join source so on ms.source_id = so.id
|
||||
left join scenic sc on sc.id = so.scenic_id
|
||||
|
||||
where
|
||||
ms.member_id = #{memberId} and so.id is not null
|
||||
<if test="scenicId!= null">and ms.scenic_id = #{scenicId} </if>
|
||||
@@ -155,7 +155,7 @@
|
||||
select so.id, ms.scenic_id, device_id, url, ms.is_free, video_url, so.create_time, so.update_time,sc.`name` as scenicName, ms.is_buy
|
||||
from member_source ms
|
||||
left join source so on ms.source_id = so.id
|
||||
left join scenic sc on sc.id = so.scenic_id
|
||||
|
||||
where ms.member_id = #{userId} and ms.source_id = #{sourceId} and so.id is not null
|
||||
limit 1
|
||||
</select>
|
||||
@@ -163,7 +163,7 @@
|
||||
select so.id, ms.face_id, ms.scenic_id, ms.type, so.url, ms.is_free, so.create_time, so.update_time,sc.`name` as scenicName, ms.is_buy
|
||||
from member_source ms
|
||||
left join source so on ms.source_id = so.id
|
||||
left join scenic sc on sc.id = so.scenic_id
|
||||
|
||||
where
|
||||
ms.member_id = #{memberId} and so.id
|
||||
<if test="faceId!= null">and ms.face_id = #{faceId} </if>
|
||||
|
@@ -76,8 +76,8 @@
|
||||
delete from template_config where id = #{id}
|
||||
</delete>
|
||||
<select id="list" resultType="com.ycwl.basic.model.pc.template.resp.TemplateRespVO">
|
||||
select t.*, s.name as scenic_name
|
||||
from template t left join scenic s on s.id = t.scenic_id
|
||||
select t.*
|
||||
from template t
|
||||
<where>
|
||||
pid = 0
|
||||
<if test="scenicId!=null" >
|
||||
@@ -93,13 +93,13 @@
|
||||
order by scenic_id, sort
|
||||
</select>
|
||||
<select id="getById" resultType="com.ycwl.basic.model.pc.template.resp.TemplateRespVO">
|
||||
select t.*, s.name as scenic_name
|
||||
from template t left join scenic s on s.id = t.scenic_id
|
||||
select t.*
|
||||
from template t
|
||||
where t.id = #{id}
|
||||
</select>
|
||||
<select id="getByPid" resultType="com.ycwl.basic.model.pc.template.resp.TemplateRespVO">
|
||||
select t.*, s.name as scenic_name
|
||||
from template t left join scenic s on s.id = t.scenic_id
|
||||
select t.*
|
||||
from template t
|
||||
where pid = #{id}
|
||||
order by sort
|
||||
</select>
|
||||
@@ -113,10 +113,10 @@
|
||||
order by sort
|
||||
</select>
|
||||
<select id="listFor" resultType="com.ycwl.basic.model.mobile.scenic.content.ContentPageVO">
|
||||
select t.id templateId, t.scenic_id, s.name as scenic_name, t.`name`, pid, t.cover_url templateCoverUrl,
|
||||
select t.id templateId, t.scenic_id, t.`name`, pid, t.cover_url templateCoverUrl,
|
||||
0 as sourceType, sort,
|
||||
t.create_time, t.price
|
||||
from template t left join scenic s on s.id = t.scenic_id
|
||||
from template t
|
||||
where t.scenic_id = #{scenicId} and pid = 0 and t.status = 1
|
||||
order by sort
|
||||
</select>
|
||||
|
@@ -77,9 +77,8 @@
|
||||
</delete>
|
||||
<select id="list" resultType="com.ycwl.basic.model.pc.video.resp.VideoRespVO">
|
||||
select v.id, v.scenic_id, template_id, task_id, worker_id, video_url, v.create_time, v.update_time,
|
||||
s.name scenicName, s.latitude, s.longitude, t.name templateName, t.price templatePrice,t.cover_url templateCoverUrl
|
||||
t.name templateName, t.price templatePrice,t.cover_url templateCoverUrl
|
||||
from video v
|
||||
left join scenic s on s.id = v.scenic_id
|
||||
left join template t on v.template_id = t.id
|
||||
<where>
|
||||
<if test="scenicId!= null">and v.scenic_id = #{scenicId} </if>
|
||||
@@ -99,9 +98,8 @@
|
||||
<select id="getById" resultType="com.ycwl.basic.model.pc.video.resp.VideoRespVO">
|
||||
select v.id, v.scenic_id, template_id, task_id, worker_id, video_url, v.create_time, v.update_time,
|
||||
t.name templateName,t.price templatePrice, t.cover_url templateCoverUrl, t.slash_price slashPrice,
|
||||
s.name scenicName, v.height, v.width, v.duration
|
||||
v.height, v.width, v.duration
|
||||
from video v
|
||||
left join scenic s on v.scenic_id = s.id
|
||||
left join template t on v.template_id = t.id
|
||||
where v.id = #{id}
|
||||
</select>
|
||||
@@ -110,10 +108,9 @@
|
||||
</select>
|
||||
<select id="queryByRelation" resultType="com.ycwl.basic.model.pc.video.resp.VideoRespVO">
|
||||
select v.id, mv.scenic_id, v.template_id, mv.task_id, mv.face_id, worker_id, video_url, v.create_time, v.update_time,
|
||||
s.name scenicName, t.name templateName, t.price templatePrice,t.cover_url templateCoverUrl, mv.is_buy
|
||||
t.name templateName, t.price templatePrice,t.cover_url templateCoverUrl, mv.is_buy
|
||||
from member_video mv
|
||||
left join video v on mv.video_id = v.id
|
||||
left join scenic s on s.id = v.scenic_id
|
||||
left join template t on mv.template_id = t.id
|
||||
<where>
|
||||
<if test="scenicId!= null">and mv.scenic_id = #{scenicId} </if>
|
||||
|
Reference in New Issue
Block a user