From ecef3df4890be54c1da2a8a4fc1c8c1f50f1c263 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期一, 07 四月 2025 15:41:47 +0800 Subject: [PATCH] 式样代码管理 --- pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml | 252 ++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 211 insertions(+), 41 deletions(-) diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml index 8e5ea53..fbed989 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/SeGeneralMapper.xml @@ -5,16 +5,17 @@ <!--@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" /> - <result column="total_amount" jdbcType="FLOAT" property="totalAmount" /> + <result column="refund_amount" jdbcType="FLOAT" property="refundAmount" /> <result column="operate_date" jdbcType="TIMESTAMP" property="operateDate" /> <result column="audit_status" jdbcType="TINYINT" property="auditStatus" /> </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, refund_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, refund_amount, + operate_date, audit_status) + values (#{id,jdbcType=BIGINT}, #{cashierId,jdbcType=BIGINT}, #{cashierName,jdbcType=VARCHAR}, + #{tradeAmount,jdbcType=FLOAT}, #{gift,jdbcType=FLOAT}, #{refundAmount,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, @@ -53,8 +57,8 @@ <if test="gift != null"> gift, </if> - <if test="totalAmount != null"> - total_amount, + <if test="refundAmount != null"> + refund_amount, </if> <if test="operateDate != null"> operate_date, @@ -67,6 +71,9 @@ <if test="id != null"> #{id,jdbcType=BIGINT}, </if> + <if test="cashierId != null"> + #{cashierId,jdbcType=BIGINT}, + </if> <if test="cashierName != null"> #{cashierName,jdbcType=VARCHAR}, </if> @@ -76,8 +83,8 @@ <if test="gift != null"> #{gift,jdbcType=FLOAT}, </if> - <if test="totalAmount != null"> - #{totalAmount,jdbcType=FLOAT}, + <if test="refundAmount != null"> + #{refundAmount,jdbcType=FLOAT}, </if> <if test="operateDate != null"> #{operateDate,jdbcType=TIMESTAMP}, @@ -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> @@ -100,8 +110,8 @@ <if test="gift != null"> gift = #{gift,jdbcType=FLOAT}, </if> - <if test="totalAmount != null"> - total_amount = #{totalAmount,jdbcType=FLOAT}, + <if test="refundAmount != null"> + refund_amount = #{refundAmount,jdbcType=FLOAT}, </if> <if test="operateDate != null"> operate_date = #{operateDate,jdbcType=TIMESTAMP}, @@ -115,10 +125,11 @@ <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}, + refund_amount = #{refundAmount,jdbcType=FLOAT}, operate_date = #{operateDate,jdbcType=TIMESTAMP}, audit_status = #{auditStatus,jdbcType=TINYINT} where id = #{id,jdbcType=BIGINT} @@ -129,28 +140,59 @@ SELECT DISTINCT Date(ope.operate_dt) AS operateDate FROM se_card_operate ope - WHERE Date(ope.operate_dt) NOT IN(SELECT operate_date FROM se_general) AND Date(ope.operate_dt) != CURDATE() + WHERE Date(ope.operate_dt) NOT IN(SELECT operate_date FROM se_general) +<!-- 鍙栨秷褰撳ぉ闄愬埗--> +<!-- AND Date(ope.operate_dt) != CURDATE()--> </select> <!--鏍规嵁浜ゆ槗鏃ユ湡鑾峰彇鎬昏处璁板綍鍒楄〃锛堝緟鐢熸垚鐨勶級 --> <select id="getGeneralByOperateDate" resultType="com.dy.pipIrrGlobal.pojoSe.SeGeneral"> SELECT - us.`name` AS cashierName, - IFNULL(SUM(ope.trade_amount),0) AS tradeAmount, - IFNULL(SUM(ope.gift),0) AS gift, - IFNULL((SUM(ope.trade_amount) + SUM(ope.gift)),0) AS totalAmount, - Date(ope.operate_dt) AS operateDate, - 1 AS auditStatus + us.id AS cashierId, + us.`name` AS cashierName, + (IFNULL(SUM(ope.trade_amount),0) + IFNULL(SUM(ope.card_cost),0)) AS tradeAmount, + IFNULL(SUM(ope.gift),0) AS gift, + IFNULL(SUM(ope.refund_amount),0) AS refundAmount, + Date(ope.operate_dt) AS operateDate, + 1 AS auditStatus FROM se_card_operate ope - INNER JOIN ba_user us ON ope.operator = us.id - WHERE Date(ope.operate_dt) = #{operateDate} + INNER JOIN ba_user us ON ope.operator = us.id + WHERE Date(ope.operate_dt) = #{operateDate} AND ope.operate_valid = 2 GROUP BY ope.operator, Date(ope.operate_dt) + + UNION ALL + + SELECT + 1000000 AS cashierId, + '寰俊' AS cashierName, + IFNULL(SUM(amount), 0) AS tradeAmount, + 0 AS gift, + 0 AS refundAmount, + Date(recharge_time) AS operateDate, + 1 AS auditStatus + FROM se_wallet_recharge + WHERE Date(recharge_time) = #{operateDate} + GROUP BY Date(recharge_time) + + UNION ALL + + SELECT + 1000000 AS cashierId, + '寰俊' AS cashierName, + IFNULL(-SUM(refund_amount), 0) AS tradeAmount, + 0 AS gift, + 0 AS refundAmount, + Date(audit_time) AS operateDate, + 1 AS auditStatus + FROM se_refund + WHERE Date(audit_time) = #{operateDate} + GROUP BY Date(audit_time) </select> <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鎬昏处璁板綍鏁�--> <select id="getRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> SELECT - COUNT(*) AS recordCount + COUNT(*) AS recordCount FROM se_general <where> <if test = "cashierName != null and cashierName !=''"> @@ -158,7 +200,7 @@ </if> <if test = "auditStatus != null and auditStatus > 0"> - AND audit_status = ${auditStatus} + AND audit_status = #{auditStatus} </if> <if test = "operateDateStart != null and operateDateStop != null"> @@ -170,16 +212,18 @@ <!--鏍规嵁鎸囧畾鏉′欢鑾峰彇鎬昏处璁板綍--> <select id="getGenerals" resultType="com.dy.pipIrrGlobal.voSe.VoGeneral"> SELECT - id AS generalId, - cashier_name AS cashierName, - trade_amount AS tradeAmount, - gift, - total_amount AS totalAmount, - Date(operate_date) AS operateDate, - (CASE - WHEN audit_status = 1 THEN "鏈鏍�" - WHEN audit_status = 2 THEN "鍚屾剰" - WHEN audit_status = 3 THEN "椹冲洖" + id AS generalId, + cashier_id AS cashierId, + cashier_name AS cashierName, + trade_amount AS tradeAmount, + gift, + refund_amount AS refundAmount, + (trade_amount + gift - refund_amount) AS totalAmount, + Date(operate_date) AS operateDate, + (CASE + WHEN audit_status = 1 THEN '鏈鏍�' + WHEN audit_status = 2 THEN '鍚屾剰' + WHEN audit_status = 3 THEN '椹冲洖' END) AS auditStatus FROM se_general <where> @@ -188,7 +232,7 @@ </if> <if test = "auditStatus != null and auditStatus > 0"> - AND audit_status = ${auditStatus} + AND audit_status = #{auditStatus} </if> <if test = "operateDateStart != null and operateDateStop != null"> @@ -196,9 +240,135 @@ </if> </where> ORDER BY Date(operate_date) DESC - <if test="pageCurr != null and pageSize != null"> - LIMIT ${pageCurr}, ${pageSize} - </if> + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> </select> + <!--鑾峰彇鎸囧畾鏃ユ湡銆佹寚瀹氭敹閾跺憳銆佹寚瀹氭敮浠樻柟寮忓疄鏀堕噾棰濆悎璁�--> + <select id="getPaymentSums" resultType="java.lang.Float"> + SELECT + (SUM(ope.trade_amount) + SUM(ope.card_cost)) AS tradeAmount + FROM se_card_operate ope + <where> + AND ope.operate_valid = 2 + <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="getToAuditRecordCount" parameterType="java.util.Map" resultType="java.lang.Long">--> +<!-- SELECT--> +<!-- COUNT(*) AS recordCount--> +<!-- FROM v_trade_summary--> +<!-- <where>--> +<!-- <if test = "cashierId != null and cashierId > 0">--> +<!-- AND cashierId = ${cashierId}--> +<!-- </if>--> + +<!-- <if test = "tradeDate != null">--> +<!-- AND tradeDate = #{tradeDate}--> +<!-- </if>--> +<!-- </where>--> +<!-- </select>--> + + <!--寮�鍗$郴缁熶氦鏄撶粺璁★紝鏀堕摱鍛�+鏃ユ湡+绫诲瀷鍒嗙粍--> + <select id="getSummaries" resultType="com.dy.pipIrrGlobal.voSe.VoTransactionStatistics"> + SELECT + CASE + WHEN ope.operate_type = 1 THEN '寮�鍗�' + WHEN ope.operate_type = 2 THEN '鍏呭��' + WHEN ope.operate_type = 3 THEN '閿�鍗�' + WHEN ope.operate_type = 4 THEN '琛ュ崱' + WHEN ope.operate_type = 5 THEN '杩旇繕' + WHEN ope.operate_type = 10 THEN '鍙嶅啓' + END AS operateType, + Date(ope.operate_dt) AS tradeDate, + COUNT(*) AS count, + (IFNULL(SUM(ope.trade_amount), 0) + IFNULL(SUM(ope.card_cost), 0)) AS received, + IFNULL(SUM(ope.gift), 0) AS gift, + IFNULL(sum(ope.refund_amount),0) AS refundAmount, + us.id AS cashierId + FROM se_card_operate ope + INNER JOIN ba_user us ON us.id = ope.operator + <where> + AND ope.operate_type IN(1,2,3,4,5,10) + AND ope.operate_valid = 2 + <if test = "cashierId != null and cashierId > 0"> + AND us.id = #{cashierId} + </if> + + <if test = "timeStart != null and timeStop != null"> + AND Date(ope.operate_dt) BETWEEN #{timeStart} AND #{timeStop} + </if> + </where> + GROUP BY ope.operate_type, Date(ope.operate_dt), us.id + ORDER BY tradeDate + +<!-- SELECT * FROM v_trade_summary--> +<!-- <where>--> +<!-- <if test = "cashierId != null and cashierId > 0">--> +<!-- AND cashierId = #{cashierId}--> +<!-- </if>--> + +<!-- <if test = "timeStart != null and timeStop != null">--> +<!-- AND Date(tradeDate) BETWEEN #{timeStart} AND #{timeStop}--> +<!-- </if>--> +<!-- </where>--> +<!-- ORDER BY tradeDate--> + </select> + + <!-- 鏍规嵁鏀堕摱鍛業D鍙婃棩鏈熻幏鍙栬储鍔″璐浜ゆ槗鏄庣粏璁板綍鏁�--> + <select id="getTradeDetailsRecordCount" parameterType="java.util.Map" resultType="java.lang.Long"> + SELECT + COUNT(*) AS recordCount + FROM v_trade_details + <where> + <if test = "cashierId != null and cashierId > 0"> + AND cashierId = #{cashierId} + </if> + + <if test = "tradeDate != null"> + AND Date(tradeTime) = #{tradeDate} + </if> + </where> + </select> + + <!--鏍规嵁鏀堕摱鍛業D鍙婃棩鏈熻幏鍙栬储鍔″璐浜ゆ槗鏄庣粏璁板綍--> + <select id="getTradeDetails" resultType="com.dy.pipIrrGlobal.voSe.VoTradeDetails"> + SELECT * FROM v_trade_details + <where> + <if test = "cashierId != null and cashierId > 0"> + AND cashierId = #{cashierId} + </if> + + <if test = "tradeDate != null"> + AND Date(tradeTime) = #{tradeDate} + </if> + </where> + ORDER BY tradeTime + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> + <!-- 鍒犻櫎浠婂ぉ鐨勬�昏处--> + <delete id="deleteTodayGeneral"> + DELETE FROM se_general + WHERE operate_date = DATE(NOW()) + </delete> </mapper> \ No newline at end of file -- Gitblit v1.8.0