大家好,欢迎来到IT知识分享网。
图书管理借阅系统设计与实现
现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本图书管理借阅系统就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率,达到事半功倍的效果。此图书管理借阅系统利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的Mysql数据库进行程序开发.图书管理借阅系统的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。
Java SSM图书借阅管理系统,后端基于SSM框架进行开发,前端页面效果通过使用JSP进行编码实现,主要将实现用户、教师跟管理员角色,实现了图书管理、留言管理等功能。
package com.controller; import java.util.Arrays; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; 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.annotation.IgnoreAuth; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.entity.ConfigEntity; import com.service.ConfigService; import com.utils.PageUtils; import com.utils.R; import com.utils.ValidatorUtils; / * 登录相关 */ @RequestMapping("config") @RestController public class ConfigController{
@Autowired private ConfigService configService; / * 列表 */ @RequestMapping("/page") public R page(@RequestParam Map<String, Object> params,ConfigEntity config){
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>(); PageUtils page = configService.queryPage(params); return R.ok().put("data", page); } / * 列表 */ @IgnoreAuth @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params,ConfigEntity config){
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>(); PageUtils page = configService.queryPage(params); return R.ok().put("data", page); } / * 信息 */ @RequestMapping("/info/{id}") public R info(@PathVariable("id") String id){
ConfigEntity config = configService.selectById(id); return R.ok().put("data", config); } / * 详情 */ @IgnoreAuth @RequestMapping("/detail/{id}") public R detail(@PathVariable("id") String id){
ConfigEntity config = configService.selectById(id); return R.ok().put("data", config); } / * 根据name获取信息 */ @RequestMapping("/info") public R infoByName(@RequestParam String name){
ConfigEntity config = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile")); return R.ok().put("data", config); } / * 保存 */ @PostMapping("/save") public R save(@RequestBody ConfigEntity config){
// ValidatorUtils.validateEntity(config); configService.insert(config); return R.ok(); } / * 修改 */ @RequestMapping("/update") public R update(@RequestBody ConfigEntity config){
// ValidatorUtils.validateEntity(config); configService.updateById(config);//全部更新 return R.ok(); } / * 删除 */ @RequestMapping("/delete") public R delete(@RequestBody Long[] ids){
configService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); } }
package com.controller; import java.io.File; import java.io.IOException; import java.util.Date; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import com.annotation.IgnoreAuth; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.entity.ConfigEntity; import com.entity.EIException; import com.service.ConfigService; import com.utils.R; / * 上传文件映射表 */ @RestController @RequestMapping("file") @SuppressWarnings({
"unchecked","rawtypes"}) public class FileController{
@Autowired private ConfigService configService; / * 上传文件 */ @RequestMapping("/upload") public R upload(@RequestParam("file") MultipartFile file, String type,HttpServletRequest request) throws Exception {
if (file.isEmpty()) {
throw new EIException("上传文件不能为空"); } String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1); String fileName = new Date().getTime()+"."+fileExt; File dest = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName); file.transferTo(dest); if(StringUtils.isNotBlank(type) && type.equals("1")) {
ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile")); if(configEntity==null) {
configEntity = new ConfigEntity(); configEntity.setName("faceFile"); configEntity.setValue(fileName); } else {
configEntity.setValue(fileName); } configService.insertOrUpdate(configEntity); } return R.ok().put("file", fileName); } / * 下载文件 */ @IgnoreAuth @RequestMapping("/download") public void download(@RequestParam String fileName, HttpServletRequest request, HttpServletResponse response) {
try {
File file = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName); if (file.exists()) {
response.reset(); response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName+"\""); response.setHeader("Cache-Control", "no-cache"); response.setHeader("Access-Control-Allow-Credentials", "true"); response.setContentType("application/octet-stream; charset=UTF-8"); IOUtils.write(FileUtils.readFileToByteArray(file), response.getOutputStream()); } } catch (IOException e) {
e.printStackTrace(); } } }
package com.controller; import java.text.SimpleDateFormat; import com.alibaba.fastjson.JSONObject; import java.util.*; import com.entity.JieyueEntity; import com.entity.ShujiaEntity; import com.entity.YonghuEntity; import com.service.*; import jdk.nashorn.internal.runtime.ScriptFunctionData; import org.springframework.beans.BeanUtils; import javax.servlet.http.HttpServletRequest; import org.springframework.web.context.ContextLoader; import javax.servlet.ServletContext; import com.utils.StringUtil; import java.lang.reflect.InvocationTargetException; 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.TushuEntity; import com.entity.view.TushuView; import com.utils.PageUtils; import com.utils.R; / * 图书 * 后端接口 * @author * @email * @date 2021-04-17 */ @RestController @Controller @RequestMapping("/tushu") public class TushuController {
private static final Logger logger = LoggerFactory.getLogger(TushuController.class); @Autowired private TushuService tushuService; @Autowired private TokenService tokenService; @Autowired private DictionaryService dictionaryService; @Autowired private YonghuService yonghuService; @Autowired private JieyueService jieyueService; @Autowired private ShujiaService shujiaService; / * 后端列表 */ @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")); } params.put("orderBy","id"); PageUtils page = tushuService.queryPage(params); //字典表数据转换 List<TushuView> list =(List<TushuView>)page.getList(); for(TushuView 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); TushuEntity tushu = tushuService.selectById(id); if(tushu !=null){
//entity转view TushuView view = new TushuView(); BeanUtils.copyProperties( tushu , view );//把实体数据重构到view中 //修改对应字典表字段 dictionaryService.dictionaryConvert(view); return R.ok().put("data", view); }else {
return R.error(511,"查不到数据"); } } / * 后端保存 */ @RequestMapping("/save") public R save(@RequestBody TushuEntity tushu, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,tushu:{}",this.getClass().getName(),tushu.toString()); Wrapper<TushuEntity> queryWrapper = new EntityWrapper<TushuEntity>() .eq("tushu_bianhao", tushu.getTushuBianhao()) .eq("tushu_name", tushu.getTushuName()) .eq("tushu_zuozhe", tushu.getTushuZuozhe()) .eq("tushu_types", tushu.getTushuTypes()) .eq("chubanshe_types", tushu.getChubansheTypes()) .eq("tushu_kuchuen", tushu.getTushuKuchuen()) .eq("tushu_jieyue", tushu.getTushuJieyue()) ; logger.info("sql语句:"+queryWrapper.getSqlSegment()); TushuEntity tushuEntity = tushuService.selectOne(queryWrapper); if(tushuEntity==null){
tushu.setCreateTime(new Date()); // String role = String.valueOf(request.getSession().getAttribute("role")); // if("".equals(role)){
// tushu.set // } tushuService.insert(tushu); return R.ok(); }else {
return R.error(511,"表中有相同数据"); } } / * 后端修改 */ @RequestMapping("/update") public R update(@RequestBody TushuEntity tushu, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,tushu:{}",this.getClass().getName(),tushu.toString()); //根据字段查询是否有相同数据 Wrapper<TushuEntity> queryWrapper = new EntityWrapper<TushuEntity>() .notIn("id",tushu.getId()) .andNew() .eq("tushu_bianhao", tushu.getTushuBianhao()) .eq("tushu_name", tushu.getTushuName()) .eq("tushu_zuozhe", tushu.getTushuZuozhe()) .eq("tushu_types", tushu.getTushuTypes()) .eq("chubanshe_types", tushu.getChubansheTypes()) .eq("tushu_kuchuen", tushu.getTushuKuchuen()) .eq("tushu_jieyue", tushu.getTushuJieyue()) ; logger.info("sql语句:"+queryWrapper.getSqlSegment()); TushuEntity tushuEntity = tushuService.selectOne(queryWrapper); if("".equals(tushu.getTushuPhoto()) || "null".equals(tushu.getTushuPhoto())){
tushu.setTushuPhoto(null); } if(tushuEntity==null){
// String role = String.valueOf(request.getSession().getAttribute("role")); // if("".equals(role)){
// tushu.set // } tushuService.updateById(tushu);//根据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()); tushuService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); } / * 还书 */ @RequestMapping("/huanshu") public R huanshu(Integer ids, HttpServletRequest request) {
Integer userId = (Integer) request.getSession().getAttribute("userId"); YonghuEntity yonghu = yonghuService.selectById(userId); JieyueEntity jieyue = jieyueService.selectById(ids); TushuEntity tushu = tushuService.selectById(jieyue.getTushuId()); jieyue.setJieyueTypes(2); boolean b = jieyueService.updateById(jieyue); if(b){
yonghu.setJieyueshuliang(yonghu.getJieyueshuliang()-1); yonghuService.updateById(yonghu); tushu.setTushuKuchuen(tushu.getTushuKuchuen()+1); tushuService.updateById(tushu); return R.ok(); } return R.error(); } / * 续借 */ @RequestMapping("/xujie") public R xujie(Integer ids, HttpServletRequest request) {
JieyueEntity jieyue = jieyueService.selectById(ids); if(jieyue == null){
return R.error(); } jieyue.setHuanshuTime(new Date(Long.valueOf(jieyue.getHuanshuTime().getTime()+30*24*60*60*1000L))); boolean b = jieyueService.updateById(jieyue); if(b){
return R.ok(); } return R.error(); } / * 加入书架 */ @RequestMapping("/jiarushujia") public R jiarushujia(Integer ids, HttpServletRequest request){
Integer userId = (Integer) request.getSession().getAttribute("userId"); ShujiaEntity shujia = new ShujiaEntity(); shujia.setCreateTime(new Date()); shujia.setInsertTime(new Date()); shujia.setTushuId(ids); shujia.setYonghuId(userId); Wrapper<ShujiaEntity> queryWrapper = new EntityWrapper<ShujiaEntity>() .eq("yonghu_id", shujia.getYonghuId()) .eq("tushu_id", shujia.getTushuId()) ; logger.info("sql语句:"+queryWrapper.getSqlSegment()); ShujiaEntity shujiaEntity = shujiaService.selectOne(queryWrapper); if(shujiaEntity==null){
shujiaService.insert(shujia); return R.ok(); }else {
return R.error(511,"您的书架中已经有这本书了"); } } / * 借阅 */ @RequestMapping("/jieyue") public R jieyue(Integer ids, HttpServletRequest request){
YonghuEntity userId = yonghuService.selectById((Integer) request.getSession().getAttribute("userId")); if(userId.getJieyueshuliang() == null || userId.getJieyueshuliang() < 0){
userId.setJieyueshuliang(0); } if(userId.getJieyueshuliang() >= 3){
return R.error("您已经借阅三本书了"); } userId.setJieyueshuliang(userId.getJieyueshuliang()+1); TushuEntity tushu = tushuService.selectById(ids); if(tushu == null){
return R.error(); } if(tushu.getTushuKuchuen() <= 0){
return R.error("此书库存不足"); } JieyueEntity jieyue = new JieyueEntity(); jieyue.setCreateTime(new Date()); jieyue.setJieyueTypes(1); jieyue.setJieyueTime(new Date()); jieyue.setTushuId(ids); jieyue.setYonghuId((Integer) request.getSession().getAttribute("userId")); jieyue.setHuanshuTime(new Date(new Date().getTime()+Long.valueOf(tushu.getTushuJieyue())*24*60*60*1000)); Wrapper<JieyueEntity> queryWrapper = new EntityWrapper<JieyueEntity>() .eq("yonghu_id", jieyue.getYonghuId()) .eq("tushu_id", jieyue.getTushuId()) ; logger.info("sql语句:"+queryWrapper.getSqlSegment()); JieyueEntity jieyueEntity = jieyueService.selectOne(queryWrapper); if(jieyueEntity!=null && jieyueEntity.getJieyueTypes()!=2){
return R.error("你已经借阅过这本书了"); } tushu.setTushuKuchuen(tushu.getTushuKuchuen()-1); tushuService.updateById(tushu); yonghuService.updateById(userId); jieyueService.insert(jieyue); return R.ok(); } / * 前端列表 */ @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,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")); } // 没有指定排序字段就默认id倒序 if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id"); } PageUtils page = tushuService.queryPage(params); //字典表数据转换 List<TushuView> list =(List<TushuView>)page.getList(); for(TushuView c:list){
//修改对应字典表字段 dictionaryService.dictionaryConvert(c); } return R.ok().put("data", page); } / * 前端详情 */ @RequestMapping("/detail/{id}") public R detail(@PathVariable("id") Long id){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id); TushuEntity tushu = tushuService.selectById(id); if(tushu !=null){
//entity转view TushuView view = new TushuView(); BeanUtils.copyProperties( tushu , view );//把实体数据重构到view中 //修改对应字典表字段 dictionaryService.dictionaryConvert(view); return R.ok().put("data", view); }else {
return R.error(511,"查不到数据"); } } / * 前端保存 */ @RequestMapping("/add") public R add(@RequestBody TushuEntity tushu, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,tushu:{}",this.getClass().getName(),tushu.toString()); Wrapper<TushuEntity> queryWrapper = new EntityWrapper<TushuEntity>() .eq("tushu_bianhao", tushu.getTushuBianhao()) .eq("tushu_name", tushu.getTushuName()) .eq("tushu_zuozhe", tushu.getTushuZuozhe()) .eq("tushu_types", tushu.getTushuTypes()) .eq("chubanshe_types", tushu.getChubansheTypes()) .eq("tushu_kuchuen", tushu.getTushuKuchuen()) .eq("tushu_jieyue", tushu.getTushuJieyue()) ; logger.info("sql语句:"+queryWrapper.getSqlSegment()); TushuEntity tushuEntity = tushuService.selectOne(queryWrapper); if(tushuEntity==null){
tushu.setCreateTime(new Date()); // String role = String.valueOf(request.getSession().getAttribute("role")); // if("".equals(role)){
// tushu.set // } tushuService.insert(tushu); return R.ok(); }else {
return R.error(511,"表中有相同数据"); } } }
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.TushuLiuyanEntity; import com.service.TushuLiuyanService; import com.entity.view.TushuLiuyanView; import com.service.TushuService; import com.entity.TushuEntity; import com.service.YonghuService; import com.entity.YonghuEntity; import com.utils.PageUtils; import com.utils.R; / * 图书留言 * 后端接口 * @author * @email * @date 2021-04-17 */ @RestController @Controller @RequestMapping("/tushuLiuyan") public class TushuLiuyanController {
private static final Logger logger = LoggerFactory.getLogger(TushuLiuyanController.class); @Autowired private TushuLiuyanService tushuLiuyanService; @Autowired private TokenService tokenService; @Autowired private DictionaryService dictionaryService; //级联表service @Autowired private TushuService tushuService; @Autowired private YonghuService yonghuService; / * 后端列表 */ @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")); } params.put("orderBy","id"); PageUtils page = tushuLiuyanService.queryPage(params); //字典表数据转换 List<TushuLiuyanView> list =(List<TushuLiuyanView>)page.getList(); for(TushuLiuyanView 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); TushuLiuyanEntity tushuLiuyan = tushuLiuyanService.selectById(id); if(tushuLiuyan !=null){
//entity转view TushuLiuyanView view = new TushuLiuyanView(); BeanUtils.copyProperties( tushuLiuyan , view );//把实体数据重构到view中 //级联表 TushuEntity tushu = tushuService.selectById(tushuLiuyan.getTushuId()); if(tushu != null){
BeanUtils.copyProperties( tushu , view ,new String[]{
"id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段 view.setTushuId(tushu.getId()); } //级联表 YonghuEntity yonghu = yonghuService.selectById(tushuLiuyan.getYonghuId()); if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{
"id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段 view.setYonghuId(yonghu.getId()); } //修改对应字典表字段 dictionaryService.dictionaryConvert(view); return R.ok().put("data", view); }else {
return R.error(511,"查不到数据"); } } / * 后端保存 */ @RequestMapping("/save") public R save(@RequestBody TushuLiuyanEntity tushuLiuyan, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,tushuLiuyan:{}",this.getClass().getName(),tushuLiuyan.toString()); tushuLiuyan.setInsertTime(new Date()); tushuLiuyan.setCreateTime(new Date()); tushuLiuyanService.insert(tushuLiuyan); return R.ok(); } / * 后端修改 */ @RequestMapping("/update") public R update(@RequestBody TushuLiuyanEntity tushuLiuyan, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,tushuLiuyan:{}",this.getClass().getName(),tushuLiuyan.toString()); tushuLiuyanService.updateById(tushuLiuyan);//根据id更新 return R.ok(); } / * 删除 */ @RequestMapping("/delete") public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString()); tushuLiuyanService.deleteBatchIds(Arrays.asList(ids)); return R.ok(); } / * 前端列表 */ @RequestMapping("/list") public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); // 没有指定排序字段就默认id倒序 if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id"); } PageUtils page = tushuLiuyanService.queryPage(params); //字典表数据转换 List<TushuLiuyanView> list =(List<TushuLiuyanView>)page.getList(); for(TushuLiuyanView c:list){
//修改对应字典表字段 dictionaryService.dictionaryConvert(c); } return R.ok().put("data", page); } / * 前端详情 */ @RequestMapping("/detail/{id}") public R detail(@PathVariable("id") Long id){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id); TushuLiuyanEntity tushuLiuyan = tushuLiuyanService.selectById(id); if(tushuLiuyan !=null){
//entity转view TushuLiuyanView view = new TushuLiuyanView(); BeanUtils.copyProperties( tushuLiuyan , view );//把实体数据重构到view中 //级联表 TushuEntity tushu = tushuService.selectById(tushuLiuyan.getTushuId()); if(tushu != null){
BeanUtils.copyProperties( tushu , view ,new String[]{
"id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段 view.setTushuId(tushu.getId()); } //级联表 YonghuEntity yonghu = yonghuService.selectById(tushuLiuyan.getYonghuId()); if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{
"id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段 view.setYonghuId(yonghu.getId()); } //修改对应字典表字段 dictionaryService.dictionaryConvert(view); return R.ok().put("data", view); }else {
return R.error(511,"查不到数据"); } } / * 前端保存 */ @RequestMapping("/add") public R add(@RequestBody TushuLiuyanEntity tushuLiuyan, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,tushuLiuyan:{}",this.getClass().getName(),tushuLiuyan.toString()); tushuLiuyan.setInsertTime(new Date()); tushuLiuyan.setCreateTime(new Date()); tushuLiuyanService.insert(tushuLiuyan); return R.ok(); } }
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/115700.html