current position:Home>Java project: drug management system (java + springboot + HTML + layui + bootstrap + seals + MySQL)

Java project: drug management system (java + springboot + HTML + layui + bootstrap + seals + MySQL)

2022-04-29 16:40:33OldWinePot

The source code for : Blog's front page " resources " Download !

Project introduction

This project belongs to the project with front and rear ends separated , It is divided into two roles: drug administrator and personnel of drug taking office
Drug Administrator :
Sign in 、 sign out 、 Drug information entry 、 Pharmaceutical information entry 、 Purchaser information entry 、 Drug information browsing 、 Pharmaceutical information browsing 、 Purchasing personnel information browsing 、 Drug information query, warehousing, modification and deletion 、 Modification and deletion of pharmaceutical factory information warehousing 、 Modification and deletion of purchaser information warehousing 、 Browse warehousing records 、 Browse the delivery record 、 System help

Personnel of drug taking department :

Sign in 、 sign out 、 Drug information browsing 、 Pharmaceutical information browsing 、 Buyer information browsing 、 Drug information query 、 Browse the delivery record 、 System help

Environmental needs

1. Running environment : It is best to java jdk 1.8, We run on this platform . Other versions can, in theory .
2.IDE Environmental Science :IDEA,Eclipse,Myeclipse Fine . recommend IDEA;
3.tomcat Environmental Science :Tomcat 7.x,8.x,9.x All versions are available
4. Hardware environment :windows 7/8/10 1G Above memory ; perhaps Mac OS;
5. database :MySql 5.7 edition ;

6. whether Maven project : yes

Technology stack

1. Back end :SpringBoot

2. front end :html+layui+jquery+bootstrap+echarts

Instructions

1. Use Navicat Or other tools , stay mysql Create a database with the corresponding name in , And import the sql file ;
2. Use IDEA/Eclipse/MyEclipse Import the project ,Eclipse/MyEclipse Import time , if maven Item, please select maven;
if maven project , After importing successfully, please execute maven clean;maven install command , And then run ;
3. In the project application.yml Change the database configuration in the configuration file to your own configuration ;
4. Run the project , Back end input localhost:8081/

 

 

 

 

 

 

User related controller Control layer :

/**
 *  User related controller
 */
@Controller
public class UserController {

    /**
     *  Go to the login page 
     */
    @RequestMapping(value = "/login")
    public String login(){
        return "/login";
    }

    /**
     *  Judge whether the user login is successful 
     */
    @RequestMapping(value = "/toLogin")
    @ResponseBody
    public Object toLogin(String username,String password){
        if(username==null||password==null){
            return ResultMapUtil.getHashMapLogin(" User name and password cannot be empty ","2");
        }
        Subject subject = SecurityUtils.getSubject();
        UsernamePasswordToken token = new UsernamePasswordToken(username,password);
        try{
            subject.login(token);
        }catch (UnknownAccountException e){
            return ResultMapUtil.getHashMapLogin(" The username does not exist ","2");
        }catch (IncorrectCredentialsException e){
            return ResultMapUtil.getHashMapLogin(" Wrong password ","2");
        }
        return ResultMapUtil.getHashMapLogin(" Verify success ","1");
    }

    /**
     *  Turn to the background management homepage 
     */
    @RequestMapping(value = "/index")
    public String index(){
        return "/index";
    }

    /**
     *  Log out 
     */
    @RequestMapping(value = "/logout")
    public String logout(){
        Subject subject = SecurityUtils.getSubject();
        subject.logout();
        return "redirect:/login";
    }

}

Drug related controller:

/**
 *  Drug related controller
 */
@Controller
@RequestMapping(value = "/druginfo")
public class DruginfoController {

    @Autowired
    private IDruginfoService druginfoService;

    /**
     *  Go to the drugs page 
     */
    @RequestMapping
    public String druginfo(){
        return "/druginfo";
    }

    /**
     *  Query the drug list by page 
     */
    @RequestMapping(value = "/druginfoQueryPage")
    @ResponseBody
    public Object druginfoQueryPage(String param, @RequestParam(defaultValue = "1")int pageNum,@RequestParam(defaultValue = "10")int pageSize){
        try{
            IPage<Druginfo> iPage = druginfoService.selectDruginfoPage(pageNum,pageSize,param);
            return ResultMapUtil.getHashMapMysqlPage(iPage);
        } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
        }
    }

    /**
     *  Turn to the new drug page 
     */
    @RequestMapping(value = "/druginfoPage")
    public String druginfoPage(){
        return "/druginfoPage";
    }

    /**
     *  Add a medicine 
     */
    @RequestMapping(value = "/druginfoAdd")
    @ResponseBody
    public Object druginfoAdd(Druginfo druginfo){
        try{
            int i = druginfoService.addDruginfo(druginfo);
            return ResultMapUtil.getHashMapSave(i);
        } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
        }
    }

    /**
     *  Turn to the drug editing page 
     */
    @RequestMapping(value = "/druginfoQueryById")
    public String druginfoQueryById(@RequestParam(name = "id",required = true)Integer id, Model model){
        Druginfo druginfo = druginfoService.queryDruginfoById(id);
        model.addAttribute("obj",druginfo);
        return "/druginfoPage";
    }

    /**
     *  Modify a drug 
     */
    @RequestMapping(value = "/druginfoEdit")
    @ResponseBody
    public Object druginfoEdit(Druginfo druginfo){
        try{
            int i = druginfoService.editDruginfo(druginfo);
            return ResultMapUtil.getHashMapSave(i);
        } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
        }
    }

    /**
     *  Delete a drug 
     */
    @RequestMapping(value = "/druginfoDelById")
    @ResponseBody
    public Object druginfoDelById(Integer id){
        try{
            int i = druginfoService.delDruginfoById(id);
            return ResultMapUtil.getHashMapDel(i);
        } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
        }
    }

    /**
     *  Get all medicines 
     */
    @RequestMapping(value = "/druginfoList")
    @ResponseBody
    public Object druginfoList(){
        List<Druginfo> druginfoList = druginfoService.queryDruginfoList();
        return ResultMapUtil.getHashMapList(druginfoList);
    }

    /**
     *  Turn to the drug shelf life inspection page 
     */
    @RequestMapping(value = "/warranty")
    public String warranty(){
        return "/warranty";
    }
}

Supplier related controller: 

/**
 *  Supplier related controller
 */
@Controller
@RequestMapping(value = "/supplier")
public class SupplierController {

    @Autowired
    private ISupplierService supplierService;

    /**
     *  Go to the supplier page 
     */
    @RequestMapping
    public String supplier(){
        return "/supplier";
    }

    /**
     *  Query the supplier list by page 
     */
    @RequestMapping(value = "/supplierQueryPage")
    @ResponseBody
    public Object supplierQueryPage(String param, @RequestParam(defaultValue = "1")int pageNum,@RequestParam(defaultValue = "10")int pageSize){
        try{
            IPage<Supplier> iPage = supplierService.selectSupplierPage(pageNum,pageSize,param);
            return ResultMapUtil.getHashMapMysqlPage(iPage);
        } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
        }
    }

    /**
     *  Turn to the new supplier page 
     */
    @RequestMapping(value = "/supplierPage")
    public String supplierPage(){
        return "/supplierPage";
    }

    /**
     *  Add a supplier 
     */
    @RequestMapping(value = "/supplierAdd")
    @ResponseBody
    public Object supplierAdd(Supplier supplier){
        try{
            supplier.setCreatetime(new Date());
            int i = supplierService.addSupplier(supplier);
            return ResultMapUtil.getHashMapSave(i);
        } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
        }
    }

    /**
     *  Turn to the supplier edit page 
     */
    @RequestMapping(value = "/supplierQueryById")
    public String supplierQueryById(@RequestParam(name = "id",required = true)Integer id, Model model){
        Supplier supplier = supplierService.querySupplierById(id);
        model.addAttribute("obj",supplier);
        return "/supplierPage";
    }

    /**
     *  Modify a supplier 
     */
    @RequestMapping(value = "/supplierEdit")
    @ResponseBody
    public Object supplierEdit(Supplier supplier){
        try{
            int i = supplierService.editSupplier(supplier);
            return ResultMapUtil.getHashMapSave(i);
        } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
        }
    }

    /**
     *  Delete a supplier 
     */
    @RequestMapping(value = "/supplierDelById")
    @ResponseBody
    public Object supplierDelById(Integer id){
        try{
            int i = supplierService.delSupplierById(id);
            return ResultMapUtil.getHashMapDel(i);
        } catch (Exception e){
            return ResultMapUtil.getHashMapException(e);
        }
    }

    /**
     *  Get all suppliers 
     */
    @RequestMapping(value = "/supplierList")
    @ResponseBody
    public Object supplierList(){
        List<Supplier> supplierList = supplierService.querySupplierList();
        return ResultMapUtil.getHashMapList(supplierList);
    }

}

The source code for : Blog's front page " resources " Download ! 

copyright notice
author[OldWinePot],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/119/202204291448261731.html

Random recommended