---
# System prepended metadata

title: 注意事項
tags: [Note]

---

---

robots: index, follow
lang: zh-tw
dir: ltr
breaks: true
title: 注意事項     # 簡報的名稱
tags: Note  # 簡報的標籤

---
#  注意事項

## 2020/10/19
### 寫出bug被抓到而修復的例子
controller URL傳進來的參數 最好不要改名稱 不然會搞混
也就是說
controller -> service -> repository -> query
名稱一致 

---

![](https://i.imgur.com/D1R7wDX.png)

---

#### 必須檢查:
於相關的表格內容去檢查 並對照
此次原因:檢視與下載的內容不符

---

![](https://i.imgur.com/7IJttHh.png)

---

#### 建立table

1.SQL
```gherkin=
CREATE TABLE `PRODUCT_REWARD`
(
`ID` bigint(20) AUTO_INCREMENT COMMENT 'ID',
`CAMPAIGN_ID`	varchar(50) NOT NULL COMMENT '活動ID',
`STATUS`	varchar(10) NOT NULL COMMENT '狀態:ACTIVE, DELETE',
`CREATE_TIME`	datetime NOT NULL COMMENT '建立時間',
`UPDATE_TIME`	datetime NOT NULL COMMENT '異動時間',
PRIMARY KEY ( ID )
);

CREATE TABLE `PRODUCT_REWARD_DETAIL`
(
`ID` bigint(20) AUTO_INCREMENT COMMENT 'ID',
`PRODUCT_REWARD_ID`	bigint(20) NOT NULL COMMENT '商品集點ID',
`PRODUCT_GROUP_ID`	varchar(50) NOT NULL COMMENT '商品群組ID',
`STATUS` varchar(10) NOT NULL COMMENT '狀態:ACTIVE, DELETE',
`POINTS` bigint(10) NOT NULL COMMENT '可獲得點數',
`CREATE_TIME`	datetime NOT NULL COMMENT '建立時間',
`UPDATE_TIME`	datetime NOT NULL COMMENT '異動時間',
PRIMARY KEY ( ID )
);

DROP table `PRODUCT_REWARD`;
DROP table `PRODUCT_REWARD_DETAIL`;

```
2.entity
```gherkin=
package com.bcs.core.db.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import com.bcs.core.json.AbstractBcsEntity;

@Entity
@Table(name = "PRODUCT_REWARD_DETAIL")
public class ProductRewardDetail extends AbstractBcsEntity{

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID")
    private Long Id;
    @Column(name = "PRODUCT_REWARD_ID",nullable = false)
    private Long productRewardId;
    @Column(name = "PRODUCT_GROUP_ID", columnDefinition = "NVARCHAR(50)",nullable = false)
    private String productGroupId;
    @Column(name = "STATUS", columnDefinition = "nvarchar(10)",nullable = false)
    private String status;
    @Column(name = "POINTS",nullable = false)
    private Long points;
    @Column(name = "CREATE_TIME",nullable = false)
    private Date createTime;
    @Column(name = "UPDATE_TIME",nullable = false)
    private Date updateTime;

    public ProductRewardDetail(){
    }

    public Long getId(){
        return Id;
    }

    public void setId(Long Id){
        this.Id = Id;
    }

    public Long getProductRewardId(){
        return productRewardId;
    }

    public void setProductRewardId(Long productRewardId){
        this.productRewardId = productRewardId;
    }

    public String getProductGroupId(){
        return productGroupId;
    }

    public void setProductGroupId(String productGroupId){
        this.productGroupId = productGroupId;
    }

    public String getStatus(){
        return status;
    }

    public void setStatus(String status){
        this.status = status;
    }

    public Long getPoints(){
        return points;
    }

    public void setPoints(Long points){
        this.points = points;
    }

    public Date getCreateTime(){
        return createTime;
    }

    public void setCreateTime(Date createTime){
        this.createTime = createTime;
    }

    public Date getUpdateTime(){
        return updateTime;
    }

    public void setUpdateTime(Date updateTime){
        this.updateTime = updateTime;
    }
}

```
3.repository
```gherkin=
package com.bcs.core.db.repository;

import org.springframework.stereotype.Repository;

import com.bcs.core.db.entity.ProductRewardDetail;
import com.bcs.core.db.persistence.EntityRepository;

@Repository
public interface ProductRewardDetailRepository extends EntityRepository<ProductRewardDetail, Long> {

}

```

