wuyuxin_common

branch_wuyuxin
wyx 7 months ago
commit f32d677d4d

4
.idea/.gitignore vendored

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

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -15,11 +15,4 @@
</profile> </profile>
</annotationProcessing> </annotationProcessing>
</component> </component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="sky-common" options="-parameters" />
<module name="sky-pojo" options="-parameters" />
<module name="sky-server" options="-parameters" />
</option>
</component>
</project> </project>

@ -2,7 +2,7 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/code.iml" filepath="$PROJECT_DIR$/.idea/code.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/cangqiong-takeout-master.iml" filepath="$PROJECT_DIR$/.idea/cangqiong-takeout-master.iml" />
</modules> </modules>
</component> </component>
</project> </project>

@ -0,0 +1,9 @@
<archetype>
<id>sky-pojo</id>
<sources>
<source>src/main/java/App.java</source>
</sources>
<testSources>
<source>src/test/java/AppTest.java</source>
</testSources>
</archetype>

@ -0,0 +1,15 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>$com</groupId>
<artifactId>$sky-pojo</artifactId>
<version>$0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

@ -0,0 +1,13 @@
package $com;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

@ -0,0 +1,38 @@
package $com;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}

@ -0,0 +1,28 @@
sky:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
host: localhost
port: 3306
database: sky_take_out
username: root
password: root
alioss:
endpoint: oss-cn-beijing.aliyuncs.com
access-key-id: LTAI5tPeuNEqfEv8FjWSbSxh
access-key-secret: nFwotFS7o05vy6VkLPooGP45yJbyNS
bucket-name: skybucketoss
upload-path: dish/
redis:
host: localhost
port: 6379
database: 10
wechat:
appid: wxee3110d9ddfa6c12
secret: cd1316f4647b11b1ac095500a57a762e
excel:
filePath: C:\Users\Administrator\Desktop\学习资料\学习笔记\项目笔记\苍穹外卖\1、黑马程序员Java项目《苍穹外卖》企业级开发实战\资料\day12\运营数据报表模板.xlsx
sheet:
Sheet1,
sheet2,
sheet3,
sheet4

@ -0,0 +1,63 @@
server:
port: 8080
spring:
profiles:
active: dev
main:
allow-circular-references: true
datasource:
druid:
driver-class-name: ${sky.datasource.driver-class-name}
url: jdbc:mysql://${sky.datasource.host}:${sky.datasource.port}/${sky.datasource.database}?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: ${sky.datasource.username}
password: ${sky.datasource.password}
redis:
host: ${sky.redis.host}
port: ${sky.redis.port}
database: ${sky.redis.database}
mybatis:
#mapper????
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.sky.entity
configuration:
#??????
map-underscore-to-camel-case: true
logging:
level:
com:
sky:
mapper: debug
service: info
controller: info
sky:
jwt:
# ??jwt??????????
admin-secret-key: itcast
# jwt有效时间
admin-ttl: 7200000
# 令牌名字,令牌存放在请求头中,通过令牌名字获取请求头中的鹰牌
admin-token-name: token
# 服务器私钥
user-secret-key: itheima
# 生效时间
user-ttl: 7200000
user-token-name: authentication
alioss:
endpoint: ${sky.alioss.endpoint}
access-key-id: ${sky.alioss.access-key-id}
access-key-secret: ${sky.alioss.access-key-secret}
bucket-name: ${sky.alioss.bucket-name}
upload-path: ${sky.alioss.upload-path}
wechat:
appid: ${sky.wechat.appid}
secret: ${sky.wechat.secret}
shop:
address: ??????????10?
baidu:
ak: your-ak
excel:
filePath: ${sky.excel.filePath}
sheet: ${sky.excel.sheet}

@ -0,0 +1,45 @@
<?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.sky.mapper.AddressBookMapper">
<select id="list" parameterType="com.sky.entity.AddressBook" resultType="com.sky.entity.AddressBook">
select * from address_book
<where>
<if test="userId != null">
user_id = #{userId}
</if>
<if test="phone != null">
and phone = #{phone}
</if>
<if test="isDefault != null">
and is_default = #{isDefault}
</if>
</where>
</select>
<update id="update">
update address_book
<set>
<if test="consignee != null">
consignee = #{consignee},
</if>
<if test="sex != null">
sex = #{sex},
</if>
<if test="phone != null">
phone = #{phone},
</if>
<if test="detail != null">
detail = #{detail},
</if>
<if test="label != null">
label = #{label},
</if>
<if test="isDefault != null">
is_default = #{isDefault},
</if>
</set>
where id = #{id}
</update>
</mapper>

@ -0,0 +1,57 @@
<?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.sky.mapper.CategoryMapper">
<select id="pageQuery" resultType="com.sky.entity.Category">
select * from category
<where>
<if test="type!=null">
and type=#{type}
</if>
<if test="name!=null and name!=''">
and name like concat('%',#{name},'%')
</if>
</where>
order by sort desc
</select>
<update id="updateCategory">
update category
<set>
<if test="name!=null and name!=''">
name=#{name},
</if>
<if test="type!=null">
type=#{type},
</if>
<if test="sort!=null">
sort=#{sort},
</if>
<if test="status!=null">
status=#{status},
</if>
<if test="updateTime!=null">
update_time=#{updateTime},
</if>
<if test="updateUser">
update_user=#{updateUser},
</if>
</set>
where id=#{id}
</update>
<select id="query" resultType="com.sky.entity.Category">
select * from category
<where>
<if test="type!=null">
type=#{type}
</if>
<if test="name!=null">
and name=#{name}
</if>
</where>
</select>
</mapper>

@ -0,0 +1,112 @@
<?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.sky.mapper.DishMapper">
<select id="pageQuery" resultType="com.sky.entity.Dish">
select * from dish
<where>
<if test="status!=null">
and status=#{status},
</if>
<if test="categoryId!=null">
and category_id=#{categoryId}
</if>
</where>
</select>
<insert id="save" useGeneratedKeys="true" keyProperty="id">
insert into dish(name, category_id, price, image, description, create_time, update_time, create_user,
update_user, status)
values (#{name}, #{categoryId}, #{price}, #{image}, #{description}, #{createTime}, #{updateTime}, #{createUser},
#{updateUser}, #{status})
</insert>
<insert id="insertBatchFlavors">
insert into dish_flavor(dish_id, name, value)
values
<foreach collection="flavors" item="flavor" separator=",">
(#{flavor.dishId},#{flavor.name},#{flavor.value})
</foreach>
</insert>
<delete id="deleteBatch">
delete from dish where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</delete>
<select id="getByIdBatch" resultType="com.sky.entity.Dish">
select * from dish where id in
<foreach collection="ids" item="id" close=")" open="(" separator=",">
#{id}
</foreach>
</select>
<select id="countMealDish" resultType="java.lang.Integer">
select count(*) from setmeal_dish where id in
<foreach collection="ids" separator="," open="(" close=")" item="id">
#{id}
</foreach>
</select>
<update id="updateDish">
update dish
<set>
<if test="name!=null and name!=''">
name=#{name},
</if>
<if test="categoryId!=null">
category_id=#{categoryId},
</if>
<if test="description!=null and description!=''">
description=#{description},
</if>
<if test="image!=null and image!=''">
image=#{image},
</if>
<if test="price!=null">
price=#{price},
</if>
<if test="status!=null">
status=#{status}
</if>
</set>
where id=#{id}
</update>
<delete id="deleteBatchFlavors">
delete from dish_flavor where dish_id in
<foreach collection="flavors" item="flavor" close=")" open="(" separator=",">
#{flavor.dishId}
</foreach>
</delete>
<select id="getFlavorById" resultType="com.sky.entity.DishFlavor">
select *
from dish_flavor
where dish_id = #{id}
</select>
<select id="countByMap" resultType="java.lang.Integer">
select count(id) from dish
<where>
<if test="status != null">
and status = #{status}
</if>
</where>
</select>
<select id="getByCategoryId" resultType="com.sky.entity.Dish">
select * from dish
<where>
<if test="categoryId!=null">
category_id=#{categoryId}
</if>
<if test="status!=null">
and status=#{status}
</if>
</where>
</select>
</mapper>

@ -0,0 +1,30 @@
<?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.sky.mapper.EmployeeMapper">
<select id="pageQuery" resultType="com.sky.entity.Employee">
select * from employee
<where>
<if test="name != null and name != ''">
and name like concat('%',#{name},'%')
</if>
</where>
order by create_time desc
</select>
<update id="update" parameterType="com.sky.entity.Employee">
update employee
<set>
<if test="name != null">name = #{name},</if>
<if test="username != null">username = #{username},</if>
<if test="password != null">password = #{password},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="sex != null">sex = #{sex},</if>
<if test="idNumber != null">id_Number = #{idNumber},</if>
<if test="updateTime != null">update_Time = #{updateTime},</if>
<if test="updateUser != null">update_User = #{updateUser},</if>
<if test="status != null">status = #{status},</if>
</set>
where id = #{id}
</update>
</mapper>

@ -0,0 +1,13 @@
<?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.sky.mapper.OrderDetailMapper">
<insert id="insertBatch" parameterType="com.sky.entity.OrderDetail">
insert into order_detail(name,image,order_id,dish_id,setmeal_id,dish_flavor,number,amount)
values
<foreach collection="orderDetails" item="item" separator="," index="index">
(#{item.name},#{item.image},#{item.orderId},#{item.dishId},#{item.setmealId},#{item.dishFlavor},#{item.number},#{item.amount})
</foreach>
</insert>
</mapper>

@ -0,0 +1,108 @@
<?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.sky.mapper.OrderMapper">
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
insert into orders(number, status, user_id, address_book_id, order_time, checkout_time, pay_method, pay_status,
amount, remark, phone,
address, consignee, estimated_delivery_time, delivery_status, pack_amount, tableware_number,
tableware_status)
values (#{number}, #{status}, #{userId}, #{addressBookId}, #{orderTime}, #{checkoutTime}, #{payMethod},
#{payStatus}, #{amount},
#{remark}, #{phone}, #{address}, #{consignee}, #{estimatedDeliveryTime}, #{deliveryStatus},
#{packAmount}, #{tablewareNumber},
#{tablewareStatus})
</insert>
<update id="update" parameterType="com.sky.entity.Orders">
update orders
<set>
<if test="cancelReason != null and cancelReason!='' ">
cancel_reason=#{cancelReason},
</if>
<if test="rejectionReason != null and rejectionReason!='' ">
rejection_reason=#{rejectionReason},
</if>
<if test="cancelTime != null">
cancel_time=#{cancelTime},
</if>
<if test="payStatus != null">
pay_status=#{payStatus},
</if>
<if test="payMethod != null">
pay_method=#{payMethod},
</if>
<if test="checkoutTime != null">
checkout_time=#{checkoutTime},
</if>
<if test="status != null">
status = #{status},
</if>
<if test="deliveryTime != null">
delivery_time = #{deliveryTime}
</if>
</set>
where id = #{id}
</update>
<update id="updateBatchStatus" parameterType="com.sky.entity.Orders">
update orders set status=#{status} where id in
<foreach collection="ordersList" separator="," close=")" open="(" item="order">
#{order.id}
</foreach>
</update>
<select id="pageQuery" resultType="com.sky.entity.Orders">
select * from orders
<where>
<if test="number != null and number!=''">
and number like concat('%',#{number},'%')
</if>
<if test="phone != null and phone!=''">
and phone like concat('%',#{phone},'%')
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="beginTime != null">
and order_time &gt;= #{beginTime}
</if>
<if test="endTime != null">
and order_time &lt;= #{endTime}
</if>
</where>
order by order_time desc
</select>
<select id="getByStatusAndOrderTimeLT" resultType="com.sky.entity.Orders">
select * from orders
<where>
<if test="time!=null">
order_time <![CDATA[ < ]]> #{time}
</if>
<if test="pendingPayment!=null">
and status = #{pendingPayment}
</if>
</where>
</select>
<select id="countByMap" resultType="java.lang.Integer" parameterType="java.util.Map">
select count(*) from orders where order_time <![CDATA[
<
]]> #{map.end} and order_time <![CDATA[
>
]]> #{map.begin}
<if test="map.status!=null">
and status=#{map.status}
</if>
</select>
<select id="sumByMap" resultType="java.lang.Double" parameterType="java.util.Map">
select sum(amount) from orders where order_time <![CDATA[
<
]]> #{map.end} and order_time <![CDATA[
>
]]> #{map.begin}
</select>
</mapper>

@ -0,0 +1,111 @@
<?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.sky.mapper.SetmealMapper">
<select id="list" resultType="com.sky.entity.Setmeal">
select * from setmeal
<where>
<if test="name != null">
name like concat('%',#{name},'%')
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</if>
<if test="status != null">
and status = #{status}
</if>
</where>
</select>
<select id="countByMap" resultType="java.lang.Integer">
select count(id) from setmeal
<where>
<if test="status != null">
and status = #{status}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</if>
</where>
</select>
<select id="pageQuery" resultType="com.sky.entity.Setmeal">
select * from setmeal
<where>
<if test="name !=null and name!=''">
name=#{name},
</if>
<if test="categoryId!=null">
category_id=#{categoryId},
</if>
<if test="status!=null">
status=#{status}
</if>
</where>
</select>
<update id="updateSetmeal">
update setmeal
<set>
<if test="name!=null and name!=''">
name=#{name},
</if>
<if test="price!=null">
price=#{price},
</if>
<if test="categoryId!=null">
category_id=#{categoryId},
</if>
<if test="image!=null">
image=#{image},
</if>
<if test="description!=null and description!=''">
description=#{description},
</if>
<if test="createTime!=null">
create_time=#{createTime},
</if>
<if test="createUser!=null">
create_user=#{createUser},
</if>
<if test="updateTime!=null">
update_time=#{updateTime},
</if>
<if test="updateUser!=null">
update_user=#{updateUser},
</if>
<if test="status!=null">
status=#{status}
</if>
</set>
where id=#{id}
</update>
<insert id="insertBatchSetmealDish">
insert into setmeal_dish(name,price,copies,setmeal_id,dish_id)
values
<foreach collection="setmealDishes" separator="," item="setmealDish">
(#{setmealDish.name},#{setmealDish.price},#{setmealDish.copies},#{setmealDish.setmealId},#{setmealDish.dishId})
</foreach>
</insert>
<delete id="batchDeleteSetmeal">
delete from setmeal
where
id in
<foreach collection="ids" item="id" close=")" open="(" separator=",">
#{id}
</foreach>
</delete>
<insert id="insertSetmeal">
insert into setmeal(category_id, name, price, status, description, image, create_time, update_time, create_user,
update_user)
values (#{categoryId}, #{name}, #{price}, #{status},
#{description}, #{image}
, #{createTime}, #{updateTime}, #{createUser}, #{updateUser})
</insert>
</mapper>

@ -0,0 +1,50 @@
<?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.sky.mapper.ShoppingCartMapper">
<delete id="delete" parameterType="com.sky.entity.ShoppingCart">
delete from shopping_cart
<where>
<if test="userId!=null">
user_id=#{userId}
</if>
<if test="dishId!=null">
and dish_id=#{dishId}
</if>
<if test="dishFlavor!=null">
and dish_flavor=#{dishFlavor}
</if>
<if test="setmealId!=null">
and setmeal_id=#{setmealId}
</if>
</where>
</delete>
<insert id="insertBatch" parameterType="list">
insert into shopping_cart
(name, image, user_id, dish_id, setmeal_id, dish_flavor, number, amount, create_time)
values
<foreach collection="shoppingCartList" item="sc" separator=",">
(#{sc.name},#{sc.image},#{sc.userId},#{sc.dishId},#{sc.setmealId},#{sc.dishFlavor},#{sc.number},#{sc.amount},#{sc.createTime})
</foreach>
</insert>
<select id="list" resultType="com.sky.entity.ShoppingCart">
select * from shopping_cart
<where>
<if test="userId!=null">
user_id=#{userId}
</if>
<if test="dishId!=null">
and dish_id=#{dishId}
</if>
<if test="setmealId!=null">
and setmeal_id=#{setmealId}
</if>
<if test="dishFlavor!=null">
and dish_flavor=#{dishFlavor}
</if>
</where>
</select>
</mapper>

@ -0,0 +1,17 @@
<?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.sky.mapper.UserMapper">
<insert id="insertUser" useGeneratedKeys="true" keyProperty="id">
insert into user(openid, name, phone, sex, id_number, avatar, create_time)
values(#{openid},#{name},#{phone},#{sex},#{idNumber},#{avatar},#{createTime})
</insert>
<select id="countByMap" resultType="java.lang.Integer" parameterType="java.util.Map">
select count(*) from user where create_time <![CDATA[
<
]]> #{map.end} and create_time <![CDATA[
>
]]> #{map.begin}
</select>
</mapper>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 MiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 MiB

@ -0,0 +1,85 @@
package com.sky.test;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.HSSFColor;
import org.junit.jupiter.api.Test;
import javax.swing.filechooser.FileSystemView;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
public class POITest {
@Test
public void me() throws IOException {
POITest.createExcel();
}
public static void createExcel() throws IOException {
// 获取桌面路径
FileSystemView fsv = FileSystemView.getFileSystemView();
String desktop = fsv.getHomeDirectory().getPath();
String filePath = desktop + "/template.xls";
File file = new File(filePath);
OutputStream outputStream = new FileOutputStream(file);
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("Sheet1");
workbook.createSheet("Sheet2");
HSSFRow row = sheet.createRow(0);
row.createCell(0).setCellValue("id");
row.createCell(1).setCellValue("订单号");
row.createCell(2).setCellValue("下单时间");
row.createCell(3).setCellValue("个数");
row.createCell(4).setCellValue("单价");
row.createCell(5).setCellValue("订单金额");
row.setHeightInPoints(30); // 设置行的高度
HSSFRow row1 = sheet.createRow(1);
row1.createCell(0).setCellValue("1");
row1.createCell(1).setCellValue("NO00001");
// 日期格式化
HSSFCellStyle cellStyle2 = workbook.createCellStyle();
HSSFCreationHelper creationHelper = workbook.getCreationHelper();
cellStyle2.setDataFormat(creationHelper.createDataFormat().getFormat("yyyy-MM-dd HH:mm:ss"));
sheet.setColumnWidth(2, 20 * 256); // 设置列的宽度
HSSFCell cell2 = row1.createCell(2);
cell2.setCellStyle(cellStyle2);
cell2.setCellValue(new Date());
row1.createCell(3).setCellValue(2);
// 保留两位小数
HSSFCellStyle cellStyle3 = workbook.createCellStyle();
cellStyle3.setDataFormat(HSSFDataFormat.getBuiltinFormat("0.00"));
HSSFCell cell4 = row1.createCell(4);
cell4.setCellStyle(cellStyle3);
cell4.setCellValue(29.5);
// 货币格式化
HSSFCellStyle cellStyle4 = workbook.createCellStyle();
HSSFFont font = workbook.createFont();
font.setFontName("宋体");
font.setColor(HSSFColor.RED.index);
cellStyle4.setFont(font);
HSSFCell cell5 = row1.createCell(5);
cell5.setCellFormula("D2*E2"); // 设置计算公式
cell5.setCellStyle(cellStyle4);
// 获取计算公式的值
HSSFFormulaEvaluator e = new HSSFFormulaEvaluator(workbook);
cell5 = e.evaluateInCell(cell5);
System.out.println(cell5.getNumericCellValue());
workbook.setActiveSheet(1);
workbook.write(outputStream);
outputStream.close();
}
}

@ -0,0 +1,29 @@
package com.sky.test;
import com.sky.entity.Dish;
import com.sky.entity.Orders;
import org.junit.jupiter.api.Test;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.*;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@SpringBootTest
public class RedisTest {
@Autowired
RedisTemplate redisTemplate;
@Test
public void testString() throws CloneNotSupportedException {
}
}
Loading…
Cancel
Save