master
hjl 9 months ago
commit 3a8c11bc2b

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry including="**/*.java" kind="src" output="WebRoot/WEB-INF/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>

8
.idea/.gitignore vendored

@ -0,0 +1,8 @@
# 默认忽略的文件
/shelf/
/workspace.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="RedWine" />
</profile>
</annotationProcessing>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src" charset="UTF-8" />
</component>
</project>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK" />
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-module
type="WEB"
name="testMaven"
id="myeclipse.1502800787417"
context-root="/test1"
j2ee-spec="5.0"
archive="testMaven.war">
<attributes>
<attribute name="webrootdir" value="WebRoot" />
</attributes>
</project-module>

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>testMaven</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.core.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
<nature>com.genuitec.eclipse.ast.deploy.core.deploymentnature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="WebRoot"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>

@ -0,0 +1,2 @@
eclipse.preferences.version=1
useAssemblyMapping=true

@ -0,0 +1,4 @@
eclipse.preferences.version=1
encoding//WebRoot/resource/user/css/style.css=UTF-8
encoding/<project>=UTF-8
encoding/src=UTF-8

@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="test1-0.0.1-SNAPSHOT">
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/WebRoot" tag="defaultRootSource"/>
<property name="java-output-path" value="/testMaven/WebRoot/WEB-INF/classes"/>
<property name="context-root" value="test1"/>
</wb-module>
</project-modules>

@ -0,0 +1,7 @@
<root>
<facet id="jst.jsf">
<node name="libprov">
<attribute name="provider-id" value="jsf-no-op-library-provider"/>
</node>
</facet>
</root>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.jsf" version="2.2"/>
</faceted-project>

@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

@ -0,0 +1,2 @@
disabled=06target
eclipse.preferences.version=1

@ -0,0 +1,8 @@
#Fri Apr 27 12:46:37 CST 2018
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1

@ -0,0 +1,5 @@
Manifest-Version: 1.0
Created-By: IntelliJ IDEA
Built-By: Administrator
Build-Jdk: 1.8.0_401

@ -0,0 +1,267 @@
<?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.javapandeng.mapper.CarMapper">
<!--实体类与数据库映射字段部分-->
<resultMap id="ResultMapCar" type="com.javapandeng.po.Car">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="itemId" column="item_id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="num" column="num" jdbcType="INTEGER"/>
<result property="price" column="price" jdbcType="DECIMAL"/>
<result property="zk" column="zk" jdbcType="DECIMAL"/>
<result property="total" column="total" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="ResultMapCarDto" type="com.javapandeng.po.Car">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="itemId" column="item_id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="num" column="num" jdbcType="INTEGER"/>
<result property="price" column="price" jdbcType="DECIMAL"/>
<result property="zk" column="zk" jdbcType="DECIMAL"/>
<result property="total" column="total" jdbcType="VARCHAR"/>
<association property="item" column="item_id" select="com.javapandeng.mapper.ItemMapper.load"/>
</resultMap>
<!-- 声明数据库字段 -->
<sql id="Car_field">
id,item_id,user_id,num,price,zk,total
</sql>
<!-- 实体类属性-->
<sql id="Car_insert">
#{id},#{itemId},#{userId},#{num},#{price},#{zk},#{total}
</sql>
<!-- 更新结果 -->
<sql id="Car_update">
<if test="itemId != null">
item_id = #{itemId},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="num != null">
num = #{num},
</if>
<if test="price != null">
price = #{price},
</if>
<if test="zk != null">
zk = #{zk},
</if>
<if test="total != null">
total = #{total},
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Car_where">
<if test="id != null">
and id = #{id}
</if>
<if test="itemId != null">
and item_id = #{itemId}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="num != null">
and num = #{num}
</if>
<if test="price != null">
and price = #{price}
</if>
<if test="zk != null">
and zk = #{zk},
</if>
<if test="total != null">
and total = #{total}
</if>
</sql>
<!-- 新增 -->
<!-- 参数:实体类-->
<!-- 返回:主键 -->
<insert id="insert" parameterType="com.javapandeng.po.Car" useGeneratedKeys="true" keyProperty="id">
insert into car(
<include refid="Car_field"/>
) values(
<include refid="Car_insert"/>
)
</insert>
<!-- 根据实体主键删除一个实体-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from car where id=#{id}
</delete>
<!-- 通过实体删除-->
<delete id="deleteByEntity" parameterType="com.javapandeng.po.Car">
delete from car where 1=1
<include refid="Car_where"/>
</delete>
<!-- 通过map删除 -->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from car where 1=1
<include refid="Car_where"/>
</delete>
<!-- 更新一个实体 -->
<update id="update" parameterType="com.javapandeng.po.Car">
update car
<set>
<include refid="Car_update"/>
</set>
where 1=1
<include refid="Car_where"/>
</update>
<!-- 通过id进行修改-->
<update id="updateById" parameterType="com.javapandeng.po.Car">
update car
<set>
<include refid="Car_update"/>
</set>
where id=#{id}
</update>
<!-- 根据参数查询-->
<select id="listByMap" resultMap="ResultMapCar" parameterType="map">
select <include refid="Car_field"/>
from car where 1=1
<include refid="Car_where"/>
</select>
<!-- 查询整个表 -->
<select id="listAll" resultMap="ResultMapCar">
select <include refid="Car_field"/>
from car
</select>
<!-- 查询所有实体,根据实体属性值为判断条件查询所有实体-->
<select id="listAllByEntity" resultMap="ResultMapCar" parameterType="com.javapandeng.po.Car">
select <include refid="Car_field"/>
from car where 1=1
<include refid="Car_where"/>
</select>
<!-- 根据主键获取一个实体-->
<select id="load" resultMap="ResultMapCar" parameterType="java.lang.Integer">
select <include refid="Car_field"/>
from car where id=#{id}
</select>
<!-- 根据主键获取一个实体-->
<select id="getById" resultMap="ResultMapCar" parameterType="java.lang.Integer">
select <include refid="Car_field"/>
from car where id=#{id}
</select>
<!-- 通过map查询-->
<select id="getByMap" resultMap="ResultMapCar" parameterType="map">
select <include refid="Car_field"/>
from car where 1=1
<include refid="Car_where"/>
</select>
<!--通过对象查询-不分页-->
<select id="getByEntity" resultMap="ResultMapCar" parameterType="com.javapandeng.po.Car">
select <include refid="Car_field"/>
from car where 1=1
<include refid="Car_where"/>
</select>
<!-- 通过map查询分页-->
<select id="findByMap" resultMap="ResultMapCar" parameterType="map">
select <include refid="Car_field"/>
from car where 1=1
<include refid="Car_where"/>
</select>
<!--通过对象查询分页-->
<select id="findByEntity" resultMap="ResultMapCar" parameterType="com.javapandeng.po.Car">
select <include refid="Car_field"/>
from car where 1=1
<include refid="Car_where"/>
</select>
<!-- 批量新增-->
<select id="insertBatch" parameterType="java.util.List">
insert into car(
<include refid="Car_field"/>
) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.item_id},#{item.user_id},#{item.num},#{item.price},#{item.zk},#{item.total})
</foreach>
</select>
<!-- 批量修改-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
update car
<set>
<if test="item.itemId != null">
item_id = #{item.itemId},
</if>
<if test="item.userId != null">
user_id = #{item.userId},
</if>
<if test="item.num != null">
num = #{item.num},
</if>
<if test="item.price != null">
price = #{item.price},
</if>
<if test="item.zk != null">
zk = #{item.zk},
</if>
<if test="item.total != null">
total = #{item.total},
</if>
</set>
where 1=1
<if test="item.id != null">
and id = #{item.id}
</if>
</foreach>
</update>
<!-- 封装纯sql语法-->
<!-- 查询一个对象返回map-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询一个对象返回实体类-->
<select id="getBySqlReturnEntity" resultMap="ResultMapCar">
${sql}
</select>
<!-- 查询一个对象返回map列表-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询列表返回实体-->
<select id="listBySqlReturnEntity" resultMap="ResultMapCarDto">
${sql}
</select>
<!-- 查询分页-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapCarDto">
${sql}
</select>
<!-- 通过sql修改-->
<update id="updateBysql">
${sql}
</update>
<!-- 通过sql删除-->
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,242 @@
<?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.javapandeng.mapper.CommentMapper">
<!--实体类与数据库映射字段部分-->
<resultMap id="ResultMapComment" type="com.javapandeng.po.Comment">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="userId" column="userId" jdbcType="INTEGER"/>
<result property="itemId" column="itemId" jdbcType="INTEGER"/>
<result property="content" column="content" jdbcType="VARCHAR"/>
<result property="addTime" column="addTime" jdbcType="TIMESTAMP"/>
<association property="user" column="user_id" select="com.javapandeng.mapper.UserMapper.load"/>
</resultMap>
<!-- 声明数据库字段 -->
<sql id="Comment_field">
id,user_id,item_id,content,addTime
</sql>
<!-- 实体类属性-->
<sql id="Comment_insert">
#{id},#{userId},#{itemId},#{content},#{addTime}
</sql>
<!-- 更新结果 -->
<sql id="Comment_update">
<if test="userId != null">
user_id = #{userId},
</if>
<if test="itemId != null">
item_id = #{itemId},
</if>
<if test="content != null">
content = #{content},
</if>
<if test="addTime != null">
addTime = #{addTime}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Comment_where">
<if test="id != null">
and id = #{id}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="itemId != null">
and item_id = #{itemId}
</if>
<if test="content != null">
and content = #{content}
</if>
<if test="addTime != null">
and addTime = #{addTime}
</if>
</sql>
<!-- 新增 -->
<!-- 参数:实体类-->
<!-- 返回:主键 -->
<insert id="insert" parameterType="com.javapandeng.po.Comment" useGeneratedKeys="true" keyProperty="id">
insert into comment(
<include refid="Comment_field"/>
) values(
<include refid="Comment_insert"/>
)
</insert>
<!-- 根据实体主键删除一个实体-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from comment where id=#{id}
</delete>
<!-- 通过实体删除-->
<delete id="deleteByEntity" parameterType="com.javapandeng.po.Comment">
delete from comment where 1=1
<include refid="Comment_where"/>
</delete>
<!-- 通过map删除 -->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from comment where 1=1
<include refid="Comment_where"/>
</delete>
<!-- 更新一个实体 -->
<update id="update" parameterType="com.javapandeng.po.Comment">
update comment
<set>
<include refid="Comment_update"/>
</set>
where 1=1
<include refid="Comment_where"/>
</update>
<!-- 通过id进行修改-->
<update id="updateById" parameterType="com.javapandeng.po.Comment">
update comment
<set>
<include refid="Comment_update"/>
</set>
where id=#{id}
</update>
<!-- 根据参数查询-->
<select id="listByMap" resultMap="ResultMapComment" parameterType="map">
select <include refid="Comment_field"/>
from comment where 1=1
<include refid="Comment_where"/>
</select>
<!-- 查询整个表 -->
<select id="listAll" resultMap="ResultMapComment">
select <include refid="Comment_field"/>
from comment
</select>
<!-- 查询所有实体,根据实体属性值为判断条件查询所有实体-->
<select id="listAllByEntity" resultMap="ResultMapComment" parameterType="com.javapandeng.po.Comment">
select <include refid="Comment_field"/>
from comment where 1=1
<include refid="Comment_where"/>
</select>
<!-- 根据主键获取一个实体-->
<select id="load" resultMap="ResultMapComment" parameterType="java.lang.Integer">
select <include refid="Comment_field"/>
from comment where id=#{id}
</select>
<!-- 根据主键获取一个实体-->
<select id="getById" resultMap="ResultMapComment" parameterType="java.lang.Integer">
select <include refid="Comment_field"/>
from comment where id=#{id}
</select>
<!-- 通过map查询-->
<select id="getByMap" resultMap="ResultMapComment" parameterType="map">
select <include refid="Comment_field"/>
from comment where 1=1
<include refid="Comment_where"/>
</select>
<!--通过对象查询-不分页-->
<select id="getByEntity" resultMap="ResultMapComment" parameterType="com.javapandeng.po.Comment">
select <include refid="Comment_field"/>
from comment where 1=1
<include refid="Comment_where"/>
</select>
<!-- 通过map查询分页-->
<select id="findByMap" resultMap="ResultMapComment" parameterType="map">
select <include refid="Comment_field"/>
from comment where 1=1
<include refid="Comment_where"/>
</select>
<!--通过对象查询分页-->
<select id="findByEntity" resultMap="ResultMapComment" parameterType="com.javapandeng.po.Comment">
select <include refid="Comment_field"/>
from comment where 1=1
<include refid="Comment_where"/>
</select>
<!--根据商品id查询对象列表-->
<select id="listByItemId" resultMap="ResultMapComment">
select <include refid="Comment_field"/>
from comment where item_id = #{id} order by id desc
</select>
<!-- 批量新增-->
<select id="insertBatch" parameterType="java.util.List">
insert into comment(
<include refid="Comment_field"/>
) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.userId},#{item.itemId},#{item.content},#{item.addTime})
</foreach>
</select>
<!-- 批量修改-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
update comment
<set>
<if test="item.userId != null">
user_id = #{item.userId},
</if>
<if test="item.itemId != null">
item_id = #{item.itemId},
</if>
<if test="item.content != null">
content = #{item.content},
</if>
<if test="item.addTime != null">
addTime = #{item.addTime}
</if>
</set>
where 1=1
<if test="item.id != null">
and id = #{item.id}
</if>
</foreach>
</update>
<!-- 封装纯sql语法-->
<!-- 查询一个对象返回map-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询一个对象返回实体类-->
<select id="getBySqlReturnEntity" resultMap="ResultMapComment">
${sql}
</select>
<!-- 查询一个对象返回map列表-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询列表返回实体-->
<select id="listBySqlReturnEntity" resultMap="ResultMapComment">
${sql}
</select>
<!-- 查询分页-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapComment">
${sql}
</select>
<!-- 通过sql修改-->
<update id="updateBysql">
${sql}
</update>
<!-- 通过sql删除-->
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,225 @@
<?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.javapandeng.mapper.ItemCategoryMapper">
<!--实体类与数据库映射字段部分-->
<resultMap id="ResultMapItemCategory" type="com.javapandeng.po.ItemCategory">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="pid" column="pid" jdbcType="INTEGER"/>
<result property="isDelete" column="isDelete" jdbcType="INTEGER"/>
</resultMap>
<!-- 声明数据库字段 -->
<sql id="ItemCategory_field">
id,name,pid,isDelete
</sql>
<!-- 实体类属性-->
<sql id="ItemCategory_insert">
#{id},#{name},#{pid},#{isDelete}
</sql>
<!-- 更新结果 -->
<sql id="ItemCategory_update">
<if test="name != null">
name = #{name},
</if>
<if test="pid != null">
pid = #{pid},
</if>
<if test="isDelete != null">
isDelete = #{isDelete}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="ItemCategory_where">
<if test="id != null">
and id = #{id}
</if>
<if test="name != null">
and name = #{name}
</if>
<if test="pid != null">
and pid = #{pid}
</if>
<if test="isDelete != null">
and isDelete = #{isDelete}
</if>
</sql>
<!-- 新增 -->
<!-- 参数:实体类-->
<!-- 返回:主键 -->
<insert id="insert" parameterType="com.javapandeng.po.ItemCategory" useGeneratedKeys="true" keyProperty="id">
insert into item_category(
<include refid="ItemCategory_field"/>
) values(
<include refid="ItemCategory_insert"/>
)
</insert>
<!-- 根据实体主键删除一个实体-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from item_category where id=#{id}
</delete>
<!-- 通过实体删除-->
<delete id="deleteByEntity" parameterType="com.javapandeng.po.ItemCategory">
delete from item_category where 1=1
<include refid="ItemCategory_where"/>
</delete>
<!-- 通过map删除 -->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from item_category where 1=1
<include refid="ItemCategory_where"/>
</delete>
<!-- 更新一个实体 -->
<update id="update" parameterType="com.javapandeng.po.ItemCategory">
update item_category
<set>
<include refid="ItemCategory_update"/>
</set>
where 1=1
<include refid="ItemCategory_where"/>
</update>
<!-- 通过id进行修改-->
<update id="updateById" parameterType="com.javapandeng.po.ItemCategory">
update item_category
<set>
<include refid="ItemCategory_update"/>
</set>
where id=#{id}
</update>
<!-- 根据参数查询-->
<select id="listByMap" resultMap="ResultMapItemCategory" parameterType="map">
select <include refid="ItemCategory_field"/>
from item_category where 1=1
<include refid="ItemCategory_where"/>
</select>
<!-- 查询整个表 -->
<select id="listAll" resultMap="ResultMapItemCategory">
select <include refid="ItemCategory_field"/>
from item_category
</select>
<!-- 查询所有实体,根据实体属性值为判断条件查询所有实体-->
<select id="listAllByEntity" resultMap="ResultMapItemCategory" parameterType="com.javapandeng.po.ItemCategory">
select <include refid="ItemCategory_field"/>
from item_category where 1=1
<include refid="ItemCategory_where"/>
</select>
<!-- 根据主键获取一个实体-->
<select id="load" resultMap="ResultMapItemCategory" parameterType="java.lang.Integer">
select <include refid="ItemCategory_field"/>
from item_category where id=#{id}
</select>
<!-- 根据主键获取一个实体-->
<select id="getById" resultMap="ResultMapItemCategory" parameterType="java.lang.Integer">
select <include refid="ItemCategory_field"/>
from item_category where id=#{id}
</select>
<!-- 通过map查询-->
<select id="getByMap" resultMap="ResultMapItemCategory" parameterType="map">
select <include refid="ItemCategory_field"/>
from item_category where 1=1
<include refid="ItemCategory_where"/>
</select>
<!--通过对象查询-不分页-->
<select id="getByEntity" resultMap="ResultMapItemCategory" parameterType="com.javapandeng.po.ItemCategory">
select <include refid="ItemCategory_field"/>
from item_category where 1=1
<include refid="ItemCategory_where"/>
</select>
<!-- 通过map查询分页-->
<select id="findByMap" resultMap="ResultMapItemCategory" parameterType="map">
select <include refid="ItemCategory_field"/>
from item_category where 1=1
<include refid="ItemCategory_where"/>
</select>
<!--通过对象查询分页-->
<select id="findByEntity" resultMap="ResultMapItemCategory" parameterType="com.javapandeng.po.ItemCategory">
select <include refid="ItemCategory_field"/>
from item_category where 1=1
<include refid="ItemCategory_where"/>
</select>
<!-- 批量新增-->
<select id="insertBatch" parameterType="java.util.List">
insert into item_category(
<include refid="ItemCategory_field"/>
) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.name},#{item.pid},#{item.isDelete})
</foreach>
</select>
<!-- 批量修改-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
update item_category
<set>
<if test="item.name != null">
name = #{item.name},
</if>
<if test="item.pid != null">
pid = #{item.pid},
</if>
<if test="item.isDelete != null">
isDelete = #{item.isDelete}
</if>
</set>
where 1=1
<if test="item.id != null">
and id = #{item.id}
</if>
</foreach>
</update>
<!-- 封装纯sql语法-->
<!-- 查询一个对象返回map-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询一个对象返回实体类-->
<select id="getBySqlReturnEntity" resultMap="ResultMapItemCategory">
${sql}
</select>
<!-- 查询一个对象返回map列表-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询列表返回实体-->
<select id="listBySqlReturnEntity" resultMap="ResultMapItemCategory">
${sql}
</select>
<!-- 查询分页-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapItemCategory">
${sql}
</select>
<!-- 通过sql修改-->
<update id="updateBysql">
${sql}
</update>
<!-- 通过sql删除-->
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,410 @@
<?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.javapandeng.mapper.ItemMapper">
<!--实体类与数据库映射字段部分-->
<resultMap id="ResultMapItem" type="com.javapandeng.po.Item">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="price" column="price" jdbcType="VARCHAR"/>
<result property="zk" column="zk" jdbcType="INTEGER"/>
<result property="scNum" column="scNum" jdbcType="INTEGER"/>
<result property="gmNum" column="gmNum" jdbcType="INTEGER"/>
<result property="url1" column="url1" jdbcType="VARCHAR"/>
<result property="url2" column="url2" jdbcType="VARCHAR"/>
<result property="url3" column="url3" jdbcType="VARCHAR"/>
<result property="url4" column="url4" jdbcType="VARCHAR"/>
<result property="url5" column="url5" jdbcType="VARCHAR"/>
<result property="ms" column="ms" jdbcType="VARCHAR"/>
<result property="pam1" column="pam1" jdbcType="VARCHAR"/>
<result property="pam2" column="pam2" jdbcType="VARCHAR"/>
<result property="pam3" column="pam3" jdbcType="VARCHAR"/>
<result property="val1" column="val1" jdbcType="VARCHAR"/>
<result property="val2" column="val2" jdbcType="VARCHAR"/>
<result property="val3" column="val3" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="INTEGER"/>
<result property="categoryIdOne" column="category_id_one" jdbcType="INTEGER"/>
<result property="categoryIdTwo" column="category_id_two" jdbcType="INTEGER"/>
<result property="isDelete" column="isDelete" jdbcType="INTEGER"/>
<association property="yiji" column="category_id_one" select="com.javapandeng.mapper.ItemCategoryMapper.load"/>
<association property="erji" column="category_id_two" select="com.javapandeng.mapper.ItemCategoryMapper.load"/>
<collection property="pls" column="id" ofType="com.javapandeng.po.Comment" select="com.javapandeng.mapper.CommentMapper.listByItemId"/>
</resultMap>
<!-- 声明数据库字段 -->
<sql id="Item_field">
id,name,price,zk,scNum,gmNum,url1,url2,url3,url4,url5,ms,pam1,pam2,pam3,val1,val2,val3,type,category_id_one,category_id_two,isDelete
</sql>
<!-- 实体类属性-->
<sql id="Item_insert">
#{id},#{name},#{price},#{zk},#{scNum},#{gmNum},#{url1},#{url2},#{url3},#{url4},#{url5},#{ms},#{pam1},#{pam2},#{pam3},
#{val1},#{val2},#{val3},#{type},#{categoryIdOne},#{categoryIdTwo},#{isDelete}
</sql>
<!-- 更新结果 -->
<sql id="Item_update">
<if test="name != null">
name = #{name},
</if>
<if test="price != null">
price = #{price},
</if>
<if test="zk != null">
zk = #{zk},
</if>
<if test="scNum != null">
scNum = #{scNum},
</if>
<if test="gmNum != null">
gmNum = #{gmNum},
</if>
<if test="url1 != null">
url1 = #{url1},
</if>
<if test="url2 != null">
url2 = #{url2},
</if>
<if test="url3 != null">
url3 = #{url3},
</if>
<if test="url4 != null">
url4 = #{url4},
</if>
<if test="url5 != null">
url5 = #{url5},
</if>
<if test="ms != null">
ms = #{ms},
</if>
<if test="pam1 != null">
pam1 = #{pam1},
</if>
<if test="pam2 != null">
pam2 = #{pam2},
</if>
<if test="pam3 != null">
pam3 = #{pam3},
</if>
<if test="val1 != null">
val1 = #{val1},
</if>
<if test="val2 != null">
val2 = #{val2},
</if>
<if test="val3 != null">
val3 = #{val3},
</if>
<if test="type != null">
type = #{type},
</if>
<if test="categoryIdOne != null">
category_id_one = #{categoryIdOne},
</if>
<if test="categoryIdTwo != null">
category_id_two = #{categoryIdTwo},
</if>
<if test="isDelete != null">
isDelete = #{isDelete}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Item_where">
<if test="id != null">
and id = #{id}
</if>
<if test="name != null">
and name = #{name}
</if>
<if test="price != null">
and price = #{price}
</if>
<if test="zk != null">
and zk = #{zk}
</if>
<if test="scNum != null">
and scNum = #{scNum}
</if>
<if test="gmNum != null">
and gmNum = #{gmNum}
</if>
<if test="url1 != null">
and url1 = #{url1}
</if>
<if test="url2 != null">
and url2 = #{url2}
</if>
<if test="url3 != null">
and url3 = #{url3}
</if>
<if test="url4 != null">
and url4 = #{url4}
</if>
<if test="url5 != null">
and url5 = #{url5}
</if>
<if test="ms != null">
and ms = #{ms}
</if>
<if test="pam1 != null">
and pam1 = #{pam1}
</if>
<if test="pam2 != null">
and pam2 = #{pam2}
</if>
<if test="pam3 != null">
and pam3 = #{pam3}
</if>
<if test="val1 != null">
and val1 = #{val1}
</if>
<if test="val2 != null">
and val2 = #{val2}
</if>
<if test="val3 != null">
and val3 = #{val3}
</if>
<if test="type != null">
and type = #{type}
</if>
<if test="categoryIdOne != null">
and category_id_one = #{categoryIdOne}
</if>
<if test="categoryIdTwo != null">
and category_id_two = #{categoryIdTwo}
</if>
<if test="isDelete != null">
and isDelete = #{isDelete}
</if>
</sql>
<!-- 新增 -->
<!-- 参数:实体类-->
<!-- 返回:主键 -->
<insert id="insert" parameterType="com.javapandeng.po.Item" useGeneratedKeys="true" keyProperty="id">
insert into item(
<include refid="Item_field"/>
) values(
<include refid="Item_insert"/>
)
</insert>
<!-- 根据实体主键删除一个实体-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from item where id=#{id}
</delete>
<!-- 通过实体删除-->
<delete id="deleteByEntity" parameterType="com.javapandeng.po.Item">
delete from item where 1=1
<include refid="Item_where"/>
</delete>
<!-- 通过map删除 -->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from item where 1=1
<include refid="Item_where"/>
</delete>
<!-- 更新一个实体 -->
<update id="update" parameterType="com.javapandeng.po.Item">
update item
<set>
<include refid="Item_update"/>
</set>
where 1=1
<include refid="Item_where"/>
</update>
<!-- 通过id进行修改-->
<update id="updateById" parameterType="com.javapandeng.po.Item">
update item
<set>
<include refid="Item_update"/>
</set>
where id=#{id}
</update>
<!-- 根据参数查询-->
<select id="listByMap" resultMap="ResultMapItem" parameterType="map">
select <include refid="Item_field"/>
from item where 1=1
<include refid="Item_where"/>
</select>
<!-- 查询整个表 -->
<select id="listAll" resultMap="ResultMapItem">
select <include refid="Item_field"/>
from item
</select>
<!-- 查询所有实体,根据实体属性值为判断条件查询所有实体-->
<select id="listAllByEntity" resultMap="ResultMapItem" parameterType="com.javapandeng.po.Item">
select <include refid="Item_field"/>
from item where 1=1
<include refid="Item_where"/>
</select>
<!-- 根据主键获取一个实体-->
<select id="load" resultMap="ResultMapItem" parameterType="java.lang.Integer">
select <include refid="Item_field"/>
from item where id=#{id}
</select>
<!-- 根据主键获取一个实体-->
<select id="getById" resultMap="ResultMapItem" parameterType="java.lang.Integer">
select <include refid="Item_field"/>
from item where id=#{id}
</select>
<!-- 通过map查询-->
<select id="getByMap" resultMap="ResultMapItem" parameterType="map">
select <include refid="Item_field"/>
from item where 1=1
<include refid="Item_where"/>
</select>
<!--通过对象查询-不分页-->
<select id="getByEntity" resultMap="ResultMapItem" parameterType="com.javapandeng.po.Item">
select <include refid="Item_field"/>
from item where 1=1
<include refid="Item_where"/>
</select>
<!-- 通过map查询分页-->
<select id="findByMap" resultMap="ResultMapItem" parameterType="map">
select <include refid="Item_field"/>
from item where 1=1
<include refid="Item_where"/>
</select>
<!--通过对象查询分页-->
<select id="findByEntity" resultMap="ResultMapItem" parameterType="com.javapandeng.po.Item">
select <include refid="Item_field"/>
from item where 1=1
<include refid="Item_where"/>
</select>
<!-- 批量新增-->
<select id="insertBatch" parameterType="java.util.List">
insert into item(
<include refid="Item_field"/>
) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.name},#{item.price},#{item.zk},#{item.scNum},#{item.gmNum},#{item.url1},#{item.url2},#{item.url3},#{item.url4},#{item.url5},#{item.ms},#{item.pam1},#{item.pam2},#{item.pam3},
#{val1},#{item.val2},#{item.val3},#{item.type},#{item.categoryIdOne},#{item.categoryIdTwo},#{item.isDelete})
</foreach>
</select>
<!-- 批量修改-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
update item
<set>
<if test="item.name != null">
name = #{item.name},
</if>
<if test="item.price != null">
price = #{item.price},
</if>
<if test="item.zk != null">
zk = #{item.zk},
</if>
<if test="item.scNum != null">
scNum = #{item.scNum},
</if>
<if test="item.gmNum != null">
gmNum = #{item.gmNum},
</if>
<if test="item.url1 != null">
url1 = #{item.url1},
</if>
<if test="item.url2 != null">
url2 = #{item.url2},
</if>
<if test="item.url3 != null">
url3 = #{item.url3},
</if>
<if test="item.url4 != null">
url4 = #{item.url4},
</if>
<if test="item.url5 != null">
url5 = #{item.url5},
</if>
<if test="item.ms != null">
ms = #{item.ms},
</if>
<if test="item.pam1 != null">
pam1 = #{item.pam1},
</if>
<if test="item.pam2 != null">
pam2 = #{item.pam2},
</if>
<if test="item.pam3 != null">
pam3 = #{item.pam3},
</if>
<if test="item.val1 != null">
val1 = #{item.val1},
</if>
<if test="item.val2 != null">
val2 = #{item.val2},
</if>
<if test="item.val3 != null">
val3 = #{item.val3},
</if>
<if test="item.type != null">
type = #{item.type},
</if>
<if test="item.categoryIdOne != null">
category_id_one = #{item.categoryIdOne},
</if>
<if test="item.categoryIdTwo != null">
category_id_two = #{item.categoryIdTwo},
</if>
<if test="item.isDelete != null">
isDelete = #{item.isDelete}
</if>
</set>
where 1=1
<if test="item.id != null">
and id = #{item.id}
</if>
</foreach>
</update>
<!-- 封装纯sql语法-->
<!-- 查询一个对象返回map-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询一个对象返回实体类-->
<select id="getBySqlReturnEntity" resultMap="ResultMapItem">
${sql}
</select>
<!-- 查询一个对象返回map列表-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询列表返回实体-->
<select id="listBySqlReturnEntity" resultMap="ResultMapItem">
${sql}
</select>
<!-- 查询分页-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapItem">
${sql}
</select>
<!-- 通过sql修改-->
<update id="updateBysql">
${sql}
</update>
<!-- 通过sql删除-->
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,278 @@
<?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.javapandeng.mapper.ItemOrderMapper">
<!--实体类与数据库映射字段部分-->
<resultMap id="ResultMapItemOrder" type="com.javapandeng.po.ItemOrder">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="itemId" column="item_id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="addTime" column="addTime" jdbcType="TIMESTAMP"/>
<result property="total" column="total" jdbcType="VARCHAR"/>
<result property="isDelete" column="isDelete" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
</resultMap>
<resultMap id="ResultMapItemOrderDto" type="com.javapandeng.po.ItemOrder">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="itemId" column="item_id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="addTime" column="addTime" jdbcType="TIMESTAMP"/>
<result property="total" column="total" jdbcType="VARCHAR"/>
<result property="isDelete" column="isDelete" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<association property="user" column="user_id" select="com.javapandeng.mapper.UserMapper.load"/>
<collection property="details" column="id" ofType="com.javapandeng.po.OrderDetail" select="com.javapandeng.mapper.OrderDetailMapper.listByOrderId"/>
</resultMap>
<!-- 声明数据库字段 -->
<sql id="ItemOrder_field">
id,item_id,user_id,code,addTime,total,isDelete,status
</sql>
<!-- 实体类属性-->
<sql id="ItemOrder_insert">
#{id},#{itemId},#{userId},#{code},#{addTime},#{total},#{isDelete},#{status}
</sql>
<!-- 更新结果 -->
<sql id="ItemOrder_update">
<if test="itemId != null">
item_id = #{itemId},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="code != null">
code = #{code},
</if>
<if test="addTime != null">
addTime = #{addTime},
</if>
<if test="total != null">
total = #{total},
</if>
<if test="isDelete != null">
isDelete = #{isDelete},
</if>
<if test="status != null">
status = #{status}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="ItemOrder_where">
<if test="id != null">
and id = #{id}
</if>
<if test="itemId != null">
and item_id = #{itemId}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="code != null">
and code = #{code}
</if>
<if test="addTime != null">
and addTime = #{addTime}
</if>
<if test="total != null">
and total = #{total}
</if>
<if test="isDelete != null">
and isDelete = #{isDelete}
</if>
<if test="status != null">
and status = #{status}
</if>
</sql>
<!-- 新增 -->
<!-- 参数:实体类-->
<!-- 返回:主键 -->
<insert id="insert" parameterType="com.javapandeng.po.ItemOrder" useGeneratedKeys="true" keyProperty="id">
insert into item_order(
<include refid="ItemOrder_field"/>
) values(
<include refid="ItemOrder_insert"/>
)
</insert>
<!-- 根据实体主键删除一个实体-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from item_order where id=#{id}
</delete>
<!-- 通过实体删除-->
<delete id="deleteByEntity" parameterType="com.javapandeng.po.ItemOrder">
delete from item_order where 1=1
<include refid="ItemOrder_where"/>
</delete>
<!-- 通过map删除 -->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from item_order where 1=1
<include refid="ItemOrder_where"/>
</delete>
<!-- 更新一个实体 -->
<update id="update" parameterType="com.javapandeng.po.ItemOrder">
update item_order
<set>
<include refid="ItemOrder_update"/>
</set>
where 1=1
<include refid="ItemOrder_where"/>
</update>
<!-- 通过id进行修改-->
<update id="updateById" parameterType="com.javapandeng.po.ItemOrder">
update item_order
<set>
<include refid="ItemOrder_update"/>
</set>
where id=#{id}
</update>
<!-- 根据参数查询-->
<select id="listByMap" resultMap="ResultMapItemOrder" parameterType="map">
select <include refid="ItemOrder_field"/>
from item_order where 1=1
<include refid="ItemOrder_where"/>
</select>
<!-- 查询整个表 -->
<select id="listAll" resultMap="ResultMapItemOrder">
select <include refid="ItemOrder_field"/>
from item_order
</select>
<!-- 查询所有实体,根据实体属性值为判断条件查询所有实体-->
<select id="listAllByEntity" resultMap="ResultMapItemOrder" parameterType="com.javapandeng.po.ItemOrder">
select <include refid="ItemOrder_field"/>
from item_order where 1=1
<include refid="ItemOrder_where"/>
</select>
<!-- 根据主键获取一个实体-->
<select id="load" resultMap="ResultMapItemOrder" parameterType="java.lang.Integer">
select <include refid="ItemOrder_field"/>
from item_order where id=#{id}
</select>
<!-- 根据主键获取一个实体-->
<select id="getById" resultMap="ResultMapItemOrder" parameterType="java.lang.Integer">
select <include refid="ItemOrder_field"/>
from item_order where id=#{id}
</select>
<!-- 通过map查询-->
<select id="getByMap" resultMap="ResultMapItemOrder" parameterType="map">
select <include refid="ItemOrder_field"/>
from item_order where 1=1
<include refid="ItemOrder_where"/>
</select>
<!--通过对象查询-不分页-->
<select id="getByEntity" resultMap="ResultMapItemOrder" parameterType="com.javapandeng.po.ItemOrder">
select <include refid="ItemOrder_field"/>
from item_order where 1=1
<include refid="ItemOrder_where"/>
</select>
<!-- 通过map查询分页-->
<select id="findByMap" resultMap="ResultMapItemOrder" parameterType="map">
select <include refid="ItemOrder_field"/>
from item_order where 1=1
<include refid="ItemOrder_where"/>
</select>
<!--通过对象查询分页-->
<select id="findByEntity" resultMap="ResultMapItemOrder" parameterType="com.javapandeng.po.ItemOrder">
select <include refid="ItemOrder_field"/>
from item_order where 1=1
<include refid="ItemOrder_where"/>
</select>
<!-- 批量新增-->
<select id="insertBatch" parameterType="java.util.List">
insert into item_order(
<include refid="ItemOrder_field"/>
) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.itemId},#{item.userId},#{item.code},#{item.addTime},#{item.total},#{item.isDelete},#{item.status})
</foreach>
</select>
<!-- 批量修改-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
update item_order
<set>
<if test="item.itemId != null">
item_id = #{item.itemId},
</if>
<if test="item.userId != null">
user_id = #{item.userId},
</if>
<if test="item.code != null">
code = #{item.code},
</if>
<if test="item.addTime != null">
addTime = #{item.addTime},
</if>
<if test="item.total != null">
total = #{item.total},
</if>
<if test="item.isDelete != null">
isDelete = #{item.isDelete},
</if>
<if test="item.status != null">
status = #{item.status}
</if>
</set>
where 1=1
<if test="item.id != null">
and id = #{item.id}
</if>
</foreach>
</update>
<!-- 封装纯sql语法-->
<!-- 查询一个对象返回map-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询一个对象返回实体类-->
<select id="getBySqlReturnEntity" resultMap="ResultMapItemOrder">
${sql}
</select>
<!-- 查询一个对象返回map列表-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询列表返回实体-->
<select id="listBySqlReturnEntity" resultMap="ResultMapItemOrderDto">
${sql}
</select>
<!-- 查询分页-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapItemOrderDto">
${sql}
</select>
<!-- 通过sql修改-->
<update id="updateBysql">
${sql}
</update>
<!-- 通过sql删除-->
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,225 @@
<?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.javapandeng.mapper.ManageMapper">
<!--实体类与数据库映射字段部分-->
<resultMap id="ResultMapManage" type="com.javapandeng.po.Manage">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="userName" column="userName" jdbcType="VARCHAR"/>
<result property="passWord" column="passWord" jdbcType="VARCHAR"/>
<result property="realName" column="realName" jdbcType="VARCHAR"/>
</resultMap>
<!-- 声明数据库字段 -->
<sql id="Manage_field">
id,userName,passWord,realName
</sql>
<!-- 实体类属性-->
<sql id="Manage_insert">
#{id},#{userName},#{passWord},#{realName}
</sql>
<!-- 更新结果 -->
<sql id="Manage_update">
<if test="userName != null">
userName = #{userName},
</if>
<if test="passWord != null">
passWord = #{passWord},
</if>
<if test="realName != null">
realName = #{realName}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Manage_where">
<if test="id != null">
and id = #{id}
</if>
<if test="userName != null">
and userName = #{userName}
</if>
<if test="passWord != null">
and passWord = #{passWord}
</if>
<if test="realName != null">
and realName = #{realName}
</if>
</sql>
<!-- 新增 -->
<!-- 参数:实体类-->
<!-- 返回:主键 -->
<insert id="insert" parameterType="com.javapandeng.po.Manage" useGeneratedKeys="true" keyProperty="id">
insert into manage(
<include refid="Manage_field"/>
) values(
<include refid="Manage_insert"/>
)
</insert>
<!-- 根据实体主键删除一个实体-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from manage where id=#{id}
</delete>
<!-- 通过实体删除-->
<delete id="deleteByEntity" parameterType="com.javapandeng.po.Manage">
delete from manage where 1=1
<include refid="Manage_where"/>
</delete>
<!-- 通过map删除 -->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from manage where 1=1
<include refid="Manage_where"/>
</delete>
<!-- 更新一个实体 -->
<update id="update" parameterType="com.javapandeng.po.Manage">
update manage
<set>
<include refid="Manage_update"/>
</set>
where 1=1
<include refid="Manage_where"/>
</update>
<!-- 通过id进行修改-->
<update id="updateById" parameterType="com.javapandeng.po.Manage">
update manage
<set>
<include refid="Manage_update"/>
</set>
where id=#{id}
</update>
<!-- 根据参数查询-->
<select id="listByMap" resultMap="ResultMapManage" parameterType="map">
select <include refid="Manage_field"/>
from manage where 1=1
<include refid="Manage_where"/>
</select>
<!-- 查询整个表 -->
<select id="listAll" resultMap="ResultMapManage">
select <include refid="Manage_field"/>
from manage
</select>
<!-- 查询所有实体,根据实体属性值为判断条件查询所有实体-->
<select id="listAllByEntity" resultMap="ResultMapManage" parameterType="com.javapandeng.po.Manage">
select <include refid="Manage_field"/>
from manage where 1=1
<include refid="Manage_where"/>
</select>
<!-- 根据主键获取一个实体-->
<select id="load" resultMap="ResultMapManage" parameterType="java.lang.Integer">
select <include refid="Manage_field"/>
from manage where id=#{id}
</select>
<!-- 根据主键获取一个实体-->
<select id="getById" resultMap="ResultMapManage" parameterType="java.lang.Integer">
select <include refid="Manage_field"/>
from manage where id=#{id}
</select>
<!-- 通过map查询-->
<select id="getByMap" resultMap="ResultMapManage" parameterType="map">
select <include refid="Manage_field"/>
from manage where 1=1
<include refid="Manage_where"/>
</select>
<!--通过对象查询-不分页-->
<select id="getByEntity" resultMap="ResultMapManage" parameterType="com.javapandeng.po.Manage">
select <include refid="Manage_field"/>
from manage where 1=1
<include refid="Manage_where"/>
</select>
<!-- 通过map查询分页-->
<select id="findByMap" resultMap="ResultMapManage" parameterType="map">
select <include refid="Manage_field"/>
from manage where 1=1
<include refid="Manage_where"/>
</select>
<!--通过对象查询分页-->
<select id="findByEntity" resultMap="ResultMapManage" parameterType="com.javapandeng.po.Manage">
select <include refid="Manage_field"/>
from manage where 1=1
<include refid="Manage_where"/>
</select>
<!-- 批量新增-->
<select id="insertBatch" parameterType="java.util.List">
insert into manage(
<include refid="Manage_field"/>
) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.userName},#{item.passWord},#{item.realName})
</foreach>
</select>
<!-- 批量修改-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
update manage
<set>
<if test="item.userName != null">
userName = #{item.userName},
</if>
<if test="item.passWord != null">
passWord = #{item.passWord},
</if>
<if test="item.realName != null">
realName = #{item.realName}
</if>
</set>
where 1=1
<if test="item.id != null">
and id = #{item.id}
</if>
</foreach>
</update>
<!-- 封装纯sql语法-->
<!-- 查询一个对象返回map-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询一个对象返回实体类-->
<select id="getBySqlReturnEntity" resultMap="ResultMapManage">
${sql}
</select>
<!-- 查询一个对象返回map列表-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询列表返回实体-->
<select id="listBySqlReturnEntity" resultMap="ResultMapManage">
${sql}
</select>
<!-- 查询分页-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapManage">
${sql}
</select>
<!-- 通过sql修改-->
<update id="updateBysql">
${sql}
</update>
<!-- 通过sql删除-->
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,225 @@
<?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.javapandeng.mapper.MessageMapper">
<!--实体类与数据库映射字段部分-->
<resultMap id="ResultMapMessage" type="com.javapandeng.po.Message">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="content" column="content" jdbcType="VARCHAR"/>
<result property="phone" column="phone" jdbcType="VARCHAR"/>
</resultMap>
<!-- 声明数据库字段 -->
<sql id="Message_field">
id,name,content,phone
</sql>
<!-- 实体类属性-->
<sql id="Message_insert">
#{id},#{name},#{content},#{phone}
</sql>
<!-- 更新结果 -->
<sql id="Message_update">
<if test="name != null">
name = #{name},
</if>
<if test="content != null">
content = #{content},
</if>
<if test="phone != null">
phone = #{phone}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Message_where">
<if test="id != null">
and id = #{id}
</if>
<if test="name != null">
and name = #{name}
</if>
<if test="content != null">
and content = #{content}
</if>
<if test="phone != null">
and phone = #{phone}
</if>
</sql>
<!-- 新增 -->
<!-- 参数:实体类-->
<!-- 返回:主键 -->
<insert id="insert" parameterType="com.javapandeng.po.Message" useGeneratedKeys="true" keyProperty="id">
insert into message(
<include refid="Message_field"/>
) values(
<include refid="Message_insert"/>
)
</insert>
<!-- 根据实体主键删除一个实体-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from message where id=#{id}
</delete>
<!-- 通过实体删除-->
<delete id="deleteByEntity" parameterType="com.javapandeng.po.Message">
delete from message where 1=1
<include refid="Message_where"/>
</delete>
<!-- 通过map删除 -->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from message where 1=1
<include refid="Message_where"/>
</delete>
<!-- 更新一个实体 -->
<update id="update" parameterType="com.javapandeng.po.Message">
update message
<set>
<include refid="Message_update"/>
</set>
where 1=1
<include refid="Message_where"/>
</update>
<!-- 通过id进行修改-->
<update id="updateById" parameterType="com.javapandeng.po.Message">
update message
<set>
<include refid="Message_update"/>
</set>
where id=#{id}
</update>
<!-- 根据参数查询-->
<select id="listByMap" resultMap="ResultMapMessage" parameterType="map">
select <include refid="Message_field"/>
from message where 1=1
<include refid="Message_where"/>
</select>
<!-- 查询整个表 -->
<select id="listAll" resultMap="ResultMapMessage">
select <include refid="Message_field"/>
from message
</select>
<!-- 查询所有实体,根据实体属性值为判断条件查询所有实体-->
<select id="listAllByEntity" resultMap="ResultMapMessage" parameterType="com.javapandeng.po.Message">
select <include refid="Message_field"/>
from message where 1=1
<include refid="Message_where"/>
</select>
<!-- 根据主键获取一个实体-->
<select id="load" resultMap="ResultMapMessage" parameterType="java.lang.Integer">
select <include refid="Message_field"/>
from message where id=#{id}
</select>
<!-- 根据主键获取一个实体-->
<select id="getById" resultMap="ResultMapMessage" parameterType="java.lang.Integer">
select <include refid="Message_field"/>
from message where id=#{id}
</select>
<!-- 通过map查询-->
<select id="getByMap" resultMap="ResultMapMessage" parameterType="map">
select <include refid="Message_field"/>
from message where 1=1
<include refid="Message_where"/>
</select>
<!--通过对象查询-不分页-->
<select id="getByEntity" resultMap="ResultMapMessage" parameterType="com.javapandeng.po.Message">
select <include refid="Message_field"/>
from message where 1=1
<include refid="Message_where"/>
</select>
<!-- 通过map查询分页-->
<select id="findByMap" resultMap="ResultMapMessage" parameterType="map">
select <include refid="Message_field"/>
from message where 1=1
<include refid="Message_where"/>
</select>
<!--通过对象查询分页-->
<select id="findByEntity" resultMap="ResultMapMessage" parameterType="com.javapandeng.po.Message">
select <include refid="Message_field"/>
from message where 1=1
<include refid="Message_where"/>
</select>
<!-- 批量新增-->
<select id="insertBatch" parameterType="java.util.List">
insert into message(
<include refid="Message_field"/>
) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.name},#{item.content},#{item.phone})
</foreach>
</select>
<!-- 批量修改-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
update message
<set>
<if test="item.name != null">
name = #{item.name},
</if>
<if test="item.content != null">
content = #{item.content},
</if>
<if test="item.phone != null">
phone = #{item.phone}
</if>
</set>
where 1=1
<if test="item.id != null">
and id = #{item.id}
</if>
</foreach>
</update>
<!-- 封装纯sql语法-->
<!-- 查询一个对象返回map-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询一个对象返回实体类-->
<select id="getBySqlReturnEntity" resultMap="ResultMapMessage">
${sql}
</select>
<!-- 查询一个对象返回map列表-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询列表返回实体-->
<select id="listBySqlReturnEntity" resultMap="ResultMapMessage">
${sql}
</select>
<!-- 查询分页-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapMessage">
${sql}
</select>
<!-- 通过sql修改-->
<update id="updateBysql">
${sql}
</update>
<!-- 通过sql删除-->
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,225 @@
<?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.javapandeng.mapper.NewsMapper">
<!--实体类与数据库映射字段部分-->
<resultMap id="ResultMapNews" type="com.javapandeng.po.News">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="content" column="content" jdbcType="VARCHAR"/>
<result property="addTime" column="addTime" jdbcType="TIMESTAMP"/>
</resultMap>
<!-- 声明数据库字段 -->
<sql id="News_field">
id,name,content,addTime
</sql>
<!-- 实体类属性-->
<sql id="News_insert">
#{id},#{name},#{content},#{addTime}
</sql>
<!-- 更新结果 -->
<sql id="News_update">
<if test="name != null">
name = #{name},
</if>
<if test="content != null">
content = #{content},
</if>
<if test="addTime != null">
addTime = #{addTime}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="News_where">
<if test="id != null">
and id = #{id}
</if>
<if test="name != null">
and name = #{name}
</if>
<if test="content != null">
and content = #{content}
</if>
<if test="addTime != null">
and addTime = #{addTime}
</if>
</sql>
<!-- 新增 -->
<!-- 参数:实体类-->
<!-- 返回:主键 -->
<insert id="insert" parameterType="com.javapandeng.po.News" useGeneratedKeys="true" keyProperty="id">
insert into news(
<include refid="News_field"/>
) values(
<include refid="News_insert"/>
)
</insert>
<!-- 根据实体主键删除一个实体-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from news where id=#{id}
</delete>
<!-- 通过实体删除-->
<delete id="deleteByEntity" parameterType="com.javapandeng.po.News">
delete from news where 1=1
<include refid="News_where"/>
</delete>
<!-- 通过map删除 -->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from news where 1=1
<include refid="News_where"/>
</delete>
<!-- 更新一个实体 -->
<update id="update" parameterType="com.javapandeng.po.News">
update news
<set>
<include refid="News_update"/>
</set>
where 1=1
<include refid="News_where"/>
</update>
<!-- 通过id进行修改-->
<update id="updateById" parameterType="com.javapandeng.po.News">
update news
<set>
<include refid="News_update"/>
</set>
where id=#{id}
</update>
<!-- 根据参数查询-->
<select id="listByMap" resultMap="ResultMapNews" parameterType="map">
select <include refid="News_field"/>
from news where 1=1
<include refid="News_where"/>
</select>
<!-- 查询整个表 -->
<select id="listAll" resultMap="ResultMapNews">
select <include refid="News_field"/>
from news
</select>
<!-- 查询所有实体,根据实体属性值为判断条件查询所有实体-->
<select id="listAllByEntity" resultMap="ResultMapNews" parameterType="com.javapandeng.po.News">
select <include refid="News_field"/>
from news where 1=1
<include refid="News_where"/>
</select>
<!-- 根据主键获取一个实体-->
<select id="load" resultMap="ResultMapNews" parameterType="java.lang.Integer">
select <include refid="News_field"/>
from news where id=#{id}
</select>
<!-- 根据主键获取一个实体-->
<select id="getById" resultMap="ResultMapNews" parameterType="java.lang.Integer">
select <include refid="News_field"/>
from news where id=#{id}
</select>
<!-- 通过map查询-->
<select id="getByMap" resultMap="ResultMapNews" parameterType="map">
select <include refid="News_field"/>
from news where 1=1
<include refid="News_where"/>
</select>
<!--通过对象查询-不分页-->
<select id="getByEntity" resultMap="ResultMapNews" parameterType="com.javapandeng.po.News">
select <include refid="News_field"/>
from news where 1=1
<include refid="News_where"/>
</select>
<!-- 通过map查询分页-->
<select id="findByMap" resultMap="ResultMapNews" parameterType="map">
select <include refid="News_field"/>
from news where 1=1
<include refid="News_where"/>
</select>
<!--通过对象查询分页-->
<select id="findByEntity" resultMap="ResultMapNews" parameterType="com.javapandeng.po.News">
select <include refid="News_field"/>
from news where 1=1
<include refid="News_where"/>
</select>
<!-- 批量新增-->
<select id="insertBatch" parameterType="java.util.List">
insert into news(
<include refid="News_field"/>
) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.name},#{item.content},#{item.addTime})
</foreach>
</select>
<!-- 批量修改-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
update news
<set>
<if test="item.name != null">
name = #{item.name},
</if>
<if test="item.content != null">
content = #{item.content},
</if>
<if test="item.addTime != null">
addTime = #{item.addTime}
</if>
</set>
where 1=1
<if test="item.id != null">
and id = #{item.id}
</if>
</foreach>
</update>
<!-- 封装纯sql语法-->
<!-- 查询一个对象返回map-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询一个对象返回实体类-->
<select id="getBySqlReturnEntity" resultMap="ResultMapNews">
${sql}
</select>
<!-- 查询一个对象返回map列表-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询列表返回实体-->
<select id="listBySqlReturnEntity" resultMap="ResultMapNews">
${sql}
</select>
<!-- 查询分页-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapNews">
${sql}
</select>
<!-- 通过sql修改-->
<update id="updateBysql">
${sql}
</update>
<!-- 通过sql删除-->
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,261 @@
<?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.javapandeng.mapper.OrderDetailMapper">
<!--实体类与数据库映射字段部分-->
<resultMap id="ResultMapOrderDetail" type="com.javapandeng.po.OrderDetail">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="itemId" column="item_id" jdbcType="INTEGER"/>
<result property="orderId" column="order_id" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="num" column="num" jdbcType="INTEGER"/>
<result property="total" column="total" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="ResultMapOrderDetailDto" type="com.javapandeng.po.OrderDetail">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="itemId" column="item_id" jdbcType="INTEGER"/>
<result property="orderId" column="order_id" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="num" column="num" jdbcType="INTEGER"/>
<result property="total" column="total" jdbcType="VARCHAR"/>
<association property="item" column="item_id" select="com.javapandeng.mapper.ItemMapper.load"/>
</resultMap>
<!-- 声明数据库字段 -->
<sql id="OrderDetail_field">
id,item_id,order_id,status,num,total
</sql>
<!-- 实体类属性-->
<sql id="OrderDetail_insert">
#{id},#{itemId},#{orderId},#{status},#{num},#{total}
</sql>
<!-- 更新结果 -->
<sql id="OrderDetail_update">
<if test="itemId != null">
item_id = #{itemId},
</if>
<if test="orderId != null">
order_id = #{orderId},
</if>
<if test="status != null">
status = #{status}
</if>
<if test="num != null">
num = #{num},
</if>
<if test="total != null">
total = #{total},
</if>
</sql>
<!-- 查询时条件 -->
<sql id="OrderDetail_where">
<if test="id != null">
and id = #{id}
</if>
<if test="itemId != null">
and item_id = #{itemId}
</if>
<if test="orderId != null">
and order_id = #{orderId}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="num != null">
and num = #{num}
</if>
<if test="total != null">
and total = #{total}
</if>
</sql>
<!-- 新增 -->
<!-- 参数:实体类-->
<!-- 返回:主键 -->
<insert id="insert" parameterType="com.javapandeng.po.OrderDetail" useGeneratedKeys="true" keyProperty="id">
insert into order_detail(
<include refid="OrderDetail_field"/>
) values(
<include refid="OrderDetail_insert"/>
)
</insert>
<!-- 根据实体主键删除一个实体-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from order_detail where id=#{id}
</delete>
<!-- 通过实体删除-->
<delete id="deleteByEntity" parameterType="com.javapandeng.po.OrderDetail">
delete from order_detail where 1=1
<include refid="OrderDetail_where"/>
</delete>
<!-- 通过map删除 -->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from order_detail where 1=1
<include refid="OrderDetail_where"/>
</delete>
<!-- 更新一个实体 -->
<update id="update" parameterType="com.javapandeng.po.OrderDetail">
update order_detail
<set>
<include refid="OrderDetail_update"/>
</set>
where 1=1
<include refid="OrderDetail_where"/>
</update>
<!-- 通过id进行修改-->
<update id="updateById" parameterType="com.javapandeng.po.OrderDetail">
update order_detail
<set>
<include refid="OrderDetail_update"/>
</set>
where id=#{id}
</update>
<!-- 根据参数查询-->
<select id="listByMap" resultMap="ResultMapOrderDetail" parameterType="map">
select <include refid="OrderDetail_field"/>
from order_detail where 1=1
<include refid="OrderDetail_where"/>
</select>
<!-- 查询整个表 -->
<select id="listAll" resultMap="ResultMapOrderDetail">
select <include refid="OrderDetail_field"/>
from order_detail
</select>
<!-- 查询所有实体,根据实体属性值为判断条件查询所有实体-->
<select id="listAllByEntity" resultMap="ResultMapOrderDetail" parameterType="com.javapandeng.po.OrderDetail">
select <include refid="OrderDetail_field"/>
from order_detail where 1=1
<include refid="OrderDetail_where"/>
</select>
<!-- 根据主键获取一个实体-->
<select id="load" resultMap="ResultMapOrderDetail" parameterType="java.lang.Integer">
select <include refid="OrderDetail_field"/>
from order_detail where id=#{id}
</select>
<!-- 根据主键获取一个实体-->
<select id="getById" resultMap="ResultMapOrderDetail" parameterType="java.lang.Integer">
select <include refid="OrderDetail_field"/>
from order_detail where id=#{id}
</select>
<!-- 通过map查询-->
<select id="getByMap" resultMap="ResultMapOrderDetail" parameterType="map">
select <include refid="OrderDetail_field"/>
from order_detail where 1=1
<include refid="OrderDetail_where"/>
</select>
<!--通过对象查询-不分页-->
<select id="getByEntity" resultMap="ResultMapOrderDetail" parameterType="com.javapandeng.po.OrderDetail">
select <include refid="OrderDetail_field"/>
from order_detail where 1=1
<include refid="OrderDetail_where"/>
</select>
<!-- 通过map查询分页-->
<select id="findByMap" resultMap="ResultMapOrderDetail" parameterType="map">
select <include refid="OrderDetail_field"/>
from order_detail where 1=1
<include refid="OrderDetail_where"/>
</select>
<!--通过对象查询分页-->
<select id="findByEntity" resultMap="ResultMapOrderDetail" parameterType="com.javapandeng.po.OrderDetail">
select <include refid="OrderDetail_field"/>
from order_detail where 1=1
<include refid="OrderDetail_where"/>
</select>
<select id="listByOrderId" resultMap="ResultMapOrderDetailDto">
select <include refid="OrderDetail_field"/>
from order_detail where order_id = #{id}
</select>
<!-- 批量新增-->
<select id="insertBatch" parameterType="java.util.List">
insert into order_detail(
<include refid="OrderDetail_field"/>
) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.itemId},#{item.orderId},#{item.status},#{item.num},#{item.total})
</foreach>
</select>
<!-- 批量修改-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
update order_detail
<set>
<if test="item.itemId != null">
item_id = #{item.itemId},
</if>
<if test="item.orderId != null">
order_id = #{item.orderId},
</if>
<if test="item.status != null">
status = #{item.status},
</if>
<if test="item.num != null">
num = #{item.num},
</if>
<if test="item.total != null">
total = #{item.total},
</if>
</set>
where 1=1
<if test="item.id != null">
and id = #{item.id}
</if>
</foreach>
</update>
<!-- 封装纯sql语法-->
<!-- 查询一个对象返回map-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询一个对象返回实体类-->
<select id="getBySqlReturnEntity" resultMap="ResultMapOrderDetail">
${sql}
</select>
<!-- 查询一个对象返回map列表-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询列表返回实体-->
<select id="listBySqlReturnEntity" resultMap="ResultMapOrderDetailDto">
${sql}
</select>
<!-- 查询分页-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapOrderDetailDto">
${sql}
</select>
<!-- 通过sql修改-->
<update id="updateBysql">
${sql}
</update>
<!-- 通过sql删除-->
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,223 @@
<?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.javapandeng.mapper.ScMapper">
<!--实体类与数据库映射字段部分-->
<resultMap id="ResultMapSc" type="com.javapandeng.po.Sc">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="itemId" column="item_id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
</resultMap>
<resultMap id="ResultMapScDto" type="com.javapandeng.po.Sc">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="itemId" column="item_id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<association property="item" column="item_id" select="com.javapandeng.mapper.ItemMapper.load"/>
</resultMap>
<!-- 声明数据库字段 -->
<sql id="Sc_field">
id,item_id,user_id
</sql>
<!-- 实体类属性-->
<sql id="Sc_insert">
#{id},#{itemId},#{userId}
</sql>
<!-- 更新结果 -->
<sql id="Sc_update">
<if test="itemId != null">
item_id = #{itemId},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Sc_where">
<if test="id != null">
and id = #{id}
</if>
<if test="itemId != null">
and item_id = #{itemId}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
</sql>
<!-- 新增 -->
<!-- 参数:实体类-->
<!-- 返回:主键 -->
<insert id="insert" parameterType="com.javapandeng.po.Sc" useGeneratedKeys="true" keyProperty="id">
insert into sc(
<include refid="Sc_field"/>
) values(
<include refid="Sc_insert"/>
)
</insert>
<!-- 根据实体主键删除一个实体-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from sc where id=#{id}
</delete>
<!-- 通过实体删除-->
<delete id="deleteByEntity" parameterType="com.javapandeng.po.Sc">
delete from sc where 1=1
<include refid="Sc_where"/>
</delete>
<!-- 通过map删除 -->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from sc where 1=1
<include refid="Sc_where"/>
</delete>
<!-- 更新一个实体 -->
<update id="update" parameterType="com.javapandeng.po.Sc">
update sc
<set>
<include refid="Sc_update"/>
</set>
where 1=1
<include refid="Sc_where"/>
</update>
<!-- 通过id进行修改-->
<update id="updateById" parameterType="com.javapandeng.po.Sc">
update sc
<set>
<include refid="Sc_update"/>
</set>
where id=#{id}
</update>
<!-- 根据参数查询-->
<select id="listByMap" resultMap="ResultMapSc" parameterType="map">
select <include refid="Sc_field"/>
from sc where 1=1
<include refid="Sc_where"/>
</select>
<!-- 查询整个表 -->
<select id="listAll" resultMap="ResultMapSc">
select <include refid="Sc_field"/>
from sc
</select>
<!-- 查询所有实体,根据实体属性值为判断条件查询所有实体-->
<select id="listAllByEntity" resultMap="ResultMapSc" parameterType="com.javapandeng.po.Sc">
select <include refid="Sc_field"/>
from sc where 1=1
<include refid="Sc_where"/>
</select>
<!-- 根据主键获取一个实体-->
<select id="load" resultMap="ResultMapSc" parameterType="java.lang.Integer">
select <include refid="Sc_field"/>
from sc where id=#{id}
</select>
<!-- 根据主键获取一个实体-->
<select id="getById" resultMap="ResultMapSc" parameterType="java.lang.Integer">
select <include refid="Sc_field"/>
from sc where id=#{id}
</select>
<!-- 通过map查询-->
<select id="getByMap" resultMap="ResultMapSc" parameterType="map">
select <include refid="Sc_field"/>
from sc where 1=1
<include refid="Sc_where"/>
</select>
<!--通过对象查询-不分页-->
<select id="getByEntity" resultMap="ResultMapSc" parameterType="com.javapandeng.po.Sc">
select <include refid="Sc_field"/>
from sc where 1=1
<include refid="Sc_where"/>
</select>
<!-- 通过map查询分页-->
<select id="findByMap" resultMap="ResultMapSc" parameterType="map">
select <include refid="Sc_field"/>
from sc where 1=1
<include refid="Sc_where"/>
</select>
<!--通过对象查询分页-->
<select id="findByEntity" resultMap="ResultMapSc" parameterType="com.javapandeng.po.Sc">
select <include refid="Sc_field"/>
from sc where 1=1
<include refid="Sc_where"/>
</select>
<!-- 批量新增-->
<select id="insertBatch" parameterType="java.util.List">
insert into sc(
<include refid="Sc_field"/>
) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.item_id},#{item.user_id})
</foreach>
</select>
<!-- 批量修改-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
update sc
<set>
<if test="item.itemId != null">
item_id = #{item.itemId},
</if>
<if test="item.userId != null">
user_id = #{item.userId},
</if>
</set>
where 1=1
<if test="item.id != null">
and id = #{item.id}
</if>
</foreach>
</update>
<!-- 封装纯sql语法-->
<!-- 查询一个对象返回map-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询一个对象返回实体类-->
<select id="getBySqlReturnEntity" resultMap="ResultMapSc">
${sql}
</select>
<!-- 查询一个对象返回map列表-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询列表返回实体-->
<select id="listBySqlReturnEntity" resultMap="ResultMapScDto">
${sql}
</select>
<!-- 查询分页-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapScDto">
${sql}
</select>
<!-- 通过sql修改-->
<update id="updateBysql">
${sql}
</update>
<!-- 通过sql删除-->
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,267 @@
<?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.javapandeng.mapper.UserMapper">
<!--实体类与数据库映射字段部分-->
<resultMap id="ResultMapUser" type="com.javapandeng.po.User">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="userName" column="userName" jdbcType="VARCHAR"/>
<result property="passWord" column="passWord" jdbcType="VARCHAR"/>
<result property="phone" column="phone" jdbcType="VARCHAR"/>
<result property="realName" column="realName" jdbcType="VARCHAR"/>
<result property="sex" column="sex" jdbcType="VARCHAR"/>
<result property="address" column="address" jdbcType="VARCHAR"/>
<result property="email" column="email" jdbcType="VARCHAR"/>
</resultMap>
<!-- 声明数据库字段 -->
<sql id="User_field">
id,userName,passWord,phone,realName,sex,address,email
</sql>
<!-- 实体类属性-->
<sql id="User_insert">
#{id},#{userName},#{passWord},#{phone},#{realName},#{sex},#{address},#{email}
</sql>
<!-- 更新结果 -->
<sql id="User_update">
<if test="userName != null">
userName = #{userName},
</if>
<if test="passWord != null">
passWord = #{passWord},
</if>
<if test="phone != null">
phone = #{phone},
</if>
<if test="realName != null">
realName = #{realName},
</if>
<if test="sex != null">
sex = #{sex},
</if>
<if test="address != null">
address = #{address},
</if>
<if test="email != null">
email = #{email}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="User_where">
<if test="id != null">
and id = #{id}
</if>
<if test="userName != null">
and userName = #{userName}
</if>
<if test="passWord != null">
and passWord = #{passWord}
</if>
<if test="phone != null">
and phone = #{phone}
</if>
<if test="realName != null">
and realName = #{realName}
</if>
<if test="sex != null">
and sex = #{sex}
</if>
<if test="address != null">
and address = #{address}
</if>
<if test="email != null">
and email = #{email}
</if>
</sql>
<!-- 新增 -->
<!-- 参数:实体类-->
<!-- 返回:主键 -->
<insert id="insert" parameterType="com.javapandeng.po.User" useGeneratedKeys="true" keyProperty="id">
insert into user(
<include refid="User_field"/>
) values(
<include refid="User_insert"/>
)
</insert>
<!-- 根据实体主键删除一个实体-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from user where id=#{id}
</delete>
<!-- 通过实体删除-->
<delete id="deleteByEntity" parameterType="com.javapandeng.po.User">
delete from user where 1=1
<include refid="User_where"/>
</delete>
<!-- 通过map删除 -->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from user where 1=1
<include refid="User_where"/>
</delete>
<!-- 更新一个实体 -->
<update id="update" parameterType="com.javapandeng.po.User">
update user
<set>
<include refid="User_update"/>
</set>
where 1=1
<include refid="User_where"/>
</update>
<!-- 通过id进行修改-->
<update id="updateById" parameterType="com.javapandeng.po.User">
update user
<set>
<include refid="User_update"/>
</set>
where id=#{id}
</update>
<!-- 根据参数查询-->
<select id="listByMap" resultMap="ResultMapUser" parameterType="map">
select <include refid="User_field"/>
from user where 1=1
<include refid="User_where"/>
</select>
<!-- 查询整个表 -->
<select id="listAll" resultMap="ResultMapUser">
select <include refid="User_field"/>
from user
</select>
<!-- 查询所有实体,根据实体属性值为判断条件查询所有实体-->
<select id="listAllByEntity" resultMap="ResultMapUser" parameterType="com.javapandeng.po.User">
select <include refid="User_field"/>
from user where 1=1
<include refid="User_where"/>
</select>
<!-- 根据主键获取一个实体-->
<select id="load" resultMap="ResultMapUser" parameterType="java.lang.Integer">
select <include refid="User_field"/>
from user where id=#{id}
</select>
<!-- 根据主键获取一个实体-->
<select id="getById" resultMap="ResultMapUser" parameterType="java.lang.Integer">
select <include refid="User_field"/>
from user where id=#{id}
</select>
<!-- 通过map查询-->
<select id="getByMap" resultMap="ResultMapUser" parameterType="map">
select <include refid="User_field"/>
from user where 1=1
<include refid="User_where"/>
</select>
<!--通过对象查询-不分页-->
<select id="getByEntity" resultMap="ResultMapUser" parameterType="com.javapandeng.po.User">
select <include refid="User_field"/>
from user where 1=1
<include refid="User_where"/>
</select>
<!-- 通过map查询分页-->
<select id="findByMap" resultMap="ResultMapUser" parameterType="map">
select <include refid="User_field"/>
from user where 1=1
<include refid="User_where"/>
</select>
<!--通过对象查询分页-->
<select id="findByEntity" resultMap="ResultMapUser" parameterType="com.javapandeng.po.User">
select <include refid="User_field"/>
from user where 1=1
<include refid="User_where"/>
</select>
<!-- 批量新增-->
<select id="insertBatch" parameterType="java.util.List">
insert into user(
<include refid="User_field"/>
) values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.userName},#{item.passWord},#{item.phone},#{item.realName},#{item.sex},#{item.address},#{item.email})
</foreach>
</select>
<!-- 批量修改-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
update user
<set>
<if test="item.userName != null">
userName = #{item.userName},
</if>
<if test="item.passWord != null">
passWord = #{item.passWord},
</if>
<if test="item.phone != null">
phone = #{item.phone}
</if>
<if test="item.realName != null">
realName = #{item.realName}
</if>
<if test="item.sex != null">
sex = #{item.sex}
</if>
<if test="item.address != null">
address = #{item.address}
</if>
<if test="item.email != null">
email = #{item.email}
</if>
</set>
where 1=1
<if test="item.id != null">
and id = #{item.id}
</if>
</foreach>
</update>
<!-- 封装纯sql语法-->
<!-- 查询一个对象返回map-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询一个对象返回实体类-->
<select id="getBySqlReturnEntity" resultMap="ResultMapUser">
${sql}
</select>
<!-- 查询一个对象返回map列表-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!-- 查询列表返回实体-->
<select id="listBySqlReturnEntity" resultMap="ResultMapUser">
${sql}
</select>
<!-- 查询分页-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapUser">
${sql}
</select>
<!-- 通过sql修改-->
<update id="updateBysql">
${sql}
</update>
<!-- 通过sql删除-->
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save