Commit 8010a20a by zhangchen

1.储值卡查询

parent 12e56013
package com.boot.security.server.controller;
import com.boot.security.server.dto.*;
import com.boot.security.server.model.PrePayCard;
import com.boot.security.server.page.table.PageTableRequest;
import com.boot.security.server.service.PrePayCardService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/prePayCard")
public class PrePayCardController {
@Autowired
private PrePayCardService prePayCardService;
@GetMapping("/list")
@ApiOperation(value = "列表")
public Response<PageData> list(PageTableRequest request) {
if(request.getCurrent() == null || request.getCurrent() <=0){
request.setCurrent(1);
}
if(request.getPageSize() == null || request.getPageSize() <=0){
request.setPageSize(20);
}
Response<PageData> response = new Response<PageData>(ResponseStatusEnum.SUCCESS,null);
List<PrePayCard> list = prePayCardService.getListByParam(request);
int count = prePayCardService.getCount(request);
Pagination pagination = new Pagination(count,request.getCurrent(), request.getPageSize());
PageData<PrePayCard> pageData = new PageData<>(list,pagination);
response.setData(pageData);
return response;
}
}
package com.boot.security.server.dao;
import com.boot.security.server.model.PrePayCard;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface PrePayCardMapper {
int deleteByPrimaryKey(Integer id);
int insert(PrePayCard record);
int insertSelective(PrePayCard record);
PrePayCard selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(PrePayCard record);
int updateByPrimaryKey(PrePayCard record);
List<PrePayCard> getListByPaream(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
Integer getListByPareamCount(@Param("params") Map<String, Object> params);
}
\ No newline at end of file
package com.boot.security.server.model;
import java.math.BigDecimal;
import java.util.Date;
public class PrePayCard {
private Integer id;
private String cardid;
private BigDecimal amount;
private String password;
private Integer status;
private Date createdtime;
private String inputer;
private Date inputtime;
private Date saletime;
private Date arrivaltime;
private String paymentway;
private String paymentno;
private String useduser;
private Date usedtime;
private Date datachangeLasttime;
private Integer type;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCardid() {
return cardid;
}
public void setCardid(String cardid) {
this.cardid = cardid == null ? null : cardid.trim();
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password == null ? null : password.trim();
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getCreatedtime() {
return createdtime;
}
public void setCreatedtime(Date createdtime) {
this.createdtime = createdtime;
}
public String getInputer() {
return inputer;
}
public void setInputer(String inputer) {
this.inputer = inputer == null ? null : inputer.trim();
}
public Date getInputtime() {
return inputtime;
}
public void setInputtime(Date inputtime) {
this.inputtime = inputtime;
}
public Date getSaletime() {
return saletime;
}
public void setSaletime(Date saletime) {
this.saletime = saletime;
}
public Date getArrivaltime() {
return arrivaltime;
}
public void setArrivaltime(Date arrivaltime) {
this.arrivaltime = arrivaltime;
}
public String getPaymentway() {
return paymentway;
}
public void setPaymentway(String paymentway) {
this.paymentway = paymentway == null ? null : paymentway.trim();
}
public String getPaymentno() {
return paymentno;
}
public void setPaymentno(String paymentno) {
this.paymentno = paymentno == null ? null : paymentno.trim();
}
public String getUseduser() {
return useduser;
}
public void setUseduser(String useduser) {
this.useduser = useduser == null ? null : useduser.trim();
}
public Date getUsedtime() {
return usedtime;
}
public void setUsedtime(Date usedtime) {
this.usedtime = usedtime;
}
public Date getDatachangeLasttime() {
return datachangeLasttime;
}
public void setDatachangeLasttime(Date datachangeLasttime) {
this.datachangeLasttime = datachangeLasttime;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
}
\ No newline at end of file
package com.boot.security.server.service;
import com.boot.security.server.model.PrePayCard;
import com.boot.security.server.page.table.PageTableRequest;
import java.util.List;
public interface PrePayCardService {
List<PrePayCard> getListByParam(PageTableRequest request);
int getCount(PageTableRequest request);
}
package com.boot.security.server.service.impl;
import com.boot.security.server.dao.PrePayCardMapper;
import com.boot.security.server.model.PrePayCard;
import com.boot.security.server.page.table.PageTableRequest;
import com.boot.security.server.service.PrePayCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class PrePayCardServiceImpl implements PrePayCardService {
@Autowired
private PrePayCardMapper prePayCardMapper;
@Override
public List<PrePayCard> getListByParam(PageTableRequest request) {
List<PrePayCard> listByPaream = prePayCardMapper.getListByPaream(request.getParams(), (request.getCurrent() - 1) * request.getPageSize(), request.getPageSize());
return listByPaream;
}
@Override
public int getCount(PageTableRequest request) {
return prePayCardMapper.getListByPareamCount(request.getParams());
}
}
<?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.boot.security.server.dao.PrePayCardMapper">
<resultMap id="BaseResultMap" type="com.boot.security.server.model.PrePayCard">
<id column="ID" jdbcType="INTEGER" property="id" />
<result column="CardId" jdbcType="VARCHAR" property="cardid" />
<result column="Amount" jdbcType="DECIMAL" property="amount" />
<result column="Password" jdbcType="VARCHAR" property="password" />
<result column="Status" jdbcType="INTEGER" property="status" />
<result column="CreatedTime" jdbcType="TIMESTAMP" property="createdtime" />
<result column="Inputer" jdbcType="VARCHAR" property="inputer" />
<result column="InputTime" jdbcType="TIMESTAMP" property="inputtime" />
<result column="SaleTime" jdbcType="TIMESTAMP" property="saletime" />
<result column="ArrivalTime" jdbcType="DATE" property="arrivaltime" />
<result column="PaymentWay" jdbcType="VARCHAR" property="paymentway" />
<result column="PaymentNo" jdbcType="VARCHAR" property="paymentno" />
<result column="UsedUser" jdbcType="VARCHAR" property="useduser" />
<result column="UsedTime" jdbcType="TIMESTAMP" property="usedtime" />
<result column="DataChange_LastTime" jdbcType="TIMESTAMP" property="datachangeLasttime" />
<result column="type" jdbcType="INTEGER" property="type" />
</resultMap>
<sql id="Base_Column_List">
ID, CardId, Amount, Password, Status, CreatedTime, Inputer, InputTime, SaleTime,
ArrivalTime, PaymentWay, PaymentNo, UsedUser, UsedTime, DataChange_LastTime, type
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from bsc_prepaycard
where ID = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from bsc_prepaycard
where ID = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.boot.security.server.model.PrePayCard">
insert into bsc_prepaycard (ID, CardId, Amount,
Password, Status, CreatedTime,
Inputer, InputTime, SaleTime,
ArrivalTime, PaymentWay, PaymentNo,
UsedUser, UsedTime, DataChange_LastTime,
type)
values (#{id,jdbcType=INTEGER}, #{cardid,jdbcType=VARCHAR}, #{amount,jdbcType=DECIMAL},
#{password,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createdtime,jdbcType=TIMESTAMP},
#{inputer,jdbcType=VARCHAR}, #{inputtime,jdbcType=TIMESTAMP}, #{saletime,jdbcType=TIMESTAMP},
#{arrivaltime,jdbcType=DATE}, #{paymentway,jdbcType=VARCHAR}, #{paymentno,jdbcType=VARCHAR},
#{useduser,jdbcType=VARCHAR}, #{usedtime,jdbcType=TIMESTAMP}, #{datachangeLasttime,jdbcType=TIMESTAMP},
#{type,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.boot.security.server.model.PrePayCard">
insert into bsc_prepaycard
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
ID,
</if>
<if test="cardid != null">
CardId,
</if>
<if test="amount != null">
Amount,
</if>
<if test="password != null">
Password,
</if>
<if test="status != null">
Status,
</if>
<if test="createdtime != null">
CreatedTime,
</if>
<if test="inputer != null">
Inputer,
</if>
<if test="inputtime != null">
InputTime,
</if>
<if test="saletime != null">
SaleTime,
</if>
<if test="arrivaltime != null">
ArrivalTime,
</if>
<if test="paymentway != null">
PaymentWay,
</if>
<if test="paymentno != null">
PaymentNo,
</if>
<if test="useduser != null">
UsedUser,
</if>
<if test="usedtime != null">
UsedTime,
</if>
<if test="datachangeLasttime != null">
DataChange_LastTime,
</if>
<if test="type != null">
type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="cardid != null">
#{cardid,jdbcType=VARCHAR},
</if>
<if test="amount != null">
#{amount,jdbcType=DECIMAL},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="createdtime != null">
#{createdtime,jdbcType=TIMESTAMP},
</if>
<if test="inputer != null">
#{inputer,jdbcType=VARCHAR},
</if>
<if test="inputtime != null">
#{inputtime,jdbcType=TIMESTAMP},
</if>
<if test="saletime != null">
#{saletime,jdbcType=TIMESTAMP},
</if>
<if test="arrivaltime != null">
#{arrivaltime,jdbcType=DATE},
</if>
<if test="paymentway != null">
#{paymentway,jdbcType=VARCHAR},
</if>
<if test="paymentno != null">
#{paymentno,jdbcType=VARCHAR},
</if>
<if test="useduser != null">
#{useduser,jdbcType=VARCHAR},
</if>
<if test="usedtime != null">
#{usedtime,jdbcType=TIMESTAMP},
</if>
<if test="datachangeLasttime != null">
#{datachangeLasttime,jdbcType=TIMESTAMP},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.boot.security.server.model.PrePayCard">
update bsc_prepaycard
<set>
<if test="cardid != null">
CardId = #{cardid,jdbcType=VARCHAR},
</if>
<if test="amount != null">
Amount = #{amount,jdbcType=DECIMAL},
</if>
<if test="password != null">
Password = #{password,jdbcType=VARCHAR},
</if>
<if test="status != null">
Status = #{status,jdbcType=INTEGER},
</if>
<if test="createdtime != null">
CreatedTime = #{createdtime,jdbcType=TIMESTAMP},
</if>
<if test="inputer != null">
Inputer = #{inputer,jdbcType=VARCHAR},
</if>
<if test="inputtime != null">
InputTime = #{inputtime,jdbcType=TIMESTAMP},
</if>
<if test="saletime != null">
SaleTime = #{saletime,jdbcType=TIMESTAMP},
</if>
<if test="arrivaltime != null">
ArrivalTime = #{arrivaltime,jdbcType=DATE},
</if>
<if test="paymentway != null">
PaymentWay = #{paymentway,jdbcType=VARCHAR},
</if>
<if test="paymentno != null">
PaymentNo = #{paymentno,jdbcType=VARCHAR},
</if>
<if test="useduser != null">
UsedUser = #{useduser,jdbcType=VARCHAR},
</if>
<if test="usedtime != null">
UsedTime = #{usedtime,jdbcType=TIMESTAMP},
</if>
<if test="datachangeLasttime != null">
DataChange_LastTime = #{datachangeLasttime,jdbcType=TIMESTAMP},
</if>
<if test="type != null">
type = #{type,jdbcType=INTEGER},
</if>
</set>
where ID = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.boot.security.server.model.PrePayCard">
update bsc_prepaycard
set CardId = #{cardid,jdbcType=VARCHAR},
Amount = #{amount,jdbcType=DECIMAL},
Password = #{password,jdbcType=VARCHAR},
Status = #{status,jdbcType=INTEGER},
CreatedTime = #{createdtime,jdbcType=TIMESTAMP},
Inputer = #{inputer,jdbcType=VARCHAR},
InputTime = #{inputtime,jdbcType=TIMESTAMP},
SaleTime = #{saletime,jdbcType=TIMESTAMP},
ArrivalTime = #{arrivaltime,jdbcType=DATE},
PaymentWay = #{paymentway,jdbcType=VARCHAR},
PaymentNo = #{paymentno,jdbcType=VARCHAR},
UsedUser = #{useduser,jdbcType=VARCHAR},
UsedTime = #{usedtime,jdbcType=TIMESTAMP},
DataChange_LastTime = #{datachangeLasttime,jdbcType=TIMESTAMP},
type = #{type,jdbcType=INTEGER}
where ID = #{id,jdbcType=INTEGER}
</update>
<select id="getListByPaream" resultMap="BaseResultMap">
select * from bsc_prepaycard where 1=1
<if test="params.username != null and params.username != ''">
and UsedUser = #{params.username}
</if>
<if test="params.uid != null and params.uid != ''">
and UsedUser = #{params.uid}
</if>
limit #{offset}, #{limit}
</select>
<select id="getListByPareamCount" resultType="java.lang.Integer">
select count(1) from bsc_prepaycard where 1=1
<if test="params.username != null and params.username != ''">
and UsedUser = #{params.username}
</if>
<if test="params.username != null and params.username != ''">
and UsedUser = #{params.username}
</if>
<if test="params.uid != null and params.uid != ''">
and UsedUser = #{params.uid}
</if>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment