Git Product home page Git Product logo

poet's Introduction

根据 sql 创建 Doamin Repository Service java 文件

依赖生成java文件库 https://github.com/square/javapoet

####Sql

CREATE TABLE `code_record` (
  `id` int(255) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `productCode` varchar(255) DEFAULT NULL COMMENT '商品编码',
  `orders` int(11) DEFAULT NULL COMMENT '批次',
  `totalCount` int(11) DEFAULT NULL COMMENT '打印数量',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1329 DEFAULT CHARSET=utf8;

####Domain

package com.sq.wms.domain;

import java.lang.Integer;
import java.lang.String;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(
    name = "hello_cdp"
)
public class HelloCdp {
  @Id
  @GeneratedValue(
      strategy = GenerationType.AUTO
  )
  private Integer id;

  private String productCode;

  private Integer orders;

  private Integer totalCount;

  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public String getProductCode() {
    return productCode;
  }

  public void setProductCode(String productCode) {
    this.productCode = productCode;
  }

  public Integer getOrders() {
    return orders;
  }

  public void setOrders(Integer orders) {
    this.orders = orders;
  }

  public Integer getTotalCount() {
    return totalCount;
  }

  public void setTotalCount(Integer totalCount) {
    this.totalCount = totalCount;
  }
}

####Repository

package com.sq.wms.repository.mysql;

import com.sq.wms.domain.HelloCdp;
import java.lang.Integer;
import java.lang.Long;
import java.lang.String;
import org.springframework.data.jpa.repository.JpaRepository;

public interface HelloCdpRepository extends JpaRepository<HelloCdp, Long> {
  HelloCdp findById(Integer id);

  HelloCdp findByProductCode(String productCode);

  HelloCdp findByOrders(Integer orders);

  HelloCdp findByTotalCount(Integer totalCount);
}

####Service

package com.sq.wms.service;

import com.sq.wms.domain.HelloCdp;
import com.sq.wms.repository.mysql.HelloCdpRepository;
import java.lang.Integer;
import java.lang.String;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HelloCdpService {
  @Autowired
  private HelloCdpRepository helloCdpRepository;

  public HelloCdp findById(Integer id) {
    return helloCdpRepository.findById(id);
  }

  public HelloCdp findByProductCode(String productCode) {
    return helloCdpRepository.findByProductCode(productCode);
  }

  public HelloCdp findByOrders(Integer orders) {
    return helloCdpRepository.findByOrders(orders);
  }

  public HelloCdp findByTotalCount(Integer totalCount) {
    return helloCdpRepository.findByTotalCount(totalCount);
  }
}

poet's People

Contributors

xiaoniao avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.