koushanshan 1 год назад
Родитель
Сommit
6df652cdea

+ 32 - 6
src/main/java/com/dk/oauth/controller/integral/IntegralController.java

@@ -1,13 +1,16 @@
 package com.dk.oauth.controller.integral;
 
-import com.dk.oauth.model.pojo.integral.Integral;
-import com.dk.common.controller.BaseController;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.common.service.BaseService;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
+import com.dk.oauth.model.pojo.integral.Integral;
+import com.dk.oauth.model.query.integral.IntegralQuery;
+import com.dk.oauth.model.response.integral.IntegralResponse;
 import com.dk.oauth.service.integral.IntegralService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
 
 @Api(tags = "积分API接口")
 @RestController
@@ -21,4 +24,27 @@ public class IntegralController{
     @Autowired
     private IntegralService integralService;
 
+    /**
+     * @desc   : 条件查询
+     * @date   : 2024/7/24 15:46
+     * @author : 寇珊珊
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<IntegralResponse>> selectByCond(@RequestBody IntegralQuery integralQuery) {
+        return integralService.selectByCond(integralQuery);
+    }
+
+    /**
+     * @desc   : 通过ID查询
+     * @date   : 2024/7/24 15:48
+     * @author : 寇珊珊
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO<?> selectById(@PathVariable String id) {
+        return integralService.selectById(id);
+    }
+
+
+
 }

+ 32 - 2
src/main/java/com/dk/oauth/controller/integral/IntegralTacticController.java

@@ -1,11 +1,17 @@
 package com.dk.oauth.controller.integral;
 
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.model.pojo.integral.IntegralTactic;
 import com.dk.common.controller.BaseController;
 import com.dk.common.service.BaseService;
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.dk.oauth.model.query.integral.IntegralQuery;
+import com.dk.oauth.model.query.integral.IntegralTacticQuery;
+import com.dk.oauth.model.response.integral.IntegralResponse;
+import com.dk.oauth.model.response.integral.IntegralTacticResponse;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RestController;
 import io.swagger.annotations.Api;
 import com.dk.oauth.service.integral.IntegralTacticService;
 
@@ -21,4 +27,28 @@ public class IntegralTacticController{
     @Autowired
     private IntegralTacticService integralTacticService;
 
+
+    /**
+     * @desc   : 条件查询
+     * @date   : 2024/7/24 15:46
+     * @author : 寇珊珊
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<IntegralTacticResponse>> selectByCond(@RequestBody IntegralTacticQuery integralTacticQuery) {
+        return integralTacticService.selectByCond(integralTacticQuery);
+    }
+
+    /**
+     * @desc   : 通过ID查询
+     * @date   : 2024/7/24 15:48
+     * @author : 寇珊珊
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO<?> selectById(@PathVariable String id) {
+        return integralTacticService.selectById(id);
+    }
+
+
+
 }

+ 3 - 3
src/main/java/com/dk/oauth/mapper/integral/CouponReceiveMapper.xml

@@ -15,7 +15,7 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.oauth.model.pojo.integral.CouponReceive">
-        <id column="cp_id" property="cpId"/>
+        <id column="cp_id" property="cpId" typeHandler="UuidTypeHandler"/>
                 <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
                 <result column="user_wxid" property="userWxid"/>
             <result column="assist_date" property="assistDate" typeHandler="TimestampTypeHandler"/>
@@ -23,7 +23,7 @@
     </resultMap>
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.CouponReceiveResponse">
-        <id column="cp_id" property="cpId"/>
+        <id column="cp_id" property="cpId" typeHandler="UuidTypeHandler"/>
         <result column="cp_name" property="cpName"/>
         <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
         <result column="coupon_name" property="couponName" />
@@ -107,7 +107,7 @@
         SELECT
         <include refid="Base_Column_List"/>
         FROM dkic_a.t_mst_coupon_receive
-        WHERE cp_id = #{cpId}
+        WHERE cp_id = #{cpId}::uuid
         for update
     </select>
 

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

@@ -14,7 +14,7 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.oauth.model.pojo.integral.CouponSend">
-        <id column="cp_id" property="cpId"/>
+        <id column="cp_id" property="cpId" typeHandler="UuidTypeHandler"/>
                 <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
             <result column="send_date" property="sendDate" typeHandler="TimestampTypeHandler"/>
             <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
@@ -23,7 +23,7 @@
     </resultMap>
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.CouponSendResponse">
-        <id column="cp_id" property="cpId"/>
+        <id column="cp_id" property="cpId" typeHandler="UuidTypeHandler"/>
         <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
         <result column="send_date" property="sendDate" typeHandler="TimestampTypeHandler"/>
         <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
@@ -108,7 +108,7 @@
         SELECT
         <include refid="Base_Column_List"/>
         FROM dkic_a.t_mst_coupon_send
-        WHERE cp_id = #{cpId}
+        WHERE cp_id = #{cpId}::uuid
         for update
     </select>
 

+ 2 - 2
src/main/java/com/dk/oauth/mapper/integral/CouponUseMapper.xml

@@ -14,7 +14,7 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.oauth.model.pojo.integral.CouponUse">
-        <id column="cp_id" property="cpId"/>
+        <id column="cp_id" property="cpId" typeHandler="UuidTypeHandler"/>
                 <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
                 <result column="use_valid_days" property="useValidDays"/>
             <result column="receive_date" property="receiveDate" typeHandler="TimestampTypeHandler"/>
@@ -25,7 +25,7 @@
     </resultMap>
     <!-- 通用查询映射结果Response -->
     <resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.CouponUseResponse">
-        <id column="cp_id" property="cpId"/>
+        <id column="cp_id" property="cpId" typeHandler="UuidTypeHandler"/>
         <result column="cp_name" property="cpName"/>
         <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
         <result column="coupon_name" property="couponName" />

+ 3 - 3
src/main/java/com/dk/oauth/mapper/integral/IntegralMapper.xml

@@ -14,14 +14,14 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.oauth.model.pojo.integral.Integral">
-        <id column="cp_id" property="cpId"/>
+        <id column="cp_id" property="cpId" typeHandler="UuidTypeHandler"/>
                 <result column="integral" property="integral"/>
                 <result column="flg_valid" property="flgValid"/>
     </resultMap>
 
     <!-- 通用查询映射结果Response -->
     <resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.IntegralResponse">
-        <id column="cp_id" property="cpId"/>
+        <id column="cp_id" property="cpId" typeHandler="UuidTypeHandler"/>
         <result column="cp_name" property="cpName"/>
         <result column="integral" property="integral"/>
         <result column="flg_valid" property="flgValid"/>
@@ -87,7 +87,7 @@
         SELECT
         <include refid="Base_Column_List"/>
         FROM dkic_a.t_mst_integral
-        WHERE cp_id = #{cpId}
+        WHERE cp_id = #{cpId}::uuid
         for update
     </select>
 

+ 2 - 2
src/main/java/com/dk/oauth/mapper/integral/IntegralShareMapper.xml

@@ -14,7 +14,7 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.oauth.model.pojo.integral.IntegralShare">
-        <id column="cp_id" property="cpId"/>
+        <id column="cp_id" property="cpId" typeHandler="UuidTypeHandler"/>
                 <result column="tactic_id" property="tacticId" typeHandler="UuidTypeHandler"/>
             <result column="share_date" property="shareDate" typeHandler="TimestampTypeHandler"/>
             <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
@@ -22,7 +22,7 @@
     </resultMap>
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.IntegralShareResponse">
-        <id column="cp_id" property="cpId"/>
+        <id column="cp_id" property="cpId" typeHandler="UuidTypeHandler"/>
         <result column="tactic_id" property="tacticId" typeHandler="UuidTypeHandler"/>
         <result column="share_date" property="shareDate" typeHandler="TimestampTypeHandler"/>
         <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>

+ 30 - 1
src/main/java/com/dk/oauth/mapper/integral/IntegralTacticMapper.java

@@ -2,13 +2,42 @@ package com.dk.oauth.mapper.integral;
 
 import com.dk.oauth.model.pojo.integral.IntegralTactic;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.oauth.model.query.integral.IntegralQuery;
+import com.dk.oauth.model.query.integral.IntegralTacticQuery;
+import com.dk.oauth.model.response.integral.IntegralResponse;
+import com.dk.oauth.model.response.integral.IntegralTacticResponse;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
 *  积分策略 Mapper
 */
 @Repository
 public interface IntegralTacticMapper extends BaseMapper<IntegralTactic>{
-	
+
+    /**
+     * @desc   : 根据id查询
+     * @date   : 2024/7/24 10:14
+     * @author : 寇珊珊
+     */
+    IntegralTacticResponse selectById(@Param("id") String id);
+
+    /**
+     * @desc   : 条件查询
+     * @date   : 2024/7/24 9:36
+     * @author : 寇珊珊
+     */
+    List<IntegralTacticResponse> selectByCond(IntegralTacticQuery integralTacticQuery);
+
+    /**
+     * @desc   : 条件查询个数
+     * @date   : 2024/7/24 9:35
+     * @author : 寇珊珊
+     */
+    Long countByCond(IntegralTacticQuery integralTacticQuery);
+
+
 }
 

+ 17 - 0
src/main/java/com/dk/oauth/service/integral/IntegralService.java

@@ -1,9 +1,14 @@
 package com.dk.oauth.service.integral;
 
+import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.model.pojo.integral.Integral;
 import com.dk.oauth.mapper.integral.IntegralMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.oauth.model.query.integral.IntegralQuery;
+import com.dk.oauth.model.response.integral.IntegralResponse;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -20,4 +25,16 @@ public class IntegralService extends BaseService<Integral> {
 	@Autowired
 	private IntegralMapper integralMapper;
 
+
+	/**
+	 * @desc   : 条件查询
+	 * @date   : 2024/7/24 15:47
+	 * @author : 寇珊珊
+	 */
+	@Pagination
+	public ResponseResultVO<PageList<IntegralResponse>> selectByCond(IntegralQuery integralQuery) {
+		return super.mergeListWithCount(integralQuery, integralMapper.selectByCond(integralQuery),
+				integralMapper.countByCond(integralQuery));
+	}
+
 }

+ 19 - 0
src/main/java/com/dk/oauth/service/integral/IntegralTacticService.java

@@ -1,9 +1,16 @@
 package com.dk.oauth.service.integral;
 
+import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.model.pojo.integral.IntegralTactic;
 import com.dk.oauth.mapper.integral.IntegralTacticMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.oauth.model.query.integral.IntegralQuery;
+import com.dk.oauth.model.query.integral.IntegralTacticQuery;
+import com.dk.oauth.model.response.integral.IntegralResponse;
+import com.dk.oauth.model.response.integral.IntegralTacticResponse;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -20,4 +27,16 @@ public class IntegralTacticService extends BaseService<IntegralTactic> {
 	@Autowired
 	private IntegralTacticMapper integralTacticMapper;
 
+
+	/**
+	 * @desc   : 条件查询
+	 * @date   : 2024/7/24 15:47
+	 * @author : 寇珊珊
+	 */
+	@Pagination
+	public ResponseResultVO<PageList<IntegralTacticResponse>> selectByCond(IntegralTacticQuery integralTacticQuery) {
+		return super.mergeListWithCount(integralTacticQuery, integralTacticMapper.selectByCond(integralTacticQuery),
+				integralTacticMapper.countByCond(integralTacticQuery));
+	}
+
 }