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

@@ -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>