店铺注册dao层,

dao层测试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package wang.beastxw.javao2o.dao;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import wang.beastxw.javao2o.BaseTest;
import wang.beastxw.javao2o.entity.Shop;

import java.util.Date;

public class ShopMapperTest extends BaseTest {
@Autowired
ShopMapper shopMapper;

@Test
public void insertTest(){
Shop shop = new Shop();
shop.setAreaId(2);
shop.setOwnerId(1);
shop.setShopCategoryId(10);
shop.setCreateTime(new Date());
shop.setLastEditTime(new Date());
shop.setEnableStatus(1);
shop.setPhone("18268100546");
shop.setPriority(1);
shop.setShopAddr("测试");
shop.setShopName("测试店铺");
shop.setAdvice("测试建议");
int effectNumber = shopMapper.insert(shop);
}
}

插入不需要设置主键,它会自增的 effectNumber为1就是成功了,然后看数据库