diff --git a/src/recommend/src/main/java/com/example/recommend/common/EmBusinessError.java b/src/recommend/src/main/java/com/example/recommend/common/EmBusinessError.java index f5aacd7b..b2145052 100644 --- a/src/recommend/src/main/java/com/example/recommend/common/EmBusinessError.java +++ b/src/recommend/src/main/java/com/example/recommend/common/EmBusinessError.java @@ -15,6 +15,9 @@ public enum EmBusinessError { //admin相关错误 ADMIN_SHOULD_LOGIN(30001, "管理员需要先登录"), + + //品类相关错误 + CATEGORY_NAME_DUPLICATED(40001, "品类名已存在"), ; private Integer errCode; diff --git a/src/recommend/src/main/java/com/example/recommend/controller/CategoryController.java b/src/recommend/src/main/java/com/example/recommend/controller/CategoryController.java new file mode 100644 index 00000000..e65cb260 --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/controller/CategoryController.java @@ -0,0 +1,26 @@ +package com.example.recommend.controller; + +import com.example.recommend.common.CommonRes; +import com.example.recommend.model.CategoryModel; +import com.example.recommend.service.CategoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +@Controller("/category") +@RequestMapping("/category") +public class CategoryController { + + @Autowired + private CategoryService categoryService; + + @ResponseBody + @RequestMapping("/list") + public CommonRes list() { + List categoryModelList = categoryService.selectAll(); + return CommonRes.create(categoryModelList); + } +} diff --git a/src/recommend/src/main/java/com/example/recommend/controller/admin/AdminController.java b/src/recommend/src/main/java/com/example/recommend/controller/admin/AdminController.java index 5e627b67..afba5145 100644 --- a/src/recommend/src/main/java/com/example/recommend/controller/admin/AdminController.java +++ b/src/recommend/src/main/java/com/example/recommend/controller/admin/AdminController.java @@ -3,6 +3,9 @@ package com.example.recommend.controller.admin; import com.example.recommend.common.AdminPermission; import com.example.recommend.common.BusinessException; import com.example.recommend.common.EmBusinessError; +import com.example.recommend.service.CategoryService; +import com.example.recommend.service.SellerService; +import com.example.recommend.service.ShopService; import com.example.recommend.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -36,6 +39,15 @@ public class AdminController { @Autowired private UserService userService; + @Autowired + private CategoryService categoryService; + + @Autowired + private ShopService shopService; + + @Autowired + private SellerService sellerService; + public static final String CURRENT_ADMIN_SESSION = "currentAdminSession"; @RequestMapping("/index") @@ -43,6 +55,9 @@ public class AdminController { public ModelAndView index() { ModelAndView modelAndView = new ModelAndView("/admin/admin/index"); modelAndView.addObject("userCount", userService.countAllUser()); + modelAndView.addObject("shopCount", shopService.countAllShop()); + modelAndView.addObject("categoryCount", categoryService.countAllCategory()); + modelAndView.addObject("sellerCount", sellerService.countAllSeller()); modelAndView.addObject("CONTROLLER_NAME", "admin"); modelAndView.addObject("ACTION_NAME", "index"); return modelAndView; diff --git a/src/recommend/src/main/java/com/example/recommend/controller/admin/CategoryController.java b/src/recommend/src/main/java/com/example/recommend/controller/admin/CategoryController.java new file mode 100644 index 00000000..3a26fe2c --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/controller/admin/CategoryController.java @@ -0,0 +1,69 @@ +package com.example.recommend.controller.admin; + +import com.example.recommend.common.AdminPermission; +import com.example.recommend.common.BusinessException; +import com.example.recommend.common.CommonUtil; +import com.example.recommend.common.EmBusinessError; +import com.example.recommend.model.CategoryModel; +import com.example.recommend.request.CategoryCreateReq; +import com.example.recommend.request.PageQuery; +import com.example.recommend.service.CategoryService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import java.util.List; + +@Controller("/admin/category") +@RequestMapping("/admin/category") +public class CategoryController { + + @Autowired + private CategoryService categoryService; + + //品类列表 + @RequestMapping("/index") + @AdminPermission + public ModelAndView index(PageQuery pageQuery) { + PageHelper.startPage(pageQuery.getPage(), pageQuery.getSize()); + List categoryModelList = categoryService.selectAll(); + PageInfo categoryModelPageInfo = new PageInfo<>(categoryModelList); + ModelAndView modelAndView = new ModelAndView("/admin/category/index.html"); + modelAndView.addObject("data", categoryModelPageInfo); + modelAndView.addObject("CONTROLLER_NAME", "category"); + modelAndView.addObject("ACTION_NAME", "index"); + return modelAndView; + } + + @RequestMapping("/createpage") + @AdminPermission + public ModelAndView createPage() { + ModelAndView modelAndView = new ModelAndView("/admin/category/create.html"); + modelAndView.addObject("CONTROLLER_NAME", "category"); + modelAndView.addObject("ACTION_NAME", "create"); + return modelAndView; + } + + @RequestMapping(value = "/create", method = RequestMethod.POST) + @AdminPermission + public String create(@Valid CategoryCreateReq categoryCreateReq, BindingResult bindingResult) throws BusinessException { + if (bindingResult.hasErrors()) { + throw new BusinessException(EmBusinessError.PARAMETER_VALIDATION_ERROR, CommonUtil.processErrorString(bindingResult)); + } + + CategoryModel categoryModel = new CategoryModel(); + categoryModel.setName(categoryCreateReq.getName()); + categoryModel.setIconUrl(categoryCreateReq.getIconUrl()); + categoryModel.setSort(categoryCreateReq.getSort()); + + categoryService.create(categoryModel); + + return "redirect:/admin/category/index"; + } +} diff --git a/src/recommend/src/main/java/com/example/recommend/controller/admin/ShopController.java b/src/recommend/src/main/java/com/example/recommend/controller/admin/ShopController.java new file mode 100644 index 00000000..2d67ba8b --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/controller/admin/ShopController.java @@ -0,0 +1,72 @@ +package com.example.recommend.controller.admin; + +import com.example.recommend.common.AdminPermission; +import com.example.recommend.common.BusinessException; +import com.example.recommend.common.CommonUtil; +import com.example.recommend.common.EmBusinessError; +import com.example.recommend.model.ShopModel; +import com.example.recommend.request.PageQuery; +import com.example.recommend.request.ShopCreateReq; +import com.example.recommend.service.ShopService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import jakarta.validation.Valid; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.servlet.ModelAndView; + +import java.util.List; + +@Controller("/admin/shop") +@RequestMapping("/admin/shop") +public class ShopController { + @Autowired + private ShopService shopService; + + //门店列表 + @RequestMapping("/index") + @AdminPermission + public ModelAndView index(PageQuery pageQuery) { + PageHelper.startPage(pageQuery.getPage(), pageQuery.getSize()); + List shopModelList = shopService.selectAll(); + PageInfo shopModelPageInfo = new PageInfo<>(shopModelList); + ModelAndView modelAndView = new ModelAndView("/admin/shop/index.html"); + modelAndView.addObject("data", shopModelPageInfo); + modelAndView.addObject("CONTROLLER_NAME", "shop"); + modelAndView.addObject("ACTION_NAME", "index"); + return modelAndView; + } + + @RequestMapping("/createpage") + @AdminPermission + public ModelAndView createPage() { + ModelAndView modelAndView = new ModelAndView("/admin/shop/create.html"); + modelAndView.addObject("CONTROLLER_NAME", "shop"); + modelAndView.addObject("ACTION_NAME", "create"); + return modelAndView; + } + + @RequestMapping(value = "/create", method = RequestMethod.POST) + @AdminPermission + public String create(@Valid ShopCreateReq shopCreateReq, BindingResult bindingResult) throws BusinessException { + if (bindingResult.hasErrors()) { + throw new BusinessException(EmBusinessError.PARAMETER_VALIDATION_ERROR, CommonUtil.processErrorString(bindingResult)); + } + ShopModel shopModel = new ShopModel(); + shopModel.setIconUrl(shopCreateReq.getIconUrl()); + shopModel.setAddress(shopCreateReq.getAddress()); + shopModel.setCategoryId(shopCreateReq.getCategoryId()); + shopModel.setEndTime(shopCreateReq.getEndTime()); + shopModel.setStartTime(shopCreateReq.getStartTime()); + shopModel.setLongitude(shopCreateReq.getLongitude()); + shopModel.setLatitude(shopCreateReq.getLatitude()); + shopModel.setName(shopCreateReq.getName()); + shopModel.setPricePerMan(shopCreateReq.getPricePerMan()); + shopModel.setSellerId(shopCreateReq.getSellerId()); + shopService.create(shopModel); + return "redirect:/admin/shop/index"; + } +} diff --git a/src/recommend/src/main/java/com/example/recommend/dal/CategoryModelMapper.java b/src/recommend/src/main/java/com/example/recommend/dal/CategoryModelMapper.java new file mode 100644 index 00000000..395f7a24 --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/dal/CategoryModelMapper.java @@ -0,0 +1,59 @@ +package com.example.recommend.dal; + +import com.example.recommend.model.CategoryModel; + +import java.util.List; + +public interface CategoryModelMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table category + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + int deleteByPrimaryKey(Integer id); + + List selectAll(); + + Integer countAllCategory(); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table category + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + int insert(CategoryModel record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table category + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + int insertSelective(CategoryModel record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table category + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + CategoryModel selectByPrimaryKey(Integer id); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table category + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + int updateByPrimaryKeySelective(CategoryModel record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table category + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + int updateByPrimaryKey(CategoryModel record); +} \ No newline at end of file diff --git a/src/recommend/src/main/java/com/example/recommend/dal/SellerModelMapper.java b/src/recommend/src/main/java/com/example/recommend/dal/SellerModelMapper.java index 209286e9..5b75d187 100644 --- a/src/recommend/src/main/java/com/example/recommend/dal/SellerModelMapper.java +++ b/src/recommend/src/main/java/com/example/recommend/dal/SellerModelMapper.java @@ -54,4 +54,6 @@ public interface SellerModelMapper { * @mbg.generated Mon Oct 09 23:38:39 CST 2023 */ int updateByPrimaryKey(SellerModel record); + + Integer countAllSeller(); } \ No newline at end of file diff --git a/src/recommend/src/main/java/com/example/recommend/dal/ShopModelMapper.java b/src/recommend/src/main/java/com/example/recommend/dal/ShopModelMapper.java new file mode 100644 index 00000000..1648bf9f --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/dal/ShopModelMapper.java @@ -0,0 +1,59 @@ +package com.example.recommend.dal; + +import com.example.recommend.model.ShopModel; + +import java.util.List; + +public interface ShopModelMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table shop + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + int deleteByPrimaryKey(Integer id); + + Integer countAllShop(); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table shop + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + int insert(ShopModel record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table shop + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + int insertSelective(ShopModel record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table shop + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + ShopModel selectByPrimaryKey(Integer id); + + List selectAll(); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table shop + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + int updateByPrimaryKeySelective(ShopModel record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table shop + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + int updateByPrimaryKey(ShopModel record); +} \ No newline at end of file diff --git a/src/recommend/src/main/java/com/example/recommend/model/CategoryModel.java b/src/recommend/src/main/java/com/example/recommend/model/CategoryModel.java new file mode 100644 index 00000000..75a7b7a0 --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/model/CategoryModel.java @@ -0,0 +1,203 @@ +package com.example.recommend.model; + +import java.util.Date; + +public class CategoryModel { + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column category.id + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + private Integer id; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column category.created_at + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + private Date createdAt; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column category.updated_at + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + private Date updatedAt; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column category.name + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + private String name; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column category.icon_url + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + private String iconUrl; + + /** + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column category.sort + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + private Integer sort; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column category.id + * + * @return the value of category.id + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + public Integer getId() { + return id; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column category.id + * + * @param id the value for category.id + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + public void setId(Integer id) { + this.id = id; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column category.created_at + * + * @return the value of category.created_at + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column category.created_at + * + * @param createdAt the value for category.created_at + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column category.updated_at + * + * @return the value of category.updated_at + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + public Date getUpdatedAt() { + return updatedAt; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column category.updated_at + * + * @param updatedAt the value for category.updated_at + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column category.name + * + * @return the value of category.name + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + public String getName() { + return name; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column category.name + * + * @param name the value for category.name + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column category.icon_url + * + * @return the value of category.icon_url + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + public String getIconUrl() { + return iconUrl; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column category.icon_url + * + * @param iconUrl the value for category.icon_url + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + public void setIconUrl(String iconUrl) { + this.iconUrl = iconUrl == null ? null : iconUrl.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column category.sort + * + * @return the value of category.sort + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + public Integer getSort() { + return sort; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column category.sort + * + * @param sort the value for category.sort + * + * @mbg.generated Tue Oct 10 12:22:57 CST 2023 + */ + public void setSort(Integer sort) { + this.sort = sort; + } +} \ No newline at end of file diff --git a/src/recommend/src/main/java/com/example/recommend/model/ShopModel.java b/src/recommend/src/main/java/com/example/recommend/model/ShopModel.java new file mode 100644 index 00000000..ca873bb2 --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/model/ShopModel.java @@ -0,0 +1,484 @@ +package com.example.recommend.model; + +import java.math.BigDecimal; +import java.util.Date; + +public class ShopModel { + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.id + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private Integer id; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.created_at + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private Date createdAt; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.updated_at + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private Date updatedAt; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.name + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private String name; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.remark_score + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private BigDecimal remarkScore; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.price_per_man + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private Integer pricePerMan; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.latitude + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private BigDecimal latitude; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.longitude + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private BigDecimal longitude; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.category_id + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private Integer categoryId; + + private CategoryModel categoryModel; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.tags + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private String tags; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.start_time + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private String startTime; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.end_time + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private String endTime; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.address + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private String address; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.seller_id + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private Integer sellerId; + + private SellerModel sellerModel; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database column shop.icon_url + * + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + private String iconUrl; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.id + * + * @return the value of shop.id + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public Integer getId() { + return id; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.id + * + * @param id the value for shop.id + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setId(Integer id) { + this.id = id; + } + + public CategoryModel getCategoryModel() { + return categoryModel; + } + + public void setCategoryModel(CategoryModel categoryModel) { + this.categoryModel = categoryModel; + } + + public SellerModel getSellerModel() { + return sellerModel; + } + + public void setSellerModel(SellerModel sellerModel) { + this.sellerModel = sellerModel; + } + +// public Integer getDistance() { +// return distance; +// } +// +// public void setDistance(Integer distance) { +// this.distance = distance; +// } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.created_at + * + * @return the value of shop.created_at + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public Date getCreatedAt() { + return createdAt; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.created_at + * + * @param createdAt the value for shop.created_at + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.updated_at + * + * @return the value of shop.updated_at + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public Date getUpdatedAt() { + return updatedAt; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.updated_at + * + * @param updatedAt the value for shop.updated_at + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.name + * + * @return the value of shop.name + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public String getName() { + return name; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.name + * + * @param name the value for shop.name + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.remark_score + * + * @return the value of shop.remark_score + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public BigDecimal getRemarkScore() { + return remarkScore; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.remark_score + * + * @param remarkScore the value for shop.remark_score + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setRemarkScore(BigDecimal remarkScore) { + this.remarkScore = remarkScore; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.price_per_man + * + * @return the value of shop.price_per_man + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public Integer getPricePerMan() { + return pricePerMan; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.price_per_man + * + * @param pricePerMan the value for shop.price_per_man + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setPricePerMan(Integer pricePerMan) { + this.pricePerMan = pricePerMan; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.latitude + * + * @return the value of shop.latitude + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public BigDecimal getLatitude() { + return latitude; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.latitude + * + * @param latitude the value for shop.latitude + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setLatitude(BigDecimal latitude) { + this.latitude = latitude; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.longitude + * + * @return the value of shop.longitude + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public BigDecimal getLongitude() { + return longitude; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.longitude + * + * @param longitude the value for shop.longitude + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setLongitude(BigDecimal longitude) { + this.longitude = longitude; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.category_id + * + * @return the value of shop.category_id + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public Integer getCategoryId() { + return categoryId; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.category_id + * + * @param categoryId the value for shop.category_id + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setCategoryId(Integer categoryId) { + this.categoryId = categoryId; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.tags + * + * @return the value of shop.tags + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public String getTags() { + return tags; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.tags + * + * @param tags the value for shop.tags + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setTags(String tags) { + this.tags = tags == null ? null : tags.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.start_time + * + * @return the value of shop.start_time + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public String getStartTime() { + return startTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.start_time + * + * @param startTime the value for shop.start_time + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setStartTime(String startTime) { + this.startTime = startTime == null ? null : startTime.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.end_time + * + * @return the value of shop.end_time + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public String getEndTime() { + return endTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.end_time + * + * @param endTime the value for shop.end_time + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setEndTime(String endTime) { + this.endTime = endTime == null ? null : endTime.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.address + * + * @return the value of shop.address + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public String getAddress() { + return address; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.address + * + * @param address the value for shop.address + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setAddress(String address) { + this.address = address == null ? null : address.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.seller_id + * + * @return the value of shop.seller_id + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public Integer getSellerId() { + return sellerId; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.seller_id + * + * @param sellerId the value for shop.seller_id + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setSellerId(Integer sellerId) { + this.sellerId = sellerId; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column shop.icon_url + * + * @return the value of shop.icon_url + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public String getIconUrl() { + return iconUrl; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column shop.icon_url + * + * @param iconUrl the value for shop.icon_url + * @mbg.generated Tue Oct 10 13:20:51 CST 2023 + */ + public void setIconUrl(String iconUrl) { + this.iconUrl = iconUrl == null ? null : iconUrl.trim(); + } +} \ No newline at end of file diff --git a/src/recommend/src/main/java/com/example/recommend/request/CategoryCreateReq.java b/src/recommend/src/main/java/com/example/recommend/request/CategoryCreateReq.java new file mode 100644 index 00000000..eb6964ff --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/request/CategoryCreateReq.java @@ -0,0 +1,41 @@ +package com.example.recommend.request; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; + +public class CategoryCreateReq { + + @NotBlank(message = "名字不能为空") + private String name; + + @NotBlank(message = "iconUrl不能为空") + private String iconUrl; + + @NotNull(message = "权重不能为空") + private Integer sort; + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getIconUrl() { + return iconUrl; + } + + public void setIconUrl(String iconUrl) { + this.iconUrl = iconUrl; + } + + public Integer getSort() { + return sort; + } + + public void setSort(Integer sort) { + this.sort = sort; + } +} diff --git a/src/recommend/src/main/java/com/example/recommend/request/RegisterReq.java b/src/recommend/src/main/java/com/example/recommend/request/RegisterReq.java index 3f620e48..bdb0dfe7 100644 --- a/src/recommend/src/main/java/com/example/recommend/request/RegisterReq.java +++ b/src/recommend/src/main/java/com/example/recommend/request/RegisterReq.java @@ -1,6 +1,7 @@ package com.example.recommend.request; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; public class RegisterReq { @@ -11,7 +12,7 @@ public class RegisterReq { @NotBlank(message = "昵称不能为空") private String nickName; - //@NotNull(message = "性别不能为空") + @NotNull(message = "性别不能为空") private Integer gender; public String getTelephone() { diff --git a/src/recommend/src/main/java/com/example/recommend/request/ShopCreateReq.java b/src/recommend/src/main/java/com/example/recommend/request/ShopCreateReq.java new file mode 100644 index 00000000..1ce57de3 --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/request/ShopCreateReq.java @@ -0,0 +1,130 @@ +package com.example.recommend.request; + +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; + +import java.math.BigDecimal; + +public class ShopCreateReq { + + @NotBlank(message = "服务名不能为空") + private String name; + + @NotNull(message = "人均价格不能为空") + private Integer pricePerMan; + + @NotNull(message = "纬度不能为空") + private BigDecimal latitude; + + @NotNull(message = "经度不能为空") + private BigDecimal longitude; + + @NotNull(message = "服务类目不能为空") + private Integer categoryId; + + private String tags; + + @NotBlank(message = "营业开始时间不能为空") + private String startTime; + + @NotBlank(message = "营业结束时间不能为空") + private String endTime; + + @NotBlank(message = "地址不能为空") + private String address; + + @NotNull(message = "商家ID不能为空") + private Integer sellerId; + + @NotBlank(message = "图标不能为空") + private String iconUrl; + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getPricePerMan() { + return pricePerMan; + } + + public void setPricePerMan(Integer pricePerMan) { + this.pricePerMan = pricePerMan; + } + + public BigDecimal getLatitude() { + return latitude; + } + + public void setLatitude(BigDecimal latitude) { + this.latitude = latitude; + } + + public BigDecimal getLongitude() { + return longitude; + } + + public void setLongitude(BigDecimal longitude) { + this.longitude = longitude; + } + + public Integer getCategoryId() { + return categoryId; + } + + public void setCategoryId(Integer categoryId) { + this.categoryId = categoryId; + } + + public String getTags() { + return tags; + } + + public void setTags(String tags) { + this.tags = tags; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getEndTime() { + return endTime; + } + + public void setEndTime(String endTime) { + this.endTime = endTime; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Integer getSellerId() { + return sellerId; + } + + public void setSellerId(Integer sellerId) { + this.sellerId = sellerId; + } + + public String getIconUrl() { + return iconUrl; + } + + public void setIconUrl(String iconUrl) { + this.iconUrl = iconUrl; + } +} diff --git a/src/recommend/src/main/java/com/example/recommend/service/CategoryService.java b/src/recommend/src/main/java/com/example/recommend/service/CategoryService.java new file mode 100644 index 00000000..c2ee3de6 --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/service/CategoryService.java @@ -0,0 +1,17 @@ +package com.example.recommend.service; + +import com.example.recommend.common.BusinessException; +import com.example.recommend.model.CategoryModel; + +import java.util.List; + +public interface CategoryService { + + CategoryModel create(CategoryModel categoryModel) throws BusinessException; + + CategoryModel get(Integer id); + + List selectAll(); + + Integer countAllCategory(); +} diff --git a/src/recommend/src/main/java/com/example/recommend/service/SellerService.java b/src/recommend/src/main/java/com/example/recommend/service/SellerService.java index b3c29e54..2de19df2 100644 --- a/src/recommend/src/main/java/com/example/recommend/service/SellerService.java +++ b/src/recommend/src/main/java/com/example/recommend/service/SellerService.java @@ -13,4 +13,6 @@ public interface SellerService { List selectAll(); SellerModel changeStatus(Integer id, Integer disabledFlag) throws BusinessException; + + Integer countAllSeller(); } diff --git a/src/recommend/src/main/java/com/example/recommend/service/ShopService.java b/src/recommend/src/main/java/com/example/recommend/service/ShopService.java new file mode 100644 index 00000000..a5f43385 --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/service/ShopService.java @@ -0,0 +1,23 @@ +package com.example.recommend.service; + +import com.example.recommend.common.BusinessException; +import com.example.recommend.model.ShopModel; + +import java.util.List; + +public interface ShopService { + + ShopModel create(ShopModel shopModel) throws BusinessException; + + ShopModel get(Integer id); + + List selectAll(); + + //List recommend(BigDecimal longitude, BigDecimal latitude); + + //List> searchGroupByTags(String keyword, Integer categoryId, String tags); + + Integer countAllShop(); + + //List search(BigDecimal longitude, BigDecimal latitude,String keyword, Integer orderby, Integer categoryId, String tags); +} diff --git a/src/recommend/src/main/java/com/example/recommend/service/impl/CategoryServiceImpl.java b/src/recommend/src/main/java/com/example/recommend/service/impl/CategoryServiceImpl.java new file mode 100644 index 00000000..0adceb3c --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/service/impl/CategoryServiceImpl.java @@ -0,0 +1,49 @@ +package com.example.recommend.service.impl; + +import com.example.recommend.common.BusinessException; +import com.example.recommend.common.EmBusinessError; +import com.example.recommend.dal.CategoryModelMapper; +import com.example.recommend.model.CategoryModel; +import com.example.recommend.service.CategoryService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; + +@Service +public class CategoryServiceImpl implements CategoryService { + + @Autowired + private CategoryModelMapper categoryModelMapper; + + @Override + @Transactional + public CategoryModel create(CategoryModel categoryModel) throws BusinessException { + categoryModel.setCreatedAt(new Date()); + categoryModel.setUpdatedAt(new Date()); + try { + categoryModelMapper.insertSelective(categoryModel); + } catch (DuplicateKeyException ex) { + throw new BusinessException(EmBusinessError.CATEGORY_NAME_DUPLICATED); + } + return get(categoryModel.getId()); + } + + @Override + public CategoryModel get(Integer id) { + return categoryModelMapper.selectByPrimaryKey(id); + } + + @Override + public List selectAll() { + return categoryModelMapper.selectAll(); + } + + @Override + public Integer countAllCategory() { + return categoryModelMapper.countAllCategory(); + } +} diff --git a/src/recommend/src/main/java/com/example/recommend/service/impl/SellerServiceImpl.java b/src/recommend/src/main/java/com/example/recommend/service/impl/SellerServiceImpl.java index f9ae8269..d93f67c3 100644 --- a/src/recommend/src/main/java/com/example/recommend/service/impl/SellerServiceImpl.java +++ b/src/recommend/src/main/java/com/example/recommend/service/impl/SellerServiceImpl.java @@ -18,7 +18,7 @@ public class SellerServiceImpl implements SellerService { @Autowired private SellerModelMapper sellerModelMapper; - + @Override @Transactional public SellerModel create(SellerModel sellerModel) { @@ -51,4 +51,8 @@ public class SellerServiceImpl implements SellerService { return sellerModel; } + @Override + public Integer countAllSeller() { + return sellerModelMapper.countAllSeller(); + } } \ No newline at end of file diff --git a/src/recommend/src/main/java/com/example/recommend/service/impl/ShopServiceImpl.java b/src/recommend/src/main/java/com/example/recommend/service/impl/ShopServiceImpl.java new file mode 100644 index 00000000..83bcb069 --- /dev/null +++ b/src/recommend/src/main/java/com/example/recommend/service/impl/ShopServiceImpl.java @@ -0,0 +1,109 @@ +package com.example.recommend.service.impl; + +import com.example.recommend.common.BusinessException; +import com.example.recommend.common.EmBusinessError; +import com.example.recommend.dal.ShopModelMapper; +import com.example.recommend.model.CategoryModel; +import com.example.recommend.model.SellerModel; +import com.example.recommend.model.ShopModel; +import com.example.recommend.service.CategoryService; +import com.example.recommend.service.SellerService; +import com.example.recommend.service.ShopService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; + +@Service +public class ShopServiceImpl implements ShopService { + + @Autowired + private ShopModelMapper shopModelMapper; + + @Autowired + private CategoryService categoryService; + + @Autowired + private SellerService sellerService; + + @Override + @Transactional + public ShopModel create(ShopModel shopModel) throws BusinessException { + shopModel.setCreatedAt(new Date()); + shopModel.setUpdatedAt(new Date()); + + //校验商家是否存在正确 + SellerModel sellerModel = sellerService.get(shopModel.getSellerId()); + if (sellerModel == null) { + throw new BusinessException(EmBusinessError.PARAMETER_VALIDATION_ERROR, "商户不存在"); + } + + if (sellerModel.getDisabledFlag().intValue() == 1) { + throw new BusinessException(EmBusinessError.PARAMETER_VALIDATION_ERROR, "商户已禁用"); + } + + //校验类目 + CategoryModel categoryModel = categoryService.get(shopModel.getCategoryId()); + if (categoryModel == null) { + throw new BusinessException(EmBusinessError.PARAMETER_VALIDATION_ERROR, "类目不存在"); + } + shopModelMapper.insertSelective(shopModel); + + return get(shopModel.getId()); + } + + @Override + public ShopModel get(Integer id) { + ShopModel shopModel = shopModelMapper.selectByPrimaryKey(id); + if (shopModel == null) { + return null; + } + shopModel.setSellerModel(sellerService.get(shopModel.getSellerId())); + shopModel.setCategoryModel(categoryService.get(shopModel.getCategoryId())); + return shopModel; + } + + @Override + public List selectAll() { + List shopModelList = shopModelMapper.selectAll(); + shopModelList.forEach(shopModel -> { + shopModel.setSellerModel(sellerService.get(shopModel.getSellerId())); + shopModel.setCategoryModel(categoryService.get(shopModel.getCategoryId())); + }); + return shopModelList; + } + +// @Override +// public List recommend(BigDecimal longitude, BigDecimal latitude) { +// List shopModelList = shopModelMapper.recommend(longitude, latitude); +// shopModelList.forEach(shopModel -> { +// shopModel.setSellerModel(sellerService.get(shopModel.getSellerId())); +// shopModel.setCategoryModel(categoryService.get(shopModel.getCategoryId())); +// }); +// return shopModelList; +// } + +// @Override +// public List> searchGroupByTags(String keyword, Integer categoryId, String tags) { +// return shopModelMapper.searchGroupByTags(keyword, categoryId, tags); +// } + + @Override + public Integer countAllShop() { + return shopModelMapper.countAllShop(); + } + +// @Override +// public List search(BigDecimal longitude, +// BigDecimal latitude, String keyword, Integer orderby, +// Integer categoryId, String tags) { +// List shopModelList = shopModelMapper.search(longitude, latitude, keyword, orderby, categoryId, tags); +// shopModelList.forEach(shopModel -> { +// shopModel.setSellerModel(sellerService.get(shopModel.getSellerId())); +// shopModel.setCategoryModel(categoryService.get(shopModel.getCategoryId())); +// }); +// return shopModelList; +// } +} diff --git a/src/recommend/src/main/resources/ddl.sql b/src/recommend/src/main/resources/ddl.sql index 1a836832..e2130de0 100644 --- a/src/recommend/src/main/resources/ddl.sql +++ b/src/recommend/src/main/resources/ddl.sql @@ -20,4 +20,36 @@ CREATE TABLE `recommenddb`.`seller` `remark_score` decimal(2, 1) NOT NULL DEFAULT 0, `disabled_flag` int(0) NOT NULL DEFAULT 0, PRIMARY KEY (`id`) +); + +CREATE TABLE `recommenddb`.`category` +( + `id` int(0) NOT NULL AUTO_INCREMENT, + `created_at` datetime(0) NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` datetime(0) NOT NULL DEFAULT '0000-00-00 00:00:00', + `name` varchar(20) NOT NULL DEFAULT '', + `icon_url` varchar(200) NOT NULL DEFAULT '', + `sort` int(0) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + UNIQUE INDEX `name_unique_in` (`name`) USING BTREE +); + +CREATE TABLE `recommenddb`.`shop` +( + `id` int(0) NOT NULL AUTO_INCREMENT, + `created_at` datetime(0) NOT NULL DEFAULT '0000-00-00 00:00:00', + `updated_at` datetime(0) NOT NULL DEFAULT '0000-00-00 00:00:00', + `name` varchar(80) NOT NULL DEFAULT '', + `remark_score` decimal(2, 1) NOT NULL DEFAULT 0, + `price_per_man` int(0) NOT NULL DEFAULT 0, + `latitude` decimal(10, 6) NOT NULL DEFAULT 0, + `longitude` decimal(10, 6) NOT NULL DEFAULT 0, + `category_id` int(0) NOT NULL DEFAULT 0, + `tags` varchar(2000) NOT NULL DEFAULT '', + `start_time` varchar(200) NOT NULL DEFAULT '', + `end_time` varchar(200) NOT NULL DEFAULT '', + `address` varchar(200) NOT NULL DEFAULT '', + `seller_id` int(0) NOT NULL DEFAULT 0, + `icon_url` varchar(100) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) ); \ No newline at end of file diff --git a/src/recommend/src/main/resources/mapping/CategoryModelMapper.xml b/src/recommend/src/main/resources/mapping/CategoryModelMapper.xml new file mode 100644 index 00000000..a4580654 --- /dev/null +++ b/src/recommend/src/main/resources/mapping/CategoryModelMapper.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + id, created_at, updated_at, name, icon_url, sort + + + + + delete from category + where id = #{id,jdbcType=INTEGER} + + + + + SELECT LAST_INSERT_ID() + + insert into category (created_at, updated_at, name, + icon_url, sort) + values (#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{name,jdbcType=VARCHAR}, + #{iconUrl,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}) + + + + + SELECT LAST_INSERT_ID() + + insert into category + + + created_at, + + + updated_at, + + + name, + + + icon_url, + + + sort, + + + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{name,jdbcType=VARCHAR}, + + + #{iconUrl,jdbcType=VARCHAR}, + + + #{sort,jdbcType=INTEGER}, + + + + + + update category + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + name = #{name,jdbcType=VARCHAR}, + + + icon_url = #{iconUrl,jdbcType=VARCHAR}, + + + sort = #{sort,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + + update category + set created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + name = #{name,jdbcType=VARCHAR}, + icon_url = #{iconUrl,jdbcType=VARCHAR}, + sort = #{sort,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + + + \ No newline at end of file diff --git a/src/recommend/src/main/resources/mapping/SellerModelMapper.xml b/src/recommend/src/main/resources/mapping/SellerModelMapper.xml index 841603dc..a738fe74 100644 --- a/src/recommend/src/main/resources/mapping/SellerModelMapper.xml +++ b/src/recommend/src/main/resources/mapping/SellerModelMapper.xml @@ -39,6 +39,10 @@ from seller order by id ASC + + + + + + + + + + + + + + + + + + + + id, created_at, updated_at, name, remark_score, price_per_man, latitude, longitude, + category_id, tags, start_time, end_time, address, seller_id, icon_url + + + + + delete from shop + where id = #{id,jdbcType=INTEGER} + + + + + SELECT LAST_INSERT_ID() + + insert into shop (created_at, updated_at, name, + remark_score, price_per_man, latitude, + longitude, category_id, tags, + start_time, end_time, address, + seller_id, icon_url) + values (#{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, #{name,jdbcType=VARCHAR}, + #{remarkScore,jdbcType=DECIMAL}, #{pricePerMan,jdbcType=INTEGER}, #{latitude,jdbcType=DECIMAL}, + #{longitude,jdbcType=DECIMAL}, #{categoryId,jdbcType=INTEGER}, #{tags,jdbcType=VARCHAR}, + #{startTime,jdbcType=VARCHAR}, #{endTime,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, + #{sellerId,jdbcType=INTEGER}, #{iconUrl,jdbcType=VARCHAR}) + + + + + SELECT LAST_INSERT_ID() + + insert into shop + + + created_at, + + + updated_at, + + + name, + + + remark_score, + + + price_per_man, + + + latitude, + + + longitude, + + + category_id, + + + tags, + + + start_time, + + + end_time, + + + address, + + + seller_id, + + + icon_url, + + + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{name,jdbcType=VARCHAR}, + + + #{remarkScore,jdbcType=DECIMAL}, + + + #{pricePerMan,jdbcType=INTEGER}, + + + #{latitude,jdbcType=DECIMAL}, + + + #{longitude,jdbcType=DECIMAL}, + + + #{categoryId,jdbcType=INTEGER}, + + + #{tags,jdbcType=VARCHAR}, + + + #{startTime,jdbcType=VARCHAR}, + + + #{endTime,jdbcType=VARCHAR}, + + + #{address,jdbcType=VARCHAR}, + + + #{sellerId,jdbcType=INTEGER}, + + + #{iconUrl,jdbcType=VARCHAR}, + + + + + + update shop + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + name = #{name,jdbcType=VARCHAR}, + + + remark_score = #{remarkScore,jdbcType=DECIMAL}, + + + price_per_man = #{pricePerMan,jdbcType=INTEGER}, + + + latitude = #{latitude,jdbcType=DECIMAL}, + + + longitude = #{longitude,jdbcType=DECIMAL}, + + + category_id = #{categoryId,jdbcType=INTEGER}, + + + tags = #{tags,jdbcType=VARCHAR}, + + + start_time = #{startTime,jdbcType=VARCHAR}, + + + end_time = #{endTime,jdbcType=VARCHAR}, + + + address = #{address,jdbcType=VARCHAR}, + + + seller_id = #{sellerId,jdbcType=INTEGER}, + + + icon_url = #{iconUrl,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + + update shop + set created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + name = #{name,jdbcType=VARCHAR}, + remark_score = #{remarkScore,jdbcType=DECIMAL}, + price_per_man = #{pricePerMan,jdbcType=INTEGER}, + latitude = #{latitude,jdbcType=DECIMAL}, + longitude = #{longitude,jdbcType=DECIMAL}, + category_id = #{categoryId,jdbcType=INTEGER}, + tags = #{tags,jdbcType=VARCHAR}, + start_time = #{startTime,jdbcType=VARCHAR}, + end_time = #{endTime,jdbcType=VARCHAR}, + address = #{address,jdbcType=VARCHAR}, + seller_id = #{sellerId,jdbcType=INTEGER}, + icon_url = #{iconUrl,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + + + \ No newline at end of file diff --git a/src/recommend/src/main/resources/mybatis-generator.xml b/src/recommend/src/main/resources/mybatis-generator.xml index 097eaec3..5778b240 100644 --- a/src/recommend/src/main/resources/mybatis-generator.xml +++ b/src/recommend/src/main/resources/mybatis-generator.xml @@ -38,7 +38,7 @@ enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> --> - diff --git a/src/recommend/src/main/resources/static/index.html b/src/recommend/src/main/resources/static/index.html index 45314fc5..4101db07 100644 --- a/src/recommend/src/main/resources/static/index.html +++ b/src/recommend/src/main/resources/static/index.html @@ -4,7 +4,7 @@ - 推荐 + 点评 @@ -692,16 +692,49 @@
-
上海天津
+ + + 登录
+ +
+
+
+
+
+
+
+
+
+
+ +
猜你喜欢
+
+ +
+
+

搜索结果

+ +
+
+
+
+
+
+ +
+
+
+ +
+
+ 商户数 +
+
+
+
+
+
+
+ +
+
+
+ +
+
+ 品类数 +
+
+
+
+
+
+
+ +
+
+
+ +
+
+ 门店数 +
+
+
+
diff --git a/src/recommend/src/main/resources/templates/admin/category/create.html b/src/recommend/src/main/resources/templates/admin/category/create.html new file mode 100644 index 00000000..02a61277 --- /dev/null +++ b/src/recommend/src/main/resources/templates/admin/category/create.html @@ -0,0 +1,170 @@ + + + + + + + + + + + 运营平台 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ +
+
+

创建品类

+
+ +
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ + +
+
+ +
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/recommend/src/main/resources/templates/admin/category/index.html b/src/recommend/src/main/resources/templates/admin/category/index.html new file mode 100644 index 00000000..ce4a8268 --- /dev/null +++ b/src/recommend/src/main/resources/templates/admin/category/index.html @@ -0,0 +1,398 @@ + + + + + + + + + + + 运营后台 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ +
+
+ +
+
+

+ 品类管理 +

+
+ +
+ + +
+
+
+
+ 品类列表 +
+
+
+
+
+ + + + + + + + + + + + + + + + +
id品类名icon图片排序权重
+ + + +
+
    +
    + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +enthemes.com +Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes +License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project. +--> + + + + + + + + + 运营后台 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    + +
    +
    + +
    +
    +

    + 品类管理 +

    +
    + +
    + + +
    +
    +
    +
    + 品类列表 +
    +
    +
    +
    + + + + + + + + + + + + + + + + + +
    id品类名icon图片排序权重
    +
    +
    +
    +
    +
      +
      +
      +
      + +
      +
      + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/recommend/src/main/resources/templates/admin/common/sidebar.html b/src/recommend/src/main/resources/templates/admin/common/sidebar.html index d3fde1bb..3944f12e 100644 --- a/src/recommend/src/main/resources/templates/admin/common/sidebar.html +++ b/src/recommend/src/main/resources/templates/admin/common/sidebar.html @@ -22,15 +22,17 @@ 商户查询 - + diff --git a/src/recommend/src/main/resources/templates/admin/shop/create.html b/src/recommend/src/main/resources/templates/admin/shop/create.html new file mode 100644 index 00000000..ae2ae0e5 --- /dev/null +++ b/src/recommend/src/main/resources/templates/admin/shop/create.html @@ -0,0 +1,255 @@ + + + + + + + + + + + 运营平台 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      + +
      +
      + +
      +
      +

      创建门店

      +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      + +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      +
      +
      + + +
      +
      +
      +
      +
      +
      + +
      + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/recommend/src/main/resources/templates/admin/shop/index.html b/src/recommend/src/main/resources/templates/admin/shop/index.html new file mode 100644 index 00000000..2e599e2f --- /dev/null +++ b/src/recommend/src/main/resources/templates/admin/shop/index.html @@ -0,0 +1,235 @@ + + + + + + + + + + + 运营后台 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      +
      + +
      +
      + +
      +
      +

      + 门店管理 +

      +
      + +
      + + +
      +
      +
      +
      + 品类门店 +
      +
      +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      id图标门店名评分人均价格品类信息标签开始营业时间结束营业时间地址商家信息
      + +
      +
      +
      +
      +
      +
        +
        +
        +
        + +
        +
        + + + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file