xuhy
2024-09-05 8c2128317af3e5a2df32150f3684167925ee4508
ruoyi-system/src/main/resources/mapper/system/TOrderMealMapper.xml
@@ -20,18 +20,18 @@
        <result column="status" property="status" />
        <result column="isCover" property="isCover" />
        <result column="shopId" property="shopId" />
        <result column="shopId" property="shopId" />
        <result column="generatorId" property="generatorId" />
    </resultMap>
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, boardId, mealType, mealPerson, orderMoney, payMoney, payType, createTime, updateTime, disabled,
            createBy, updateBy, orderNum, status,isCover,shopId
            createBy, updateBy, orderNum, status,isCover,shopId,generatorId
    </sql>
    <select id="pageList" resultType="com.ruoyi.system.vo.TOrderMealVO">
        select
        tom.id, tom.boardId, tom.mealType, tom.mealPerson, tom.orderMoney, tom.payMoney, tom.payType, tom.createTime, tom.updateTime, tom.disabled,
        tom.createBy, tom.updateBy, tom.orderNum, tom.status,tom.isCover,tom.shopId,tb.boardName
        tom.createBy, tom.updateBy, tom.orderNum, tom.status,tom.isCover,tom.shopId,tom.generatorId,tb.boardName
        from t_order_meal tom
        left join t_board tb on tb.id = tom.boardId
        <where>
@@ -164,5 +164,69 @@
            AND tom.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
    </select>
    <select id="pageListGenerator" resultType="com.ruoyi.system.vo.TOrderMealVO">
        select
        tom.id, tom.boardId, tom.mealType, tom.mealPerson, tom.orderMoney, tom.payMoney, tom.payType, tom.createTime, tom.updateTime, tom.disabled,
        tom.createBy, tom.updateBy, tom.orderNum, tom.status,tom.isCover,tom.shopId,tom.generatorId,tb.boardName
        from t_order_meal tom
        left join t_board tb on tb.id = tom.boardId
        <where>
            <if test="query.generatorId != null">
                and tom.generatorId = #{query.generatorId}
            </if>
            <if test="query.payType != null">
                and tom.payType = #{query.payType}
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND (tom.createTime BETWEEN #{query.startTime} AND #{query.endTime})
            </if>
            AND tom.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tom.createTime DESC
    </select>
    <select id="getDataGeneratorMealDetail" resultType="java.util.Map">
        SELECT
            SUM(CASE WHEN payType = 1 THEN payMoney ELSE 0 END) AS moneyPay,
            SUM(CASE WHEN payType = 2 THEN payMoney ELSE 0 END) AS aliPay,
            SUM(CASE WHEN payType = 3 THEN payMoney ELSE 0 END) AS weiXinPay,
            SUM(CASE WHEN payType = 4 THEN payMoney ELSE 0 END) AS cardPay,
            SUM(CASE WHEN payType = 5 THEN payMoney ELSE 0 END) AS otherPay
        from t_order_meal
        <where>
            <if test="query.dataId != null">
                and generatorId = #{query.dataId}
            </if>
            <if test="query.payType != null">
                and payType = #{query.payType}
            </if>
            <if test="query.generatorId != null">
                and generatorId = #{query.generatorId}
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND (createTime BETWEEN #{query.startTime} AND #{query.endTime})
            </if>
            AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
    </select>
    <select id="mealGeneratorExport" resultType="com.ruoyi.system.vo.TOrderMealVO">
        select
        tom.id, tom.boardId, tom.mealType, tom.mealPerson, tom.orderMoney, tom.payMoney, tom.payType, tom.createTime, tom.updateTime, tom.disabled,
        tom.createBy, tom.updateBy, tom.orderNum, tom.status,tom.isCover,tom.shopId,tb.boardName
        from t_order_meal tom
        left join t_board tb on tb.id = tom.boardId
        <where>
            <if test="query.payType != null">
                and tom.payType = #{query.payType}
            </if>
            <if test="query.generatorId != null">
                and tom.generatorId = #{query.generatorId}
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND (tom.createTime BETWEEN #{query.startTime} AND #{query.endTime})
            </if>
            AND tom.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tom.createTime DESC
    </select>
</mapper>