public class ShopServiceTest extends BaseTest {
@Autowired
private ShopService shopService;
@Test
public void testAddShop() throws FileNotFoundException {
Shop shop = new Shop();
PersonInfo owner = new PersonInfo();
Area area = new Area();
ShopCategory shopCategory = new ShopCategory();
owner.setUserId(2L);
area.setAreaId(2);
shopCategory.setShopCategoryId(1L);
shop.setOwner(owner);
shop.setArea(area);
shop.setShopCategory(shopCategory);
shop.setShopName("十八碗2");
shop.setShopDesc("test1");
shop.setShopAddr("test1");
shop.setPhone("1233240");
shop.setCreateTime(new Date());
shop.setEnableStatus(ShopStateEnum.CHECK.getState());
shop.setAdvice("审核中");
File shopImg = new File("E:/Pro/testpro/img/achang.jpg");
InputStream is = new FileInputStream(shopImg);
ShopExecution se = shopService.addShop(shop,is,shopImg.getName());
assertEquals(ShopStateEnum.CHECK.getState(),se.getState());
}
}
添加店铺设置 shop.setShopCategory(shopCategory);提示nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'shop_Category' in 'field list',shopCategory作为一个ShopCategory类的对象设置,但shop数据库中是没有的,所以出错了但不知道怎么解决
SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需
了解课程