Commit 675db71538cb8b253518e1dfcb2c8681b9c6fc0d

Authored by zhangxing
2 parents c5456ca0 72bdd6c6
... ... @@ -13,7 +13,7 @@
13 13 <groupId>org.springframework.boot</groupId>
14 14 <artifactId>spring-boot-starter-parent</artifactId>
15 15 <version>2.2.5.RELEASE</version>
16   - <relativePath /> <!-- lookup parent from repository -->
  16 + <relativePath /> <!-- lookup parent from repository -->
17 17 </parent>
18 18  
19 19 <properties>
... ...
src/main/java/com/diligrp/xtrade/product/controllor/CategoryController.java 0 → 100644
  1 +package com.diligrp.xtrade.product.controllor;
  2 +
  3 +import org.springframework.beans.factory.annotation.Autowired;
  4 +import org.springframework.web.bind.annotation.PathVariable;
  5 +import org.springframework.web.bind.annotation.RequestMapping;
  6 +import org.springframework.web.bind.annotation.RestController;
  7 +
  8 +import com.diligrp.xtrade.product.domain.dto.CategoryDto;
  9 +import com.diligrp.xtrade.product.service.CategoryService;
  10 +import com.diligrp.xtrade.shared.domain.Message;
  11 +
  12 +/**
  13 + * @ClassName: CategoryController
  14 + * @Description TODO(用一句话描述该文件做什么)
  15 + * @author yangfan
  16 + * @date 2020年4月20日
  17 + */
  18 +@RestController
  19 +@RequestMapping("category/")
  20 +public class CategoryController {
  21 +
  22 + @Autowired
  23 + private CategoryService categoryService;
  24 +
  25 + /**
  26 + * 新增品类
  27 + * @Title insert
  28 + * @Description 新增品类
  29 + * @param categoryDTO
  30 + * @return
  31 + * @throws
  32 + */
  33 + @RequestMapping("insert")
  34 + public Message<Object> insert(CategoryDto categoryDTO){
  35 + categoryService.insert(categoryDTO);
  36 + return Message.builder().success();
  37 + }
  38 + /**
  39 + * 修改品类
  40 + * @Title update
  41 + * @Description 修改品类
  42 + * @param categoryDTO
  43 + * @return
  44 + * @throws
  45 + */
  46 + @RequestMapping("update")
  47 + public Message<Object> update(CategoryDto categoryDTO){
  48 + categoryService.update(categoryDTO);
  49 + return Message.builder().success();
  50 + }
  51 +
  52 + /**
  53 + * id获取
  54 + * @Title get
  55 + * @Description id获取
  56 + * @param id
  57 + * @return
  58 + * @throws
  59 + */
  60 + @RequestMapping("get/{id}")
  61 + public Message<?> get(@PathVariable Long id){
  62 + return Message.builder().success(categoryService.selectEntityById(id));
  63 + }
  64 + /**
  65 + * 主键删除
  66 + * @Title delect
  67 + * @Description 主键删除
  68 + * @param id
  69 + * @return
  70 + * @throws
  71 + */
  72 + @RequestMapping("delect/{id}")
  73 + public Message<Object> delect(@PathVariable Long id){
  74 + categoryService.delectById(id);
  75 + return Message.builder().success();
  76 + }
  77 +}
... ...
src/main/java/com/diligrp/xtrade/product/controllor/ShopController.java 0 → 100644
  1 +package com.diligrp.xtrade.product.controllor;
  2 +
  3 +import java.util.List;
  4 +
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.PathVariable;
  7 +import org.springframework.web.bind.annotation.RequestMapping;
  8 +import org.springframework.web.bind.annotation.RestController;
  9 +
  10 +import com.diligrp.xtrade.product.domain.dto.ShopDto;
  11 +import com.diligrp.xtrade.product.domain.entity.ShopDo;
  12 +import com.diligrp.xtrade.product.service.ShopService;
  13 +import com.diligrp.xtrade.shared.domain.Message;
  14 +
  15 +/**
  16 + * @ClassName: ShopControler
  17 + * @Description TODO(用一句话描述该文件做什么)
  18 + * @author yangfan
  19 + * @date 2020年4月21日
  20 + */
  21 +@RestController
  22 +@RequestMapping("/sapi/shop")
  23 +public class ShopController {
  24 +
  25 + @Autowired
  26 + private ShopService shopService;
  27 +
  28 + /**
  29 + *
  30 + * @Title save
  31 + * @Description 店铺保存
  32 + * @param shop
  33 + * @return
  34 + * @throws
  35 + */
  36 + @RequestMapping("save")
  37 + public Message<?> save(ShopDto shop){
  38 + shopService.insert(shop);
  39 + return Message.builder().success();
  40 + }
  41 +
  42 + /**
  43 + *
  44 + * @Title get
  45 + * @Description 获取商铺
  46 + * @param shopId
  47 + * @return
  48 + * @throws
  49 + */
  50 + @RequestMapping("get/{shopId}")
  51 + public Message<ShopDo> get(@PathVariable Long shopId){
  52 + return Message.builder().success(shopService.selectByShopId(shopId));
  53 + }
  54 +
  55 + /**
  56 + *
  57 + * @Title selectShopByMerId
  58 + * @Description 根据商户id获取商户全部店铺信息
  59 + * @param merId
  60 + * @return
  61 + * @throws
  62 + */
  63 + @RequestMapping("selectShopByMerId/{merId}")
  64 + public Message<?> selectShopByMerId(@PathVariable Long merId){
  65 + List<ShopDo> shopDos = shopService.selectShopByMerId(merId);
  66 + return Message.builder().success(shopDos);
  67 + }
  68 +}
... ...
src/main/java/com/diligrp/xtrade/product/dao/CategoryDao.java 0 → 100644
  1 +package com.diligrp.xtrade.product.dao;
  2 +
  3 +import org.apache.ibatis.annotations.Mapper;
  4 +
  5 +import com.diligrp.xtrade.product.domain.entity.CategoryDo;
  6 +
  7 +
  8 +/**
  9 + * @ClassName: CategoryDao
  10 + * @Description TODO(用一句话描述该文件做什么)
  11 + * @author yangfan
  12 + * @date 2020年4月20日
  13 + */
  14 +@Mapper
  15 +public interface CategoryDao {
  16 +
  17 + void insert(CategoryDo category);
  18 +
  19 + void update(CategoryDo category);
  20 +
  21 + CategoryDo selectEntityById(Integer id);
  22 +
  23 + void delect(Long id);
  24 +}
... ...
src/main/java/com/diligrp/xtrade/product/dao/ShopDao.java
1 1 package com.diligrp.xtrade.product.dao;
2 2  
3   -public interface ShopDao {
  3 +import java.util.List;
  4 +
  5 +import org.apache.ibatis.annotations.Mapper;
4 6  
  7 +import com.diligrp.xtrade.product.domain.entity.ShopDo;
  8 +/**
  9 + *
  10 + * @ClassName: ShopDao
  11 + * @Description 店铺dao
  12 + * @author yangfan
  13 + * @date 2020年4月21日
  14 + */
  15 +@Mapper
  16 +public interface ShopDao {
  17 +
  18 + void insert(ShopDo shop);
  19 +
  20 + void update(ShopDo shop);
  21 +
  22 + ShopDo selectByShopId(Long shopId);
  23 +
  24 + List<ShopDo> selectByMerId(Long merId);
5 25 }
... ...
src/main/java/com/diligrp/xtrade/product/domain/dto/CategoryDto.java 0 → 100644
  1 +package com.diligrp.xtrade.product.domain.dto;
  2 +
  3 +import com.diligrp.xtrade.shared.domain.BaseDo;
  4 +
  5 +/**
  6 + * @ClassName: CategoryDto
  7 + * @Description 品类传输
  8 + * @author yangfan
  9 + * @date 2020年4月16日
  10 + */
  11 +public class CategoryDto{
  12 + /**
  13 + * 快捷简码
  14 + */
  15 + private String categoryId;
  16 + /**
  17 + * 品类名称
  18 + */
  19 + private String cname;
  20 + /**
  21 + * 拼音缩写
  22 + */
  23 + private String shortName;
  24 + /**
  25 + * 品类状态
  26 + */
  27 + private Integer status;
  28 + /**
  29 + * 是否有子级品类
  30 + */
  31 + private Integer hasChild;
  32 + /**
  33 + * 图标
  34 + */
  35 + private String icon;
  36 + /**
  37 + * 图片
  38 + */
  39 + private String image;
  40 + /**
  41 + * 品类有效期
  42 + */
  43 + private Integer validDay;
  44 + /**
  45 + * 类型
  46 + */
  47 + private Long type;
  48 + /**
  49 + * 品类等级
  50 + */
  51 + private Integer level;
  52 + public String getCategoryId() {
  53 + return categoryId;
  54 + }
  55 + public void setCategoryId(String categoryId) {
  56 + this.categoryId = categoryId;
  57 + }
  58 + public String getCname() {
  59 + return cname;
  60 + }
  61 + public void setCname(String cname) {
  62 + this.cname = cname;
  63 + }
  64 + public String getShortName() {
  65 + return shortName;
  66 + }
  67 + public void setShortName(String shortName) {
  68 + this.shortName = shortName;
  69 + }
  70 + public Integer getStatus() {
  71 + return status;
  72 + }
  73 + public void setStatus(Integer status) {
  74 + this.status = status;
  75 + }
  76 + public Integer getHasChild() {
  77 + return hasChild;
  78 + }
  79 + public void setHasChild(Integer hasChild) {
  80 + this.hasChild = hasChild;
  81 + }
  82 + public String getIcon() {
  83 + return icon;
  84 + }
  85 + public void setIcon(String icon) {
  86 + this.icon = icon;
  87 + }
  88 + public String getImage() {
  89 + return image;
  90 + }
  91 + public void setImage(String image) {
  92 + this.image = image;
  93 + }
  94 + public Integer getValidDay() {
  95 + return validDay;
  96 + }
  97 + public void setValidDay(Integer validDay) {
  98 + this.validDay = validDay;
  99 + }
  100 + public Long getType() {
  101 + return type;
  102 + }
  103 + public void setType(Long type) {
  104 + this.type = type;
  105 + }
  106 + public Integer getLevel() {
  107 + return level;
  108 + }
  109 + public void setLevel(Integer level) {
  110 + this.level = level;
  111 + }
  112 +
  113 +}
... ...
src/main/java/com/diligrp/xtrade/product/domain/dto/ShopDto.java 0 → 100644
  1 +package com.diligrp.xtrade.product.domain.dto;
  2 +
  3 +import javax.validation.constraints.NotBlank;
  4 +
  5 +/**
  6 + * @ClassName: ShopDTO
  7 + * @Description TODO(用一句话描述该文件做什么)
  8 + * @author yangfan
  9 + * @date 2020年4月21日
  10 + */
  11 +public class ShopDto {
  12 +
  13 + /**
  14 + * 商户id
  15 + */
  16 + private Long merId;
  17 +
  18 + /**
  19 + * 店铺id
  20 + */
  21 + private Long shopId;
  22 +
  23 + /**
  24 + * 店铺名称
  25 + */
  26 + @NotBlank(message = "商铺名称不能为空")
  27 + private String shopName;
  28 +
  29 + /**
  30 + * 店铺类型
  31 + */
  32 + private Integer type;
  33 +
  34 + /**
  35 + * 店铺状态
  36 + */
  37 + private Integer status;
  38 +
  39 + /**
  40 + * 是否自营
  41 + */
  42 + private Integer isSelfShop;
  43 +
  44 + /**
  45 + * 主营业务
  46 + */
  47 + private String mainBusiness;
  48 +
  49 + /**
  50 + * 地址
  51 + */
  52 + private String address;
  53 +
  54 + /**
  55 + * 描述
  56 + */
  57 + private String description;
  58 +
  59 + public Long getMerId() {
  60 + return merId;
  61 + }
  62 +
  63 + public void setMerId(Long merId) {
  64 + this.merId = merId;
  65 + }
  66 +
  67 + public Long getShopId() {
  68 + return shopId;
  69 + }
  70 +
  71 + public void setShopId(Long shopId) {
  72 + this.shopId = shopId;
  73 + }
  74 +
  75 + public String getShopName() {
  76 + return shopName;
  77 + }
  78 +
  79 + public void setShopName(String shopName) {
  80 + this.shopName = shopName;
  81 + }
  82 +
  83 + public Integer getType() {
  84 + return type;
  85 + }
  86 +
  87 + public void setType(Integer type) {
  88 + this.type = type;
  89 + }
  90 +
  91 + public Integer getStatus() {
  92 + return status;
  93 + }
  94 +
  95 + public void setStatus(Integer status) {
  96 + this.status = status;
  97 + }
  98 +
  99 + public Integer getIsSelfShop() {
  100 + return isSelfShop;
  101 + }
  102 +
  103 + public void setIsSelfShop(Integer isSelfShop) {
  104 + this.isSelfShop = isSelfShop;
  105 + }
  106 +
  107 + public String getMainBusiness() {
  108 + return mainBusiness;
  109 + }
  110 +
  111 + public void setMainBusiness(String mainBusiness) {
  112 + this.mainBusiness = mainBusiness;
  113 + }
  114 +
  115 + public String getAddress() {
  116 + return address;
  117 + }
  118 +
  119 + public void setAddress(String address) {
  120 + this.address = address;
  121 + }
  122 +
  123 + public String getDescription() {
  124 + return description;
  125 + }
  126 +
  127 + public void setDescription(String description) {
  128 + this.description = description;
  129 + }
  130 +
  131 +}
... ...
src/main/java/com/diligrp/xtrade/product/domain/emuns/IKeyGeneratorKeys.java 0 → 100644
  1 +package com.diligrp.xtrade.product.domain.emuns;
  2 +
  3 +/**
  4 + * @ClassName: IKeyGeneratorKeys
  5 + * @Description id生成key配置
  6 + * @author yangfan
  7 + * @date 2020年4月21日
  8 + */
  9 +public enum IKeyGeneratorKeys {
  10 + SHOP_SEQUENCE,
  11 + CATEGORY_SEQUENCE
  12 +}
... ...
src/main/java/com/diligrp/xtrade/product/domain/entity/CategoryDo.java 0 → 100644
  1 +package com.diligrp.xtrade.product.domain.entity;
  2 +
  3 +import com.diligrp.xtrade.shared.domain.BaseDo;
  4 +
  5 +/**
  6 + * @ClassName: CategoryDo
  7 + * @Description 品类实体表
  8 + * @author yangfan
  9 + * @date 2020年4月16日
  10 + */
  11 +public class CategoryDo extends BaseDo{
  12 + /**
  13 + * 快捷简码
  14 + */
  15 + private String categoryId;
  16 + /**
  17 + * 品类名称
  18 + */
  19 + private String cname;
  20 + /**
  21 + * 拼音缩写
  22 + */
  23 + private String shortName;
  24 + /**
  25 + * 品类状态
  26 + */
  27 + private Integer status;
  28 + /**
  29 + * 是否有子级品类 TODO 有必要?
  30 + */
  31 + private Integer hasChild;
  32 + /**
  33 + * 图标
  34 + */
  35 + private String icon;
  36 + /**
  37 + * 图片
  38 + */
  39 + private String image;
  40 + /**
  41 + * 品类有效期
  42 + */
  43 + private Integer validDay;
  44 + /**
  45 + * 类型
  46 + */
  47 + private Long type;
  48 + /**
  49 + * 品类等级
  50 + */
  51 + private Integer level;
  52 + public String getCategoryId() {
  53 + return categoryId;
  54 + }
  55 + public void setCategoryId(String categoryId) {
  56 + this.categoryId = categoryId;
  57 + }
  58 + public String getCname() {
  59 + return cname;
  60 + }
  61 + public void setCname(String cname) {
  62 + this.cname = cname;
  63 + }
  64 + public String getShortName() {
  65 + return shortName;
  66 + }
  67 + public void setShortName(String shortName) {
  68 + this.shortName = shortName;
  69 + }
  70 + public Integer getStatus() {
  71 + return status;
  72 + }
  73 + public void setStatus(Integer status) {
  74 + this.status = status;
  75 + }
  76 + public Integer getHasChild() {
  77 + return hasChild;
  78 + }
  79 + public void setHasChild(Integer hasChild) {
  80 + this.hasChild = hasChild;
  81 + }
  82 + public String getIcon() {
  83 + return icon;
  84 + }
  85 + public void setIcon(String icon) {
  86 + this.icon = icon;
  87 + }
  88 + public String getImage() {
  89 + return image;
  90 + }
  91 + public void setImage(String image) {
  92 + this.image = image;
  93 + }
  94 + public Integer getValidDay() {
  95 + return validDay;
  96 + }
  97 + public void setValidDay(Integer validDay) {
  98 + this.validDay = validDay;
  99 + }
  100 + public Long getType() {
  101 + return type;
  102 + }
  103 + public void setType(Long type) {
  104 + this.type = type;
  105 + }
  106 + public Integer getLevel() {
  107 + return level;
  108 + }
  109 + public void setLevel(Integer level) {
  110 + this.level = level;
  111 + }
  112 +
  113 +}
... ...
src/main/java/com/diligrp/xtrade/product/domain/entity/Shop.java renamed to src/main/java/com/diligrp/xtrade/product/domain/entity/ShopDo.java
... ... @@ -6,7 +6,7 @@ package com.diligrp.xtrade.product.domain.entity;
6 6  
7 7 import com.diligrp.xtrade.shared.domain.BaseDo;
8 8  
9   -public class Shop extends BaseDo {
  9 +public class ShopDo extends BaseDo {
10 10  
11 11 //商户id
12 12 private Long merId;
... ... @@ -35,10 +35,10 @@ public class Shop extends BaseDo {
35 35 //描述
36 36 private String description;
37 37  
38   - public Shop(){
  38 + public ShopDo(){
39 39 }
40 40  
41   - public Shop(Long shopId, Integer type){
  41 + public ShopDo(Long shopId, Integer type){
42 42 this.shopId = shopId;
43 43 this.type = type;
44 44 }
... ...
src/main/java/com/diligrp/xtrade/product/service/CategoryService.java 0 → 100644
  1 +package com.diligrp.xtrade.product.service;
  2 +
  3 +import org.apache.ibatis.annotations.Insert;
  4 +
  5 +import com.diligrp.xtrade.product.domain.dto.CategoryDto;
  6 +import com.diligrp.xtrade.product.domain.entity.CategoryDo;
  7 +
  8 +
  9 +
  10 +/**
  11 + * @ClassName: CategoryService
  12 + * @Description TODO(用一句话描述该文件做什么)
  13 + * @author yangfan
  14 + * @date 2020年4月20日
  15 + */
  16 +public interface CategoryService {
  17 +
  18 + void insert(CategoryDto category);
  19 + void update(CategoryDto category);
  20 + void delectById(Long id);
  21 + CategoryDo selectEntityById(Long id);
  22 +
  23 +}
... ...
src/main/java/com/diligrp/xtrade/product/service/ShopService.java
1 1 package com.diligrp.xtrade.product.service;
2 2  
3   -public interface ShopService {
  3 +import java.util.List;
  4 +
  5 +import com.diligrp.xtrade.product.domain.dto.ShopDto;
  6 +import com.diligrp.xtrade.product.domain.entity.ShopDo;
4 7  
  8 +public interface ShopService {
  9 +
  10 + /**
  11 + * @Title insert
  12 + * @Description 保存shop
  13 + * @param shop
  14 + * @throws
  15 + */
  16 + void insert(ShopDto shop);
  17 +
  18 + /**
  19 + *
  20 + * @Title update
  21 + * @Description 修改
  22 + * @param shop
  23 + * @throws
  24 + */
  25 + void update(ShopDto shop);
  26 +
  27 + /**
  28 + *
  29 + * @Title selectByMerId
  30 + * @Description 店铺id查询
  31 + * @param merId
  32 + * @return
  33 + * @throws
  34 + */
  35 + ShopDo selectByShopId(Long shopId);
  36 +
  37 + /**
  38 + *
  39 + * @Title selectByMerId
  40 + * @Description 根据商户id获取名下全部商铺
  41 + * @param merId
  42 + * @return
  43 + * @throws
  44 + */
  45 + List<ShopDo> selectShopByMerId(Long merId);
5 46 }
... ...
src/main/java/com/diligrp/xtrade/product/service/impl/CategoryServiceImpl.java 0 → 100644
  1 +package com.diligrp.xtrade.product.service.impl;
  2 +
  3 +import org.springframework.beans.BeanUtils;
  4 +import org.springframework.beans.factory.annotation.Autowired;
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +import com.diligrp.xtrade.product.dao.CategoryDao;
  8 +import com.diligrp.xtrade.product.domain.dto.CategoryDto;
  9 +import com.diligrp.xtrade.product.domain.emuns.IKeyGeneratorKeys;
  10 +import com.diligrp.xtrade.product.domain.entity.CategoryDo;
  11 +import com.diligrp.xtrade.product.service.CategoryService;
  12 +import com.diligrp.xtrade.shared.sequence.KeyGeneratorManager;
  13 +
  14 +/**
  15 + * @ClassName: CategoryServiceImpl
  16 + * @Description TODO(用一句话描述该文件做什么)
  17 + * @author yangfan
  18 + * @date 2020年4月20日
  19 + */
  20 +@Service("categoryService")
  21 +public class CategoryServiceImpl implements CategoryService {
  22 +
  23 + @Autowired
  24 + private KeyGeneratorManager keyGeneratorManager;
  25 + @Autowired
  26 + private CategoryDao categoryDao;
  27 +
  28 + @Override
  29 + public void insert(CategoryDto category) {
  30 + CategoryDo categoryDo = new CategoryDo();
  31 + BeanUtils.copyProperties(category, categoryDo);
  32 + long id = keyGeneratorManager.getKeyGenerator(IKeyGeneratorKeys.CATEGORY_SEQUENCE).nextId();
  33 + categoryDo.setIsDel(1);
  34 + // categoryDo.setCategoryId(String.format("%s%d", category.getParentId(),id));
  35 + categoryDao.insert(categoryDo);
  36 + }
  37 +
  38 + @Override
  39 + public void update(CategoryDto category) {
  40 + CategoryDo categoryDo = new CategoryDo();
  41 + BeanUtils.copyProperties(category, categoryDo);
  42 + categoryDao.update(categoryDo);
  43 + }
  44 +
  45 + @Override
  46 + public void delectById(Long id) {
  47 + // TODO Auto-generated method stub
  48 +
  49 + }
  50 +
  51 + @Override
  52 + public CategoryDo selectEntityById(Long id) {
  53 + // TODO Auto-generated method stub
  54 + return null;
  55 + }
  56 +
  57 +}
... ...
src/main/java/com/diligrp/xtrade/product/service/impl/ShopServiceImpl.java
1 1 package com.diligrp.xtrade.product.service.impl;
2 2  
  3 +import java.util.List;
  4 +
  5 +import org.springframework.beans.BeanUtils;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +import com.diligrp.xtrade.product.dao.ShopDao;
  10 +import com.diligrp.xtrade.product.domain.dto.ShopDto;
  11 +import com.diligrp.xtrade.product.domain.emuns.IKeyGeneratorKeys;
  12 +import com.diligrp.xtrade.product.domain.entity.ShopDo;
3 13 import com.diligrp.xtrade.product.service.ShopService;
  14 +import com.diligrp.xtrade.shared.sequence.KeyGeneratorManager;
4 15  
  16 +@Service("shopService")
5 17 public class ShopServiceImpl implements ShopService {
6 18  
  19 + @Autowired
  20 + private ShopDao shopDao;
  21 + @Autowired
  22 + private KeyGeneratorManager KeyGeneratorManager;
  23 +
  24 + @Override
  25 + public void insert(ShopDto shop) {
  26 + ShopDo shopDo = new ShopDo();
  27 + Long shopId = KeyGeneratorManager.getKeyGenerator(IKeyGeneratorKeys.SHOP_SEQUENCE).nextId();
  28 + BeanUtils.copyProperties(shop, shopDo);
  29 + shopDo.setShopId(shopId);
  30 + shopDao.insert(shopDo);
  31 + }
  32 +
  33 + @Override
  34 + public void update(ShopDto shop) {
  35 + ShopDo shopDo = new ShopDo();
  36 + BeanUtils.copyProperties(shop, shopDo);
  37 + shopDao.update(shopDo);
  38 + }
  39 +
  40 + @Override
  41 + public ShopDo selectByShopId(Long shopId) {
  42 + return shopDao.selectByShopId(shopId);
  43 + }
  44 +
  45 + @Override
  46 + public List<ShopDo> selectShopByMerId(Long merId) {
  47 + List<ShopDo> shops = shopDao.selectByMerId(merId);
  48 + return shops;
  49 + }
  50 +
7 51 }
... ...
src/main/resources/mapping/com/diligrp/xtrade/product/CategoryDao.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4 +<mapper namespace="com.diligrp.xtrade.product.dao.CategoryDao">
  5 +
  6 + <!-- etrade_product 所有查询列 -->
  7 + <sql id="QUERY_COLUMN_LIST">
  8 + <![CDATA[`id`, `category_id` AS categoryId, `cname`, `short_name` AS shortName, `status`, `level`, `type`, `icon`, `image`, `valid_day` AS validDay, `created_time` AS createdTime, `modified_time` AS modifiedTime, `market_id` AS marketId]]>
  9 + </sql>
  10 + <sql id="UPDATE_COLUMN_SET">
  11 + <set>
  12 + <if test="cname != null"><![CDATA[cname = #{cname},]]></if>
  13 + <if test="categoryId != null"><![CDATA[category_id = #{categoryId},]]></if>
  14 + <if test="status != null"><![CDATA[status = #{status},]]></if>
  15 + <if test="hasChild != null"><![CDATA[has_child = #{hasChild},]]></if>
  16 + <if test="shortName != null"><![CDATA[short_name = #{shortName},]]></if>
  17 + <if test="icon != null"><![CDATA[icon = #{icon},]]></if>
  18 + <if test="cateLevel != null"><![CDATA[cate_level = #{cateLevel},]]></if>
  19 + <if test="image != null"><![CDATA[image = #{image},]]></if>
  20 + <if test="validDay != null"><![CDATA[valid_day = #{validDay},]]></if>
  21 + </set>
  22 + </sql>
  23 + <insert id="insert" parameterType="com.diligrp.xtrade.product.domain.entity.CategoryDo">
  24 + <![CDATA[
  25 + INSERT INTO `category`(`id`, `category_id`, `cname`, `short_name`, `status`, `level`, `type`, `icon`, `image`, `valid_day`, `created_time`, `modified_time`, `market_id`) VALUES
  26 + (#{id}, #{categoryId}, #{sname}, #{shortName}, #{status}, #{level}, #{type}, #{icon}, #{image}, #{validDay}, now(), now(), #{marketId});
  27 + ]]>
  28 + </insert>
  29 + <select id="selectEntityById" parameterType="long">
  30 + <![CDATA[
  31 + SELECT
  32 + ]]>
  33 + <include refid="QUERY_COLUMN_LIST"/>
  34 + <![CDATA[
  35 + FROM `category` WHERE id = #{id};
  36 + ]]>
  37 + </select>
  38 + <update id="update" parameterType="com.diligrp.xtrade.product.domain.entity.CategoryDo">
  39 + <![CDATA[
  40 + UPDATE `category` SET
  41 + ]]>
  42 + <include refid="UPDATE_COLUMN_SET"/>
  43 + <![CDATA[
  44 + modify_date = now()
  45 + WHERE id = #{id}
  46 + ]]>
  47 +
  48 + </update>
  49 + <update id="delect" parameterType="long">
  50 + <![CDATA[
  51 + UPDATE `category` SET status = 2 WHERE id = #{id};
  52 + ]]>
  53 + </update>
  54 +
  55 +
  56 +
  57 +
  58 +</mapper>
0 59 \ No newline at end of file
... ...
src/main/resources/mapping/com/diligrp/xtrade/product/ShopDao.xml
... ... @@ -2,6 +2,52 @@
2 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3 <mapper namespace="com.diligrp.xtrade.product.dao.ShopDao">
4 4  
5   -
6   -
  5 + <sql id="QUERY_COLUMN_LIST">
  6 + <![CDATA[
  7 + `id`, `shop_id` AS shopId, `shop_name` AS shopName, `address`, `mer_id` AS merId, `type`, `status`,
  8 + `main_business` AS mainBusiness, `self_shop` AS selfShop,`description`,`created_time` AS createdTime, `modified_time`AS modifiedTime
  9 + ]]>
  10 + </sql>
  11 + <sql id="UPDATE_COLUMN_SET">
  12 + <set>
  13 + <if test="shopName != null"><![CDATA[shop_name = #{shopName},]]></if>
  14 + <if test="address != null"><![CDATA[address = #{address},]]></if>
  15 + <if test="merId != null"><![CDATA[mer_id = #{merId},]]></if>
  16 + <if test="type != null"><![CDATA[type = #{type},]]></if>
  17 + <if test="status != null"><![CDATA[status = #{status},]]></if>
  18 + <if test="mainBusiness != null"><![CDATA[main_business = #{mainBusiness},]]></if>
  19 + <if test="selfShop != null"><![CDATA[self_shop = #{selfShop},]]></if>
  20 + <if test="description != null"><![CDATA[description = #{description},]]></if>
  21 + <![CDATA[modify_date = now()]]>
  22 + </set>
  23 + </sql>
  24 + <insert id="insert" parameterType="com.diligrp.xtrade.product.domain.entity.ShopDo">
  25 + <![CDATA[
  26 + INSERT INTO `xt_shop`(`id`, `shop_id`, `shop_name`, `self_shop`, `mer_id`, `main_biz`, `type`, `status`, `address`, `description`, `created_time`, `modified_time`)
  27 + VALUES (#{id}, #{shopId}, #{shopName}, #{selfShop}, #{merId}, #{mainBiz}, #{type}, #{status}, #{address}, #{description}, now(), now());
  28 + ]]>
  29 + </insert>
  30 + <select id="selectByShopId" parameterType="lang" resultType="com.diligrp.xtrade.product.domain.entity.ShopDo">
  31 + <![CDATA[
  32 + SELECT
  33 + ]]>
  34 + <include refid="QUERY_COLUMN_LIST" />
  35 + <![CDATA[
  36 + FROM `xt_shop` WHERE shop_id = #{shopId}
  37 + ]]>
  38 + </select>
  39 + <update id="update" parameterType="com.diligrp.xtrade.product.domain.entity.ShopDo">
  40 + <![CDATA[UPDATE `xt_shop`]]>
  41 + <include refid="UPDATE_COLUMN_SET" />
  42 + <![CDATA[WHERE mer_id = #{merId}]]>
  43 + </update>
  44 + <select id="selectByMerId" parameterType="lang" resultType="com.diligrp.xtrade.product.domain.dto.ShopDo">
  45 + <![CDATA[
  46 + SELECT
  47 + ]]>
  48 + <include refid="QUERY_COLUMN_LIST" />
  49 + <![CDATA[
  50 + FROM `xt_shop` WHERE mer_id = #{merId}
  51 + ]]>
  52 + </select>
7 53 </mapper>
8 54 \ No newline at end of file
... ...