ghx 2 years ago
commit e506eb8f2d

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.5">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>youxi</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/>
<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
encoding/<project>=UTF-8

@ -0,0 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="youxi">
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<property name="context-root" value="youxi"/>
<property name="java-output-path" value="/youxi/build/classes"/>
</wb-module>
</project-modules>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v8.5"/>
<fixed facet="jst.web"/>
<fixed facet="wst.jsdt.web"/>
<fixed facet="java"/>
<installed facet="java" version="17"/>
<installed facet="jst.web" version="3.1"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

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

@ -0,0 +1,9 @@
DELEGATES_PREFERENCE=delegateValidatorList
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;
USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;
USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.801.v202007142017
eclipse.preferences.version=1
override=true
suspend=false
vals/org.eclipse.wst.xml.core.xml/global=FF03
vf.version=3

@ -0,0 +1,40 @@
datasource.connection.driver_class=com.mysql.jdbc.Driver
datasource.connection.url=jdbc:mysql://localhost:3306/youxi?useUnicode=true&characterEncoding=utf-8
datasource.connection.username=root
datasource.connection.password=123456
#连接池保持的最小连接数,default : 3建议使用
datasource.connection.minPoolSize=3
#连接池中拥有的最大连接数,如果获得新连接时会使连接总数超过这个值则不会再获取新连接,而是等待其他连接释放,所以这个值有可能会设计地很大,default : 15建议使用
datasource.connection.maxPoolSize=15
#连接的最大空闲时间如果超过这个时间某个数据库连接还没有被使用则会断开掉这个连接。如果为0则永远不会断开连接,即回收此连接。default : 0 单位 s建议使用
datasource.connection.maxIdleTime=0
#连接池在无空闲连接可用时一次性创建的新数据库连接数,default : 3建议使用
datasource.connection.acquireIncrement=3
#连接池为数据源缓存的PreparedStatement的总数。由于PreparedStatement属于单个Connection,所以这个数量应该根据应用中平均连接数乘以每个连接的平均PreparedStatement来计算。同时maxStatementsPerConnection的配置无效。default : 0不建议使用
datasource.connection.maxStatements=0
#连接池为数据源单个Connection缓存的PreparedStatement数这个配置比maxStatements更有意义因为它缓存的服务对象是单个数据连接如果设置的好肯定是可以提高性能的。为0的时候不缓存。default : 0看情况而论
datasource.connection.maxStatementsPerConnection=0
#连接池初始化时创建的连接数,default : 3建议使用
datasource.connection.initialPoolSize=3
#用来配置测试空闲连接的间隔时间。测试方式还是上面的两种之一可以用来解决MySQL8小时断开连接的问题。因为它保证连接池会每隔一定时间对空闲连接进行一次测试从而保证有效的空闲连接能每隔一定时间访问一次数据库将于MySQL8小时无会话的状态打破。为0则不测试。default : 0(建议使用)
datasource.connection.idleConnectionTestPeriod=0
#连接池在获得新连接失败时重试的次数如果小于等于0则无限重试直至连接获得成功。default : 30建议使用
datasource.connection.acquireRetryAttempts=30
#如果为true则当连接获取失败时自动关闭数据源除非重新启动应用程序。所以一般不用。default : false不建议使用
datasource.connection.breakAfterAcquireFailure=false
#性能消耗大。如果为true在每次getConnection的时候都会测试为了提高性能,尽量不要用。default : false不建议使用
datasource.connection.testConnectionOnCheckout=false
#配置当连接池所有连接用完时应用程序getConnection的等待时间。为0则无限等待直至有其他连接释放或者创建新的连接不为0则当时间到的时候如果仍没有获得连接则会抛出SQLException。其实就是acquireRetryAttempts*acquireRetryDelay。default : 0与上面两个有重复选择其中两个都行
datasource.connection.checkoutTimeout=30000
#如果为true则在close的时候测试连接的有效性。default : false不建议使用
datasource.connection.testConnectionOnCheckin=false
#配置一个表名连接池根据这个表名用自己的测试sql语句在这个空表上测试数据库连接,这个表只能由c3p0来使用用户不能操作。default : null不建议使用
datasource.connection.automaticTestTable=c3p0TestTable
#连接池在获得新连接时的间隔时间。default : 1000 单位ms建议使用
datasource.connection.acquireRetryDelay=1000
#为0的时候要求所有的Connection在应用程序中必须关闭。如果不为0则强制在设定的时间到达后回收Connection所以必须小心设置保证在回收之前所有数据库操作都能够完成。这种限制减少Connection未关闭情况的不是很适用。建议手动关闭。default : 0 单位 s不建议使用
datasource.connection.unreturnedConnectionTimeout=0
#这个配置主要是为了快速减轻连接池的负载比如连接池中连接数因为某次数据访问高峰导致创建了很多数据连接但是后面的时间段需要的数据库连接数很少需要快速释放必须小于maxIdleTime。其实这个没必要配置maxIdleTime已经配置了。default : 0 单位 s不建议使用
datasource.connection.maxIdleTimeExcessConnections=0
#配置连接的生存时间超过这个时间的连接将由连接池自动断开丢弃掉。当然正在使用的连接不会马上断开而是等待它close再断开。配置为0的时候则不会对连接的生存时间进行限制。default : 0 单位 s不建议使用
datasource.connection.maxConnectionAge=0

@ -0,0 +1,8 @@
### direct log message to stdout ###
log4j.appender.stdout.Target = System.out
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern = %d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=INFO, stdout
#debug,info,warning,error

@ -0,0 +1,22 @@
<?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.ischoolbar.programmer.dao.admin.AuthorityDao">
<!-- 权限插入操作 -->
<insert id="add" parameterType="Authority">
insert into authority(id,roleId,menuId) values(null,#{roleId},#{menuId})
</insert>
<!-- 权限信息搜索查询 -->
<select id="findListByRoleId" parameterType="Long" resultType="Authority">
select * from authority
<if test="_parameter != null">
where roleId = #{roleId}
</if>
</select>
<!-- 删除权限信息 -->
<delete id="deleteByRoleId" parameterType="Long">
delete from authority where roleId = #{roleId}
</delete>
</mapper>

@ -0,0 +1,31 @@
<?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.ischoolbar.programmer.dao.admin.LogDao">
<!-- 日志插入操作 -->
<insert id="add" parameterType="com.ischoolbar.programmer.entity.admin.Log">
insert into log(id,content,createTime) values(null,#{content},#{createTime})
</insert>
<!-- 日志信息搜索查询 -->
<select id="findList" parameterType="Map" resultType="com.ischoolbar.programmer.entity.admin.Log">
select * from log
<if test="content != null">
where content like '%${content}%'
</if>
<if test="offset != null and pageSize != null">
limit #{offset},#{pageSize}
</if>
</select>
<!-- 模糊搜索总条数 -->
<select id="getTotal" parameterType="Map" resultType="Integer">
select count(*) from log
<if test="content != null">
where content like '%${content}%'
</if>
</select>
<!-- 删除日志信息 -->
<delete id="delete" parameterType="String">
delete from log where id in(${value})
</delete>
</mapper>

@ -0,0 +1,53 @@
<?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.ischoolbar.programmer.dao.admin.MenuDao">
<!-- 菜单插入操作 -->
<insert id="add" parameterType="Menu">
insert into menu(id,parentId,name,url,icon) values(null,#{parentId},#{name},#{url},#{icon})
</insert>
<!-- 菜单信息模糊分页搜索查询 -->
<select id="findList" parameterType="Map" resultType="Menu">
select * from menu where 1 = 1
<if test="parentId != null">
and parentId = #{parentId}
</if>
<if test="name != null">
and name like '%${name}%'
</if>
<if test="offset != null and pageSize != null">
limit #{offset},#{pageSize}
</if>
</select>
<!-- 菜单信息模糊分页搜索查询总记录数 -->
<select id="getTotal" parameterType="Map" resultType="Integer">
select count(*) from menu where 1 = 1
<if test="parentId != null">
and parentId = #{parentId}
</if>
<if test="name != null">
and name like '%${name}%'
</if>
</select>
<!-- 获取顶级菜单信息 -->
<select id="findTopList" parameterType="Map" resultType="Menu">
select * from menu where parentId = 0
</select>
<!-- 获取某一分类的子菜单信息 -->
<select id="findChildernList" parameterType="Long" resultType="Menu">
select * from menu where parentId = #{parentId}
</select>
<!-- 根据菜单id获取菜单信息 -->
<select id="findListByIds" parameterType="String" resultType="Menu">
select * from menu where id in(${value})
</select>
<!-- 修改菜单信息 -->
<update id="edit" parameterType="Menu">
update menu set name = #{name},parentId = #{parentId},url = #{url},icon = #{icon} where id = #{id}
</update>
<!-- 删除菜单信息 -->
<delete id="delete" parameterType="Long">
delete from menu where id = #{id}
</delete>
</mapper>

@ -0,0 +1,39 @@
<?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.ischoolbar.programmer.dao.admin.RoleDao">
<!-- 角色插入操作 -->
<insert id="add" parameterType="Role">
insert into role(id,name,remark) values(null,#{name},#{remark})
</insert>
<!-- 角色信息模糊分页搜索查询 -->
<select id="findList" parameterType="Map" resultType="role">
select * from role
<if test="name != null">
where name like '%${name}%'
</if>
<if test="offset != null and pageSize != null">
limit #{offset},#{pageSize}
</if>
</select>
<!-- 角色信息模糊分页搜索查询总记录数 -->
<select id="getTotal" parameterType="Map" resultType="Integer">
select count(*) from role
<if test="name != null">
where name like '%${name}%'
</if>
</select>
<!-- 根据id获取角色 -->
<select id="find" parameterType="Long" resultType="Role">
select * from role where id = #{id}
</select>
<!-- 修改角色信息 -->
<update id="edit" parameterType="Role">
update role set name = #{name},remark = #{remark} where id = #{id}
</update>
<!-- 删除角色信息 -->
<delete id="delete" parameterType="Long">
delete from role where id = #{id}
</delete>
</mapper>

@ -0,0 +1,55 @@
<?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.ischoolbar.programmer.dao.admin.UserDao">
<!-- 根据用户名查找用户 -->
<select id="findByUsername" parameterType="String" resultType="User">
select * from user where username = #{username}
</select>
<!-- 添加用户 -->
<insert id="add" parameterType="User">
insert into user(id,username,password,roleId,photo,sex,age,address) values(null,#{username},#{password},#{roleId},#{photo},#{sex},#{age},#{address})
</insert>
<!-- 修改用户 -->
<update id="edit" parameterType="User">
update user set username = #{username},roleId = #{roleId},photo = #{photo},sex = #{sex},age = #{age},address = #{address} where id = #{id}
</update>
<!-- 修改用户密码 -->
<update id="editPassword" parameterType="User">
update user set password = #{password} where id = #{id}
</update>
<!-- 删除用户 -->
<delete id="delete" parameterType="String">
delete from user where id in(${value})
</delete>
<!-- 分页获取用户列表 -->
<select id="findList" parameterType="Map" resultType="User">
select * from user where 1 = 1
<if test="username != null">
and username like '%${username}%'
</if>
<if test="roleId != null">
and roleId = #{roleId}
</if>
<if test="sex != null">
and sex = #{sex}
</if>
<if test="offset != null and pageSize != null">
limit #{offset},#{pageSize}
</if>
</select>
<!-- 获取符合结果的总记录数 -->
<select id="getTotal" parameterType="Map" resultType="Integer">
select count(*) from user where 1 = 1
<if test="username != null">
and username like '%${username}%'
</if>
<if test="roleId != null">
and roleId = #{roleId}
</if>
<if test="sex != null">
and sex = #{sex}
</if>
</select>
</mapper>

@ -0,0 +1,58 @@
<?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.ischoolbar.programmer.dao.common.AccountDao">
<!-- 客户插入操作 -->
<insert id="add" parameterType="com.ischoolbar.programmer.entity.common.Account">
insert into account(id,name,password,email,trueName,sex,status,createTime) values(null,#{name},#{password},#{email},#{trueName},#{sex},#{status},#{createTime})
</insert>
<!-- 客户更新操作 -->
<update id="edit" parameterType="com.ischoolbar.programmer.entity.common.Account">
update account set name = #{name},password = #{password},email = #{email},trueName = #{trueName},sex = #{sex},status = #{status} where id = #{id}
</update>
<!-- 客户信息搜索查询 -->
<select id="findList" parameterType="Map" resultType="com.ischoolbar.programmer.entity.common.Account">
select * from account where 1 = 1
<if test="name != null">
and name like '%${name}%'
</if>
<if test="sex != null">
and sex = #{sex}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="orderBy != null and sort != null">
order by ${orderBy} ${sort}
</if>
<if test="offset != null and pageSize != null">
limit #{offset},#{pageSize}
</if>
</select>
<!-- 模糊搜索总条数 -->
<select id="getTotal" parameterType="Map" resultType="Integer">
select count(*) from account where 1 = 1
<if test="name != null">
and name like '%${name}%'
</if>
<if test="sex != null">
and sex = #{sex}
</if>
<if test="status != null">
and status = #{status}
</if>
</select>
<!-- 根据id查询 -->
<select id="findById" parameterType="Long" resultType="com.ischoolbar.programmer.entity.common.Account">
select * from account where id = #{value}
</select>
<!-- 根据用户名查询 -->
<select id="findByName" parameterType="String" resultType="com.ischoolbar.programmer.entity.common.Account">
select * from account where name = #{value}
</select>
<!-- 删除客户信息 -->
<delete id="delete" parameterType="String">
delete from account where id in(${value})
</delete>
</mapper>

@ -0,0 +1,84 @@
<?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.ischoolbar.programmer.dao.common.CommentDao">
<resultMap id="commentResultMap" type="com.ischoolbar.programmer.entity.common.Comment">
<id column="c_id" property="id" />
<result column="c_productId" property="productId" />
<result column="c_userId" property="userId" />
<result column="c_type" property="type" />
<result column="c_content" property="content" />
<result column="c_createTime" property="createTime" />
<association property="product" javaType="com.ischoolbar.programmer.entity.common.Product">
<id column="p_id" property="id" />
<result column="p_name" property="name" />
<result column="p_imageUrl" property="imageUrl" />
<result column="p_price" property="price" />
</association>
<association property="account" javaType="com.ischoolbar.programmer.entity.common.Account">
<id column="a_id" property="id" />
<result column="a_name" property="name" />
</association>
</resultMap>
<!-- 评论插入操作 -->
<insert id="add" parameterType="com.ischoolbar.programmer.entity.common.Comment">
insert into comment(id,productId,userId,type,content,createTime) values(null,#{productId},#{userId},#{type},#{content},#{createTime})
</insert>
<!-- 评论更新操作 -->
<update id="edit" parameterType="com.ischoolbar.programmer.entity.common.Comment">
update comment set type = #{type},content = #{content} where id = #{id}
</update>
<!-- 评论信息搜索查询 -->
<select id="findList" parameterType="Map" resultMap="commentResultMap">
select
c.id as c_id,c.productId as c_productId,c.userId as c_userId,c.type as c_type,c.content as c_content,c.createTime as c_createTime,
p.id as p_id,p.name as p_name,p.imageUrl as p_imageUrl,p.price as p_price,
a.id as a_id,a.name as a_name
from comment c,product p,account a where c.productId = p.id and c.userId = a.id
<if test="productName != null">
and p.name like '%${productName}%'
</if>
<if test="productId != null">
and p.id = #{productId}
</if>
<if test="username != null">
and a.name like '%${username}%'
</if>
<if test="userId != null">
and c.userId = #{userId}
</if>
<if test="type != null">
and c.type = #{type}
</if>
<if test="orderBy != null and sort != null">
order by ${orderBy} ${sort}
</if>
<if test="offset != null and pageSize != null">
limit #{offset},#{pageSize}
</if>
</select>
<!-- 模糊搜索总条数 -->
<select id="getTotal" parameterType="Map" resultType="Integer">
select count(*) from comment c,product p,account a where c.productId = p.id and c.userId = a.id
<if test="productName != null">
and p.name like '%${productId}%'
</if>
<if test="username != null">
and a.name like '%${username}%'
</if>
<if test="type != null">
and c.type = #{type}
</if>
</select>
<!-- 根据id查询 -->
<select id="findById" parameterType="Long" resultType="com.ischoolbar.programmer.entity.common.Comment">
select * from comment where id = #{value}
</select>
<!-- 删除评论信息 -->
<delete id="delete" parameterType="String">
delete from comment where id in(${value})
</delete>
</mapper>

@ -0,0 +1,85 @@
<?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.ischoolbar.programmer.dao.common.OrderDao">
<!-- 订单插入操作 -->
<insert id="add" useGeneratedKeys="true" keyProperty="id" parameterType="com.ischoolbar.programmer.entity.common.Order">
insert into orders(id,sn,userId,address,money,productNum,status,remark,createTime) values(null,#{sn},#{userId},#{address},#{money},#{productNum},#{status},#{remark},#{createTime})
</insert>
<!-- 订单子项插入操作 -->
<insert id="addItem" parameterType="com.ischoolbar.programmer.entity.common.OrderItem">
insert into order_item(id,orderId,productId,name,imageUrl,price,num,money) values(null,#{orderId},#{productId},#{name},#{imageUrl},#{price},#{num},#{money})
</insert>
<!-- 订单更新操作 -->
<update id="edit" parameterType="com.ischoolbar.programmer.entity.common.Order">
update orders set address = #{address},money = #{money},status = #{status},remark = #{remark} where id = #{id}
</update>
<!-- 订单信息搜索查询 -->
<select id="findList" parameterType="Map" resultType="com.ischoolbar.programmer.entity.common.Order">
select * from orders where 1 = 1
<if test="sn != null">
and sn like '%${sn}%'
</if>
<if test="userId != null">
and userId = #{userId}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="moneyMin != null">
and money &gt; #{moneyMin}
</if>
<if test="moneyMax != null">
and money &lt; #{moneyMax}
</if>
<if test="orderBy != null and sort != null">
order by ${orderBy} ${sort}
</if>
<if test="offset != null and pageSize != null">
limit #{offset},#{pageSize}
</if>
</select>
<!-- 模糊搜索总条数 -->
<select id="getTotal" parameterType="Map" resultType="Integer">
select count(*) from orders where 1 = 1
<if test="sn != null">
and sn like '%${sn}%'
</if>
<if test="userId != null">
and userId = #{userId}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="moneyMin != null">
and money &gt; #{moneyMin}
</if>
<if test="moneyMax != null">
and money &lt; #{moneyMax}
</if>
</select>
<!-- 根据id查询 -->
<select id="findById" parameterType="Long" resultType="com.ischoolbar.programmer.entity.common.Order">
select * from orders where id = #{value}
</select>
<!-- 根据orderId查询订单子项 -->
<select id="findOrderItemList" parameterType="Long" resultType="com.ischoolbar.programmer.entity.common.OrderItem">
select * from order_item where orderId = #{value}
</select>
<!-- 统计指定时间段内的销售额 -->
<select id="getStats" parameterType="Map" resultType="Map">
select sum(money) as money,DATE_FORMAT(createTime,"%Y%m%d") as date from orders where 1 = 1
<if test="startTime != null">
and createTime &gt; #{startTime}
</if>
<if test="endTime != null">
and createTime &lt; #{endTime}
</if>
GROUP BY DATE_FORMAT(createTime,"%Y%m%d")
</select>
<!-- 删除订单信息 -->
<delete id="delete" parameterType="String">
delete from orders where id in(${value})
</delete>
</mapper>

@ -0,0 +1,39 @@
<?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.ischoolbar.programmer.dao.common.ProductCategoryDao">
<!-- 商品分类插入操作 -->
<insert id="add" parameterType="com.ischoolbar.programmer.entity.common.ProductCategory">
insert into product_category(id,parentId,name,tags,remark) values(null,#{parentId},#{name},#{tags},#{remark})
</insert>
<!-- 商品分类更新操作 -->
<update id="edit" parameterType="com.ischoolbar.programmer.entity.common.ProductCategory">
update product_category set parentId = #{parentId},name = #{name},tags = #{tags},remark = #{remark} where id = #{id}
</update>
<!-- 商品分类信息搜索查询 -->
<select id="findList" parameterType="Map" resultType="com.ischoolbar.programmer.entity.common.ProductCategory">
select * from product_category
<if test="name != null">
where name like '%${name}%'
</if>
<if test="offset != null and pageSize != null">
limit #{offset},#{pageSize}
</if>
</select>
<!-- 模糊搜索总条数 -->
<select id="getTotal" parameterType="Map" resultType="Integer">
select count(*) from product_category
<if test="name != null">
where name like '%${name}%'
</if>
</select>
<!-- 根据id查询分类 -->
<select id="findById" parameterType="Long" resultType="com.ischoolbar.programmer.entity.common.ProductCategory">
select * from product_category where id = #{value}
</select>
<!-- 删除商品分类信息 -->
<delete id="delete" parameterType="String">
delete from product_category where id in(${value})
</delete>
</mapper>

@ -0,0 +1,64 @@
<?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.ischoolbar.programmer.dao.common.ProductDao">
<!-- 商品插入操作 -->
<insert id="add" parameterType="com.ischoolbar.programmer.entity.common.Product">
insert into product(id,productCategoryId,name,tags,imageUrl,price,stock,sellNum,viewNum,commentNum,content,createTime) values(null,#{productCategoryId},#{name},#{tags},#{imageUrl},#{price},#{stock},#{sellNum},#{viewNum},#{commentNum},#{content},#{createTime})
</insert>
<!-- 商品更新操作 -->
<update id="edit" parameterType="com.ischoolbar.programmer.entity.common.Product">
update product set productCategoryId = #{productCategoryId},name = #{name},tags = #{tags},imageUrl = #{imageUrl},price = #{price},stock = #{stock},content = #{content} where id = #{id}
</update>
<!-- 商品统计数量更新 -->
<update id="updateNum" parameterType="com.ischoolbar.programmer.entity.common.Product">
update product set stock = #{stock},sellNum = #{sellNum},viewNum = #{viewNum},commentNum = #{commentNum} where id = #{id}
</update>
<!-- 商品信息搜索查询 -->
<select id="findList" parameterType="Map" resultType="com.ischoolbar.programmer.entity.common.Product">
select * from product where 1 = 1
<if test="name != null">
and name like '%${name}%'
</if>
<if test="tags != null">
and tags like '%${tags}%'
</if>
<if test="priceMin != null">
and price &gt; #{priceMin}
</if>
<if test="priceMax != null">
and price &lt; #{priceMax}
</if>
<if test="orderBy != null and sort != null">
order by ${orderBy} ${sort}
</if>
<if test="offset != null and pageSize != null">
limit #{offset},#{pageSize}
</if>
</select>
<!-- 模糊搜索总条数 -->
<select id="getTotal" parameterType="Map" resultType="Integer">
select count(*) from product where 1 = 1
<if test="name != null">
and name like '%${name}%'
</if>
<if test="tags != null">
and tags in(${tags})
</if>
<if test="priceMin != null">
and price &gt; #{priceMin}
</if>
<if test="priceMax != null">
and price &lt; #{priceMax}
</if>
</select>
<!-- 根据id查询 -->
<select id="findById" parameterType="Long" resultType="com.ischoolbar.programmer.entity.common.Product">
select * from product where id = #{value}
</select>
<!-- 删除商品信息 -->
<delete id="delete" parameterType="String">
delete from product where id in(${value})
</delete>
</mapper>

@ -0,0 +1,39 @@
<?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.ischoolbar.programmer.dao.home.AddressDao">
<!-- 收货地址插入操作 -->
<insert id="add" parameterType="com.ischoolbar.programmer.entity.home.Address">
insert into address(id,userId,name,phone,address,createTime) values(null,#{userId},#{name},#{phone},#{address},#{createTime})
</insert>
<!-- 收货地址更新操作 -->
<update id="edit" parameterType="com.ischoolbar.programmer.entity.home.Address">
update address set name = #{name},phone = #{phone},address = #{address} where id = #{id} and userId = #{userId}
</update>
<!-- 收货地址信息搜索查询 -->
<select id="findList" parameterType="Map" resultType="com.ischoolbar.programmer.entity.home.Address">
select * from address where 1 = 1
<if test="userId != null">
and userId = #{userId}
</if>
<if test="offset != null and pageSize != null">
limit #{offset},#{pageSize}
</if>
</select>
<!-- 模糊搜索总条数 -->
<select id="getTotal" parameterType="Map" resultType="Integer">
select count(*) from address where 1 = 1
<if test="userId != null">
and userId = #{userId}
</if>
</select>
<!-- 根据id查询 -->
<select id="findById" parameterType="Long" resultType="com.ischoolbar.programmer.entity.home.Address">
select * from address where id = #{value}
</select>
<!-- 删除收货地址信息 -->
<delete id="delete" parameterType="String">
delete from address where id in(${value})
</delete>
</mapper>

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

Loading…
Cancel
Save