菜单 子集

存酒
购买须知
团购商品
用户列表
This commit is contained in:
2024-05-29 15:24:50 +08:00
parent 44509e1d32
commit b31148da52
33 changed files with 457 additions and 172 deletions

View File

@@ -0,0 +1,61 @@
package cn.ysk.cashier.mybatis.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import java.io.Serializable;
@SuppressWarnings("serial")
public class TagProductDepts extends Model<TagProductDepts> {
//标签id
private Integer tagId;
//商品id
private Integer productId;
//创建时间
private Date createTime=new Date();
public TagProductDepts() {
}
public TagProductDepts(Integer tagId, Integer productId) {
this.tagId = tagId;
this.productId = productId;
}
public TagProductDepts(Integer tagId, Integer productId, Date createTime) {
this.tagId = tagId;
this.productId = productId;
this.createTime = createTime;
}
public Integer getTagId() {
return tagId;
}
public void setTagId(Integer tagId) {
this.tagId = tagId;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

View File

@@ -0,0 +1,33 @@
package cn.ysk.cashier.mybatis.mapper;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.vo.ShopUserInfoVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Select;
public interface ShopUserMapper extends BaseMapper<TbShopUser> {
@Select("<script>" +
"SELECT su.id as id, u.head_img as headImg, u.nick_name as nickName, u.sex as sex, " +
"su.amount as amount, u.total_score as totalScore, u.telephone as telephone, " +
"u.birth_day as birthDay, su.is_vip as isVip, su.created_at as createAt, u.last_log_in_at as lastLoginAt " +
"FROM tb_shop_user su " +
"LEFT JOIN tb_user_info u ON su.user_id = u.id " +
"<where>" +
"<if test='param.shopId != null and param.shopId != &quot;&quot; and param.shopId != 1'>" +
"su.shop_id = #{param.shopId} " +
"</if>" +
"<if test='param.name != null and param.name != &quot;&quot;'>" +
"AND (u.nick_name like concat('%', #{param.name}, '%') or u.telephone like concat('%', #{param.name}, '%'))" +
"</if>" +
"<if test='param.isVip != null and param.isVip != &quot;&quot;'>" +
"AND su.is_vip=#{param.isVip}" +
"</if>" +
"</where>" +
"</script>")
IPage<ShopUserInfoVo> queryUser(TbShopUserQueryCriteria param, Page pageInfo);
}

View File

@@ -0,0 +1,23 @@
package cn.ysk.cashier.mybatis.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.ysk.cashier.mybatis.entity.TagProductDepts;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* (TagProductDepts)表数据库访问层
*
* @author ww
* @since 2024-05-23 14:21:29
*/
public interface TagProductDeptsMapper extends BaseMapper<TagProductDepts> {
@Delete("delete FROM tag_product_depts WHERE product_id = #{productId}")
int delByProductIdAfter(Integer productId);
@Select("SELECT * FROM tag_product_depts WHERE product_id = #{productId}")
List<TagProductDepts> queryAllByProductId(Integer productId);
}

View File

@@ -0,0 +1,8 @@
package cn.ysk.cashier.mybatis.mapper;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface TbShopUserMapper extends BaseMapper<TbShopUser> {
}

View File

@@ -20,24 +20,7 @@ import org.springframework.web.bind.annotation.*;
public class StorageController {
@Autowired
private ShopService shopService;
@PostMapping("/findStorage")
public ResponseEntity<Object> findStorage(@RequestParam Integer shopId,String account,Pageable pageable){
return new ResponseEntity<>(shopService.findStorage(shopId,account,pageable), HttpStatus.OK);
}
@PostMapping("/outStorage")
@Log("商品出库")
public ResponseEntity<Object> outStorage(@RequestParam Integer id,@RequestParam Integer num){
String userName = SecurityUtils.getCurrentUsername();
shopService.outStorage(id,userName,num);
return new ResponseEntity<>( HttpStatus.OK);
}
@PostMapping("/inStorage")
@Log("商品入库")
public ResponseEntity<Object> inStorage(@RequestBody StorageVo storageVo){
String userName = SecurityUtils.getCurrentUsername();
shopService.inStorage(storageVo,userName);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/findActivate")
public ResponseEntity<Object> findActivate(@RequestParam String shopId){
String userName = SecurityUtils.getCurrentUsername();

View File

@@ -0,0 +1,21 @@
package cn.ysk.cashier.mybatis.service;
import cn.ysk.cashier.mybatis.entity.TagProductDepts;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* (TagProductDepts)表服务接口
*
* @author ww
* @since 2024-05-23 14:21:29
*/
public interface TagProductDeptsService extends IService<TagProductDepts> {
void setTag(Integer tagId,Integer productId);
List<TagProductDepts> queryAllByProductId(Integer productId);
}

View File

@@ -0,0 +1,37 @@
package cn.ysk.cashier.mybatis.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ysk.cashier.mybatis.mapper.TagProductDeptsMapper;
import cn.ysk.cashier.mybatis.entity.TagProductDepts;
import cn.ysk.cashier.mybatis.service.TagProductDeptsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* (TagProductDepts)表服务实现类
*
* @author ww
* @since 2024-05-23 14:21:29
*/
@Service
public class TagProductDeptsServiceImpl extends ServiceImpl<TagProductDeptsMapper, TagProductDepts> implements TagProductDeptsService {
@Autowired
private TagProductDeptsMapper productDeptsMapper;
@Override
public void setTag(Integer tagId,Integer productId) {
productDeptsMapper.delByProductIdAfter(productId);
TagProductDepts tagProduct=new TagProductDepts(tagId,productId);
productDeptsMapper.insert(tagProduct);
}
@Override
public List<TagProductDepts> queryAllByProductId(Integer productId){
// productDeptsMapper.select
return productDeptsMapper.queryAllByProductId(productId);
}
}