
10 changed files with 233 additions and 1 deletions
@ -0,0 +1,33 @@ |
|||||
|
package com.yxt.yyth.api.lpkcardbuildrecord; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
/** |
||||
|
* @author Fan |
||||
|
* @description |
||||
|
* @date 2023/11/24 16:03 |
||||
|
*/ |
||||
|
@Data |
||||
|
@ApiModel(value = "礼品卡生成记录表", description = "礼品卡生成记录表") |
||||
|
@TableName("lpk_card_build_record") |
||||
|
public class LpkCardBuildRecord { |
||||
|
|
||||
|
private String id; |
||||
|
private String sid = UUID.randomUUID().toString(); |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date createTime; |
||||
|
private String remarks; |
||||
|
private String giftbagSid; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
private Date buildDate; |
||||
|
private String countNumber; |
||||
|
private String startNumber; |
||||
|
private String endNumber; |
||||
|
|
||||
|
} |
@ -0,0 +1,12 @@ |
|||||
|
package com.yxt.yyth.api.lpkcardbuildrecord; |
||||
|
|
||||
|
import com.yxt.common.core.dto.Dto; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
@ApiModel(value = "礼品卡生成记录表 数据传输对象", description = "礼品卡生成记录表 数据传输对象") |
||||
|
@Data |
||||
|
public class LpkCardBuildRecordDto implements Dto { |
||||
|
|
||||
|
} |
@ -0,0 +1,15 @@ |
|||||
|
package com.yxt.yyth.api.lpkcardbuildrecord; |
||||
|
|
||||
|
import com.yxt.common.core.query.Query; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
|
||||
|
@ApiModel(value = "礼品卡生成记录表 查询条件", description = "礼品卡生成记录表 查询条件") |
||||
|
@Data |
||||
|
public class LpkCardBuildRecordQuery implements Query { |
||||
|
|
||||
|
private String startDate; //开始时间
|
||||
|
private String endDate; //结束时间
|
||||
|
private String countNumber; //总数
|
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.yxt.yyth.api.lpkcardbuildrecord; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import com.yxt.common.core.vo.Vo; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.UUID; |
||||
|
|
||||
|
|
||||
|
@Data |
||||
|
@ApiModel(value = "礼品卡生成记录表 视图数据对象", description = "礼品卡生成记录表 视图数据对象") |
||||
|
@NoArgsConstructor |
||||
|
public class LpkCardBuildRecordVo implements Vo { |
||||
|
|
||||
|
private String sid; |
||||
|
private String buildDate; //创建时间
|
||||
|
private String countNumber; //总数
|
||||
|
private String startNumber; //起始号
|
||||
|
private String endNumber; //结束号
|
||||
|
} |
@ -0,0 +1,23 @@ |
|||||
|
package com.yxt.yyth.biz.lpkcardbuildrecord; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants; |
||||
|
import com.yxt.yyth.api.lpkcardbuildrecord.LpkCardBuildRecord; |
||||
|
import com.yxt.yyth.api.lpkcardbuildrecord.LpkCardBuildRecordVo; |
||||
|
import com.yxt.yyth.api.lpkcustomer.LpkCustomer; |
||||
|
import com.yxt.yyth.api.lpkcustomer.LpkCustomerVo; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/11/21 15:03 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface LpkCardBuildRecordMapper extends BaseMapper<LpkCardBuildRecord> { |
||||
|
|
||||
|
IPage<LpkCardBuildRecordVo> recordListPage(IPage<LpkCardBuildRecord> page, @Param(Constants.WRAPPER) QueryWrapper<LpkCardBuildRecord> qw); |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.yxt.yyth.biz.lpkcardbuildrecord.LpkCardBuildRecordMapper"> |
||||
|
<!-- <where> ${ew.sqlSegment} </where>--> |
||||
|
<!-- ${ew.customSqlSegment} --> |
||||
|
|
||||
|
|
||||
|
<select id="recordListPage" resultType="com.yxt.yyth.api.lpkcardbuildrecord.LpkCardBuildRecordVo"> |
||||
|
select |
||||
|
sid, |
||||
|
date_format(buildDate, '%Y-%m-%d') as buildDate, |
||||
|
countNumber, |
||||
|
startNumber, |
||||
|
endNumber |
||||
|
from lpk_card_build_record |
||||
|
<where> |
||||
|
${ew.sqlSegment} |
||||
|
</where> |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,34 @@ |
|||||
|
package com.yxt.yyth.biz.lpkcardbuildrecord; |
||||
|
|
||||
|
import cn.hutool.core.util.IdUtil; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.yyth.api.lpkcardbuildrecord.LpkCardBuildRecordQuery; |
||||
|
import com.yxt.yyth.api.lpkcardbuildrecord.LpkCardBuildRecordVo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.junit.Test; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/11/21 15:03 |
||||
|
*/ |
||||
|
|
||||
|
@Api(tags = "礼品卡生成记录") |
||||
|
@RestController |
||||
|
@RequestMapping("lpkcardbuildrecord") |
||||
|
public class LpkCardBuildRecordRest { |
||||
|
|
||||
|
@Autowired |
||||
|
LpkCardBuildRecordService lpkCardBuildRecordService; |
||||
|
|
||||
|
@ApiOperation("创建记录列表") |
||||
|
@PostMapping("/recordListPage") |
||||
|
public ResultBean<PagerVo<LpkCardBuildRecordVo>> recordListPage(@RequestBody PagerQuery<LpkCardBuildRecordQuery> pq) { |
||||
|
return lpkCardBuildRecordService.recordListPage(pq); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,49 @@ |
|||||
|
package com.yxt.yyth.biz.lpkcardbuildrecord; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.yxt.common.base.service.MybatisBaseService; |
||||
|
import com.yxt.common.base.utils.PagerUtil; |
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.query.PagerQuery; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.yyth.api.lpkcardbuildrecord.LpkCardBuildRecord; |
||||
|
import com.yxt.yyth.api.lpkcardbuildrecord.LpkCardBuildRecordQuery; |
||||
|
import com.yxt.yyth.api.lpkcardbuildrecord.LpkCardBuildRecordVo; |
||||
|
import com.yxt.yyth.api.lpkcustomer.LpkCustomer; |
||||
|
import com.yxt.yyth.api.lpkcustomer.LpkCustomerQuery; |
||||
|
import com.yxt.yyth.api.lpkcustomer.LpkCustomerVo; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.Collections; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2023/11/21 15:03 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class LpkCardBuildRecordService extends MybatisBaseService<LpkCardBuildRecordMapper, LpkCardBuildRecord> { |
||||
|
|
||||
|
|
||||
|
public ResultBean<PagerVo<LpkCardBuildRecordVo>> recordListPage(PagerQuery<LpkCardBuildRecordQuery> pq) { |
||||
|
ResultBean rb = ResultBean.fireFail(); |
||||
|
LpkCardBuildRecordQuery query = pq.getParams(); |
||||
|
QueryWrapper<LpkCardBuildRecord> qw = new QueryWrapper<>(); |
||||
|
qw.eq("1", "1"); |
||||
|
if (StringUtils.isNotBlank(query.getCountNumber())) { |
||||
|
qw.eq("countNumber", query.getCountNumber()); |
||||
|
} |
||||
|
String startDate = query.getStartDate(); |
||||
|
String effEndTime = query.getEndDate(); |
||||
|
qw.apply(org.apache.commons.lang3.StringUtils.isNotEmpty(startDate), "date_format (buildDate,'%Y-%m-%d') >= date_format('" + startDate + "','%Y-%m-%d')"). |
||||
|
apply(org.apache.commons.lang3.StringUtils.isNotEmpty(effEndTime), "date_format (buildDate,'%Y-%m-%d') <= date_format('" + effEndTime + "','%Y-%m-%d')" |
||||
|
); |
||||
|
qw.orderByDesc("createTime"); |
||||
|
IPage<LpkCardBuildRecord> page = PagerUtil.queryToPage(pq); |
||||
|
IPage<LpkCardBuildRecordVo> pagging = baseMapper.recordListPage(page, qw); |
||||
|
PagerVo<LpkCardBuildRecordVo> p = PagerUtil.pageToVo(pagging, null); |
||||
|
return rb.success().setData(p); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue