feat:预炸
This commit is contained in:
@@ -2,6 +2,7 @@ package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.entity.PreFriedProductsDO;
|
||||
import com.cool.store.mapper.PreFriedProductsMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -28,6 +29,14 @@ public class PreFriedProductsDAO {
|
||||
return preFriedProductsMapper.forceUpdate(product);
|
||||
}
|
||||
|
||||
public List<PreFriedProductsDO> selectByProductIds( List<Long> productIds) {
|
||||
if (CollectionUtils.isEmpty(productIds)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return preFriedProductsMapper.selectByProductIds(productIds);
|
||||
}
|
||||
|
||||
|
||||
public PreFriedProductsDO queryById(Long id){
|
||||
return preFriedProductsMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dto.pre.fry.DailyFryCountDTO;
|
||||
import com.cool.store.entity.PreFryRecordsDO;
|
||||
import com.cool.store.mapper.PreFryRecordsMapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -8,6 +9,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -48,7 +50,7 @@ public class PreFryRecordsDAO {
|
||||
}
|
||||
|
||||
|
||||
int batchUpdateStageByIds( List<Integer> ids,
|
||||
public int batchUpdateStageByIds( List<Long> ids,
|
||||
Integer currentStage){
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return CommonConstants.ZERO;
|
||||
@@ -56,13 +58,20 @@ public class PreFryRecordsDAO {
|
||||
return preFryRecordsMapper.batchUpdateStageByIds(ids,currentStage);
|
||||
}
|
||||
|
||||
List<PreFryRecordsDO> selectByStoreAndDateStage(String storeCode,
|
||||
List<Integer> yesterdayStageList,
|
||||
Integer todayStage){
|
||||
public List<PreFryRecordsDO> selectByStoreAndDateStage(String storeCode,
|
||||
List<Integer> yesterdayStageList,
|
||||
Integer todayStage, String queryDate){
|
||||
if (StringUtils.isBlank(storeCode) || CollectionUtils.isEmpty(yesterdayStageList)) {
|
||||
return null;
|
||||
}
|
||||
return preFryRecordsMapper.selectByStoreAndDateStage(storeCode,yesterdayStageList,todayStage);
|
||||
return preFryRecordsMapper.selectByStoreAndDateStage(storeCode,yesterdayStageList,todayStage,queryDate);
|
||||
}
|
||||
|
||||
public List<DailyFryCountDTO> selectDailyFryCountInCurrentMonth(String storeCode,Long time) {
|
||||
if (StringUtils.isEmpty(storeCode)) {
|
||||
return null;
|
||||
}
|
||||
return preFryRecordsMapper.selectDailyFryCountInCurrentMonth(storeCode,time);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,14 +31,19 @@ public class PreFryStageChangesDAO {
|
||||
}
|
||||
|
||||
|
||||
public List<PreFryStageImagesDTO> selectByRecordId( Integer recordId){
|
||||
public List<PreFryStageImagesDTO> selectByRecordId( Long recordId){
|
||||
if (recordId == null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return preFryStageChangesMapper.selectByRecordId(recordId);
|
||||
}
|
||||
|
||||
|
||||
public List<PreFryStageImagesDTO> selectByRecordIdList( List<Long> recordIdList){
|
||||
if (recordIdList == null){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return preFryStageChangesMapper.selectByRecordIdList(recordIdList);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -47,5 +47,7 @@ public interface PreFriedProductsMapper extends Mapper<PreFriedProductsDO> {
|
||||
*/
|
||||
int forceUpdate(@Param("product") PreFriedProductsDO product);
|
||||
|
||||
List<PreFriedProductsDO> selectByProductIds(@Param("productIds") List<Long> productIds);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,22 +1,27 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.dto.pre.fry.DailyFryCountDTO;
|
||||
import com.cool.store.entity.PreFryRecordsDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface PreFryRecordsMapper extends Mapper<PreFryRecordsDO> {
|
||||
|
||||
int batchInsert(List<PreFryRecordsDO> records);
|
||||
|
||||
int batchUpdateStageByIds(@Param("ids") List<Integer> ids,
|
||||
int batchUpdateStageByIds(@Param("ids") List<Long> ids,
|
||||
@Param("currentStage") Integer currentStage);
|
||||
|
||||
List<PreFryRecordsDO> selectByStoreAndDateStage(
|
||||
@Param("storeCode") String storeCode,
|
||||
@Param("yesterdayStageList") List<Integer> yesterdayStageList,
|
||||
@Param("todayStage") Integer todayStage);
|
||||
@Param("todayStage") Integer todayStage,
|
||||
@Param("queryDate") String queryDate);
|
||||
|
||||
|
||||
List<DailyFryCountDTO> selectDailyFryCountInCurrentMonth(
|
||||
@Param("storeCode") String storeCode,@Param("time") Long time);
|
||||
}
|
||||
@@ -12,7 +12,8 @@ public interface PreFryStageChangesMapper extends Mapper<PreFryStageChangesDO> {
|
||||
|
||||
int batchInsert(List<PreFryStageChangesDO> records);
|
||||
|
||||
List<PreFryStageImagesDTO> selectByRecordId(@Param("recordId") Integer recordId);
|
||||
List<PreFryStageImagesDTO> selectByRecordId(@Param("recordId") Long recordId);
|
||||
|
||||
List<PreFryStageImagesDTO> selectByRecordIdList(@Param("recordIdList") List<Long> recordIdList);
|
||||
|
||||
}
|
||||
@@ -59,6 +59,14 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="selectByProductIds" resultMap="BaseResultMap">
|
||||
SELECT * FROM xfsg_pre_fried_products where deleted = 0
|
||||
and id IN
|
||||
<foreach collection="productIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<update id="forceUpdate">
|
||||
UPDATE xfsg_pre_fried_products
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
-->
|
||||
<id column="id" jdbcType="INTEGER" property="id" />
|
||||
<result column="store_code" jdbcType="VARCHAR" property="storeCode" />
|
||||
<result column="product_code" jdbcType="INTEGER" property="productId" />
|
||||
<result column="product_id" jdbcType="INTEGER" property="productId" />
|
||||
<result column="record_code" jdbcType="VARCHAR" property="recordCode" />
|
||||
<result column="fry_date" jdbcType="DATE" property="fryDate" />
|
||||
<result column="fry_complete_time" jdbcType="TIMESTAMP" property="fryCompleteTime" />
|
||||
<result column="latest_sale_time" jdbcType="TIMESTAMP" property="latestSaleTime" />
|
||||
@@ -44,16 +45,28 @@
|
||||
SELECT * FROM xfsg_pre_fry_records
|
||||
WHERE store_code = #{storeCode}
|
||||
AND (
|
||||
(fry_date = DATE_SUB(CURDATE(), INTERVAL 1 DAY)
|
||||
(fry_date = DATE_SUB(#{queryDate}, INTERVAL 1 DAY)
|
||||
AND current_stage IN
|
||||
<foreach collection="yesterdayStageList" item="stage" open="(" separator="," close=")">
|
||||
#{stage}
|
||||
</foreach>)
|
||||
OR
|
||||
(fry_date = CURDATE() AND current_stage = #{todayStage})
|
||||
(fry_date = #{queryDate} AND current_stage = #{todayStage})
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="selectDailyFryCountInCurrentMonth" resultType="com.cool.store.dto.pre.fry.DailyFryCountDTO">
|
||||
SELECT
|
||||
fry_date as fryDate,
|
||||
COUNT(*) as count
|
||||
FROM xfsg_pre_fry_records
|
||||
WHERE store_code = #{storeCode}
|
||||
AND fry_date BETWEEN DATE_FORMAT(FROM_UNIXTIME(#{timestamp}/1000), '%Y-%m-01')
|
||||
AND LAST_DAY(FROM_UNIXTIME(#{timestamp}/1000)
|
||||
GROUP BY fry_date
|
||||
ORDER BY fry_date
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -34,6 +34,18 @@
|
||||
WHERE record_id = #{recordId}
|
||||
ORDER BY created_time DESC
|
||||
</select>
|
||||
<select id="selectByRecordIdList" resultType="com.cool.store.dto.pre.fry.PreFryStageImagesDTO">
|
||||
SELECT id, record_id, image1, image2, created_time,stage
|
||||
FROM xfsg_pre_fry_stage_changes
|
||||
<where>
|
||||
and record_id in
|
||||
<foreach collection="recordIdList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</where>
|
||||
ORDER BY created_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user