文档详情

商品系统源代码.doc

发布:2018-08-05约2.28万字共21页下载文档
文本预览下载声明
Config: Mapper.xml ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE mapper PUBLIC -////DTD Mapper 3.0//EN /dtd/mybatis-3-mapper.dtd mapper namespace=com.ry.Dao.ProductDao !-- 5.默认情况下,ORM是根据列名和实体的属性名对应 -- !-- 6.也可以使用resultMap进行规定 -- resultMap type=com.ry.model.Product id=productMap result column=Id property=Id javaType=Integer jdbcType=INTEGER / result column=product_no property=product_no javaType=Integer jdbcType=INTEGER / result column=product_name property=product_name javaType=String jdbcType=VARCHAR / result column=product_type property=product_type javaType=String jdbcType=VARCHAR / result column=Status property=Status javaType=Integer jdbcType=INTEGER / /resultMap select id=selectByNameAndIDAndStatus parameterType=com.ry.model.Product resultMap=productMap select*from product where 1=1 if test=product_no!=null and product_no=#{product_no} /if if test=product_name!=null and product_name =#{product_name} /if if test=Status!=-1 and Status =#{Status} /if /select insert id=insertProduct parameterType=com.ry.model.Product insert into product (product_no,product_name,product_type,Status) values (#{product_no},#{product_name},#{product_type},#{Status}) /insert delete id=deleteProduct parameterType=com.ry.model.Product delete from product where product_no=#{product_no} /delete update id=updataProduct parameterType=com.ry.model.Product update product set product_no=#{product_no},product_name =#{product_name},product_type=#{product_type},Status =#{Status} /update /mapper MyBatis.xml ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE configuration PUBLIC -////DTD Config 3.0//EN /dtd/mybatis-3-config.dtd configuration environments default=development environment id=development transactionManager type=JDBC / dataSource type=POOLED property name=driver value=com.mysql.jdbc.Driver / property name=url value=jdbc:mysql://localhost:3306/orcl / property name=username value=root / property name=
显示全部
相似文档