feat:预炸

This commit is contained in:
苏竹红
2025-06-21 18:39:29 +08:00
parent 2571ed2956
commit 9147a67b07
42 changed files with 2909 additions and 1 deletions

View File

@@ -0,0 +1,69 @@
package com.cool.store.dao;
import com.cool.store.entity.PreFriedProductsDO;
import com.cool.store.mapper.PreFriedProductsMapper;
import org.apache.commons.collections4.CollectionUtils;
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 PreFriedProductsDO queryById(Long id){
return preFriedProductsMapper.selectByPrimaryKey(id);
}
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,106 @@
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 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)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_REQUIRED, "门店编码不能为空");
}
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,12 @@
package com.cool.store.dao;
import org.springframework.stereotype.Repository;
/**
* @Author suzhuhong
* @Date 2025/6/20 19:13
* @Version 1.0
*/
@Repository
public class PreFryRecordsDAO {
}

View File

@@ -0,0 +1,12 @@
package com.cool.store.dao;
import org.springframework.stereotype.Repository;
/**
* @Author suzhuhong
* @Date 2025/6/20 19:13
* @Version 1.0
*/
@Repository
public class PreFryStageChangesDAO {
}

View File

@@ -0,0 +1,51 @@
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);
/**
* 批量删除
* @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);
}

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,7 @@
package com.cool.store.mapper;
import com.cool.store.entity.PreFryRecordsDO;
import tk.mybatis.mapper.common.Mapper;
public interface PreFryRecordsMapper extends Mapper<PreFryRecordsDO> {
}

View File

@@ -0,0 +1,7 @@
package com.cool.store.mapper;
import com.cool.store.entity.PreFryStageChangesDO;
import tk.mybatis.mapper.common.Mapper;
public interface PreFryStageChangesMapper extends Mapper<PreFryStageChangesDO> {
}

View File

@@ -0,0 +1,75 @@
<?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>
<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>
<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,125 @@
<?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="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,19 @@
<?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_code" jdbcType="VARCHAR" property="productCode" />
<result column="product_name" jdbcType="VARCHAR" property="productName" />
<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="created_time" jdbcType="TIMESTAMP" property="createdTime" />
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime" />
</resultMap>
</mapper>

View File

@@ -0,0 +1,18 @@
<?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>
</mapper>