姜永辉 1 год назад
Родитель
Сommit
36dd815dcf

+ 11 - 0
src/main/java/com/dk/oauth/controller/integral/CouponSendController.java

@@ -43,6 +43,17 @@ public class CouponSendController{
     }
 
     /**
+     * @desc   : 条件查询
+     * @date   : 2024/7/25 10:22
+     * @author : 寇珊珊
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by_history"})
+    public ResponseResultVO<PageList<CouponSendResponse>> selectByCondHistory(@RequestBody CouponSendQuery couponSendQuery ) {
+        return couponSendService.selectByCondHistory(couponSendQuery);
+    }
+
+    /**
      * @desc   : 通过ID查询
      * @date   : 2024/7/25 10:21
      * @author : 寇珊珊

+ 8 - 0
src/main/java/com/dk/oauth/mapper/integral/CouponSendMapper.java

@@ -31,6 +31,14 @@ public interface CouponSendMapper extends BaseMapper<CouponSend>{
      */
     List<CouponSendResponse> selectByCond(CouponSendQuery couponSendQuery);
 
+
+    /**
+     * @desc   : 条件查询
+     * @date   : 2024/7/24 9:22
+     * @author : 寇珊珊
+     */
+    List<CouponSendResponse> selectByCondHistory(CouponSendQuery couponSendQuery);
+
     /**
      * @desc   : 条件查询个数
      * @date   : 2024/7/24 9:22

+ 34 - 5
src/main/java/com/dk/oauth/mapper/integral/CouponSendMapper.xml

@@ -5,11 +5,12 @@
     <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
-        send_id,cp_id, coupon_id, send_date, end_date, user_num, flg_valid
+        send_id,cp_id, coupon_id, send_date, end_date, user_num, flg_valid,send_staff,send_user
     </sql>
     <!-- 通用查询列Response -->
     <sql id="Base_Column_List_Response">
-        tmcs.send_id,tmcs.cp_id, tmcs.coupon_id, tmcs.send_date, tmcs.end_date, tmcs.user_num, tmcs.flg_valid
+        tmcs.send_id,tmcs.cp_id, tmcs.coupon_id, tmcs.send_date, tmcs.end_date, tmcs.user_num,
+        tmcs.flg_valid,tmcs.send_staff,tmcs.send_user
     </sql>
 
     <!-- 通用查询映射结果 -->
@@ -21,6 +22,9 @@
         <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
         <result column="user_num" property="userNum"/>
         <result column="flg_valid" property="flgValid"/>
+        <result column="send_staff" property="sendStaff"/>
+        <result column="send_user" property="sendUser" typeHandler="UuidTypeHandler"/>
+
     </resultMap>
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.CouponSendResponse">
@@ -33,6 +37,9 @@
         <result column="flg_valid" property="flgValid"/>
         <result column="cp_name" property="cpName"/>
         <result column="coupon_name" property="couponName"/>
+        <result column="send_staff" property="sendStaff"/>
+        <result column="coupon_receive_count" property="couponReceiveCount"/>
+        <result column="send_user" property="sendUser" typeHandler="UuidTypeHandler"/>
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -42,7 +49,7 @@
                 AND tmcs.cp_id = #{cpId}
             </if>
             <if test="couponId != null and couponId != ''">
-                AND tmcs.coupon_id = #{couponId}
+                AND tmcs.coupon_id = #{couponId}::uuid
             </if>
             <if test="sendDate != null">
                 AND tmcs.send_date = #{sendDate}
@@ -62,6 +69,10 @@
             <if test="couponName != null and couponName != ''">
                 AND tmc.coupon_name LIKE concat('%',my_ex.likequery(#{couponName}),'%')
             </if>
+            <if test="sendUser != null and sendUser != ''">
+                AND tmcs.send_user = #{sendUser}::uuid
+            </if>
+
         </where>
     </sql>
 
@@ -88,6 +99,24 @@
         </if>
     </select>
 
+    <!-- 查询表dkic_a.t_mst_coupon_send,(条件查询+分页)列表 -->
+    <select id="selectByCondHistory" resultMap="BaseResultMapResponse">
+        SELECT
+        <include refid="Base_Column_List_Response"/>
+        ,tac.cp_name
+        ,tmc.coupon_name
+        ,(select count(tmcr.send_id) from dkic_a.t_mst_coupon_receive tmcr where tmcr.send_id = tmcs.send_id ) coupon_receive_count
+        FROM dkic_a.t_mst_coupon_send tmcs
+        left join dkic_a.t_a_company tac on tac.cp_id = tmcs.cp_id
+        left join dkic_a.t_mst_coupon tmc on tmc.coupon_id = tmcs.coupon_id
+        <include refid="Condition"/>
+        order by tmcs.send_date desc
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+
+    </select>
+
     <!-- 查询表dkic_a.t_mst_coupon_send,(条件查询)个数 -->
     <select id="countByCond" resultType="Long">
         SELECT
@@ -105,7 +134,7 @@
         FROM dkic_a.t_mst_coupon_send tmcs
         left join dkic_a.t_a_company tac on tac.cp_id = tmcs.cp_id
         left join dkic_a.t_mst_coupon tmc on tmc.coupon_id = tmcs.coupon_id
-        WHERE cp_id = #{id}
+        WHERE tmcs.send_id = #{sendId}::uuid
     </select>
 
     <!-- 根据主键锁定表dkic_a.t_mst_coupon_send的一行数据 -->
@@ -113,7 +142,7 @@
         SELECT
         <include refid="Base_Column_List"/>
         FROM dkic_a.t_mst_coupon_send
-        WHERE send_id = #{sendId}
+        WHERE send_id = #{sendId}::uuid
         for update
     </select>
 

+ 14 - 0
src/main/java/com/dk/oauth/model/pojo/integral/CouponSend.java

@@ -92,6 +92,20 @@ public class CouponSend extends PageInfo<CouponSend> implements Serializable {
     @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
     private Boolean flgValid;
 
+    /**
+     * 发出用户ID
+     */
+    @Excel(name = "发出用户ID")
+    @ApiModelProperty(value = "发出用户ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendUser;
+
+    /**
+     * 发出员工
+     */
+    @Excel(name = "发出员工")
+    @ApiModelProperty(value = "发出员工")
+    private String sendStaff;
 
     /*
      * 相关属性

+ 15 - 0
src/main/java/com/dk/oauth/model/query/integral/CouponSendQuery.java

@@ -88,6 +88,21 @@ public class CouponSendQuery extends PageInfo<CouponSendQuery>  {
     @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
     private Boolean flgValid;
 
+    /**
+     * 发出用户ID
+     */
+    @Excel(name = "发出用户ID")
+    @ApiModelProperty(value = "发出用户ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendUser;
+
+    /**
+     * 发出员工
+     */
+    @Excel(name = "发出员工")
+    @ApiModelProperty(value = "发出员工")
+    private String sendStaff;
+
 
     /*
      * 相关属性

+ 22 - 0
src/main/java/com/dk/oauth/model/response/integral/CouponSendResponse.java

@@ -89,6 +89,28 @@ public class CouponSendResponse {
     @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
     private Boolean flgValid;
 
+    /**
+     * 发出用户ID
+     */
+    @Excel(name = "发出用户ID")
+    @ApiModelProperty(value = "发出用户ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendUser;
+
+    /**
+     * 发出员工
+     */
+    @Excel(name = "发出员工")
+    @ApiModelProperty(value = "发出员工")
+    private String sendStaff;
+
+    /**
+     * 优惠券发出后助力的人数
+     */
+    @Excel(name = "优惠券发出后助力的人数")
+    @ApiModelProperty(value = "优惠券发出后助力的人数")
+    private Integer couponReceiveCount;
+
 
     /*
      * 相关属性

+ 11 - 0
src/main/java/com/dk/oauth/service/integral/CouponSendService.java

@@ -61,6 +61,17 @@ public class CouponSendService extends BaseService<CouponSend> {
 				couponSendMapper.countByCond(couponSendQuery));
 	}
 
+	/**
+	 * @desc   : 条件查询-历史查询
+	 * @date   : 2024/7/25 10:22
+	 * @author : 寇珊珊
+	 */
+	@Pagination
+	public ResponseResultVO<PageList<CouponSendResponse>> selectByCondHistory(CouponSendQuery couponSendQuery) {
+		return super.mergeListWithCount(couponSendQuery, couponSendMapper.selectByCondHistory(couponSendQuery),
+				couponSendMapper.countByCond(couponSendQuery));
+	}
+
 
 	/**
 	 * @desc   : 新建