Commit 3c17117a by huluobin

色系

parent f8335eec
......@@ -55,7 +55,7 @@ public class BaseProduceServiceImpl extends ServiceImpl<BaseProduceMapper, BaseP
//排序条件 1-saleNum 2-index_sort
Integer sort = baseFeatures != null && baseFeatures.getName().equals("热销款") ? 1 : 2;
page = baseProduceMapper.queryProducePage(page, featuresId, serveTypeId, sort);
page = baseProduceMapper.queryProducePage(page, colorSystemId, featuresId, serveTypeId, sort);
List<Integer> produceIds = page.getRecords().stream().map(BaseProduce::getId).collect(Collectors.toList());
......
......@@ -7,6 +7,7 @@ import com.gogirl.domain.product.serve.ColorSystem;
import com.gogirl.infrastructure.mapper.product.serve.ColorSystemMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
......@@ -20,9 +21,16 @@ import java.util.List;
@Service
public class ColorSystemServiceImpl extends ServiceImpl<ColorSystemMapper, ColorSystem> implements IColorSystemService {
@Resource
ColorSystemMapper colorSystemMapper;
@Override
public List<ColorSystem> query(Integer id) {
return this.list(new LambdaQueryWrapper<ColorSystem>().eq(ColorSystem::getPid, id));
if (id == 0) {
return this.list(new LambdaQueryWrapper<ColorSystem>()
.eq(ColorSystem::getPid, id));
}
return colorSystemMapper.listByPid(id);
}
}
......@@ -42,6 +42,7 @@ public interface BaseProduceMapper extends BaseMapper<BaseProduce> {
* @return
*/
IPage<BaseProduce> queryProducePage(IPage<BaseProduce> page,
@Param("colorSystemId") Integer colorSystemId,
@Param("featuresId") Integer featuresId,
@Param("serveTypeId") Integer serveTypeId,
@Param("sort") Integer sort);
......
......@@ -3,6 +3,8 @@ package com.gogirl.infrastructure.mapper.product.serve;
import com.gogirl.domain.product.serve.ColorSystem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* <p>
* 色系 Mapper 接口
......@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface ColorSystemMapper extends BaseMapper<ColorSystem> {
List<ColorSystem> listByPid(Integer id);
}
......@@ -2,4 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gogirl.infrastructure.mapper.product.serve.ColorSystemMapper">
<select id="listByPid" resultType="com.gogirl.domain.product.serve.ColorSystem">
select *
from color_system t1
left join color_system_product_map t2 on t1.id = t2.color_system_id
group by t1.id
having count(t1.id) > 0
</select>
</mapper>
......@@ -138,6 +138,9 @@
<if test="featuresId !=null ">
left join features_mapping t2 on t1.id =t2.data_id and t2.data_type =2
</if>
<if test="colorSystemId !=null ">
left join color_system_product_map t3 on t1.id = t3.product_id
</if>
where t1.has_index_show =1
<if test="featuresId !=null ">
and t2.features_id=#{featuresId}
......@@ -145,6 +148,9 @@
<if test="serveTypeId !=null ">
and t1.serve_type_id = #{serveTypeId}
</if>
<if test="colorSystemId !=null ">
and t3.color_system_id =#{colorSystemId}
</if>
<choose>
<when test="sort == 1 ">
order by t1.sales_num desc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment