feat
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
package com.central.order.controller;
|
||||
|
||||
import com.central.common.model.Result;
|
||||
import com.central.order.model.PackagePlan;
|
||||
import com.central.order.service.IPackagePlanService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Tag(name = "套餐管理")
|
||||
@RequestMapping("/package")
|
||||
public class PackagePlanController {
|
||||
|
||||
@Autowired
|
||||
private IPackagePlanService packagePlanService;
|
||||
|
||||
@Operation(summary = "根据二维码编码获取套餐内容")
|
||||
@GetMapping("/byCode/{codeId}")
|
||||
public Result<List<PackagePlan>> getByCode(@PathVariable("codeId") String codeId) {
|
||||
List<PackagePlan> list = packagePlanService.getByCodeId(codeId);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return Result.succeed(list, "暂无数据");
|
||||
}
|
||||
return Result.succeed(list, "获取成功");
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.central.order.mapper;
|
||||
|
||||
import com.central.db.mapper.SuperMapper;
|
||||
import com.central.order.model.PackagePlan;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PackagePlanMapper extends SuperMapper<PackagePlan> {
|
||||
|
||||
/**
|
||||
* 根据二维码编码查询套餐列表
|
||||
*/
|
||||
List<PackagePlan> findByCodeId(@Param("codeId") String codeId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.central.order.model;
|
||||
|
||||
public class PackagePlan {
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.central.order.service;
|
||||
|
||||
import com.central.common.service.ISuperService;
|
||||
import com.central.order.model.PackagePlan;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 套餐服务
|
||||
*/
|
||||
public interface IPackagePlanService extends ISuperService<PackagePlan> {
|
||||
/**
|
||||
* 根据二维码编码查询套餐列表
|
||||
*/
|
||||
List<PackagePlan> getByCodeId(String codeId);
|
||||
}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.central.order.service.impl;
|
||||
|
||||
import com.central.common.service.impl.SuperServiceImpl;
|
||||
import com.central.order.mapper.PackagePlanMapper;
|
||||
import com.central.order.model.PackagePlan;
|
||||
import com.central.order.service.IPackagePlanService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class PackagePlanServiceImpl extends SuperServiceImpl<PackagePlanMapper, PackagePlan> implements IPackagePlanService {
|
||||
|
||||
@Override
|
||||
public List<PackagePlan> getByCodeId(String codeId) {
|
||||
return baseMapper.findByCodeId(codeId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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.central.order.mapper.PackagePlanMapper">
|
||||
|
||||
<resultMap id="PackagePlanResultMap" type="com.central.order.model.PackagePlan">
|
||||
</resultMap>
|
||||
|
||||
<select id="findByCodeId" resultMap="PackagePlanResultMap">
|
||||
SELECT *
|
||||
FROM packages
|
||||
WHERE code_id = #{codeId}
|
||||
AND (is_del IS NULL OR is_del = 0)
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user