Merge #111 into master from cc_20260417_bonus
fix:工资奖金 * cc_20260417_bonus: (28 commits squashed) - feat:工资奖金发放 - fix:工资奖金发放 - fix:工资奖金发放 - fix:工资奖金发放 - fix:工资奖金发放 - fix:门店实收相关接口 - fix:新品销售门店级接口 - fix:新品销售菜品列表接口;规则新增返回id - fix:新品销售菜品详情接口 - fix:新品销售菜品接口补充 - fix:小程序接口补充 - fix - fix:新增实收、新品销售测试接口 - fix:新增实收、新品销售测试接口 - fix - fix:新增门店菜品列表接口 - fix:同规则下无法新增相同菜品规则;新增小程序门店列表接口 - fix - fix:小程序用户获取来源修改 - fix:实收规则新增上月日均实收字段 - fix:规则限制 - fix:小程序上月日均实收 - fix:查询异常 - fix:查询异常 - fix:菜品员工明细字段赋值异常 - fix:排序 - fix:排序 - fix:员工实收列表新增门店筛选条件 Signed-off-by: 王非凡 <accounts_67eba0c5fee9c49c80c8e2b4@mail.teambition.com> Merged-by: 正新 <accounts_6964c7bcd2a2c377c5bbd01b@mail.teambition.com> CR-link: https://codeup.aliyun.com/692ea314dec569489f6f167c/hangzhou/java/custom_zxjp/change/111
This commit is contained in:
@@ -67,6 +67,36 @@
|
||||
|
||||
</where>
|
||||
</select>
|
||||
<select id="listUserAuthMappingByAuthV2" resultMap="baseResult">
|
||||
select a.id,a.user_id,mapping_id,a.type from user_auth_mapping_${enterpriseId} a
|
||||
join enterprise_user_${enterpriseId} e on a.user_id= e.user_id
|
||||
<where>
|
||||
e.user_status= '1' and e.active= true
|
||||
<if test="mappingIdList!=null and mappingIdList.size>0">
|
||||
<foreach collection="mappingIdList" item="mappingId" open="and a.mapping_id in (" separator="," close=")">
|
||||
#{mappingId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="type!=null and type!=''">
|
||||
and a.type =#{type}
|
||||
</if>
|
||||
<if test="(positionType!=null and positionType!='') or (notRoleAuth!=null and notRoleAuth!='')">
|
||||
and a.user_id in (
|
||||
select
|
||||
distinct(user_id)
|
||||
from enterprise_user_role_${enterpriseId} ur JOIN sys_role_${enterpriseId} b on ur.role_id=b.id
|
||||
<where>
|
||||
<if test="positionType!=null and positionType!=''">
|
||||
and b.position_type =#{positionType}
|
||||
</if>
|
||||
<if test="notRoleAuth!=null and notRoleAuth!=''">
|
||||
and b.role_auth !=#{notRoleAuth}
|
||||
</if>
|
||||
</where>
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="listUserAuthMappingByUserList" resultMap="baseResult">
|
||||
select * from user_auth_mapping_${enterpriseId}
|
||||
<where>
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
<?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.bonus.BonusDistributionRuleMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.bonus.BonusDistributionRuleDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="type" jdbcType="BIT" property="type" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="start_date" jdbcType="DATE" property="startDate" />
|
||||
<result column="end_date" jdbcType="DATE" property="endDate" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
|
||||
<result column="bonus_config" jdbcType="LONGVARCHAR" property="bonusConfig" />
|
||||
<result column="distribute_config" jdbcType="LONGVARCHAR" property="distributeConfig" />
|
||||
<result column="enable" jdbcType="BIT" property="enable" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, type, store_id, start_date, end_date, create_time, create_user_id, update_time, update_user_id, bonus_config, distribute_config, enable
|
||||
</sql>
|
||||
<sql id="Base_Column_List_A">
|
||||
a.id, a.type, a.store_id, a.start_date, a.end_date, a.create_time, a.create_user_id, a.update_time, a.update_user_id, a.bonus_config, a.distribute_config, a.enable
|
||||
</sql>
|
||||
|
||||
<select id="existOverlap" resultType="int">
|
||||
SELECT COUNT(1) FROM bonus_distribution_rule
|
||||
WHERE store_id = #{storeId}
|
||||
AND type = #{type}
|
||||
AND enable = 1
|
||||
AND start_date <= #{endDate}
|
||||
AND end_date >= #{startDate}
|
||||
</select>
|
||||
|
||||
<select id="getList" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List_A" />
|
||||
FROM bonus_distribution_rule a
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
INNER JOIN store_${enterpriseId} b ON a.store_id = b.store_id AND b.is_delete = 'effective'
|
||||
</if>
|
||||
<where>
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
AND (b.store_num LIKE CONCAT('%', #{storeNumOrName}, '%') OR b.store_name LIKE CONCAT('%', #{storeNumOrName}, '%'))
|
||||
</if>
|
||||
<if test="type != null">
|
||||
AND a.type = #{type}
|
||||
</if>
|
||||
<if test="enable != null">
|
||||
AND a.enable = #{enable}
|
||||
</if>
|
||||
<if test="storeId != null and storeId != ''">
|
||||
AND a.store_id = #{storeId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectEnabledRulesByTypeAndMonth" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM bonus_distribution_rule
|
||||
WHERE type = #{type} AND enable = 1
|
||||
AND DATE_FORMAT(start_date, '%Y-%m') <= #{payMonth} AND DATE_FORMAT(end_date, '%Y-%m') >= #{payMonth}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?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.bonus.BonusEmployeeRewardDetailMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.bonus.BonusEmployeeRewardDetailDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="pay_date" jdbcType="DATE" property="payDate" />
|
||||
<result column="reward_user_name" jdbcType="VARCHAR" property="rewardUserName" />
|
||||
<result column="reward_user_id" jdbcType="VARCHAR" property="rewardUserId" />
|
||||
<result column="received_amount" jdbcType="DECIMAL" property="receivedAmount" />
|
||||
<result column="new_project_amount" jdbcType="DECIMAL" property="newProjectAmount" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, store_id, pay_date, reward_user_name, reward_user_id, received_amount, new_project_amount, create_time
|
||||
</sql>
|
||||
<sql id="Base_Column_List_A">
|
||||
a.id, a.store_id, a.pay_date, a.reward_user_name, a.reward_user_id, a.received_amount, a.new_project_amount, a.create_time
|
||||
</sql>
|
||||
|
||||
<select id="selectByStoreIdAndPayDate" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM bonus_employee_reward_detail
|
||||
WHERE store_id = #{storeId}
|
||||
AND DATE_FORMAT(pay_date, '%Y-%m') = #{payDate}
|
||||
AND reward_user_id IN
|
||||
<foreach item="item" index="index" collection="userIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<update id="updateReceivedAmountById">
|
||||
UPDATE bonus_employee_reward_detail SET received_amount = #{receivedAmount} WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateNewProjectAmountById">
|
||||
UPDATE bonus_employee_reward_detail SET new_project_amount = #{newProjectAmount} WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<insert id="insertOrUpdateBatch">
|
||||
INSERT INTO bonus_employee_reward_detail (store_id, pay_date, reward_user_name, reward_user_id, received_amount, new_project_amount) VALUES
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.storeId}, #{item.payDate}, #{item.rewardUserName}, #{item.rewardUserId}, #{item.receivedAmount}, #{item.newProjectAmount})
|
||||
</foreach>
|
||||
ON DUPLICATE KEY UPDATE
|
||||
received_amount = VALUES(received_amount),
|
||||
new_project_amount = VALUES(new_project_amount)
|
||||
</insert>
|
||||
|
||||
<select id="selectListByCondition" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List_A" />
|
||||
FROM bonus_employee_reward_detail a
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
INNER JOIN store_${enterpriseId} b ON a.store_id = b.store_id AND b.is_delete = 'effective'
|
||||
</if>
|
||||
<where>
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
AND (b.store_num LIKE CONCAT('%', #{storeNumOrName}, '%') OR b.store_name LIKE CONCAT('%', #{storeNumOrName}, '%'))
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
AND a.pay_date >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND a.pay_date <= #{endDate}
|
||||
</if>
|
||||
<if test="rewardUserName != null and rewardUserName != ''">
|
||||
AND a.reward_user_name LIKE CONCAT('%', #{rewardUserName}, '%')
|
||||
</if>
|
||||
<if test="storeId != null and storeId != ''">
|
||||
AND a.store_id = #{storeId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,96 @@
|
||||
<?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.bonus.BonusNewProductEmployeeMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.bonus.BonusNewProductEmployeeDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="product_store_id" jdbcType="BIGINT" property="productStoreId" />
|
||||
<result column="rule_id" jdbcType="BIGINT" property="ruleId" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="pay_date" jdbcType="DATE" property="payDate" />
|
||||
<result column="reward_ratio" jdbcType="DECIMAL" property="rewardRatio" />
|
||||
<result column="reward_amount" jdbcType="DECIMAL" property="rewardAmount" />
|
||||
<result column="reward_user_name" jdbcType="VARCHAR" property="rewardUserName" />
|
||||
<result column="reward_user_id" jdbcType="VARCHAR" property="rewardUserId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
|
||||
<select id="getMonthlyStatistics" resultType="java.util.Map">
|
||||
SELECT reward_user_id, SUM(reward_amount) total_amount
|
||||
FROM bonus_new_product_employee
|
||||
WHERE store_id = #{storeId}
|
||||
AND DATE_FORMAT(pay_date, '%Y-%m') = #{payDate}
|
||||
AND reward_user_id IN
|
||||
<foreach item="item" index="index" collection="userIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
GROUP BY reward_user_id
|
||||
</select>
|
||||
|
||||
<insert id="insertBatch" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO bonus_new_product_employee (product_store_id, rule_id, store_id, pay_date, reward_ratio, reward_amount, reward_user_name, reward_user_id) VALUES
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
(#{item.productStoreId}, #{item.ruleId}, #{item.storeId}, #{item.payDate}, #{item.rewardRatio}, #{item.rewardAmount}, #{item.rewardUserName}, #{item.rewardUserId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="monthlyStatistics" resultMap="BaseResultMap">
|
||||
SELECT reward_user_id, reward_user_name, SUM(reward_amount) reward_amount, rule_id
|
||||
FROM bonus_new_product_employee
|
||||
<where>
|
||||
<if test="storeId != null and storeId != ''">
|
||||
AND store_id = #{storeId}
|
||||
</if>
|
||||
<if test="ruleId != null">
|
||||
AND rule_id = #{ruleId}
|
||||
</if>
|
||||
<if test="payDate != null">
|
||||
AND DATE_FORMAT(pay_date, '%Y-%m') = DATE_FORMAT(#{payDate}, '%Y-%m')
|
||||
</if>
|
||||
<if test="userId != null and userId != ''">
|
||||
AND reward_user_id = #{userId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY reward_user_id
|
||||
</select>
|
||||
|
||||
<select id="employeeMonthlyStatistics" resultMap="BaseResultMap">
|
||||
SELECT a.store_id, a.rule_id, a.reward_user_id, a.reward_user_name, SUM(a.reward_amount) reward_amount, a.pay_date
|
||||
FROM bonus_new_product_employee a
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
INNER JOIN store_${enterpriseId} b ON a.store_id = b.store_id AND b.is_delete = 'effective'
|
||||
</if>
|
||||
<where>
|
||||
<if test="startDate != null">
|
||||
AND DATE_FORMAT(a.pay_date, '%Y-%m') >= DATE_FORMAT(#{startDate}, '%Y-%m')
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND DATE_FORMAT(a.pay_date, '%Y-%m') <= DATE_FORMAT(#{endDate}, '%Y-%m')
|
||||
</if>
|
||||
<if test="rewardUserName != null and rewardUserName != ''">
|
||||
AND a.reward_user_name LIKE CONCAT('%', #{rewardUserName}, '%')
|
||||
</if>
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
AND (b.store_num LIKE CONCAT('%', #{storeNumOrName}, '%') OR b.store_name LIKE CONCAT('%', #{storeNumOrName}, '%'))
|
||||
</if>
|
||||
<if test="storeId != null and storeId != ''">
|
||||
AND a.store_id = #{storeId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY a.store_id, a.reward_user_id, DATE_FORMAT(a.pay_date, '%Y-%m')
|
||||
ORDER BY a.pay_date DESC, a.store_id ASC, a.reward_user_id ASC
|
||||
</select>
|
||||
|
||||
<select id="getMonthlyStatisticsGroupByStore" resultMap="BaseResultMap">
|
||||
SELECT store_id, reward_user_id, reward_user_name, SUM(reward_amount) AS reward_amount
|
||||
FROM bonus_new_product_employee
|
||||
<where>
|
||||
<if test="payMonth != null and payMonth != ''">
|
||||
AND DATE_FORMAT(pay_date, '%Y-%m') = #{payMonth}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY store_id, reward_user_id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?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.bonus.BonusNewProductRecipeEmployeeMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.bonus.BonusNewProductRecipeEmployeeDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="product_recipe_id" jdbcType="BIGINT" property="productRecipeId" />
|
||||
<result column="rule_id" jdbcType="BIGINT" property="ruleId" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="pay_date" jdbcType="DATE" property="payDate" />
|
||||
<result column="recipe_no" jdbcType="VARCHAR" property="recipeNo" />
|
||||
<result column="recipe_name" jdbcType="VARCHAR" property="recipeName" />
|
||||
<result column="basic_reward_amount" jdbcType="DECIMAL" property="basicRewardAmount" />
|
||||
<result column="sales_volume" jdbcType="INTEGER" property="salesVolume" />
|
||||
<result column="excess_reward_amount" jdbcType="DECIMAL" property="excessRewardAmount" />
|
||||
<result column="reward_ratio" jdbcType="DECIMAL" property="rewardRatio" />
|
||||
<result column="reward_user_name" jdbcType="VARCHAR" property="rewardUserName" />
|
||||
<result column="reward_user_id" jdbcType="VARCHAR" property="rewardUserId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertBatch">
|
||||
insert into bonus_new_product_recipe_employee (id, product_recipe_id, rule_id, store_id, pay_date, recipe_no, recipe_name, basic_reward_amount, excess_reward_amount, reward_ratio, reward_user_name, reward_user_id, sales_volume)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id}, #{item.productRecipeId}, #{item.ruleId}, #{item.storeId}, #{item.payDate}, #{item.recipeNo}, #{item.recipeName}, #{item.basicRewardAmount}, #{item.excessRewardAmount}, #{item.rewardRatio}, #{item.rewardUserName}, #{item.rewardUserId}, #{item.salesVolume})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="monthlyStatistics" resultMap="BaseResultMap">
|
||||
SELECT a.store_id, a.pay_date, a.recipe_no, a.recipe_name, SUM(a.sales_volume) sales_volume, SUM(a.basic_reward_amount) basic_reward_amount, SUM(a.excess_reward_amount) excess_reward_amount, a.reward_user_id, a.reward_user_name
|
||||
FROM bonus_new_product_recipe_employee a
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
INNER JOIN store_${enterpriseId} b ON a.store_id = b.store_id AND b.is_delete = 'effective'
|
||||
</if>
|
||||
<where>
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
AND (b.store_num LIKE CONCAT('%', #{storeNumOrName}, '%') OR b.store_name LIKE CONCAT('%', #{storeNumOrName}, '%'))
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
AND DATE_FORMAT(a.pay_date, '%Y-%m') >= DATE_FORMAT(#{startDate}, '%Y-%m')
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND DATE_FORMAT(a.pay_date, '%Y-%m') <= DATE_FORMAT(#{endDate}, '%Y-%m')
|
||||
</if>
|
||||
<if test="rewardUserName != null and rewardUserName != ''">
|
||||
AND a.reward_user_name LIKE CONCAT('%', #{rewardUserName}, '%')
|
||||
</if>
|
||||
<if test="recipeNoOrName != null and recipeNoOrName != ''">
|
||||
AND (a.recipe_no LIKE CONCAT('%', #{recipeNoOrName}, '%') OR a.recipe_name LIKE CONCAT('%', #{recipeNoOrName}, '%'))
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY a.store_id, DATE_FORMAT(a.pay_date, '%Y-%m'), a.reward_user_id, a.recipe_no
|
||||
ORDER BY a.pay_date DESC, a.store_id ASC, a.reward_user_id ASC, a.recipe_no ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?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.bonus.BonusNewProductRecipeMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.bonus.BonusNewProductRecipeDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="rule_id" jdbcType="BIGINT" property="ruleId" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="pay_date" jdbcType="DATE" property="payDate" />
|
||||
<result column="recipe_no" jdbcType="VARCHAR" property="recipeNo" />
|
||||
<result column="recipe_name" jdbcType="VARCHAR" property="recipeName" />
|
||||
<result column="min_standard_num" jdbcType="INTEGER" property="minStandardNum" />
|
||||
<result column="reward_amount" jdbcType="DECIMAL" property="rewardAmount" />
|
||||
<result column="excess_standard_num" jdbcType="INTEGER" property="excessStandardNum" />
|
||||
<result column="excess_amount" jdbcType="DECIMAL" property="excessAmount" />
|
||||
<result column="sales_volume" jdbcType="INTEGER" property="salesVolume" />
|
||||
<result column="basic_reward_amount" jdbcType="DECIMAL" property="basicRewardAmount" />
|
||||
<result column="excess_reward_amount" jdbcType="DECIMAL" property="excessRewardAmount" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, rule_id, store_id, pay_date, recipe_no, recipe_name, min_standard_num, reward_amount, excess_standard_num, excess_amount, sales_volume, basic_reward_amount, excess_reward_amount, create_time
|
||||
</sql>
|
||||
|
||||
<insert id="insertBatch" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
|
||||
INSERT INTO bonus_new_product_recipe (rule_id, store_id, pay_date, recipe_no, recipe_name, min_standard_num, reward_amount, excess_standard_num, excess_amount, sales_volume, basic_reward_amount, excess_reward_amount) VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.ruleId}, #{item.storeId}, #{item.payDate}, #{item.recipeNo}, #{item.recipeName}, #{item.minStandardNum}, #{item.rewardAmount}, #{item.excessStandardNum}, #{item.excessAmount}, #{item.salesVolume}, #{item.basicRewardAmount}, #{item.excessRewardAmount})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="monthlyStatistics" resultMap="BaseResultMap">
|
||||
SELECT a.store_id, a.recipe_no, a.recipe_name, a.pay_date, SUM(a.basic_reward_amount) basic_reward_amount, SUM(a.excess_reward_amount) excess_reward_amount
|
||||
FROM bonus_new_product_recipe a
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
INNER JOIN store_${enterpriseId} b ON a.store_id = b.store_id AND b.is_delete = 'effective'
|
||||
</if>
|
||||
<where>
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
AND (b.store_num LIKE CONCAT('%', #{storeNumOrName}, '%') OR b.store_name LIKE CONCAT('%', #{storeNumOrName}, '%'))
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
AND DATE_FORMAT(a.pay_date, '%Y-%m') >= DATE_FORMAT(#{startDate}, '%Y-%m')
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND DATE_FORMAT(a.pay_date, '%Y-%m') <= DATE_FORMAT(#{endDate}, '%Y-%m')
|
||||
</if>
|
||||
<if test="recipeNoOrName != null and recipeNoOrName != ''">
|
||||
AND (a.recipe_no LIKE CONCAT('%', #{recipeNoOrName}, '%') OR a.recipe_name LIKE CONCAT('%', #{recipeNoOrName}, '%'))
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY a.store_id, a.recipe_no, DATE_FORMAT(a.pay_date, '%Y-%m')
|
||||
ORDER BY a.pay_date DESC, a.store_id ASC, a.recipe_no ASC
|
||||
</select>
|
||||
|
||||
<select id="selectListByCondition" resultMap="BaseResultMap">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM bonus_new_product_recipe
|
||||
<where>
|
||||
<if test="storeId != null and storeId != ''">
|
||||
AND store_id = #{storeId}
|
||||
</if>
|
||||
<if test="recipeNo != null and recipeNo != ''">
|
||||
AND recipe_no = #{recipeNo}
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
AND DATE_FORMAT(pay_date, '%Y-%m-%d') >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND DATE_FORMAT(pay_date, '%Y-%m-%d') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY create_time DESC, store_id ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?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.bonus.BonusNewProductStoreMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.bonus.BonusNewProductStoreDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="rule_id" jdbcType="BIGINT" property="ruleId" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="pay_date" jdbcType="DATE" property="payDate" />
|
||||
<result column="amount_total" jdbcType="DECIMAL" property="amountTotal" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectCountByRuleIdAndPayDate" resultType="int">
|
||||
SELECT COUNT(1) FROM bonus_new_product_store
|
||||
WHERE rule_id = #{ruleId} AND DATE_FORMAT(pay_date, '%Y-%m-%d') = #{payDate}
|
||||
</select>
|
||||
|
||||
<select id="monthlyStatistics" resultMap="BaseResultMap">
|
||||
SELECT a.rule_id, a.store_id, a.pay_date, SUM(a.amount_total) amount_total
|
||||
FROM bonus_new_product_store a
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
INNER JOIN store_${enterpriseId} b ON a.store_id = b.store_id AND b.is_delete = 'effective'
|
||||
</if>
|
||||
<where>
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
AND (b.store_num LIKE CONCAT('%', #{storeNumOrName}, '%') OR b.store_name LIKE CONCAT('%', #{storeNumOrName}, '%'))
|
||||
</if>
|
||||
<if test="startDate != null">
|
||||
AND DATE_FORMAT(a.pay_date, '%Y-%m') >= DATE_FORMAT(#{startDate}, '%Y-%m')
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND DATE_FORMAT(a.pay_date, '%Y-%m') <= DATE_FORMAT(#{endDate}, '%Y-%m')
|
||||
</if>
|
||||
<if test="storeId != null and storeId != ''">
|
||||
AND a.store_id = #{storeId}
|
||||
</if>
|
||||
<if test="ruleId != null">
|
||||
AND a.rule_id = #{ruleId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY a.store_id, a.rule_id, DATE_FORMAT(a.pay_date, '%Y-%m')
|
||||
ORDER BY a.pay_date DESC, a.store_id ASC, a.rule_id ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,67 @@
|
||||
<?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.bonus.BonusReceivedEmployeeMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.bonus.BonusReceivedEmployeeDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="received_store_id" jdbcType="BIGINT" property="receivedStoreId" />
|
||||
<result column="rule_id" jdbcType="BIGINT" property="ruleId" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="pay_date" jdbcType="DATE" property="payDate" />
|
||||
<result column="reward_ratio" jdbcType="DECIMAL" property="rewardRatio" />
|
||||
<result column="received_amount" jdbcType="DECIMAL" property="receivedAmount" />
|
||||
<result column="reward_user_name" jdbcType="VARCHAR" property="rewardUserName" />
|
||||
<result column="reward_user_id" jdbcType="VARCHAR" property="rewardUserId" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO bonus_received_employee(received_store_id, rule_id, store_id, pay_date, reward_ratio, received_amount, reward_user_name, reward_user_id)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.receivedStoreId}, #{item.ruleId}, #{item.storeId}, #{item.payDate}, #{item.rewardRatio}, #{item.receivedAmount}, #{item.rewardUserName}, #{item.rewardUserId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="selectByReceivedStoreId" resultMap="BaseResultMap">
|
||||
SELECT id, received_store_id, rule_id, store_id, pay_date, reward_ratio, received_amount, reward_user_name, reward_user_id, create_time
|
||||
FROM bonus_received_employee
|
||||
WHERE received_store_id = #{receivedStoreId}
|
||||
ORDER BY id
|
||||
</select>
|
||||
|
||||
<select id="selectEmployeeListByCondition" resultMap="BaseResultMap">
|
||||
SELECT e.id, e.received_store_id, e.rule_id, e.store_id, e.pay_date, e.reward_ratio, e.received_amount, e.reward_user_name, e.reward_user_id, e.create_time
|
||||
FROM bonus_received_employee e
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
INNER JOIN store_${enterpriseId} st ON e.store_id = st.store_id AND st.is_delete = 'effective'
|
||||
</if>
|
||||
<where>
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
AND (st.store_num LIKE CONCAT('%', #{storeNumOrName}, '%') OR st.store_name LIKE CONCAT('%', #{storeNumOrName}, '%'))
|
||||
</if>
|
||||
<if test="startMonth != null">
|
||||
AND e.pay_date >= #{startMonth}
|
||||
</if>
|
||||
<if test="endMonth != null">
|
||||
AND e.pay_date <= #{endMonth}
|
||||
</if>
|
||||
<if test="rewardUserName != null and rewardUserName != ''">
|
||||
AND e.reward_user_name LIKE CONCAT('%', #{rewardUserName}, '%')
|
||||
</if>
|
||||
<if test="storeId != null and storeId != ''">
|
||||
AND e.store_id = #{storeId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY e.create_time DESC, e.store_id ASC
|
||||
</select>
|
||||
|
||||
<select id="getMonthlyStatisticsGroupByStore" resultMap="BaseResultMap">
|
||||
SELECT store_id, reward_user_id, reward_user_name, SUM(received_amount) AS received_amount
|
||||
FROM bonus_received_employee
|
||||
WHERE DATE_FORMAT(pay_date, '%Y-%m') = #{payMonth}
|
||||
GROUP BY store_id, reward_user_id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?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.bonus.BonusReceivedStoreMapper">
|
||||
<resultMap id="BaseResultMap" type="com.cool.store.entity.bonus.BonusReceivedStoreDO">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
-->
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="rule_id" jdbcType="BIGINT" property="ruleId" />
|
||||
<result column="store_id" jdbcType="VARCHAR" property="storeId" />
|
||||
<result column="pay_date" jdbcType="DATE" property="payDate" />
|
||||
<result column="received_monthly" jdbcType="DECIMAL" property="receivedMonthly" />
|
||||
<result column="business_days" jdbcType="INTEGER" property="businessDays" />
|
||||
<result column="received_daily" jdbcType="DECIMAL" property="receivedDaily" />
|
||||
<result column="received_daily_last" jdbcType="DECIMAL" property="receivedDailyLast" />
|
||||
<result column="amount_total" jdbcType="DECIMAL" property="amountTotal" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectCountByRuleIdAndPayDate" resultType="int">
|
||||
SELECT COUNT(1) FROM bonus_received_store
|
||||
WHERE rule_id = #{ruleId} AND DATE_FORMAT(pay_date, '%Y-%m') = #{payDate}
|
||||
</select>
|
||||
|
||||
<select id="selectListByCondition" resultMap="BaseResultMap">
|
||||
SELECT a.id, a.rule_id, a.store_id, a.pay_date, a.received_monthly, a.business_days, a.received_daily, a.received_daily_last, a.amount_total, a.create_time
|
||||
FROM bonus_received_store a
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
INNER JOIN store_${enterpriseId} b ON a.store_id = b.store_id AND b.is_delete = 'effective'
|
||||
</if>
|
||||
<where>
|
||||
<if test="storeNumOrName != null and storeNumOrName != ''">
|
||||
AND (b.store_num LIKE CONCAT('%', #{storeNumOrName}, '%') OR b.store_name LIKE CONCAT('%', #{storeNumOrName}, '%'))
|
||||
</if>
|
||||
<if test="startMonth != null">
|
||||
AND a.pay_date >= #{startMonth}
|
||||
</if>
|
||||
<if test="endMonth != null">
|
||||
AND a.pay_date <= #{endMonth}
|
||||
</if>
|
||||
<if test="storeId != null and storeId != ''">
|
||||
AND a.store_id = #{storeId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user