| @@ -2,7 +2,6 @@ package com.iformall.controller.market; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.annotation.SystemControllerLog; | import com.iformall.annotation.SystemControllerLog; | ||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.po.BaseEntity; | import com.iformall.domain.po.BaseEntity; | ||||
| @@ -21,8 +20,6 @@ import org.springframework.web.bind.annotation.ModelAttribute; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | import org.springframework.web.bind.annotation.RequestMapping; | ||||
| import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
| import java.util.List; | |||||
| /** | /** | ||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| @@ -51,11 +48,15 @@ public class WxCouponPasswordController extends BaseController { | |||||
| @ApiOperation("可发送卡数据") | @ApiOperation("可发送卡数据") | ||||
| @GetMapping("/findCouponList") | @GetMapping("/findCouponList") | ||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| @SystemControllerLog(description = "可发送卡数据") | @SystemControllerLog(description = "可发送卡数据") | ||||
| public ResultData findCouponList() { | |||||
| public ResultData findCouponList(@ModelAttribute WxCouponPassword wxCouponPassword, Integer pageNum, Integer pageSize) { | |||||
| logger.debug("[" + getIpAddr() + "] WxCouponPasswordController::findCouponList"); | logger.debug("[" + getIpAddr() + "] WxCouponPasswordController::findCouponList"); | ||||
| List<WxCouponPasswordCountInfoVO> voList = wxCouponPasswordService.findCouponList(getTenantId()); | |||||
| return new ResultData(Result.SUCCESS, "查询成功", voList); | |||||
| wxCouponPassword.setTenantId(getTenantId()); | |||||
| final PageInfo<WxCouponPasswordCountInfoVO> page = wxCouponPasswordService.findCouponList(wxCouponPassword, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | } | ||||
| @@ -11,4 +11,6 @@ public class WxCouponPasswordCountInfoVO { | |||||
| private Long couponId; | private Long couponId; | ||||
| private String couponName; | private String couponName; | ||||
| private Long couponCount; | private Long couponCount; | ||||
| private String price; | |||||
| } | } | ||||
| @@ -6,7 +6,6 @@ import com.iformall.domain.vo.WxCouponPasswordCountInfoVO; | |||||
| import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.HttpServletRequest; | ||||
| import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.HttpServletResponse; | ||||
| import java.util.List; | |||||
| public interface WxCouponPasswordService { | public interface WxCouponPasswordService { | ||||
| @@ -58,9 +57,6 @@ public interface WxCouponPasswordService { | |||||
| */ | */ | ||||
| void mkPasswords(String tenantId, Long couponId, Integer inventory); | void mkPasswords(String tenantId, Long couponId, Integer inventory); | ||||
| List<WxCouponPasswordCountInfoVO> findCouponList(String tenantId); | |||||
| /** | /** | ||||
| * 导出兑换码 | * 导出兑换码 | ||||
| * @param request | * @param request | ||||
| @@ -69,4 +65,6 @@ public interface WxCouponPasswordService { | |||||
| */ | */ | ||||
| void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponPassword couponPassword); | void exportData(HttpServletRequest request, HttpServletResponse response, WxCouponPassword couponPassword); | ||||
| PageInfo<WxCouponPasswordCountInfoVO> findCouponList(WxCouponPassword wxCouponPassword, Integer pageNum, Integer pageSize); | |||||
| } | } | ||||
| @@ -92,13 +92,6 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| wxCouponPasswordMapper.deleteByPrimaryKey(id); | wxCouponPasswordMapper.deleteByPrimaryKey(id); | ||||
| } | } | ||||
| @Override | |||||
| public List<WxCouponPasswordCountInfoVO> findCouponList(String tenantId) { | |||||
| WxCouponPassword wxCouponPassword = new WxCouponPassword(); | |||||
| wxCouponPassword.setTenantId(tenantId); | |||||
| return wxCouponPasswordMapper.findCouponCountInfo(wxCouponPassword); | |||||
| } | |||||
| @Override | @Override | ||||
| public void mkPasswords(String tenantId, Long couponId, Integer inventory) { | public void mkPasswords(String tenantId, Long couponId, Integer inventory) { | ||||
| String strAll = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | String strAll = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; | ||||
| @@ -163,6 +156,11 @@ public class WxCouponPasswordServiceImpl implements WxCouponPasswordService { | |||||
| } | } | ||||
| @Override | |||||
| public PageInfo<WxCouponPasswordCountInfoVO> findCouponList(WxCouponPassword record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponPasswordMapper.findCouponCountInfo(record)); | |||||
| } | |||||
| /* | /* | ||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| WxCouponPasswordServiceImpl ll = new WxCouponPasswordServiceImpl(); | WxCouponPasswordServiceImpl ll = new WxCouponPasswordServiceImpl(); | ||||
| @@ -119,11 +119,12 @@ | |||||
| <result column="coupon_count" jdbcType="BIGINT" property="couponCount"/> | <result column="coupon_count" jdbcType="BIGINT" property="couponCount"/> | ||||
| <result column="title" jdbcType="VARCHAR" property="couponName"/> | <result column="title" jdbcType="VARCHAR" property="couponName"/> | ||||
| <result column="coupon_id" jdbcType="BIGINT" property="couponId"/> | <result column="coupon_id" jdbcType="BIGINT" property="couponId"/> | ||||
| <result column="price" jdbcType="VARCHAR" property="price"/> | |||||
| </resultMap> | </resultMap> | ||||
| <select id="findCouponCountInfo" parameterType="com.iformall.domain.po.WxCouponPassword" | <select id="findCouponCountInfo" parameterType="com.iformall.domain.po.WxCouponPassword" | ||||
| resultMap="CouponCountInfoMap"> | resultMap="CouponCountInfoMap"> | ||||
| select cp.coupon_id,c.title,cp.coupon_count from | |||||
| select cp.coupon_id,c.title,c.price,cp.coupon_count from | |||||
| (select count(*) as coupon_count,coupon_id from wx_coupon_password | (select count(*) as coupon_count,coupon_id from wx_coupon_password | ||||
| where tenant_id=#{tenantId} and status=0 group by coupon_id) cp | where tenant_id=#{tenantId} and status=0 group by coupon_id) cp | ||||
| inner join wx_coupon c on cp.coupon_id = c.id | inner join wx_coupon c on cp.coupon_id = c.id | ||||
| @@ -132,6 +133,7 @@ | |||||
| and cp.`coupon_id` = #{couponId} | and cp.`coupon_id` = #{couponId} | ||||
| </if> | </if> | ||||
| group by cp.coupon_id | group by cp.coupon_id | ||||
| order by c.create_date desc | |||||
| </select> | </select> | ||||
| <update id="updateStatus" parameterType="java.util.List"> | <update id="updateStatus" parameterType="java.util.List"> | ||||