基于微信小程序的超市售货管理平台的设计与实现(非常适合二次开发,创业的小伙伴,作为一个学习参考:源码+lw+部署文档+讲解)

💗博主介绍:✌全网粉丝10W+,CSDN特邀作者、博客专家、CSDN新星计划导师、全栈领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java、小程序技术领域和毕业项目实战✌💗
👇🏻 精彩专栏 推荐订阅👇🏻

🌟文末获取源码+数据库🌟
感兴趣的可以先收藏起来,还有大家在毕设选题,项目以及论文编写等相关问题都可以给我留言咨询,希望帮助更多的人

!!!有定制需要可以咨询我的微信:kotlinLiu
 

目录

摘  要

1.1 课题背景

1.2 课题意义

1.3 研究内容

3.2.1 操作流程

3.2.2 登录流程

3.2.3 删除信息流程

3.2.4 添加信息流程

4.2 功能结构设计

系统实现界面

为什么选择我

参考代码:

摘 

如今社会上各行各业,都喜欢用自己行业的专属软件工作,互联网发展到这个时候,人们已经发现离不开了互联网。新技术的产生,往往能解决一些老技术的弊端问题。因为传统超市售货管理平台信息管理难度大,容错率低,管理人员处理数据费工费时,所以专门为解决这个难题开发了一个超市售货管理平台管理系统,可以解决许多问题。

超市售货管理平台管理系统按照操作主体分为管理员和用户。管理员的功能包括购物车管理、字典管理、公告管理、供应商信息管理、会员管理、商品管理、出入库管理、出入库详情管理、商品订单管理、用户管理、管理员管理。用户的功能等。该系统采用了Mysql数据库,Java语言,Spring Boot框架等技术进行编程实现。

超市售货管理平台管理系统可以提高超市售货管理平台信息管理问题的解决效率,优化超市售货管理平台信息处理流程,保证超市售货管理平台信息数据的安全,它是一个非常可靠,非常安全的应用程序。

1.1 课题背景

二十一世纪互联网的出现,改变了几千年以来人们的生活,不仅仅是生活物资的丰富,还有精神层次的丰富。在互联网诞生之前,地域位置往往是人们思想上不可跨域的鸿沟,信息的传播速度极慢,信息处理的速度和要求还是通过人们骑马或者是信鸽传递,这些信息传递都是不可控制的,中间很有可能丢失,信息的传递水平决定了人们生活的水平。如今大家都在使用互联网软件产品,从内部管理设置计算机管理,提高内部信息化的管理水准,从外部市场也可以用计算机获取相关数据进行处理,如今各行各业已经严重依赖于计算机了。

本课题研究和开发超市售货管理平台管理系统,让安装在计算机上的该系统变成管理人员的小帮手,提高超市售货管理平台信息处理速度,规范超市售货管理平台信息处理流程,让管理人员的产出效益更高。

1.2 课题意义

传统处理数据,必须是一张张纸,然后处理完毕又是统计在一张张纸上面,不断的重复处理,最终有个结果给最高层作为参考,这个模式在互联网没有出现之前,是一种常见的事情,信息管理的效率提不上去,人多不一定力量大,因为人多肯定更加消耗资源,并且因为人类需要休息,需要管理,思想会不统一,会偷懒,所以人们研究出专门帮助人们计算的机器,就是计算机的前身,到了互联网时代,人们发现完全可以让程序供应商提供解决方案,自己挑选自己合适的方案来提高自己的产出比。所以在日常工作和生活中会发现各种各样方便人们的工具。

本课题研发的超市售货管理平台管理系统,就是提供超市售货管理平台信息处理的解决方案,它可以短时间处理完信息,并且这些信息都有专门的存储设备,而且数据的备份和迁移都可以设定为无人值守,从人力角度和信息处理角度以及信息安全角度,超市售货管理平台管理系统是完胜传统纸质操作的。

1.3 研究内容

本文对超市售货管理平台管理系统的设计与实现分成六个章节来说明。

第1章:研究超市售货管理平台管理系统的背景,以及开发超市售货管理平台管理系统的意义。

第2章:对开发超市售货管理平台管理系统的环境还有技术进行说明。

第3章:分析超市售货管理平台管理系统的可行性,性能,流程以及功能。

第4章:设计超市售货管理平台管理系统的功能结构,设计数据库E-R图以及对数据表的存储结构进行设计。

第5章:实现超市售货管理平台管理系统的功能并进行功能界面展示。

第6章:对系统测试进行阐述,以及对本系统部分功能进行检测

3.2.1 操作流程

使用者在操作超市售货管理平台管理系统中,应该按照本系统提供的操作流程(图3.1即为本系统的操作流程图)进行操作,可以减少操作失误,从而节省进入超市售货管理平台管理系统的时间。

3.2.2 登录流程

超市售货管理平台管理系统通过登录功能(图3.2即为其登录的流程)引导使用者进入指定的功能操作区,也避免非本系统的用户享受本系统提供的服务以及查看本系统提供的信息,进而保证用户安全。

图3.2 登录流程

3.2.3 删除信息流程

超市售货管理平台管理系统在经过长期使用后,会产生很多的数据信息。为了腾出存储空间存放更多的数据,本系统数据库中存储的数据,一些没有参考价值的数据需要进行删除(图3.3即为删除信息的流程),删除数据过程中,为避免误删,使用者要根据系统的提示来决定是否删除数据。

3.2.4 添加信息流程

超市售货管理平台管理系统提供可视化的功能操作区,非常方便使用者进行数据操作,当使用者往系统中录入数据时(图3.4即为添加信息的流程),本系统也会进行数据合法性的判断,符合要求的数据才能够在数据库指定表中进行登记。

4.2 功能结构设计

图4.1即为设计的管理员功能结构,管理员权限操作的功能包括管理公告,管理超市售货管理平台信息,包括商品管理,培训管理,出入库管理,薪资管理等,可以管理公告。

系统实现界面

为什么选择我

在B站持续讲解自己的项目,辅导过多名的计算机毕业设计优秀学生,用最实惠的价格做最好的毕业设计!!

参考代码:

       

package com.dao;

import com.entity.GonggaoEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;

import org.apache.ibatis.annotations.Param;
import com.entity.view.GonggaoView;

/**
 * 公告 Dao 接口
 *
 * @author 
 */
public interface GonggaoDao extends BaseMapper<GonggaoEntity> {

   List<GonggaoView> selectListView(Pagination page,@Param("params")Map<String,Object> params);

}


package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 出入库
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/shangpinChuruInout")
public class ShangpinChuruInoutController {
    private static final Logger logger = LoggerFactory.getLogger(ShangpinChuruInoutController.class);

    private static final String TABLE_NAME = "shangpinChuruInout";

    @Autowired
    private ShangpinChuruInoutService shangpinChuruInoutService;


    @Autowired
    private TokenService tokenService;

    @Autowired
    private CartService cartService;//购物车
    @Autowired
    private DictionaryService dictionaryService;//字典
    @Autowired
    private GonggaoService gonggaoService;//公告
    @Autowired
    private GongyingshangService gongyingshangService;//供应商信息
    @Autowired
    private HuiyuanService huiyuanService;//会员
    @Autowired
    private ShangpinService shangpinService;//商品
    @Autowired
    private ShangpinChuruInoutListService shangpinChuruInoutListService;//出入库详情
    @Autowired
    private ShangpinOrderService shangpinOrderService;//商品订单
    @Autowired
    private YonghuService yonghuService;//用户
    @Autowired
    private UsersService usersService;//管理员


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永不会进入");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        CommonUtil.checkMap(params);
        PageUtils page = shangpinChuruInoutService.queryPage(params);

        //字典表数据转换
        List<ShangpinChuruInoutView> list =(List<ShangpinChuruInoutView>)page.getList();
        for(ShangpinChuruInoutView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        ShangpinChuruInoutEntity shangpinChuruInout = shangpinChuruInoutService.selectById(id);
        if(shangpinChuruInout !=null){
            //entity转view
            ShangpinChuruInoutView view = new ShangpinChuruInoutView();
            BeanUtils.copyProperties( shangpinChuruInout , view );//把实体数据重构到view中
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody ShangpinChuruInoutEntity shangpinChuruInout, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,shangpinChuruInout:{}",this.getClass().getName(),shangpinChuruInout.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");

        Wrapper<ShangpinChuruInoutEntity> queryWrapper = new EntityWrapper<ShangpinChuruInoutEntity>()
            .eq("shangpin_churu_inout_name", shangpinChuruInout.getShangpinChuruInoutName())
            .eq("shangpin_churu_inout_types", shangpinChuruInout.getShangpinChuruInoutTypes())
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ShangpinChuruInoutEntity shangpinChuruInoutEntity = shangpinChuruInoutService.selectOne(queryWrapper);
        if(shangpinChuruInoutEntity==null){
            shangpinChuruInout.setInsertTime(new Date());
            shangpinChuruInout.setCreateTime(new Date());
            shangpinChuruInoutService.insert(shangpinChuruInout);
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody ShangpinChuruInoutEntity shangpinChuruInout, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
        logger.debug("update方法:,,Controller:{},,shangpinChuruInout:{}",this.getClass().getName(),shangpinChuruInout.toString());
        ShangpinChuruInoutEntity oldShangpinChuruInoutEntity = shangpinChuruInoutService.selectById(shangpinChuruInout.getId());//查询原先数据

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
        if("".equals(shangpinChuruInout.getShangpinChuruInoutContent()) || "null".equals(shangpinChuruInout.getShangpinChuruInoutContent())){
                shangpinChuruInout.setShangpinChuruInoutContent(null);
        }

            shangpinChuruInoutService.updateById(shangpinChuruInout);//根据id更新
            return R.ok();
    }


    /**
    * 出库
    */
    @RequestMapping("/outShangpinChuruInoutList")
    public R outShangpinChuruInoutList(@RequestBody  Map<String, Object> params,HttpServletRequest request){
        logger.debug("outShangpinChuruInoutList方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        String role = String.valueOf(request.getSession().getAttribute("role"));

        //取出入库名称并判断是否存在
        String shangpinChuruInoutName = String.valueOf(params.get("shangpinChuruInoutName"));
        Wrapper<ShangpinChuruInoutEntity> queryWrapper = new EntityWrapper<ShangpinChuruInoutEntity>()
            .eq("shangpin_churu_inout_name", shangpinChuruInoutName)
            ;
        ShangpinChuruInoutEntity shangpinChuruInoutSelectOne = shangpinChuruInoutService.selectOne(queryWrapper);
        if(shangpinChuruInoutSelectOne != null)
            return R.error(511,"出入库名称已被使用");



        Map<String, Integer> map = (Map<String, Integer>) params.get("map");
        if(map == null || map.size() == 0)
            return R.error(511,"列表内容不能为空");


        Set<String> ids = map.keySet();

        List<ShangpinEntity> shangpinList = shangpinService.selectBatchIds(ids);
        if(shangpinList == null || shangpinList.size() == 0){
            return R.error(511,"查数据库查不到数据");
        }else{
            for(ShangpinEntity w:shangpinList){
                Integer value = w.getShangpinKucunNumber()-map.get(String.valueOf(w.getId()));
                if(value <0){
                    return R.error(511,"出库数量大于库存数量");
                }
                w.setShangpinKucunNumber(value);
            }
        }

        //当前表
        ShangpinChuruInoutEntity shangpinChuruInoutEntity = new ShangpinChuruInoutEntity<>();
            shangpinChuruInoutEntity.setShangpinChuruInoutUuidNumber(String.valueOf(new Date().getTime()));
            shangpinChuruInoutEntity.setShangpinChuruInoutName(shangpinChuruInoutName);
            shangpinChuruInoutEntity.setShangpinChuruInoutTypes(1);
            shangpinChuruInoutEntity.setShangpinChuruInoutContent("");
            shangpinChuruInoutEntity.setInsertTime(new Date());
            shangpinChuruInoutEntity.setCreateTime(new Date());

        boolean insertShangpinChuruInout = shangpinChuruInoutService.insert(shangpinChuruInoutEntity);
        //list表
        ArrayList<ShangpinChuruInoutListEntity> shangpinChuruInoutLists = new ArrayList<>();
        if(insertShangpinChuruInout){
            for(String id:ids){
                ShangpinChuruInoutListEntity shangpinChuruInoutListEntity = new ShangpinChuruInoutListEntity();
                    shangpinChuruInoutListEntity.setShangpinChuruInoutId(shangpinChuruInoutEntity.getId());
                    shangpinChuruInoutListEntity.setShangpinId(Integer.valueOf(id));
                    shangpinChuruInoutListEntity.setShangpinChuruInoutListNumber(map.get(id));
                    shangpinChuruInoutListEntity.setInsertTime(new Date());
                    shangpinChuruInoutListEntity.setCreateTime(new Date());
                shangpinChuruInoutLists.add(shangpinChuruInoutListEntity);
                shangpinService.updateBatchById(shangpinList);
            }
            shangpinChuruInoutListService.insertBatch(shangpinChuruInoutLists);
        }

        return R.ok();
    }

    /**
    *入库
    */
    @RequestMapping("/inShangpinChuruInoutList")
    public R inShangpinChuruInoutList(@RequestBody  Map<String, Object> params,HttpServletRequest request){
        logger.debug("inShangpinChuruInoutList方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        //params:{"map":{"1":2,"2":3},"wuziOutinName":"订单1"}

        String role = String.valueOf(request.getSession().getAttribute("role"));

        //取当前表名称并判断
        String shangpinChuruInoutName = String.valueOf(params.get("shangpinChuruInoutName"));
        Wrapper<ShangpinChuruInoutEntity> queryWrapper = new EntityWrapper<ShangpinChuruInoutEntity>()
            .eq("shangpin_churu_inout_name", shangpinChuruInoutName)
            ;
        ShangpinChuruInoutEntity shangpinChuruInoutSelectOne = shangpinChuruInoutService.selectOne(queryWrapper);
        if(shangpinChuruInoutSelectOne != null)
            return R.error(511,"出入库名称已被使用");


        Map<String, Integer> map = (Map<String, Integer>) params.get("map");
        if(map == null || map.size() == 0)
            return R.error(511,"列表内容不能为空");

        Set<String> ids = map.keySet();

        List<ShangpinEntity> shangpinList = shangpinService.selectBatchIds(ids);
        if(shangpinList == null || shangpinList.size() == 0){
            return R.error(511,"查数据库查不到数据");
        }else{
            for(ShangpinEntity w:shangpinList){
                w.setShangpinKucunNumber(w.getShangpinKucunNumber()+map.get(String.valueOf(w.getId())));
            }
        }

        //当前表
        ShangpinChuruInoutEntity shangpinChuruInoutEntity = new ShangpinChuruInoutEntity<>();
            shangpinChuruInoutEntity.setShangpinChuruInoutUuidNumber(String.valueOf(new Date().getTime()));
            shangpinChuruInoutEntity.setShangpinChuruInoutName(shangpinChuruInoutName);
            shangpinChuruInoutEntity.setShangpinChuruInoutTypes(2);
            shangpinChuruInoutEntity.setShangpinChuruInoutContent("");
            shangpinChuruInoutEntity.setInsertTime(new Date());
            shangpinChuruInoutEntity.setCreateTime(new Date());


        boolean insertShangpinChuruInout = shangpinChuruInoutService.insert(shangpinChuruInoutEntity);
        //list表
        ArrayList<ShangpinChuruInoutListEntity> shangpinChuruInoutLists = new ArrayList<>();
        if(insertShangpinChuruInout){
            for(String id:ids){
                ShangpinChuruInoutListEntity shangpinChuruInoutListEntity = new ShangpinChuruInoutListEntity();
                shangpinChuruInoutListEntity.setShangpinChuruInoutId(shangpinChuruInoutEntity.getId());
                shangpinChuruInoutListEntity.setShangpinId(Integer.valueOf(id));
                shangpinChuruInoutListEntity.setShangpinChuruInoutListNumber(map.get(id));
                shangpinChuruInoutListEntity.setInsertTime(new Date());
                shangpinChuruInoutListEntity.setCreateTime(new Date());
                shangpinChuruInoutLists.add(shangpinChuruInoutListEntity);
                shangpinService.updateBatchById(shangpinList);
            }
            shangpinChuruInoutListService.insertBatch(shangpinChuruInoutLists);
        }

        return R.ok();
    }
    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        List<ShangpinChuruInoutEntity> oldShangpinChuruInoutList =shangpinChuruInoutService.selectBatchIds(Arrays.asList(ids));//要删除的数据
        shangpinChuruInoutService.deleteBatchIds(Arrays.asList(ids));
        shangpinChuruInoutListService.delete(new EntityWrapper<ShangpinChuruInoutListEntity>().in("shangpin_churu_inout_id",ids));

        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName, HttpServletRequest request){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        //.eq("time", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))
        try {
            List<ShangpinChuruInoutEntity> shangpinChuruInoutList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            ShangpinChuruInoutEntity shangpinChuruInoutEntity = new ShangpinChuruInoutEntity();
//                            shangpinChuruInoutEntity.setShangpinChuruInoutUuidNumber(data.get(0));                    //出入库流水号 要改的
//                            shangpinChuruInoutEntity.setShangpinChuruInoutName(data.get(0));                    //出入库名称 要改的
//                            shangpinChuruInoutEntity.setShangpinChuruInoutTypes(Integer.valueOf(data.get(0)));   //出入库类型 要改的
//                            shangpinChuruInoutEntity.setShangpinChuruInoutContent("");//详情和图片
//                            shangpinChuruInoutEntity.setInsertTime(date);//时间
//                            shangpinChuruInoutEntity.setCreateTime(date);//时间
                            shangpinChuruInoutList.add(shangpinChuruInoutEntity);


                            //把要查询是否重复的字段放入map中
                                //出入库流水号
                                if(seachFields.containsKey("shangpinChuruInoutUuidNumber")){
                                    List<String> shangpinChuruInoutUuidNumber = seachFields.get("shangpinChuruInoutUuidNumber");
                                    shangpinChuruInoutUuidNumber.add(data.get(0));//要改的
                                }else{
                                    List<String> shangpinChuruInoutUuidNumber = new ArrayList<>();
                                    shangpinChuruInoutUuidNumber.add(data.get(0));//要改的
                                    seachFields.put("shangpinChuruInoutUuidNumber",shangpinChuruInoutUuidNumber);
                                }
                        }

                        //查询是否重复
                         //出入库流水号
                        List<ShangpinChuruInoutEntity> shangpinChuruInoutEntities_shangpinChuruInoutUuidNumber = shangpinChuruInoutService.selectList(new EntityWrapper<ShangpinChuruInoutEntity>().in("shangpin_churu_inout_uuid_number", seachFields.get("shangpinChuruInoutUuidNumber")));
                        if(shangpinChuruInoutEntities_shangpinChuruInoutUuidNumber.size() >0 ){
                            ArrayList<String> repeatFields = new ArrayList<>();
                            for(ShangpinChuruInoutEntity s:shangpinChuruInoutEntities_shangpinChuruInoutUuidNumber){
                                repeatFields.add(s.getShangpinChuruInoutUuidNumber());
                            }
                            return R.error(511,"数据库的该表中的 [出入库流水号] 字段已经存在 存在数据为:"+repeatFields.toString());
                        }
                        shangpinChuruInoutService.insertBatch(shangpinChuruInoutList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }




    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        CommonUtil.checkMap(params);
        PageUtils page = shangpinChuruInoutService.queryPage(params);

        //字典表数据转换
        List<ShangpinChuruInoutView> list =(List<ShangpinChuruInoutView>)page.getList();
        for(ShangpinChuruInoutView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段

        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Integer id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        ShangpinChuruInoutEntity shangpinChuruInout = shangpinChuruInoutService.selectById(id);
            if(shangpinChuruInout !=null){


                //entity转view
                ShangpinChuruInoutView view = new ShangpinChuruInoutView();
                BeanUtils.copyProperties( shangpinChuruInout , view );//把实体数据重构到view中

                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody ShangpinChuruInoutEntity shangpinChuruInout, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,shangpinChuruInout:{}",this.getClass().getName(),shangpinChuruInout.toString());
        Wrapper<ShangpinChuruInoutEntity> queryWrapper = new EntityWrapper<ShangpinChuruInoutEntity>()
            .eq("shangpin_churu_inout_uuid_number", shangpinChuruInout.getShangpinChuruInoutUuidNumber())
            .eq("shangpin_churu_inout_name", shangpinChuruInout.getShangpinChuruInoutName())
            .eq("shangpin_churu_inout_types", shangpinChuruInout.getShangpinChuruInoutTypes())
//            .notIn("shangpin_churu_inout_types", new Integer[]{102})
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        ShangpinChuruInoutEntity shangpinChuruInoutEntity = shangpinChuruInoutService.selectOne(queryWrapper);
        if(shangpinChuruInoutEntity==null){
            shangpinChuruInout.setInsertTime(new Date());
            shangpinChuruInout.setCreateTime(new Date());
        shangpinChuruInoutService.insert(shangpinChuruInout);

            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

}

  • 27
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序员阿龙

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值