diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponCodeController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponCodeController.java index 173bc0e9..9c77dc6d 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponCodeController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponCodeController.java @@ -11,9 +11,11 @@ import com.hai.entity.HighCouponCode; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; import com.hai.service.HighCouponCodeService; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; @@ -29,6 +31,9 @@ import java.util.Map; * @Description: 卡卷销售码 * @Date: 2021/3/22 19:39 */ +@Controller +@RequestMapping(value = "/couponCode") +@Api(value = "卡卷销售码接口") public class HighCouponCodeController { private static Logger log = LoggerFactory.getLogger(HighCouponCodeController.class); @@ -41,12 +46,14 @@ public class HighCouponCodeController { @ApiOperation(value = "销售码列表") public ResponseData getCouponCodeList(@RequestParam(name = "couponId", required = true) Long couponId, @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "salesCode", required = false) String salesCode, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize) { try { Map map = new HashMap<>(); map.put("couponId", couponId); map.put("status", status); + map.put("salesCode", salesCode); PageHelper.startPage(pageNum, pageSize); return ResponseMsgUtil.success(new PageInfo<>(highCouponCodeService.getCouponCodeList(map))); diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java index 882d276f..d4cc97ed 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java @@ -6,6 +6,7 @@ import com.hai.entity.HighCouponCode; import com.hai.entity.HighCouponCodeExample; import com.hai.service.HighCouponCodeService; import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -57,6 +58,10 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); } + if (StringUtils.isNotBlank(MapUtils.getString(map, "salesCode"))) { + criteria.andSalesCodeLike("%" + MapUtils.getString(map, "salesCode") + "%"); + } + example.setOrderByClause("create_time desc"); return highCouponCodeMapper.selectByExample(example); }