小程序接口修改、加上随机获取小知识、案例
This commit is contained in:
@ -75,4 +75,11 @@ public interface SysCustomerCaseMapper
|
||||
* @return
|
||||
*/
|
||||
public int updateWxShowByIds(@Param("wxShow")Integer wxShow, @Param("array") Long[] ids);
|
||||
|
||||
/**
|
||||
* 随机获取指定数量的客户案例
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
public List<CustomerCaseResponse> getWxCustomerCaseByRandom(@Param("pageSize")Integer pageSize);
|
||||
}
|
@ -2,6 +2,7 @@ package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.custom.domain.SysNutritionQuestion;
|
||||
import com.stdiet.custom.dto.response.NutritionQuestionResponse;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
@ -87,4 +88,12 @@ public interface SysNutritionQuestionMapper
|
||||
* @return
|
||||
*/
|
||||
public int updateWxShowByIds(@Param("wxShow")Integer wxShow, @Param("array") Long[] ids);
|
||||
|
||||
/**
|
||||
* 随机获取指定数量的营养小知识
|
||||
* @param sysNutritionQuestion
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
public List<NutritionQuestionResponse> getNutritionQuestionByRandom(SysNutritionQuestion sysNutritionQuestion, @Param("pageSize")Integer pageSize);
|
||||
}
|
@ -82,4 +82,11 @@ public interface ISysCustomerCaseService {
|
||||
*/
|
||||
int updateWxShowByIds(Integer wxShow, Long[] ids);
|
||||
|
||||
/**
|
||||
* 随机获取指定数量的客户案例
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
public List<CustomerCaseResponse> getWxCustomerCaseByRandom(Integer pageSize);
|
||||
|
||||
}
|
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.stdiet.custom.domain.SysNutritionQuestion;
|
||||
import com.stdiet.custom.dto.response.NutritionQuestionResponse;
|
||||
|
||||
/**
|
||||
* 营养知识小问答Service接口
|
||||
@ -81,4 +82,12 @@ public interface ISysNutritionQuestionService
|
||||
*/
|
||||
public int updateWxShowByIds(Integer wxShow, Long[] ids);
|
||||
|
||||
/**
|
||||
* 随机获取指定数量的营养小知识
|
||||
* @param sysNutritionQuestion
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
public List<NutritionQuestionResponse> getNutritionQuestionByRandom(SysNutritionQuestion sysNutritionQuestion, Integer pageSize);
|
||||
|
||||
}
|
@ -180,4 +180,14 @@ public class SysCustomerCaseServiceImpl implements ISysCustomerCaseService
|
||||
public int updateWxShowByIds(Integer wxShow, Long[] ids){
|
||||
return sysCustomerCaseMapper.updateWxShowByIds(wxShow, ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机获取指定数量的客户案例
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<CustomerCaseResponse> getWxCustomerCaseByRandom(Integer pageSize){
|
||||
return sysCustomerCaseMapper.getWxCustomerCaseByRandom(pageSize);
|
||||
}
|
||||
}
|
@ -326,4 +326,14 @@ public class SysNutritionQuestionServiceImpl implements ISysNutritionQuestionSer
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机获取指定数量的营养小知识
|
||||
* @param sysNutritionQuestion
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
public List<NutritionQuestionResponse> getNutritionQuestionByRandom(SysNutritionQuestion sysNutritionQuestion, Integer pageSize){
|
||||
return sysNutritionQuestionMapper.getNutritionQuestionByRandom(sysNutritionQuestion, pageSize);
|
||||
}
|
||||
}
|
@ -154,4 +154,10 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 随机获取指定数量可展示的客户案例 -->
|
||||
<select id="getWxCustomerCaseByRandom" parameterType="int" resultMap="SysCustomerCaseResponseResult">
|
||||
SELECT id, name, keyword, remark, wx_show from sys_customer_case WHERE del_flag = 0 and wx_show = 1
|
||||
and id >= ((SELECT MAX(id) FROM sys_customer_case )-(SELECT MIN(id) FROM sys_customer_case )) * RAND() + (SELECT MIN(id) FROM sys_customer_case) LIMIT #{pageSize}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -24,7 +24,6 @@
|
||||
<result property="title" column="title" />
|
||||
<result property="content" column="content" />
|
||||
<result property="key" column="key" />
|
||||
<result property="key" column="key" />
|
||||
<result property="showFlag" column="show_flag" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
@ -127,6 +126,12 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 随机获取指定数量的营养小知识 -->
|
||||
<select id="getNutritionQuestionByRandom" resultMap="SysNutritionQuestionResultExtended">
|
||||
SELECT * FROM sys_nutrition_question WHERE del_flag = 0 and show_flag = 1
|
||||
and id >= ((SELECT MAX(id) FROM sys_nutrition_question )-(SELECT MIN(id) FROM sys_nutrition_question )) * RAND() + (SELECT MIN(id) FROM sys_nutrition_question ) LIMIT #{pageSize}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user