Administrator
2024-01-25 7de25577335478f3f2a55ac41ace3360b8f56b46
pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml
@@ -5,6 +5,7 @@
    <!--@mbg.generated-->
    <!--@Table se_general-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="cashier_id" jdbcType="BIGINT" property="cashierId" />
    <result column="cashier_name" jdbcType="VARCHAR" property="cashierName" />
    <result column="trade_amount" jdbcType="FLOAT" property="tradeAmount" />
    <result column="gift" jdbcType="FLOAT" property="gift" />
@@ -14,7 +15,7 @@
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, cashier_name, trade_amount, gift, total_amount, operate_date, audit_status
    id, cashier_id, cashier_name, trade_amount, gift, total_amount, operate_date, audit_status
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
@@ -30,12 +31,12 @@
  </delete>
  <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoSe.SeGeneral">
    <!--@mbg.generated-->
    insert into se_general (id, cashier_name, trade_amount,
      gift, total_amount, operate_date,
      audit_status)
    values (#{id,jdbcType=BIGINT}, #{cashierName,jdbcType=VARCHAR}, #{tradeAmount,jdbcType=FLOAT},
      #{gift,jdbcType=FLOAT}, #{totalAmount,jdbcType=FLOAT}, #{operateDate,jdbcType=TIMESTAMP},
      #{auditStatus,jdbcType=TINYINT})
    insert into se_general (id, cashier_id, cashier_name,
      trade_amount, gift, total_amount,
      operate_date, audit_status)
    values (#{id,jdbcType=BIGINT}, #{cashierId,jdbcType=BIGINT}, #{cashierName,jdbcType=VARCHAR},
      #{tradeAmount,jdbcType=FLOAT}, #{gift,jdbcType=FLOAT}, #{totalAmount,jdbcType=FLOAT},
      #{operateDate,jdbcType=TIMESTAMP}, #{auditStatus,jdbcType=TINYINT})
  </insert>
  <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoSe.SeGeneral">
    <!--@mbg.generated-->
@@ -43,6 +44,9 @@
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="cashierId != null">
        cashier_id,
      </if>
      <if test="cashierName != null">
        cashier_name,
@@ -66,6 +70,9 @@
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="cashierId != null">
        #{cashierId,jdbcType=BIGINT},
      </if>
      <if test="cashierName != null">
        #{cashierName,jdbcType=VARCHAR},
@@ -91,6 +98,9 @@
    <!--@mbg.generated-->
    update se_general
    <set>
      <if test="cashierId != null">
        cashier_id = #{cashierId,jdbcType=BIGINT},
      </if>
      <if test="cashierName != null">
        cashier_name = #{cashierName,jdbcType=VARCHAR},
      </if>
@@ -115,7 +125,8 @@
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoSe.SeGeneral">
    <!--@mbg.generated-->
    update se_general
    set cashier_name = #{cashierName,jdbcType=VARCHAR},
    set cashier_id = #{cashierId,jdbcType=BIGINT},
      cashier_name = #{cashierName,jdbcType=VARCHAR},
      trade_amount = #{tradeAmount,jdbcType=FLOAT},
      gift = #{gift,jdbcType=FLOAT},
      total_amount = #{totalAmount,jdbcType=FLOAT},
@@ -135,6 +146,7 @@
  <!--根据交易日期获取总账记录列表(待生成的)  -->
  <select id="getGeneralByOperateDate" resultType="com.dy.pipIrrGlobal.pojoSe.SeGeneral">
    SELECT
        us.id AS cashierId,
      us.`name` AS cashierName,
      IFNULL(SUM(ope.trade_amount),0) AS tradeAmount,
      IFNULL(SUM(ope.gift),0) AS gift,
@@ -170,7 +182,8 @@
  <!--根据指定条件获取总账记录-->
  <select id="getGenerals" resultType="com.dy.pipIrrGlobal.voSe.VoGeneral">
    SELECT
      id AS generalId,
        CAST(id AS  char) AS generalId,
        CAST(cashier_id AS char) AS cashierId,
      cashier_name AS cashierName,
      trade_amount AS tradeAmount,
      gift,
@@ -201,4 +214,76 @@
    </if>
  </select>
  <!--获取指定日期、指定收银员、指定支付方式实收金额合计-->
  <select id="getPaymentSums" resultType="java.lang.Float">
    SELECT
    SUM(ope.trade_amount) AS tradeAmount
    FROM se_card_operate ope
    <where>
      <if test = "tradeDate != null and tradeDate !=''">
        AND Date(ope.operate_dt) = #{tradeDate}
      </if>
      <if test = "paymentId != null and paymentId >0">
        AND ope.payment_id = ${paymentId}
      </if>
      <if test = "cashierId != null and cashierId >0">
        AND ope.operator = ${cashierId}
      </if>
    </where>
    GROUP BY ope.payment_id,  Date(ope.operate_dt)
  </select>
  <!--根基指定日期、指定收银员获取笔数合计、实收金额合计、赠送金额合计-->
  <select id="getTransactionStatisticsSums" resultType="java.util.Map">
    SELECT
      SUM(count) AS totalCount,
      SUM(received) AS totalReceived,
      SUM(gift) AS totalGift
    FROM v_transactionstatistics2
    <where>
      <if test = "tradeDate != null and tradeDate !=''">
        AND tradeDate = #{tradeDate}
      </if>
      <if test = "cashierId != null and cashierId >0">
        AND cashierId = ${cashierId}
      </if>
    </where>
  </select>
  <!--  财务对账审核页,收银员+日期分组,排除交易类型分组,记录数-->
  <select id="getToAuditRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">
    SELECT
    COUNT(*) AS recordCount
    FROM v_transactionstatistics2
    <where>
      <if test = "cashierId != null and cashierId > 0">
        AND cashierId = ${cashierId}
      </if>
      <if test = "tradeDate != null">
        AND tradeDate = #{tradeDate}
      </if>
    </where>
  </select>
  <!--财务对账审核页,收银员+日期分组,排除交易类型分组-->
  <select id="getToAudit" resultType="com.dy.pipIrrGlobal.voSe.VoTransactionStatistics">
    SELECT * FROM v_transactionstatistics2
    <where>
      <if test = "cashierId != null and cashierId > 0">
        AND cashierId = ${cashierId}
      </if>
      <if test = "tradeDate != null">
        AND tradeDate = #{tradeDate}
      </if>
    </where>
    ORDER BY tradeDate
    <if test="pageCurr != null and pageSize != null">
      LIMIT ${pageCurr}, ${pageSize}
    </if>
  </select>
</mapper>