SSM框架练习—主从表的业务模型

2023-11-06

需要实现的整体功能:

  1. 系统的登录并进行用户名的校验
  2. 团购信息的列表展示
  3. 团购信息的添加
  4. 团购信息的检索

1、数据库创建

CREATE DATABASE mydb;

USE mydb;


drop table if exists vaccunit;

CREATE TABLE vaccunit (
  vid INT AUTO_INCREMENT PRIMARY KEY,
  unitname VARCHAR(50) NOT NULL,
  address VARCHAR(50) NOT NULL
);

insert into vaccunit(unitname,address) values('柏林卫生院','中原区');
insert into vaccunit(unitname,address) values('社区卫生院','金水区');
insert into vaccunit(unitname,address) values('第一医院','二七区');


drop table if exists appointment;

CREATE TABLE appointment (
  aid INT AUTO_INCREMENT PRIMARY KEY,
  person VARCHAR(32) NOT NULL,
  phone VARCHAR(11) NOT NULL,
  ipcard VARCHAR(18) NOT NULL,
  birthday DATETIME NOT NULL,
  sex VARCHAR(10) NOT NULL,
  vid INT NOT NULL,
  FOREIGN KEY (vid) REFERENCES vaccunit(vid)
);

insert into appointment values (1,'张三','1364758374','40038312345678','2020-01-01','男',1);
insert into appointment values (2,'李四','136423374','40038312345678','2020-01-01','女',2);
insert into appointment values (3,'王五','1364758374','40038312345678','2020-01-01','男',3);


select * from vaccunit;
select * from appointment;

#查询所有预约1号医院(柏林)预约医院
select * from appointment where vid=1;

#使用聚合函数统计查询数据数量
select count(*) from appointment where vid=1;

2、框架搭建,创建项目,导入jar包,创建实体类;

 1.springmvc.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd">
    <context:component-scan base-package="com.zhan.controller"/>

    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/"/>
        <property name="suffix" value=".jsp"/>
    </bean>

    <mvc:resources mapping="/css/**" location="/css/"/>
    <mvc:resources mapping="/js/**" location="/js/"/>
    <mvc:resources mapping="/fonts/**" location="/fonts/"/>
    <mvc:resources mapping="/img/**" location="/img/"/>

    <mvc:annotation-driven/>

</beans>

2.spring.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context.xsd
            http://www.springframework.org/schema/aop
            http://www.springframework.org/schema/aop/spring-aop.xsd">
    <context:component-scan base-package="com.zhan">
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>

    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
        <property name="url" value="jdbc:mysql://localhost:3306/mydb"/>
        <property name="username" value="root"/>
        <property name="password" value="root"/>
    </bean>

    <bean id="factoryBean" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="typeAliasesPackage" value="com.zhan.bean"/>
        <property name="configLocation" value="classpath:mybatis.xml"/>
    </bean>

    <bean id="scannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="com.zhan.dao"/>
    </bean>

</beans>

3.mybatis.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <settings>
        <setting name="logImpl" value="log4j"/>
    </settings>

</configuration>

4.web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:spring.xml</param-value>
    </context-param>

    <servlet>
        <servlet-name>dispatcherServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:springmvc.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>dispatcherServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <filter>
        <filter-name>encodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>utf-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>encodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>

配置完成后,测试是否能够运行成功;

index.jsp首页

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>首页</title>
  </head>
  <body>
  <a href="findAll">去登录</a>
  </body>
</html>

zhuye.jsp主页

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>主页</title>
</head>
<body>
<h2>欢迎来到主页!</h2>
</body>
<table>
    <thead>
    <tr>
        <th>接种单位</th>
        <th>预约人</th>
        <th>电话</th>
        <th>身份证</th>
        <th>生日</th>
        <th>性别</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    
    </tbody>
</table>
</html>

controller层的AppointmentController

@Controller
public class AppointmentController {

    @RequestMapping("/findAll")
    public ModelAndView findAll(){
        ModelAndView mv = new ModelAndView();
        System.out.println("findAll执行");
        mv.setViewName("zhuye");
        return mv;
    }
}

运行后,测试成功; 

 

 3、当页面第一次加载时,显示所有的预约列表。 在列表中,需要显示列“接种单位”、“预约人”、“电话”、“身份证”、“生日”、“性别”、“操作”。

1.全查 

 dao层AppointmentDao

@Repository
public interface AppointmentDao {
    List<Appointment> selectAll();
}

dao层VaccunitDao

@Repository
public interface VaccunitDao {
    @Select("select * from vaccunit where vid=#{vid}")
    Vaccunit selectById(int vid);
}

dao层AppointmentDao.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhan.dao.AppointmentDao">
    <resultMap id="amMap" type="com.zhan.bean.Appointment">
        <id property="aid" column="aid"/>
        <result property="person" column="person"/>
        <result property="phone" column="phone"/>
        <result property="ipcard" column="ipcard"/>
        <result property="birthday" column="birthday"/>
        <result property="sex" column="sex"/>
        <association property="vaccunit" column="vid" select="com.zhan.dao.VaccunitDao.selectById"></association>
    </resultMap>
    <select id="selectAll" resultMap="amMap">
        select * from appointment;
    </select>
</mapper>

service层AppointmentService

@Service
public interface AppointmentService {
    List<Appointment> selectAll();
}

 service层VaccunitService

public interface VaccunitService {
    Vaccunit selectById(int vid);
}

service层impl.AppointmentServiceImpl

@Service
public class AppointmentServiceImpl implements AppointmentService {
    @Autowired
    AppointmentDao appointmentDao;

    @Override
    public List<Appointment> selectAll() {
        return appointmentDao.selectAll();
    }
}

 service层impl.VaccunitServiceImpl

@Service
public class VaccunitServiceImpl implements VaccunitService {
    @Autowired
    VaccunitDao vaccunitDao;

    @Override
    public Vaccunit selectById(int vid) {
        return vaccunitDao.selectById(vid);
    }
}

 controller层的AppointmentController

@Controller
public class AppointmentController {
    @Autowired
    AppointmentService appointmentService;
    @Autowired
    VaccunitService vaccunitService;

    @RequestMapping("/findAll")
    public ModelAndView findAll(){
        ModelAndView mv = new ModelAndView();
//        System.out.println("findAll执行");
        List<Appointment> appointmentList = appointmentService.selectAll();
//        System.out.println(appointmentList);
        mv.addObject("appointmentList",appointmentList);
        mv.setViewName("zhuye");
        return mv;
    }
}

zhuye.jsp主页

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>主页</title>
</head>
<body>
<h2>欢迎来到主页!</h2>
<table>
    <thead>
    <tr>
        <th>接种单位</th>
        <th>预约人</th>
        <th>电话</th>
        <th>身份证</th>
        <th>生日</th>
        <th>性别</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${appointmentList}" var="appointment">
        <tr>
            <td><a href="findByVid?vid=${appointment.vaccunit.vid}">${appointment.vaccunit.unitname}</a>
            </td>
            <td>${appointment.person}</td>
            <td>${appointment.phone}</td>
            <td>${appointment.ipcard}</td>
            <td>${appointment.birthday}</td>
            <td>${appointment.sex}</td>
            <td>
                <a href="del?aid=${appointment.aid}">删除</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
</body>
</html>

新增

  • 添加页面的接种单位需要从后台查询并使用下列列表显示。
  • 当缺陷预约成功之后,跳转到列表页面。
dao层AppointmentDao
@Repository
public interface AppointmentDao {
    int insert(Appointment appointment);
}

dao层AppointmentDao.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhan.dao.AppointmentDao">
    <resultMap id="amMap" type="com.zhan.bean.Appointment">
        <id property="aid" column="aid"/>
        <result property="person" column="person"/>
        <result property="phone" column="phone"/>
        <result property="ipcard" column="ipcard"/>
        <result property="birthday" column="birthday"/>
        <result property="sex" column="sex"/>
        <association property="vaccunit" column="vid" select="com.zhan.dao.VaccunitDao.selectById"></association>
    </resultMap>
    <insert id="insert" parameterType="com.zhan.bean.Appointment">
        insert into appointment(person,phone,ipcard,birthday,sex,vid)
        values (#{person},#{phone},#{ipcard},#{birthday},#{sex},#{vaccunit.vid});
    </insert>
</mapper>

service层AppointmentService

@Service
public interface AppointmentService {
    int insert(Appointment appointment);
}

service层impl.AppointmentServiceImpl

@Service
public class AppointmentServiceImpl implements AppointmentService {
    @Autowired
    AppointmentDao appointmentDao;

    @Override
    public int insert(Appointment appointment) {
        return appointmentDao.insert(appointment);
    }
}

 controller层的AppointmentController

@Controller
public class AppointmentController {
    @Autowired
    AppointmentService appointmentService;
    @Autowired
    VaccunitService vaccunitService;


    @RequestMapping("/add")
    public ModelAndView insert(Appointment appointment){
        ModelAndView mv = new ModelAndView();
//        System.out.println(appointment);
        int n = appointmentService.insert(appointment);
        if(n>0){
            mv.setViewName("redirect:/findAll");
        }else{
            mv.setViewName("error");
        }
        return mv;
    }

    @RequestMapping("/del")
    public ModelAndView del(int aid){
        ModelAndView mv = new ModelAndView();
        int n = appointmentService.delete(aid);
        System.out.println(n);
        mv.setViewName("redirect:/findAll");
        return mv;
    }
}

zhuye.jsp主页

<h2>欢迎来到主页!</h2>
<h3>
    <a href="add.jsp">预约</a>
</h3>

add.jsp添加页

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加页</title>
</head>
<body>
<form action="add" method="post">
    接种单位:
    <select id="type" name="vaccunit.vid">
        <option value="1">柏林卫生院</option>
        <option value="2">社区卫生院</option>
        <option value="3">第一医院</option>
    </select><br>
    预约人:<input type="text" name="person" id="person" value=""><br>
    电话:<input type="text" name="phone" id="phone" value=""><br>
    身份证:<input type="text" name="ipcard" id="ipcard" value=""><br>
    生日:<input type="text" name="birthday" id="birthday" value=""><br>
    性别:<input type="radio" name="sex" value="男">男
    <input type="radio" name="sex" value="女">女<br>
    <button type="submit" id="btn">预约</button>
</form>
</body>
</html>

删除

dao层AppointmentDao

@Repository
public interface AppointmentDao {
    int delete(int aid);
}

dao层AppointmentDao.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhan.dao.AppointmentDao">
    <resultMap id="amMap" type="com.zhan.bean.Appointment">
        <id property="aid" column="aid"/>
        <result property="person" column="person"/>
        <result property="phone" column="phone"/>
        <result property="ipcard" column="ipcard"/>
        <result property="birthday" column="birthday"/>
        <result property="sex" column="sex"/>
        <association property="vaccunit" column="vid" select="com.zhan.dao.VaccunitDao.selectById"></association>
    </resultMap>

    <delete id="delete" parameterType="int">
         delete from appointment where aid=#{aid};
    </delete>
</mapper>

service层AppointmentService

@Service
public interface AppointmentService {
    int delete(int aid);
}

service层impl.AppointmentServiceImpl

@Service
public class AppointmentServiceImpl implements AppointmentService {
    @Autowired
    AppointmentDao appointmentDao;

    @Override
    public int delete(int aid) {
        return appointmentDao.delete(aid);
    }
}

 controller层的AppointmentController

@Controller
public class AppointmentController {
    @Autowired
    AppointmentService appointmentService;
    @Autowired
    VaccunitService vaccunitService;

    @RequestMapping("/del")
    public ModelAndView del(int aid){
        ModelAndView mv = new ModelAndView();
        int n = appointmentService.delete(aid);
        System.out.println(n);
        mv.setViewName("redirect:/findAll");
        return mv;
    }
}

zhuye.jsp主页

            <td>
                <a href="del?aid=${appointment.aid}">删除</a>
            </td>

统计

  • 详情界面能够正确显示接种单位和单位地址。
  • 并能够正确显示预约人数。

dao层AppointmentDao

@Repository
public interface AppointmentDao {
    int count(int vid);
}

dao层AppointmentDao.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhan.dao.AppointmentDao">
    <resultMap id="amMap" type="com.zhan.bean.Appointment">
        <id property="aid" column="aid"/>
        <result property="person" column="person"/>
        <result property="phone" column="phone"/>
        <result property="ipcard" column="ipcard"/>
        <result property="birthday" column="birthday"/>
        <result property="sex" column="sex"/>
        <association property="vaccunit" column="vid" select="com.zhan.dao.VaccunitDao.selectById"></association>
    </resultMap>
    <select id="count" parameterType="int" resultType="int">
        select count(*) from appointment where vid=#{vid};
    </select>
</mapper>

service层AppointmentService

@Service
public interface AppointmentService {
    int count(int vid);
}

service层impl.AppointmentServiceImpl

@Service
public class AppointmentServiceImpl implements AppointmentService {
    @Autowired
    AppointmentDao appointmentDao;

    @Override
    public int count(int vid) {
        return appointmentDao.count(vid);
    }
}

 controller层的AppointmentController

@Controller
public class AppointmentController {
    @Autowired
    AppointmentService appointmentService;
    @Autowired
    VaccunitService vaccunitService;

    @RequestMapping("/findByVid")
    public ModelAndView findByVid(int vid){
        ModelAndView mv = new ModelAndView();
        //根据Vid查询医院信息
        Vaccunit vaccunit = vaccunitService.selectById(vid);
        //根vid查询该医院预约信息的计数数量
        int count = appointmentService.count(vid);
        mv.addObject("vaccunit",vaccunit);
        mv.addObject("count",count);
        mv.setViewName("show");
        return mv;
    }
}

zhuye.jsp主页 

    <select id="type" name="vaccunit.vid">
        <option value="1">柏林卫生院</option>
        <option value="2">社区卫生院</option>
        <option value="3">第一医院</option>
    </select>

模糊查询

dao层AppointmentDao 

@Repository
public interface AppointmentDao {
    List<Appointment> seach(Appointment appointment);
}

dao层AppointmentDao.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhan.dao.AppointmentDao">
    <resultMap id="amMap" type="com.zhan.bean.Appointment">
        <id property="aid" column="aid"/>
        <result property="person" column="person"/>
        <result property="phone" column="phone"/>
        <result property="ipcard" column="ipcard"/>
        <result property="birthday" column="birthday"/>
        <result property="sex" column="sex"/>
        <association property="vaccunit" column="vid" select="com.zhan.dao.VaccunitDao.selectById"></association>
    </resultMap>
    <select id="seach" parameterType="com.zhan.bean.Appointment" resultMap="amMap">
        select * from appointment where vid=#{vaccunit.vid} and person like concat('%',#{person},'%');
    </select>
</mapper>

service层AppointmentService

@Service
public interface AppointmentService {
    List<Appointment> seach(Appointment appointment);
}

service层impl.AppointmentServiceImpl

@Service
public class AppointmentServiceImpl implements AppointmentService {
    @Autowired
    AppointmentDao appointmentDao;

    @Override
    public List<Appointment> seach(Appointment appointment) {
        return appointmentDao.seach(appointment);
    }
}

 controller层的AppointmentController

@Controller
public class AppointmentController {
    @Autowired
    AppointmentService appointmentService;
    @Autowired
    VaccunitService vaccunitService;

    @RequestMapping("/seach")
    public ModelAndView seach(Appointment appointment){
        ModelAndView mv = new ModelAndView();
        List<Appointment> appointmentList = appointmentService.seach(appointment);
        System.out.println(appointmentList);
        mv.addObject("appointmentList",appointmentList);
        mv.setViewName("zhuye");
        return mv;
    }
}

zhuye.jsp主页

<form action="seach" method="post">
    <select id="type" name="vaccunit.vid">
        <option value="1">柏林卫生院</option>
        <option value="2">社区卫生院</option>
        <option value="3">第一医院</option>
    </select>
    <input type="text" name="person" value="" placeholder="请输入姓名">
    <input type="submit" value="搜索">
</form>

页面展示

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

SSM框架练习—主从表的业务模型 的相关文章

  • XML 解析:格式良好的检查:未声明的实体

    我正在使用 SSMS 2008 但收到以下错误 你知道这意味着什么吗 Msg 9448 Level 16 State 1 Line 4 XML parsing line 1 character 89 well formed check un
  • 执行带有 EXCEPTION 的 PostgreSQL 查询会导致两条不同的错误消息

    我有一个 PostgreSQL 查询 其中包含事务和列重复时的异常 BEGIN ALTER TABLE public cars ADD COLUMN top speed text EXCEPTION WHEN duplicate colum
  • 加速代码 - 3D 数组

    我正在尝试提高我编写的一些代码的速度 我想知道从 3d 整数数组访问数据的效率如何 我有一个数组 int cube new int 10 10 10 我用价值观填充其中 然后我访问这些值数千次 我想知道 由于理论上所有 3d 数组都存储在内
  • JavaMail 只获取新邮件

    我想知道是否有一种方法可以在javamail中只获取新消息 例如 在初始加载时 获取收件箱中的所有消息并存储它们 然后 每当应用程序再次加载时 仅获取新消息 而不是再次重新加载它们 javamail 可以做到这一点吗 它是如何工作的 一些背
  • Liferay ClassNotFoundException:DLFileEntryImpl

    在我的 6 1 0 Portal 实例上 带有使用 ServiceBuilder 和 DL Api 的 6 1 0 SDK Portlet 这一行 DynamicQuery query DynamicQueryFactoryUtil for
  • 操作错误不会显示在 JSP 上

    我尝试在 Action 类中添加操作错误并将其打印在 JSP 页面上 当发生异常时 它将进入 catch 块并在控制台中打印 插入异常时出错 请联系管理员 在 catch 块中 我添加了它addActionError 我尝试在jsp页面中打
  • 磁模拟

    假设我在 n m 像素的 2D 表面上有 p 个节点 我希望这些节点相互吸引 使得它们相距越远吸引力就越强 但是 如果两个节点之间的距离 比如 d A B 小于某个阈值 比如 k 那么它们就会开始排斥 谁能让我开始编写一些关于如何随时间更新
  • 我可以使用 HSQLDB 进行 junit 测试克隆 mySQL 数据库吗

    我正在开发一个 spring webflow 项目 我想我可以使用 HSQLDB 而不是 mysql 进行 junit 测试吗 如何将我的 mysql 数据库克隆到 HSQLDB 如果您使用 spring 3 1 或更高版本 您可以使用 s
  • 十进制到八进制的转换[重复]

    这个问题在这里已经有答案了 可能的重复 十进制转换错误 https stackoverflow com questions 13142977 decimal conversion error 我正在为一个类编写一个程序 并且在计算如何将八进
  • getResourceAsStream() 可以找到 jar 文件之外的文件吗?

    我正在开发一个应用程序 该应用程序使用一个加载配置文件的库 InputStream in getClass getResourceAsStream resource 然后我的应用程序打包在一个 jar文件 如果resource是在里面 ja
  • 如何在NiFi中映射流文件中的列数据?

    我有 csv 文件 其结构如下 Alfreds Centro Ernst Island Bacchus Germany Mexico Austria UK Canada 01 02 03 04 05 现在我必须将这些数据移入数据库 如下所示
  • 如何在控制器、服务和存储库模式中使用 DTO

    我正在遵循控制器 服务和存储库模式 我只是想知道 DTO 在哪里出现 控制器应该只接收 DTO 吗 我的理解是您不希望外界了解底层域模型 从领域模型到 DTO 的转换应该发生在控制器层还是服务层 在今天使用 Spring MVC 和交互式
  • Java列表的线程安全

    我有一个列表 它将在线程安全上下文或非线程安全上下文中使用 究竟会是哪一个 无法提前确定 在这种特殊情况下 每当列表进入非线程安全上下文时 我都会使用它来包装它 Collections synchronizedList 但如果不进入非线程安
  • SQL 国家字符 (NCHAR) 数据类型的真正用途是什么?

    也CHAR CHARACTER and VARCHAR CHARACTER VARYING SQL 提供了NCHAR NATIONAL CHARACTER and NVARCHAR NATIONAL CHARACTER VARYING 类型
  • 静态变量的线程安全

    class ABC implements Runnable private static int a private static int b public void run 我有一个如上所述的 Java 类 我有这个类的多个线程 在里面r
  • 索引数量越少意味着插入、更新和删除速度更快? [关闭]

    就目前情况而言 这个问题不太适合我们的问答形式 我们希望答案得到事实 参考资料或专业知识的支持 但这个问题可能会引发辩论 争论 民意调查或扩展讨论 如果您觉得这个问题可以改进并可能重新开放 访问帮助中心 help reopen questi
  • 捕获的图像分辨率太大

    我在做什么 我允许用户捕获图像 将其存储到 SD 卡中并上传到服务器 但捕获图像的分辨率为宽度 4608 像素和高度 2592 像素 现在我想要什么 如何在不影响质量的情况下获得小分辨率图像 例如我可以获取或设置捕获的图像分辨率为原始图像分
  • 当我从 Netbeans 创建 Derby 数据库时,它存储在哪里?

    当我从 netbeans 创建 Derby 数据库时 它存储在哪里 如何将它与项目的其余部分合并到一个文件夹中 右键单击Databases gt JavaDB in the Service查看并选择Properties This will
  • java.lang.IllegalStateException:驱动程序可执行文件的路径必须由 webdriver.chrome.driver 系统属性设置 - Similiar 不回答

    尝试学习 Selenium 我打开了类似的问题 但似乎没有任何帮助 我的代码 package seleniumPractice import org openqa selenium WebDriver import org openqa s
  • Spring Boot @ConfigurationProperties 不从环境中检索属性

    我正在使用 Spring Boot 1 2 1 并尝试创建一个 ConfigurationProperties带有验证的bean 如下所示 package com sampleapp import java net URL import j

随机推荐

  • MyBatis与JDBC连接数据库所使用的url之间的差异

    1 在JDBC连接里是这样的 连接无误 2 在Mybatis里配置要这样 3 主要区别 说明 JDBC 方式连接 MySQL 不需要对 进行转义 而在Mybatis里要求一定要对 转义 4 如果是在properties文件里 不用转义的 在
  • IP静态路由实验报告

    一 将192 168 1 0 24划分为4个网段 192 168 1 0 26 192 168 1 64 26 192 168 1 128 26 192 168 1 192 26 1 取192 168 1 0 26继续划分 为主干道添加IP
  • Spring 加载、解析applicationContext.xml 流程

    概要 Spring 框架使用了BeanFactory 进行加载 xml 和生成 bean 实例 下面我们分析下Spring加载xml文件的过程 spring 版本是最新的 4 3 9 release 版本 示例 XmlBeanFactory
  • java 转换tif图片为jpg,解决转换后颜色异常问题

    java 转换tif图片为jpg 解决转换后颜色异常问题 说明 正常情况下 tif转换jpg图片会出现颜色失真 丢失部分颜色 原因是两种图片的色彩模式不同 jpg默认使用的是RGB色彩模式 TIF默认使用的是CMYK色彩模式 RGB的色域比
  • 有关“ModuleNotFoundError: No module named ‘flask._compat’”错误的解决过程

    在进行flask安装后 运行程序的过程中出现了 ModuleNotFoundError No module named flask compat 的错误 在查询了多个网站后给出了不同的答案 其报错原因是flask版本过高导致无法识别该语法
  • 仿京东 项目笔记2(注册登录)

    这里写目录标题 1 注册页面 1 1 注册 登录页面 接口请求 1 2 Vue开发中Element UI的样式穿透 1 2 1 v deep的使用 1 2 2 elementUI Dialog内容区域显示滚动条 1 3 注册页面 步骤条和表
  • 服务器i5 和e系列,e5和i5有什么区别

    两个系列的处理器主要在设计规格和面向范围方面存在区别 设计规格上 前者核心数更多 多线程能力更强 但睿频能力相对较弱 后者核心数较少 多线程能力不如前者 但睿频能力更强 面向范围上 前者主要面向服务器 嵌入式等企业设备 后者主要面向消费级硬
  • (LeetCode)全排列

    目录 题目要求 题目理解以及思路分析 代码分部讲解 第一部分 第二部分 题目要求 给定一个不含重复数字的数组 nums 返回其 所有可能的全排列 你可以 按任意顺序 返回答案 示例 1 输入 nums 1 2 3 输出 1 2 3 1 3
  • 规则引擎Drools使用 第十一篇 Drools 的高级语法之LHS增强

    前面我们已经知道了在规则体中的LHS部分是介于when和then之间的部分 主要用于模式匹配 只有匹配结果为true时 才会触发RHS部分的执行 下面我们会针对LHS部分学习几个新的用法 目录 复合值限制in not in 条件元素eval
  • 升压电路(BOOST)与降压电路(BUCK)

    一 电路中产生电流的条件是 1 电路里必须有电源供电 2 电路必须形成闭合回路 降压元器件 升降压电路构成的核心元器件 1 电感 储存能量 电感是无法突变的 工作状态是线性的 2 二极管 3 mos管 首先先分清楚mos是N mos还是P
  • Qt全局宏和变量

    1 Qt 全局宏定义 Qt版本号 QT VERSION major lt lt 16 minor lt lt 8 patch 检测版本号 QT VERSION CHECK major minor patch major lt lt 16 m
  • virtio代码分析(一)-qemu部分

    virtio内容众多 代码分布于qemu linux dpdk等中 而且分为frontend和backend 可以运行于userspace也可以运行于kernelspace 极其难以理解 不看代码只看原理性文档往往流于表面 只有真正看懂了代
  • 大数据准备——安装JDK

    1 解压Linux版本的JDK压缩包 命令行敲入 mkdir home software cd home software rz 上传jdk tar包 这里添加自己tar包的名字 如果rz命令不能使用 先执行yum install lrzs
  • C语言关键字解析

    在C语言中有32个关键字 如下表所示 释 1 声明 1 告诉编译器 这个名字已经匹配到一块内存上 2 告诉编译器 这个名字已经预定了 其他地方再也不能用它来作为变量名或对象名 2 定义 编译器创建一个对象 为这个对象分配一块内存空间 并给它
  • 前端 配色网站 自用 免费 颜色很全

    1 中国色彩 http zhongguose com 3 ColorHex https www colorhexa com 4 优色网配色专区 https color uisdc com 4 ColorDrop https www colo
  • cuda学习

    GPU中有多个流处理器SM 当一个线程块被指定给一个SM后 里面的线程会被划分成线程束 32个线程 在SM上交替运行 也就是说SM上一个时刻只有一个线程束在运行 函数修饰符 global 表示该函数只能在GPU上运行 但是可以从CPU或者G
  • qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method

    最近在做一个网络音乐播放器时 由于出现qt network ssl QSslSocket cannot call unresolved function SSLv23 client method 而不能播放网络歌曲 上网搜了半天 都说要在电
  • Jmeter(二十七) - 从入门到精通 - Jmeter Http协议录制脚本(详解教程)

    1 简介 LoadRunner的录制功能让性能测试脚本编写对于不懂代码的人变成了一件容易上手的事 但是由于LoadRunner收费高昂 庞大 一般企业很少用 除非必须使用 Jmeter作为性能测试中的王者也少不了提供录制功能 Jmeter的
  • 靠!我被项目经理和同事嘲笑了,因为不会远程debug调试...

    大家好 我是曹尼玛 刚从培训机构毕业 去一家单位上班一周了 这一周项目经理让我熟悉了项目业务 架构和设计 不算难 凭借我培训机构第一名的成绩 还是很顺溜 今天项目经理把同事们叫到一起 说线上438x6项目出现奇葩问题 但是开发环境初步测试没
  • SSM框架练习—主从表的业务模型

    需要实现的整体功能 系统的登录并进行用户名的校验 团购信息的列表展示 团购信息的添加 团购信息的检索 1 数据库创建 CREATE DATABASE mydb USE mydb drop table if exists vaccunit C