feat:预炸
This commit is contained in:
@@ -4,6 +4,7 @@ import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dto.pre.fry.DailyFryCountDTO;
|
||||
import com.cool.store.dto.pre.fry.PreFryRecordQueryDTO;
|
||||
import com.cool.store.dto.pre.fry.PreFryRecordsDTO;
|
||||
import com.cool.store.dto.pre.fry.ViolationDTO;
|
||||
import com.cool.store.entity.PreFryRecordsDO;
|
||||
import com.cool.store.mapper.PreFryRecordsMapper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@@ -11,6 +12,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -51,6 +53,13 @@ public class PreFryRecordsDAO {
|
||||
return preFryRecordsMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public List<PreFryRecordsDO> queryByIds(List<Long> ids) {
|
||||
if (CollectionUtils.isEmpty(ids)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return preFryRecordsMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
public int batchUpdateStageByIds( List<Long> ids,
|
||||
Integer currentStage){
|
||||
@@ -81,7 +90,12 @@ public class PreFryRecordsDAO {
|
||||
return preFryRecordsMapper.selectByQueryDTO(dto);
|
||||
}
|
||||
|
||||
|
||||
public void batchUpdateViolation(List<ViolationDTO> violationList) {
|
||||
if (CollectionUtils.isEmpty(violationList)){
|
||||
return;
|
||||
}
|
||||
preFryRecordsMapper.batchUpdateViolation(violationList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.cool.store.mapper;
|
||||
import com.cool.store.dto.pre.fry.DailyFryCountDTO;
|
||||
import com.cool.store.dto.pre.fry.PreFryRecordQueryDTO;
|
||||
import com.cool.store.dto.pre.fry.PreFryRecordsDTO;
|
||||
import com.cool.store.dto.pre.fry.ViolationDTO;
|
||||
import com.cool.store.entity.PreFryRecordsDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import tk.mybatis.mapper.common.Mapper;
|
||||
@@ -17,6 +18,8 @@ public interface PreFryRecordsMapper extends Mapper<PreFryRecordsDO> {
|
||||
int batchUpdateStageByIds(@Param("ids") List<Long> ids,
|
||||
@Param("currentStage") Integer currentStage);
|
||||
|
||||
List<PreFryRecordsDO> selectByIds(@Param("ids") List<Long> ids);
|
||||
|
||||
List<PreFryRecordsDO> selectByStoreAndDateStage(
|
||||
@Param("storeCode") String storeCode,
|
||||
@Param("yesterdayStageList") List<Integer> yesterdayStageList,
|
||||
@@ -29,6 +32,6 @@ public interface PreFryRecordsMapper extends Mapper<PreFryRecordsDO> {
|
||||
|
||||
List<PreFryRecordsDTO> selectByQueryDTO(@Param("query") PreFryRecordQueryDTO dto);
|
||||
|
||||
|
||||
void batchUpdateViolation(@Param("list") List<ViolationDTO> violationList);
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
<result column="current_stage" jdbcType="TINYINT" property="currentStage" />
|
||||
<result column="current_apply_type" jdbcType="TINYINT" property="currentApplyType" />
|
||||
<result column="violation_flag" jdbcType="TINYINT" property="violationFlag" />
|
||||
<result column="violation_reason" jdbcType="TINYINT" property="violationReason" />
|
||||
<result column="violation_reason" jdbcType="VARCHAR" property="violationReason" />
|
||||
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
|
||||
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
|
||||
</resultMap>
|
||||
@@ -43,6 +43,16 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="selectByIds" resultMap="BaseResultMap">
|
||||
SELECT * FROM xfsg_pre_fry_records
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
ORDER BY created_time DESC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectByStoreAndDateStage" resultMap="BaseResultMap">
|
||||
SELECT * FROM xfsg_pre_fry_records
|
||||
WHERE store_code = #{storeCode}
|
||||
@@ -110,12 +120,33 @@
|
||||
AND a.violation_flag = #{query.violationFlag}
|
||||
</if>
|
||||
<if test="query.violationReason != null">
|
||||
AND a.violation_reason = #{query.violationReason}
|
||||
AND a.violation_reason LIKE CONCAT('%', #{query.violationReason}, '%')
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY a.fry_date DESC
|
||||
</select>
|
||||
|
||||
<update id="batchUpdateViolation">
|
||||
UPDATE xfsg_pre_fry_records
|
||||
SET
|
||||
violation_flag = CASE id
|
||||
<foreach collection="list" item="item">
|
||||
WHEN #{item.id} THEN #{item.violationFlag}
|
||||
</foreach>
|
||||
ELSE violation_flag
|
||||
END,
|
||||
violation_reason = CASE id
|
||||
<foreach collection="list" item="item">
|
||||
WHEN #{item.id} THEN #{item.violationReason}
|
||||
</foreach>
|
||||
ELSE violation_reason
|
||||
END,
|
||||
updated_time = NOW()
|
||||
WHERE id IN
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user