Merge branch 'master' into cc_20250623_desk

This commit is contained in:
shuo.wang
2025-06-26 14:30:46 +08:00
68 changed files with 4338 additions and 13 deletions

View File

@@ -0,0 +1,86 @@
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.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2025/6/20 19:11
* @Version 1.0
*/
@Repository
public class PreFriedProductsDAO {
@Resource
PreFriedProductsMapper preFriedProductsMapper;
public int createProduct(PreFriedProductsDO preFriedProductsDO){
return preFriedProductsMapper.insertSelective(preFriedProductsDO);
}
public int updateProduct(PreFriedProductsDO product) {
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);
}
public PreFriedProductsDO queryByProductCode(String productCode){
if (StringUtils.isEmpty(productCode)){
return null;
}
return preFriedProductsMapper.queryByProductCode(productCode);
}
public List<PreFriedProductsDO> selectByCondition(String productCode, String productName, Integer status){
return preFriedProductsMapper.selectByCondition(productCode,productName,status);
}
/**
* 批量删除(带业务校验)
*/
public int batchDeleteProducts(List<Long> ids, String userId) {
if (CollectionUtils.isEmpty(ids)) {
throw new IllegalArgumentException("ID列表不能为空");
}
return preFriedProductsMapper.batchDelete(ids,userId);
}
/**
* 批量上下架
*/
public int batchUpdateProductStatus(List<Long> ids, Integer status, String userId) {
if (CollectionUtils.isEmpty(ids)) {
throw new IllegalArgumentException("ID列表不能为空");
}
return preFriedProductsMapper.batchUpdateStatus(ids, status,userId);
}
public int forceUpdate(PreFriedProductsDO preFriedProductsDO, String userId) {
if (preFriedProductsDO!=null&&preFriedProductsDO.getId()!=null) {
return 0;
}
return preFriedProductsMapper.forceUpdate(preFriedProductsDO);
}
}

View File

@@ -0,0 +1,46 @@
package com.cool.store.dao;
import com.cool.store.entity.PreFryApprovalRecordsDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.PreFryApprovalRecordsMapper;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2025/6/20 19:12
* @Version 1.0
*/
@Repository
public class PreFryApprovalRecordsDAO {
@Resource
PreFryApprovalRecordsMapper preFryApprovalRecordsMapper;
public int createApprovalRecord(PreFryApprovalRecordsDO preFryApprovalRecordsDO) {
return preFryApprovalRecordsMapper.insertSelective(preFryApprovalRecordsDO);
}
/**
* 查询申请的所有审批记录(按时间正序)
*/
public List<PreFryApprovalRecordsDO> getRecordsByApplyId(Long applyId) {
if (applyId == null) {
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
return preFryApprovalRecordsMapper.selectByApplyId(applyId);
}
}

View File

@@ -0,0 +1,107 @@
package com.cool.store.dao;
import com.cool.store.dto.pre.fry.ApplyDetailDTO;
import com.cool.store.dto.pre.fry.ApplyManagementDTO;
import com.cool.store.dto.pre.fry.ApplyManagementQueryDTO;
import com.cool.store.entity.PreFryQualificationApplyDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.mapper.PreFryQualificationApplyMapper;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2025/6/20 19:12
* @Version 1.0
*/
@Repository
public class PreFryQualificationApplyDAO {
@Resource
PreFryQualificationApplyMapper preFryQualificationApplyMapper;
/**
* 根据ID查询资质申请
* @param id
* @return
*/
public PreFryQualificationApplyDO queryById(Long id) {
//校验ID不为空
if (id == null){
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
return preFryQualificationApplyMapper.selectByPrimaryKey(id);
}
/**
* 新增资质申请
* @param preFryQualificationApplyDO
* @return
*/
public int createQualificationApply(PreFryQualificationApplyDO preFryQualificationApplyDO) {
return preFryQualificationApplyMapper.insertSelective(preFryQualificationApplyDO);
}
/**
* 强制修改资质申请 非空置为空
* @param preFryQualificationApplyDO
* @return
*/
public int updateForce(PreFryQualificationApplyDO preFryQualificationApplyDO) {
return preFryQualificationApplyMapper.updateForce(preFryQualificationApplyDO);
}
/**
* 根据门店编码查询申请记录列表
* @param storeCode 门店编码
* @return 申请记录列表
*/
public List<PreFryQualificationApplyDO> listByStoreCode(String storeCode) {
// 参数校验
if (StringUtils.isBlank(storeCode)) {
return Lists.newArrayList();
}
return preFryQualificationApplyMapper.listByStoreCode(storeCode);
}
public PreFryQualificationApplyDO selectByStoreCodeAndType(String storeCode, Integer applyType) {
// 参数校验
if (StringUtils.isBlank(storeCode)|| applyType==null) {
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
return preFryQualificationApplyMapper.selectByStoreCodeAndType(storeCode,applyType);
}
/**
* 查询指定门店applyType最小的申请记录
* @param storeCode 门店编码
* @return 申请记录
*/
public PreFryQualificationApplyDO getMinApplyTypeByStoreCode(String storeCode) {
// 参数校验
if (StringUtils.isBlank(storeCode)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED, "门店编码不能为空");
}
return preFryQualificationApplyMapper.selectMinApplyTypeByStoreCode(storeCode);
}
public List<ApplyManagementDTO> selectApplyManagementList(ApplyManagementQueryDTO query) {
return preFryQualificationApplyMapper.selectApplyManagementList(query);
}
public ApplyDetailDTO getApplyDetail(Long id) {
if (id==null) {
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED);
}
return preFryQualificationApplyMapper.getDetail(id);
}
}

View File

@@ -0,0 +1,100 @@
package com.cool.store.dao;
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;
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;
/**
* @Author suzhuhong
* @Date 2025/6/20 19:13
* @Version 1.0
*/
@Repository
public class PreFryRecordsDAO {
@Resource
private PreFryRecordsMapper preFryRecordsMapper;
public int insert(PreFryRecordsDO record) {
if (Objects.isNull(record)) {
return CommonConstants.ZERO;
}
return preFryRecordsMapper.insertSelective(record);
}
public int batchInsert(List<PreFryRecordsDO> records) {
if (CollectionUtils.isEmpty(records)) {
return CommonConstants.ZERO;
}
return preFryRecordsMapper.batchInsert(records);
}
public PreFryRecordsDO queryById(Long id) {
if (id == null) {
return null;
}
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){
if (CollectionUtils.isEmpty(ids)) {
return CommonConstants.ZERO;
}
return preFryRecordsMapper.batchUpdateStageByIds(ids,currentStage);
}
public List<PreFryRecordsDO> selectByStoreAndDateStage(String storeCode,
Integer applyType, String queryDate){
if (StringUtils.isBlank(storeCode)) {
return null;
}
return preFryRecordsMapper.selectByStoreAndDateStage(storeCode,applyType,queryDate);
}
public List<DailyFryCountDTO> selectDailyFryCountInCurrentMonth(String storeCode,Long time) {
if (StringUtils.isEmpty(storeCode)) {
return null;
}
return preFryRecordsMapper.selectDailyFryCountInCurrentMonth(storeCode,time);
}
public List<PreFryRecordsDTO> selectByQueryDTO(PreFryRecordQueryDTO dto) {
return preFryRecordsMapper.selectByQueryDTO(dto);
}
public void batchUpdateViolation(List<ViolationDTO> violationList) {
if (CollectionUtils.isEmpty(violationList)){
return;
}
preFryRecordsMapper.batchUpdateViolation(violationList);
}
}

View File

@@ -0,0 +1,51 @@
package com.cool.store.dao;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dto.pre.fry.PreFryStageImagesDTO;
import com.cool.store.entity.PreFryStageChangesDO;
import com.cool.store.mapper.PreFryStageChangesMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* @Author suzhuhong
* @Date 2025/6/20 19:13
* @Version 1.0
*/
@Repository
public class PreFryStageChangesDAO {
@Resource
PreFryStageChangesMapper preFryStageChangesMapper;
public int batchInsert(List<PreFryStageChangesDO> records){
if (CollectionUtils.isEmpty(records)){
return CommonConstants.ZERO;
}
return preFryStageChangesMapper.batchInsert(records);
}
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);
}
}

View File

@@ -0,0 +1,56 @@
package com.cool.store.mapper;
import com.cool.store.entity.PreFriedProductsDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface PreFriedProductsMapper extends Mapper<PreFriedProductsDO> {
/**
* 条件查询预炸产品
* @param productCode 产品编码模糊查询
* @param productName 产品名称模糊查询
* @param status 上下架状态(0下架 1上架)
* @return 产品列表
*/
List<PreFriedProductsDO> selectByCondition(
@Param("productCode") String productCode,
@Param("productName") String productName,
@Param("status") Integer status);
PreFriedProductsDO queryByProductCode(@Param("productCode") String productCode);
/**
* 批量删除
* @param ids 产品ID列表
* @param userId 操作人ID
* @return 影响行数
*/
int batchDelete(@Param("ids") List<Long> ids,
@Param("userId") String userId);
/**
* 批量上下架
* @param ids 产品ID列表
* @param status 目标状态(0下架 1上架)
* @param userId 操作人ID
* @return 影响行数
*/
int batchUpdateStatus(@Param("ids") List<Long> ids,
@Param("status") Integer status,
@Param("userId") String userId);
/**
* 更新数据
* @param product
* @return
*/
int forceUpdate(@Param("product") PreFriedProductsDO product);
List<PreFriedProductsDO> selectByProductIds(@Param("productIds") List<Long> productIds);
}

View File

@@ -0,0 +1,20 @@
package com.cool.store.mapper;
import com.cool.store.entity.PreFryApprovalRecordsDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface PreFryApprovalRecordsMapper extends Mapper<PreFryApprovalRecordsDO> {
/**
* 根据申请ID查询审批记录(按创建时间正序)
* @param applyId
* @return
*/
List<PreFryApprovalRecordsDO> selectByApplyId(@Param("applyId") Long applyId);
}

View File

@@ -0,0 +1,52 @@
package com.cool.store.mapper;
import com.cool.store.dto.pre.fry.ApplyDetailDTO;
import com.cool.store.dto.pre.fry.ApplyManagementDTO;
import com.cool.store.dto.pre.fry.ApplyManagementQueryDTO;
import com.cool.store.entity.PreFryQualificationApplyDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface PreFryQualificationApplyMapper extends Mapper<PreFryQualificationApplyDO> {
/**
* 强制修改
* @param entity
* @return
*/
int updateForce(PreFryQualificationApplyDO entity);
/**
* 根据门店编码查询
* @param storeCode
* @return
*/
List<PreFryQualificationApplyDO> listByStoreCode(@Param("storeCode") String storeCode);
/**
* 根据门店编码查询与申请类型查询
* @param storeCode
* @param applyType
* @return
*/
PreFryQualificationApplyDO selectByStoreCodeAndType(@Param("storeCode") String storeCode,
@Param("applyType") Integer applyType);
/**
* 查询指定门店applyType最小的申请记录
* @param storeCode 门店编码
* @return 申请记录
*/
PreFryQualificationApplyDO selectMinApplyTypeByStoreCode(@Param("storeCode") String storeCode);
List<ApplyManagementDTO> selectApplyManagementList(ApplyManagementQueryDTO query);
ApplyDetailDTO getDetail(Long id);
}

View File

@@ -0,0 +1,36 @@
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;
import java.util.Date;
import java.util.List;
public interface PreFryRecordsMapper extends Mapper<PreFryRecordsDO> {
int batchInsert(List<PreFryRecordsDO> records);
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("applyType") Integer applyType,
@Param("queryDate") String queryDate);
List<DailyFryCountDTO> selectDailyFryCountInCurrentMonth(@Param("storeCode") String storeCode,@Param("time") Long time);
List<PreFryRecordsDTO> selectByQueryDTO(@Param("query") PreFryRecordQueryDTO dto);
void batchUpdateViolation(@Param("list") List<ViolationDTO> violationList);
}

View File

@@ -0,0 +1,19 @@
package com.cool.store.mapper;
import com.cool.store.dto.pre.fry.PreFryStageImagesDTO;
import com.cool.store.entity.PreFryStageChangesDO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
public interface PreFryStageChangesMapper extends Mapper<PreFryStageChangesDO> {
int batchInsert(List<PreFryStageChangesDO> records);
List<PreFryStageImagesDTO> selectByRecordId(@Param("recordId") Long recordId);
List<PreFryStageImagesDTO> selectByRecordIdList(@Param("recordIdList") List<Long> recordIdList);
}

View File

@@ -201,6 +201,7 @@
<if test="endTime != null and endTime != ''">
and update_time &lt;= #{endTime}
</if>
and subject != 'MINI_PRE_FRIED'
order by update_time desc
</select>

View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cool.store.mapper.PreFriedProductsMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.PreFriedProductsDO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="product_code" jdbcType="VARCHAR" property="productCode" />
<result column="product_name" jdbcType="VARCHAR" property="productName" />
<result column="product_image" jdbcType="VARCHAR" property="productImage" />
<result column="status" jdbcType="BIT" property="status" />
<result column="sort_order" jdbcType="INTEGER" property="sortOrder" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="created_user_id" jdbcType="VARCHAR" property="createdUserId" />
<result column="updated_User_id" jdbcType="VARCHAR" property="updatedUserId" />
<result column="deleted" property="deleted" />
</resultMap>
<select id="selectByCondition" resultMap="BaseResultMap">
SELECT * FROM xfsg_pre_fried_products where deleted = 0
<!-- 产品编码模糊查询 -->
<if test="productCode != null and productCode != ''">
AND product_code LIKE CONCAT('%', #{productCode}, '%')
</if>
<!-- 产品名称模糊查询 -->
<if test="productName != null and productName != ''">
AND product_name LIKE CONCAT('%', #{productName}, '%')
</if>
<!-- 上下架状态(注意字段类型是 BIT -->
<if test="status != null">
AND status = #{status}
</if>
<!-- 默认按创建时间倒序 -->
ORDER BY sort_order DESC
</select>
<select id="queryByProductCode" resultMap="BaseResultMap">
SELECT * FROM xfsg_pre_fried_products
where deleted = 0
<if test="productCode != null and productCode != ''">
AND product_code = #{productCode}
</if>
</select>
<delete id="batchDelete">
UPDATE xfsg_pre_fried_products
SET deleted = 1,
updated_time = NOW(),
updated_user_id = #{userId}
WHERE id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="batchUpdateStatus">
UPDATE xfsg_pre_fried_products
SET status = #{status},
updated_time = NOW(),
updated_user_id = #{userId}
WHERE id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="selectByProductIds" resultMap="BaseResultMap">
SELECT * FROM xfsg_pre_fried_products
where id IN
<foreach collection="productIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<update id="forceUpdate">
UPDATE xfsg_pre_fried_products
SET
product_code = #{product.productCode},
product_name = #{product.productName},
product_image = #{product.productImage},
status = #{product.status},
sort_order = #{product.sortOrder},
updated_time = NOW(),
updated_user_id = #{product.updatedUserId}
WHERE id = #{product.id}
</update>
</mapper>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cool.store.mapper.PreFryApprovalRecordsMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.PreFryApprovalRecordsDO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="apply_id" jdbcType="BIGINT" property="applyId" />
<result column="record_type" jdbcType="TINYINT" property="recordType" />
<result column="operation_status" jdbcType="TINYINT" property="operationStatus" />
<result column="operator_name" jdbcType="VARCHAR" property="operatorName" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
</resultMap>
<!-- 根据申请ID查询审批记录 -->
<select id="selectByApplyId" resultMap="BaseResultMap">
SELECT *
FROM xfsg_pre_fry_approval_records
WHERE apply_id = #{applyId}
ORDER BY created_time ASC
</select>
</mapper>

View File

@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cool.store.mapper.PreFryQualificationApplyMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.PreFryQualificationApplyDO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="apply_code" jdbcType="VARCHAR" property="applyCode" />
<result column="store_code" jdbcType="VARCHAR" property="storeCode" />
<result column="apply_type" jdbcType="TINYINT" property="applyType" />
<result column="refrigerator_photo" jdbcType="VARCHAR" property="refrigeratorPhoto" />
<result column="refrigerator_plate_photo" jdbcType="VARCHAR" property="refrigeratorPlatePhoto" />
<result column="protective_cover_photo" jdbcType="VARCHAR" property="protectiveCoverPhoto" />
<result column="cold_storage_box_photo" jdbcType="VARCHAR" property="coldStorageBoxPhoto" />
<result column="audit_status" jdbcType="TINYINT" property="auditStatus" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
<result column="created_user_id" jdbcType="VARCHAR" property="createdUserId" />
</resultMap>
<update id="updateForce" parameterType="com.cool.store.entity.PreFryQualificationApplyDO">
UPDATE xfsg_pre_fry_qualification_apply
SET store_code = #{storeCode},
apply_type = #{applyType},
refrigerator_photo = #{refrigeratorPhoto},
refrigerator_plate_photo = #{refrigeratorPlatePhoto},
protective_cover_photo = #{protectiveCoverPhoto},
cold_storage_box_photo = #{coldStorageBoxPhoto},
audit_status = #{auditStatus},
updated_time = NOW()
WHERE id = #{id}
</update>
<select id="listByStoreCode" resultMap="BaseResultMap">
SELECT *
FROM xfsg_pre_fry_qualification_apply
WHERE store_code = #{storeCode}
</select>
<select id="selectByStoreCodeAndType" resultMap="BaseResultMap">
SELECT *
FROM xfsg_pre_fry_qualification_apply
WHERE store_code = #{storeCode} and apply_type = #{applyType}
</select>
<select id="selectMinApplyTypeByStoreCode" resultMap="BaseResultMap">
SELECT *
FROM xfsg_pre_fry_qualification_apply
WHERE store_code = #{storeCode} and audit_status = 1
ORDER BY apply_type ASC
LIMIT 1
</select>
<select id="selectApplyManagementList" resultType="com.cool.store.dto.pre.fry.ApplyManagementDTO">
SELECT
a.id AS id,
a.store_code AS storeCode,
b.store_name AS storeName,
a.apply_code AS applyCode,
a.apply_type AS applyType,
a.created_user_id AS createUserId,
c.username AS createUserName,
c.mobile AS createUserMobile,
a.created_time AS createTime,
a.audit_status AS auditStatus
FROM
xfsg_pre_fry_qualification_apply a
LEFT JOIN store_${enterpriseId} b ON a.store_code = b.store_num
LEFT JOIN xfsg_line_info c ON c.partner_id = a.created_user_id
<where>
<if test="applyCode !=null and applyCode != ''">
and a.apply_code LIKE CONCAT('%', #{applyCode}, '%')
</if>
<if test="storeCode != null and storeCode != ''">
AND a.store_code LIKE CONCAT('%', #{storeCode}, '%')
</if>
<if test="storeName != null and storeName != ''">
AND b.store_name LIKE CONCAT('%', #{storeName}, '%')
</if>
<if test="createUserName != null and createUserName != ''">
AND c.username LIKE CONCAT('%', #{createUserName}, '%')
</if>
<if test="createUserMobile != null and createUserMobile != ''">
AND c.mobile LIKE CONCAT('%', #{createUserMobile}, '%')
</if>
<if test="auditStatus != null">
AND a.audit_status = #{auditStatus}
</if>
<if test="applyType != null">
AND a.apply_type = #{applyType}
</if>
<if test="createTimeStart != null">
AND a.created_time >= #{createTimeStart}
</if>
<if test="createTimeEnd != null">
AND a.created_time <![CDATA[<=]]> #{createTimeEnd}
</if>
</where>
ORDER BY a.created_time DESC
</select>
<select id="getDetail" resultType="com.cool.store.dto.pre.fry.ApplyDetailDTO">
SELECT
a.id AS id,
a.store_code AS storeCode,
a.refrigerator_photo as refrigeratorPhoto,
a.refrigerator_plate_photo AS refrigeratorPlatePhoto,
a.protective_cover_photo AS protectiveCoverPhoto,
a.cold_storage_box_photo AS coldStorageBoxPhoto,
b.store_name AS storeName,
a.apply_code AS applyCode,
a.apply_type AS applyType,
a.created_user_id AS createUserId,
c.username AS createUserName,
c.mobile AS createUserMobile,
a.created_time AS createTime,
a.audit_status AS auditStatus
FROM
xfsg_pre_fry_qualification_apply a
LEFT JOIN store_${enterpriseId} b ON a.store_code = b.store_num
LEFT JOIN xfsg_line_info c ON c.partner_id = a.created_user_id
where a.id= #{id}
</select>
</mapper>

View File

@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cool.store.mapper.PreFryRecordsMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.PreFryRecordsDO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="store_code" jdbcType="VARCHAR" property="storeCode" />
<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" />
<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="VARCHAR" property="violationReason" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
</resultMap>
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
INSERT INTO xfsg_pre_fry_records
(store_code, product_code, fry_date, fry_complete_time,
latest_sale_time, current_stage, current_apply_type, created_time, updated_time)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.storeCode}, #{item.productCode}, #{item.fryDate},
#{item.fryCompleteTime}, #{item.latestSaleTime}, #{item.currentStage},#{item.currentApplyType},
NOW(), NOW())
</foreach>
</insert>
<update id="batchUpdateStageByIds">
UPDATE xfsg_pre_fry_records
SET current_stage = #{currentStage},
updated_time = NOW()
WHERE id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</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} and current_apply_type = #{applyType}
AND ( (fry_date = DATE_SUB(#{queryDate}, INTERVAL 1 DAY) AND current_stage IN (3,4,5))
OR (fry_date = #{queryDate}))
</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(#{time}/1000), '%Y-%m-01')
AND LAST_DAY(FROM_UNIXTIME(#{time}/1000))
GROUP BY fry_date
ORDER BY fry_date
</select>
<select id="selectByQueryDTO" resultType="com.cool.store.dto.pre.fry.PreFryRecordsDTO">
SELECT
a.id as id,
a.record_code as recordCode,
a.current_stage as currentStage,
a.fry_date as fryDate,
a.violation_flag as violationFlag,
a.violation_reason as violationReason,
b.product_name as productName,
b.product_code as productCode,
c.store_name as storeName,
c.store_num as storeCode
FROM xfsg_pre_fry_records a
LEFT JOIN xfsg_pre_fried_products b ON a.product_id = b.id
LEFT JOIN store_${enterpriseId} c ON a.store_code = c.store_num
<where>
<if test="query.recordCode != null and query.recordCode != ''">
AND a.record_code LIKE CONCAT('%', #{query.recordCode}, '%')
</if>
<if test="query.storeCode != null and query.storeCode != ''">
AND a.store_code LIKE CONCAT('%', #{query.storeCode}, '%')
</if>
<if test="query.storeName != null and query.storeName != ''">
AND c.store_name LIKE CONCAT('%', #{query.storeName}, '%')
</if>
<if test="query.productCode != null and query.productCode != ''">
AND b.product_code LIKE CONCAT('%', #{query.productCode}, '%')
</if>
<if test="query.productName != null and query.productName != ''">
AND b.product_name LIKE CONCAT('%', #{query.productName}, '%')
</if>
<if test="query.currentStage != null">
AND a.current_stage = #{query.currentStage}
</if>
<if test="query.fryStartDate != null and query.fryEndDate != null">
AND a.fry_date BETWEEN #{query.fryStartDate} AND #{query.fryEndDate}
</if>
<if test="query.violationFlag != null">
AND a.violation_flag = #{query.violationFlag}
</if>
<if test="query.violationReason != null">
AND a.violation_reason LIKE CONCAT('%,', #{query.violationReason}, ',%')
</if>
</where>
ORDER BY a.created_time 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>

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cool.store.mapper.PreFryStageChangesMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.PreFryStageChangesDO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="record_id" jdbcType="INTEGER" property="recordId" />
<result column="stage" jdbcType="TINYINT" property="stage" />
<result column="image1" jdbcType="VARCHAR" property="image1" />
<result column="image2" jdbcType="VARCHAR" property="image2" />
<result column="operator_name" jdbcType="VARCHAR" property="operatorName" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
</resultMap>
<insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
INSERT INTO xfsg_pre_fry_stage_changes
(record_id, stage, image1, image2, operator_name, remark, created_time, updated_time)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.recordId}, #{item.stage}, #{item.image1}, #{item.image2},
#{item.operatorName}, #{item.remark}, NOW(), NOW())
</foreach>
</insert>
<select id="selectByRecordId" resultType="com.cool.store.dto.pre.fry.PreFryStageImagesDTO">
SELECT id, record_id, image1, image2, created_time,stage
FROM xfsg_pre_fry_stage_changes
WHERE record_id = #{recordId}
ORDER BY created_time asc
</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 asc
</select>
</mapper>

View File

@@ -3,6 +3,6 @@ jdbc.url = jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcoll
jdbc.user= coolstore
jdbc.password = CSCErYcXniNYm7bT
table.name = xfsg_invoicing
table.object.class = InvoicingDO
table.mapper = InvoicingMapper
table.name = xfsg_pre_fry_stage_changes
table.object.class = PreFryStageChangesDO
table.mapper = PreFryStageChangesMapper