Browse Source

Merge branch 'refs/heads/ljl' into hqz

hqz
huangqizhen 3 weeks ago
parent
commit
919f81cabb
  1. 1
      src/main/java/com/example/demo/controller/ActivityController.java
  2. 5
      src/main/java/com/example/demo/controller/ProductController.java
  3. 2
      src/main/java/com/example/demo/mapper/ActivityMapper.java
  4. 3
      src/main/java/com/example/demo/mapper/ProductMapper.java
  5. 4
      src/main/java/com/example/demo/serviceImpl/ActivityServiceImpl.java
  6. 5
      src/main/java/com/example/demo/serviceImpl/ProductServiceImpl.java
  7. 3
      src/main/java/com/example/demo/sevice/ProductService.java
  8. 11
      src/main/resources/mapper/ConsumeMapper.xml
  9. 5
      src/main/resources/mapper/ProductMapper.xml

1
src/main/java/com/example/demo/controller/ActivityController.java

@ -55,6 +55,7 @@ public class ActivityController {
Integer pageSize=page.getPageSize(); Integer pageSize=page.getPageSize();
Activity activity= page.getActivity(); Activity activity= page.getActivity();
if (ObjectUtils.isEmpty(pageNum)){ if (ObjectUtils.isEmpty(pageNum)){
return Result.success(activityService.search(activity)); return Result.success(activityService.search(activity));
} }
return Result.success(activityService.searchForPage(pageNum,pageSize,activity)); return Result.success(activityService.searchForPage(pageNum,pageSize,activity));

5
src/main/java/com/example/demo/controller/ProductController.java

@ -20,6 +20,11 @@ public class ProductController {
public Result Product(@RequestBody Product product){ public Result Product(@RequestBody Product product){
return Result.success(productService.findAll(product)); return Result.success(productService.findAll(product));
} }
// 所有消费明细---获取商品名
@PostMapping("/findProductName")
public Result getProductName(){
return Result.success(productService.findAllProductName());
}
@PostMapping("/add") @PostMapping("/add")
public Result add(@RequestBody Product product){ public Result add(@RequestBody Product product){
return Result.success(productService.add(product)); return Result.success(productService.add(product));

2
src/main/java/com/example/demo/mapper/ActivityMapper.java

@ -49,7 +49,7 @@ public interface ActivityMapper {
//模糊查询--根据活动id查询活动信息 //模糊查询--根据活动id查询活动信息
@Select({ @Select({
"<script>", "<script>",
"SELECT activity.*, admin.name FROM activity",
"SELECT activity.*, admin.name FROM activity",
"INNER JOIN admin ON activity.admin_id = admin.admin_id", "INNER JOIN admin ON activity.admin_id = admin.admin_id",
"<where>", "<where>",
"activity.activity_flag = 1", "activity.activity_flag = 1",

3
src/main/java/com/example/demo/mapper/ProductMapper.java

@ -19,4 +19,7 @@ public interface ProductMapper {
"select * from product" "select * from product"
}) })
public List<Product> findAll(Product product); public List<Product> findAll(Product product);
// 查询消费表的所有商品名称
List<String> findAllProductName();
} }

4
src/main/java/com/example/demo/serviceImpl/ActivityServiceImpl.java

@ -62,9 +62,9 @@ public class ActivityServiceImpl implements ActivityService {
Date endTime = activity1.getEndTime(); Date endTime = activity1.getEndTime();
// 使用 Date 类的 before after 方法进行比较 // 使用 Date 类的 before after 方法进行比较
if (nowDate.before(startTime)) {
if (startTime != null &&nowDate.before(startTime)) {
activity1.setStatus(0); // 设置状态为 0 activity1.setStatus(0); // 设置状态为 0
} else if (nowDate.after(endTime)) {
} else if (endTime != null &&nowDate.after(endTime)) {
activity1.setStatus(2); // 设置状态为 2 activity1.setStatus(2); // 设置状态为 2
} else { } else {
activity1.setStatus(1); // 设置状态为 1 activity1.setStatus(1); // 设置状态为 1

5
src/main/java/com/example/demo/serviceImpl/ProductServiceImpl.java

@ -32,4 +32,9 @@ public class ProductServiceImpl implements ProductService {
public List<Index> findIndex(Index index) { public List<Index> findIndex(Index index) {
return productMapper.findIndex(index); return productMapper.findIndex(index);
} }
@Override
public List<String> findAllProductName() {
return productMapper.findAllProductName();
}
} }

3
src/main/java/com/example/demo/sevice/ProductService.java

@ -10,4 +10,7 @@ public interface ProductService {
int add(Product product); int add(Product product);
List<Product> findAll(Product product); List<Product> findAll(Product product);
List<Index> findIndex(Index index); List<Index> findIndex(Index index);
//查询 消费表的商品名
List<String> findAllProductName();
} }

11
src/main/resources/mapper/ConsumeMapper.xml

@ -10,11 +10,10 @@
sum(recharge_coin) as SumRcion, sum(recharge_coin) as SumRcion,
sum(recharge_coin+free_coin+task_coin) as Sumcion sum(recharge_coin+free_coin+task_coin) as Sumcion
from detail_y from detail_y
left join product on detail_y.product_id= product.product_id
<where> <where>
update_type = '1' update_type = '1'
<if test='jwcode!=null and jwcode.length>0'>and detail_y.jwcode =#{jwcode}</if> <if test='jwcode!=null and jwcode.length>0'>and detail_y.jwcode =#{jwcode}</if>
<if test='productName!=null and productName.length>0'>and product.name = #{productName}</if>
<if test='productName!=null and productName.length>0'>and detail_y.product_name = #{productName}</if>
<if test='consumePlatform!=null and consumePlatform.length>0'>and detail_y.consume_platform=#{consumePlatform}</if> <if test='consumePlatform!=null and consumePlatform.length>0'>and detail_y.consume_platform=#{consumePlatform}</if>
<if test='consumeType!=null and consumeType.length>0'>and detail_y.consume_type= #{consumeType}</if> <if test='consumeType!=null and consumeType.length>0'>and detail_y.consume_type= #{consumeType}</if>
<if test='startDate != null and endDate != null'>AND detail_y.create_time BETWEEN #{startDate} AND #{endDate}</if> <if test='startDate != null and endDate != null'>AND detail_y.create_time BETWEEN #{startDate} AND #{endDate}</if>
@ -30,19 +29,19 @@
<select id="select" resultType="com.example.demo.domain.vo.ConsumeDetail"> <select id="select" resultType="com.example.demo.domain.vo.ConsumeDetail">
SELECT SELECT
detail_y.*, detail_y.*,
admin.name AS adminName,
product.name AS productName
admin.name AS adminName
FROM detail_y FROM detail_y
LEFT JOIN `admin` ON detail_y.admin_id = admin.admin_id LEFT JOIN `admin` ON detail_y.admin_id = admin.admin_id
LEFT JOIN `user` ON detail_y.jwcode = user.jwcode LEFT JOIN `user` ON detail_y.jwcode = user.jwcode
LEFT JOIN product ON detail_y.product_id = product.product_id
<where> <where>
update_type = 1 update_type = 1
<if test='jwcode != null'> <if test='jwcode != null'>
AND detail_y.jwcode = #{jwcode} AND detail_y.jwcode = #{jwcode}
</if> </if>
<if test='productName != null and productName.length > 0'> <if test='productName != null and productName.length > 0'>
AND product.name = #{productName}
AND detail_y.product_name = #{productName}
</if> </if>
<if test='consumePlatform != null and consumePlatform.length > 0'> <if test='consumePlatform != null and consumePlatform.length > 0'>
AND detail_y.consume_platform = #{consumePlatform} AND detail_y.consume_platform = #{consumePlatform}

5
src/main/resources/mapper/ProductMapper.xml

@ -10,4 +10,9 @@
<select id="findIndex" resultType="com.example.demo.domain.entity.Index"> <select id="findIndex" resultType="com.example.demo.domain.entity.Index">
SELECT * FROM `index` WHERE type = #{type} SELECT * FROM `index` WHERE type = #{type}
</select> </select>
<!--查询消费表的商品名-->
<select id="findAllProductName" resultType="java.lang.String">
select DISTINCT product_name from detail_y where product_name is not null and update_type = 1
</select>
</mapper> </mapper>
Loading…
Cancel
Save