Source code and papers based on ssm electronic photo album system

Based on ssm electronic photo album system source code and paper 146


 Development tools: idea or eclipse
 database mysql5.7+
 database link tools: navcat, little dolphin and other
  technologies: ssm 

Summary

The fast-paced development of the modern economy and the constantly improving and upgrading of information technology have upgraded traditional data information management to software storage, summary, and centralized processing of data information management methods. This electronic photo album system was born in such an environment. It can help managers process huge data information in a short time. Using this software tool can help managers improve transaction processing efficiency and achieve twice the result with half the effort. This electronic photo album system uses the current mature and complete SSM framework, uses the cross-platform Java language that can develop large-scale commercial websites, and the Mysql database, one of the most popular RDBMS application software, for program development. The development of the electronic photo album system is based on the operator The interface needs to be designed to be simple and beautiful, and to be consistent with websites of the same type in terms of functional module layout. When the program realizes the basic required functions, it also provides some practical solutions to the security issues faced by data information. It can be said that this program not only helps managers handle work affairs efficiently, but also realizes the integration, standardization and automation of data information.

Keywords : electronic photo album system; SSM framework; Mysql; automation


Abstract

The fast-paced development of the modern economy and the continuous improvement and upgrading of information technology have allowed the management of traditional data information to be upgraded to software storage, induction, and centralized management of data information. This book lending system was born in such a large environment, which can help managers to process huge data information in a short time. Using this software tool can help managers improve transaction processing efficiency and achieve double the result with half the effort. This book lending system uses the current mature and perfect SSM framework, cross-platform Java language that can be used to develop large-scale commercial websites, and Mysql database, one of the most popular RDBMS application software, for program development. It realizes the functions of book basic data management, book borrowing and return, review of registered teacher information, and announcement information release. The development of the book lending system is designed to be simple and beautiful according to the needs of the operator. The layout of the function module is consistent with the same type of website. When the program realizes the basic requirements, it also provides some practical solutions for the security problems faced by the data information. . It can be said that this program not only helps managers efficiently handle work affairs, but also realizes the integration, standardization and automation of data information.

Key WordsBook borrowing system; SSM framework; Mysql; automation

package com.controller;


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.StringUtil;
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.XiangpianEntity;

import com.service.XiangpianService;
import com.entity.view.XiangpianView;
import com.service.XiangcheService;
import com.entity.XiangcheEntity;
import com.utils.PageUtils;
import com.utils.R;

/**
 * 相片信息
 * 后端接口
 * @author
 * @email
 * @date 2021-03-31
*/
@RestController
@Controller
@RequestMapping("/xiangpian")
public class XiangpianController {
    private static final Logger logger = LoggerFactory.getLogger(XiangpianController.class);

    @Autowired
    private XiangpianService xiangpianService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;


    //级联表service
    @Autowired
    private XiangcheService xiangcheService;

    /**
     * 后端列表
     */
    @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(StringUtil.isNotEmpty(role) && "用户".equals(role)){
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        }
        PageUtils page = xiangpianService.queryPage(params);

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

    /**
     * 后端列表
     */
    @RequestMapping("/list")
    public R list(@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"));
        PageUtils page = xiangpianService.queryPage(params);
        //字典表数据转换
        List<XiangpianView> list =(List<XiangpianView>)page.getList();
        for(XiangpianView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        XiangpianEntity xiangpian = xiangpianService.selectById(id);
        if(xiangpian !=null){
            //entity转view
            XiangpianView view = new XiangpianView();
            BeanUtils.copyProperties( xiangpian , view );//把实体数据重构到view中

            //级联表
            XiangcheEntity xiangche = xiangcheService.selectById(xiangpian.getXiangcheId());
            if(xiangche != null){
                BeanUtils.copyProperties( xiangche , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                view.setXiangcheId(xiangche.getId());
            }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody XiangpianEntity xiangpian, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,xiangpian:{}",this.getClass().getName(),xiangpian.toString());
        Wrapper<XiangpianEntity> queryWrapper = new EntityWrapper<XiangpianEntity>()
            .eq("xiangche_id", xiangpian.getXiangcheId())
            .eq("xpname", xiangpian.getXpname())
            .eq("paishedidian", xiangpian.getPaishedidian())
            .eq("paisheren", xiangpian.getPaisheren())
            .eq("fenlei_types", xiangpian.getFenleiTypes())
            .eq("xiangpian_content", xiangpian.getXiangpianContent())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        XiangpianEntity xiangpianEntity = xiangpianService.selectOne(queryWrapper);
        if(xiangpianEntity==null){
            boolean insert = xiangpianService.insert(xiangpian);
            if(insert){
                XiangcheEntity xiangche = xiangcheService.selectById(xiangpian.getXiangcheId());
                xiangche.setNumber(xiangche.getNumber()+1);
                xiangcheService.updateById(xiangche);
            }
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody XiangpianEntity xiangpian, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,xiangpian:{}",this.getClass().getName(),xiangpian.toString());
        //根据字段查询是否有相同数据
        Wrapper<XiangpianEntity> queryWrapper = new EntityWrapper<XiangpianEntity>()
            .notIn("id",xiangpian.getId())
            .andNew()
            .eq("xiangche_id", xiangpian.getXiangcheId())
            .eq("xpname", xiangpian.getXpname())
            .eq("paishedidian", xiangpian.getPaishedidian())
            .eq("paisheren", xiangpian.getPaisheren())
            .eq("fenlei_types", xiangpian.getFenleiTypes())
            .eq("xiangpian_content", xiangpian.getXiangpianContent())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        XiangpianEntity xiangpianEntity = xiangpianService.selectOne(queryWrapper);
        if("".equals(xiangpian.getXpimgPhoto()) || "null".equals(xiangpian.getXpimgPhoto())){
                xiangpian.setXpimgPhoto(null);
        }
        if(xiangpianEntity==null){
            //  String role = String.valueOf(request.getSession().getAttribute("role"));
            //  if("".equals(role)){
            //      xiangpian.set
            //  }
            xiangpianService.updateById(xiangpian);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }


    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        xiangpianService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }


}

 

package com.controller;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;

import com.entity.NewsEntity;
import com.entity.view.NewsView;

import com.service.NewsService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.CommonUtil;


/**
 * 新闻资讯
 * 后端接口
 * @author 
 * @email 
 * @date 2020-12-24 11:35:16
 */
@RestController
@RequestMapping("/news")
public class NewsController {
    @Autowired
    private NewsService newsService;
    


    /**
     * 后端列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,NewsEntity news, HttpServletRequest request){

        EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>();
    	PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params));
		request.setAttribute("data", page);
        return R.ok().put("data", page);
    }
    
    /**
     * 前端列表
     */
	@IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params,NewsEntity news, HttpServletRequest request){
        EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>();
    	PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params));
		request.setAttribute("data", page);
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/lists")
    public R list( NewsEntity news){
       	EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>();
      	ew.allEq(MPUtil.allEQMapPre( news, "news")); 
        return R.ok().put("data", newsService.selectListView(ew));
    }

	 /**
     * 查询
     */
    @RequestMapping("/query")
    public R query(NewsEntity news){
        EntityWrapper< NewsEntity> ew = new EntityWrapper< NewsEntity>();
 		ew.allEq(MPUtil.allEQMapPre( news, "news")); 
		NewsView newsView =  newsService.selectView(ew);
		return R.ok("查询新闻资讯成功").put("data", newsView);
    }
	
    /**
     * 后端详情
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        NewsEntity news = newsService.selectById(id);
        return R.ok().put("data", news);
    }

    /**
     * 前端详情
     */
	@IgnoreAuth
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") String id){
        NewsEntity news = newsService.selectById(id);
        return R.ok().put("data", news);
    }
    



    /**
     * 后端保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody NewsEntity news, HttpServletRequest request){
    	news.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(news);

        newsService.insert(news);
        return R.ok();
    }
    
    /**
     * 前端保存
     */
    @RequestMapping("/add")
    public R add(@RequestBody NewsEntity news, HttpServletRequest request){
    	news.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
    	//ValidatorUtils.validateEntity(news);

        newsService.insert(news);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody NewsEntity news, HttpServletRequest request){
        //ValidatorUtils.validateEntity(news);
        newsService.updateById(news);//全部更新
        return R.ok();
    }
    

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        newsService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
    
    /**
     * 提醒接口
     */
	@RequestMapping("/remind/{columnName}/{type}")
	public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request, 
						 @PathVariable("type") String type,@RequestParam Map<String, Object> map) {
		map.put("column", columnName);
		map.put("type", type);
		
		if(type.equals("2")) {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Calendar c = Calendar.getInstance();
			Date remindStartDate = null;
			Date remindEndDate = null;
			if(map.get("remindstart")!=null) {
				Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
				c.setTime(new Date()); 
				c.add(Calendar.DAY_OF_MONTH,remindStart);
				remindStartDate = c.getTime();
				map.put("remindstart", sdf.format(remindStartDate));
			}
			if(map.get("remindend")!=null) {
				Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
				c.setTime(new Date());
				c.add(Calendar.DAY_OF_MONTH,remindEnd);
				remindEndDate = c.getTime();
				map.put("remindend", sdf.format(remindEndDate));
			}
		}
		
		Wrapper<NewsEntity> wrapper = new EntityWrapper<NewsEntity>();
		if(map.get("remindstart")!=null) {
			wrapper.ge(columnName, map.get("remindstart"));
		}
		if(map.get("remindend")!=null) {
			wrapper.le(columnName, map.get("remindend"));
		}


		int count = newsService.selectCount(wrapper);
		return R.ok().put("count", count);
	}
	
	


}

Guess you like

Origin blog.csdn.net/weixin_46437112/article/details/132730648