当前位置: 首页 > news >正文

2018年的网站制作wordpress上传视频教程

2018年的网站制作,wordpress上传视频教程,wordpress免费交易主题,网站建设江苏2021.8.31 从25号开始练习复杂的mybatis多对多#xff0c;从设计数据库思路到实现需求功能转移到实体项目中 1.之前很少看过字符转换的详细内容从今往后会注意字符串转换此项目为转数组#xff08;date#xff09;实体项目会有UUID生成的字符串 2.在添加时如果原表设计的首个…2021.8.31 从25号开始练习复杂的mybatis多对多从设计数据库思路到实现需求功能转移到实体项目中 1.之前很少看过字符转换的详细内容从今往后会注意字符串转换此项目为转数组date实体项目会有UUID生成的字符串 2.在添加时如果原表设计的首个id是自动增长的在xml中要设置是否使用jdbc的getGenerateKeys方法获取主键并赋值到keyProperty设置的主键字段中将要插入字段对应的生成的id抽出来 3.service中如果中间表角色id不想用逗号的形式要做循环插入数据 4.修改多表连接的中间表 因为是1-2 2-3的形式不能做修改只能删除干净后重新插入新数据 表结构 实体类Entity—user package com.example.unicom.entity;import lombok.Data;Data public class User {private Integer id;private String name;private String phone;private Integer age;private String sex;private String date;private String name1;private String js_id; } Entity—js死表 package com.example.unicom.entity;import lombok.Data;Data public class Js {private Integer id;private String name;private String date; } Entity—user_role package com.example.unicom.entity;import lombok.Data;Data public class UserJs {private Integer id;private Integer id1;private Integer user_id;private String js_id; } UsrtController package com.example.unicom.controller;import com.example.unicom.entity.User; import com.example.unicom.entity.base.GeneralResponse;import com.example.unicom.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController;import java.util.List;/*** author 孙翊轩* since 2021-08-25*/ RestController RequestMapping(/isp/unicom/user) public class UserController {Autowiredprivate UserService userService; // Autowired // private UserJsService userJsService;RequestMapping(value selectUser,method RequestMethod.GET)public GeneralResponse selectUser(){try{ListUseruserListuserService.selectUser();return new GeneralResponse(SUCCESS,查询成功,userList);}catch (Exception e){e.printStackTrace();}return new GeneralResponse(FAIL,查询失败,null);}RequestMapping(value addUser ,method RequestMethod.POST )public GeneralResponse addUser(RequestBody User user){try{userService.addUser(user);return new GeneralResponse(SUCCESS,添加成功,null);}catch (Exception e) {e.printStackTrace();return new GeneralResponse(FAIL,添加失败,null);}}RequestMapping(value updateUser,method RequestMethod.GET)public GeneralResponse updateUser(RequestBody User user){try{userService.updateUser(user);return new GeneralResponse(SUCCESS,修改成功,null);}catch (Exception e){e.printStackTrace();}return new GeneralResponse(FAIL,修改失败,null);}RequestMapping(value deleteUser,method RequestMethod.GET)public GeneralResponse deleteUser(RequestBody User user){try{userService.deleteUser(user);return new GeneralResponse(SUCCESS,删除成功,null);}catch (Exception e){e.printStackTrace();}return new GeneralResponse(FAIL,删除失败,null);} } UserService接口 package com.example.unicom.service;import com.example.unicom.entity.User; import com.example.unicom.entity.base.GeneralResponse; import org.springframework.stereotype.Repository;import java.util.List;public interface UserService {ListUser selectUser();GeneralResponse addUser(User user);GeneralResponse updateUser(User user);GeneralResponse deleteUser(User user); } Service业务层 UserServiceImpl package com.example.unicom.service.impl;import com.example.unicom.entity.User; import com.example.unicom.entity.UserJs; import com.example.unicom.entity.base.GeneralResponse; import com.example.unicom.mapper.JsMapper; import com.example.unicom.mapper.UserJsMapper; import com.example.unicom.mapper.UserMapper; import com.example.unicom.service.JsService; import com.example.unicom.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional;import java.util.List; Service public class UserServiceImpl implements UserService {Autowiredprivate UserMapper userMapper;Autowiredprivate UserJsMapper userJsMapper;Overridepublic ListUser selectUser() {ListUseruserListuserMapper.selectUser();return userList;}TransactionalOverridepublic GeneralResponse addUser(User user) {userMapper.addUser(user);String[] arruser.getJs_id().split(,);UserJs userjsnew UserJs();for (int i 0; i arr.length; i) {userjs.setUser_id(user.getId());userjs.setJs_id(arr[i]);userJsMapper.addUserJs(userjs);}return null;}Overridepublic GeneralResponse updateUser(User user) {userMapper.updateUser(user);userJsMapper.deleteUserJs(user.getId());UserJs userjsnew UserJs();String[] arruser.getJs_id().split(,);for (int i 0; i arr.length; i) {userjs.setUser_id(user.getId());userjs.setJs_id(arr[i]);userJsMapper.addUserJs(userjs);}return null;}Overridepublic GeneralResponse deleteUser(User user) {userMapper.deleteUser(user);userJsMapper.deleteUserJs(user.getId());return null;} } UserMapper口 package com.example.unicom.mapper;import com.example.unicom.entity.User; import com.example.unicom.entity.UserJs; import com.example.unicom.entity.base.GeneralResponse; import org.springframework.stereotype.Repository;import java.util.List;Repository public interface UserMapper {ListUser selectUser();void addUser(User user);void updateUser(User user);void deleteUser(User user);void addJsId(Integer id, int roleId); } UserMapper.xml映射 ?xml version1.0 encodingUTF-8? !DOCTYPE mapper PUBLIC -//mybatis.org//DTD Mapper 3.0//EN http://mybatis.org/dtd/mybatis-3-mapper.dtd mapper namespacecom.example.unicom.mapper.UserMapperselect idselectUser resultTypecom.example.unicom.entity.UserSELECT u.id,u.name,u.age,u.phone,u.sex,GROUP_CONCAT(j.name )as name1,j.dateFROM user AS uLEFT JOIN user_js AS uj ON u.iduj.user_idLEFT JOIN js AS J ON J.iduj.js_idGROUP BY u.id/selectinsert idaddUser parameterTypecom.example.unicom.entity.User useGeneratedKeystrue keyPropertyidkeyColumnidinsert into usertrim prefix( suffix ) suffixOverrides,if testname !nullname,/ifif testphone !nullphone,/ifif testage !nullage,/ifif testsex !nullsex,/ifif testdate !nulldate,/if/trimtrim prefixvalues ( suffix) suffixOverrides,if testid !null#{id,jdbcTypeINTEGER},/ifif testname !null#{name,jdbcTypeVARCHAR},/ifif testphone !null#{phone,jdbcTypeVARCHAR},/ifif testage !null#{age,jdbcTypeINTEGER},/ifif testsex !null#{sex,jdbcTypeVARCHAR},/ifif testdate !null#{date,jdbcTypeVARCHAR},/if/trim/insertupdate idupdateUser parameterTypecom.example.unicom.entity.Userupdate user set name#{name} ,phone#{phone},age#{age},sex#{sex},date#{date}where id #{id}/updatedelete iddeleteUser parameterTypecom.example.unicom.entity.Userdelete from user where id#{id};/delete /mapper 中间需要多对多操作所以展示中间表逻辑外键关联非绑定的映射内容** ?xml version1.0 encodingUTF-8? !DOCTYPE mapper PUBLIC -//mybatis.org//DTD Mapper 3.0//EN http://mybatis.org/dtd/mybatis-3-mapper.dtd mapper namespacecom.example.unicom.mapper.UserJsMapperinsert idaddUserJs parameterTypecom.example.unicom.entity.UserJsinsert into user_js(user_id,js_id) values (#{user_id},#{js_id})/insertupdate iddelete parameterTypecom.example.unicom.entity.UserJsdelete from user_js where user_id#{user_id}insert into user_js (js_id) values (#{js_id});/updatedelete iddeleteUserJs parameterTypecom.example.unicom.entity.UserJsdelete from user_js where user_id#{user_id}/delete /mapper
http://wiki.neutronadmin.com/news/235803/

相关文章:

  • 免费注册网站域名卷帘门怎么做网站
  • 建设个人博客网站百度云搜索引擎入口
  • 做网站第一步要干啥轻量级服务器wordpress
  • 网站建设都包含哪些内容秦皇岛做网站的公司有哪些
  • 虚拟空间的网站赚钱吗教育机构网站代码
  • 介绍自己做衣服的网站电子商务网络推广主要做什么
  • 公司需要做网站吗建网站合同
  • 招聘网站大全58同城h5网页版制作
  • 网站没有备案会被降权吗flash建网站教程
  • 会展网站建设h开头的网页设计软件
  • 常用ppt模板网站有关建设网站的英语文献
  • 企业网站制作公司合肥dede 汽车网站
  • 个人如何接网站建设订单预算有哪些网站做私活
  • 网站域名证书哪里获取推广链接让别人点击
  • 北京食药局网站年检怎么做青岛专业网站开发公司
  • 做网站需要哪些程序上海轨道交通建设查询网站
  • 做网站优化公司报价wordpress首页文章缩略图插件
  • 强化网站建设和管理网络优化工程师前景
  • 荆门市住房和城乡建设局网站有没有帮人做CAD的网站
  • 建站网哪个好青岛网站建设哪家更好
  • 吴家山网站建设公司湖南企业网站制作公司
  • 上海免费网站建设咨询品牌设计公司成都
  • 做公寓酒店跟网站合作有什么技巧济宁恒德建设有限公司网站
  • 个人网站备案 导航制学网网站
  • 成都开网站多城市地方门户网站系统
  • 公路水运建设质量与安全监督系统网站网站怎么做看起来好看
  • 那些做兼职的小网站怎么交换友情链接
  • 企商百度网站建设网站建设地带
  • 佛山做外贸网站渠道邹平做网站哪家好
  • 密云郑州阳网站建设北京高端网站建设公司