Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
4ab56785
提交
4ab56785
authored
1月 06, 2020
作者:
zgy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增功能
上级
5137565f
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
239 行增加
和
12 行删除
+239
-12
TbCfStationItemController.java
...va/com/platform/controller/TbCfStationItemController.java
+15
-2
TbCfStationItemDao.java
...in/src/main/java/com/platform/dao/TbCfStationItemDao.java
+7
-0
TbCfStationItemService.java
...ain/java/com/platform/service/TbCfStationItemService.java
+8
-0
TbCfStationItemServiceImpl.java
...com/platform/service/impl/TbCfStationItemServiceImpl.java
+62
-1
TbCfStationItemDao.xml
...rc/main/resources/com/platform/dao/TbCfStationItemDao.xml
+19
-1
tbcfstationitem.html
...min/src/main/webapp/WEB-INF/page/sys/tbcfstationitem.html
+1
-3
config.js
platform-admin/src/main/webapp/js/sys/config.js
+2
-1
tbcfstationitem.js
platform-admin/src/main/webapp/js/sys/tbcfstationitem.js
+10
-4
pom.xml
platform-common/pom.xml
+2
-0
Excel.java
...m-common/src/main/java/com/platform/annotation/Excel.java
+113
-0
没有找到文件。
platform-admin/src/main/java/com/platform/controller/TbCfStationItemController.java
浏览文件 @
4ab56785
...
...
@@ -90,7 +90,7 @@ public class TbCfStationItemController extends ApiBaseAction {
@RequestMapping
(
"/save"
)
@RequiresPermissions
(
"tbcfstationitem:save"
)
@ResponseBody
public
R
save
(
@RequestBody
ItemDescSkus
items
)
throws
UnsupportedEncodingException
{
public
R
save
(
@RequestBody
ItemDescSkus
items
)
throws
UnsupportedEncodingException
{
tbCfStationItemService
.
save
(
items
);
return
R
.
ok
();
}
...
...
@@ -101,7 +101,7 @@ public class TbCfStationItemController extends ApiBaseAction {
@RequestMapping
(
"/update"
)
@RequiresPermissions
(
"tbcfstationitem:update"
)
@ResponseBody
public
R
update
(
@RequestBody
ItemDescSkus
items
,
String
itemDesc
)
throws
UnsupportedEncodingException
{
public
R
update
(
@RequestBody
ItemDescSkus
items
,
String
itemDesc
)
throws
UnsupportedEncodingException
{
tbCfStationItemService
.
update
(
items
,
itemDesc
);
return
R
.
ok
();
...
...
@@ -167,4 +167,17 @@ public class TbCfStationItemController extends ApiBaseAction {
tbCfStationItemService
.
changeItemStatus
(
status
,
itemIds
);
return
R
.
ok
();
}
/**
* 导出到Excel
*
* @param
* @return
*/
@RequestMapping
(
"/exportExcel"
)
@ResponseBody
public
R
exportExcel
()
{
tbCfStationItemService
.
exportExcel
();
return
R
.
ok
();
}
}
platform-admin/src/main/java/com/platform/dao/TbCfStationItemDao.java
浏览文件 @
4ab56785
...
...
@@ -2,9 +2,11 @@ package com.platform.dao;
import
com.platform.entity.ItemDescSkus
;
import
com.platform.entity.TbCfStationItemEntity
;
import
com.platform.entity.TbCfStationItemEntityExtends
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* 站点商品Dao
...
...
@@ -14,5 +16,10 @@ import java.util.List;
*/
public
interface
TbCfStationItemDao
extends
BaseDao
<
TbCfStationItemEntity
>
{
int
changeItemStatus
(
@Param
(
"status"
)
Integer
status
,
@Param
(
"itemIds"
)
String
[]
itemIds
);
List
<
ItemDescSkus
>
queryItemInfoById
(
String
itemId
);
List
<
TbCfStationItemEntityExtends
>
queryByItems
();
}
platform-admin/src/main/java/com/platform/service/TbCfStationItemService.java
浏览文件 @
4ab56785
...
...
@@ -3,6 +3,7 @@ package com.platform.service;
import
com.platform.entity.ItemDescSkus
;
import
com.platform.entity.ItemInfo
;
import
com.platform.entity.TbCfStationItemEntity
;
import
com.platform.utils.R
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
java.io.UnsupportedEncodingException
;
...
...
@@ -80,4 +81,11 @@ public interface TbCfStationItemService {
* @return
*/
void
changeItemStatus
(
Integer
status
,
String
[]
itemIds
);
/**
* 导出到Excel
* @param
*/
void
exportExcel
();
}
platform-admin/src/main/java/com/platform/service/impl/TbCfStationItemServiceImpl.java
浏览文件 @
4ab56785
...
...
@@ -4,14 +4,17 @@ import com.platform.dao.*;
import
com.platform.entity.*
;
import
com.platform.service.TbCfStationItemService
;
import
com.platform.utils.IdUtil
;
import
com.platform.utils.excel.ExcelExport
;
import
com.platform.utils.util.StringUtil
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.io.UnsupportedEncodingException
;
import
java.io.*
;
import
java.math.BigDecimal
;
import
java.net.URLDecoder
;
import
java.net.URLEncoder
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -296,4 +299,62 @@ public class TbCfStationItemServiceImpl implements TbCfStationItemService {
tbCfCategoryDao
.
changStatusBatch
(
itemIds
);
tbCfOptionDao
.
changStatusBatch
(
itemIds
);
}
@Override
public
void
exportExcel
()
{
// if (itemIds != null) {
// itemList = tbCfStationItemDao.queryByItems(itemIds);
// } else {
List
<
TbCfStationItemEntityExtends
>
itemList
=
tbCfStationItemDao
.
queryByItems
();
// }
ExcelExport
excelExport
=
new
ExcelExport
();
List
<
Object
[]>
list
=
new
ArrayList
<
Object
[]>();
String
status
=
null
;
for
(
int
i
=
0
;
i
<
itemList
.
size
();
i
++)
{
List
<
Object
>
obj
=
new
ArrayList
<
Object
>();
status
=
itemList
.
get
(
i
).
getEnableFlag
().
toString
();
if
(
"1"
.
equals
(
status
))
{
status
=
"在线销售"
;
}
else
{
status
=
"已下架"
;
}
obj
.
add
(
itemList
.
get
(
i
).
getItemId
()
==
null
?
null
:
itemList
.
get
(
i
).
getItemId
());
obj
.
add
(
itemList
.
get
(
i
).
getItemImg
()
==
null
?
null
:
itemList
.
get
(
i
).
getItemImg
());
obj
.
add
(
itemList
.
get
(
i
).
getItemCode
()
==
null
?
null
:
itemList
.
get
(
i
).
getItemCode
());
obj
.
add
(
itemList
.
get
(
i
).
getItemName
()
==
null
?
null
:
itemList
.
get
(
i
).
getItemName
());
obj
.
add
(
itemList
.
get
(
i
).
getItemPrice
()
==
null
?
null
:
itemList
.
get
(
i
).
getItemPrice
());
obj
.
add
(
itemList
.
get
(
i
).
getItemCount
()
==
null
?
null
:
itemList
.
get
(
i
).
getItemCount
());
obj
.
add
(
itemList
.
get
(
i
).
getItemNum
()
==
null
?
null
:
itemList
.
get
(
i
).
getItemNum
());
obj
.
add
(
itemList
.
get
(
i
).
getItemCategory
()
==
null
?
null
:
itemList
.
get
(
i
).
getItemCategory
());
obj
.
add
(
itemList
.
get
(
i
).
getItemCategorytwo
()
==
null
?
null
:
itemList
.
get
(
i
).
getItemCategorytwo
());
obj
.
add
(
itemList
.
get
(
i
).
getItemDescritionId
()
==
null
?
null
:
itemList
.
get
(
i
).
getItemDescritionId
());
obj
.
add
(
itemList
.
get
(
i
).
getEnableFlag
()
==
null
?
null
:
status
);
obj
.
add
(
itemList
.
get
(
i
).
getCreateTime
()
==
null
?
null
:
itemList
.
get
(
i
).
getCreateTime
());
obj
.
add
(
itemList
.
get
(
i
).
getItemDesc
()
==
null
?
null
:
itemList
.
get
(
i
).
getItemDesc
());
list
.
add
(
obj
.
toArray
());
}
String
[]
header
=
new
String
[]{
"商品ID"
,
"商品图片"
,
"商品编号"
,
"商品名称"
,
"商品价格"
,
"商品库存"
,
"点击量"
,
"一级分类"
,
"二级分类"
,
"商品品名"
,
"状态"
,
"创建时间"
,
"商品详情"
};
excelExport
.
addSheetByArray
(
"商品信息"
,
list
,
header
);
OutputStream
fis
;
try
{
fis
=
new
FileOutputStream
(
"D:\\product.xlsx"
);
excelExport
.
getWorkbook
().
write
(
fis
);
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
platform-admin/src/main/resources/com/platform/dao/TbCfStationItemDao.xml
浏览文件 @
4ab56785
...
...
@@ -52,7 +52,25 @@
from tb_cf_station_item i left join tb_cf_item_desc d on i.item_id=d.item_id
where i.item_id = #{id}
</select>
<select
id=
"queryByItems"
resultType=
"com.platform.entity.TbCfStationItemEntityExtends"
>
select
i.item_id,
`item_img`,
`item_code`,
`item_name`,
`item_price`,
`item_count`,
`item_num`,
`item_category`,
`item_categorytwo`,
`item_descrition_id`,
`enable_flag`,
i.create_time,
item_desc itemDesc
from tb_cf_station_item i left join tb_cf_item_desc d on i.item_id=d.item_id
where
i.enable_flag!=0
</select>
<select
id=
"queryList"
resultType=
"com.platform.entity.TbCfStationItemEntityExtends"
>
SELECT
i.item_id,
...
...
platform-admin/src/main/webapp/WEB-INF/page/sys/tbcfstationitem.html
浏览文件 @
4ab56785
...
...
@@ -173,7 +173,6 @@
<i-select
v-model=
"q.status"
@
on-enter=
"query"
placeholder=
"商品状态"
style=
"width:160px"
>
<i-option
value=
"1"
>
在线销售
</i-option>
<i-option
value=
"2"
>
已下架
</i-option>
<i-option
value=
"0"
>
已删除
</i-option>
</i-select>
</span>
</div>
...
...
@@ -211,7 +210,6 @@
<i-button type="info" @click="export"><i class="fa fa-chevron-down"></i> 导出
</i-button>
#end-->
#if($shiro.hasPermission("tbcfstationitem:delete"))
<i-button
type=
"error"
@
click=
"changeItemStatus(0)"
><i
class=
"fa fa-trash-o"
></i>
删除
</i-button>
#end
...
...
@@ -301,7 +299,7 @@
<!-- 选项 -->
<section
class=
"form-wrapper"
>
<h4>
选项
</h4>
<section
class=
"default-price"
>
<section
class=
"default-price"
>
<h4>
设置默认价格与库存
<i-switch
v-model=
"setDefaultValue"
:disabled=
"disabled"
>
<Icon
type=
"md-checkmark"
></Icon>
...
...
platform-admin/src/main/webapp/js/sys/config.js
浏览文件 @
4ab56785
...
...
@@ -58,7 +58,8 @@ var vm = new Vue({
if
(
ids
==
null
)
{
return
;
}
console
.
log
(
1
,
ids
)
console
.
log
(
2
,
JSON
.
stringify
(
ids
))
confirm
(
'确定要删除选中的记录?'
,
function
()
{
Ajax
.
request
({
url
:
"../sys/config/delete"
,
...
...
platform-admin/src/main/webapp/js/sys/tbcfstationitem.js
浏览文件 @
4ab56785
...
...
@@ -243,10 +243,16 @@ let vm = new Vue({
},
export
:
function
()
{
let
itemIds
=
getSelectedRows
(
"#jqGrid"
);
if
(
itemIds
==
null
)
{
return
;
}
Ajax
.
request
({
url
:
"../tbcfstationitem/exportExcel/"
,
async
:
false
,
type
:
"POST"
,
contentType
:
"application/json"
,
successCallback
:
function
(
resultData
)
{
// console.log(resultData);
iview
.
Message
.
success
(
resultData
.
success
);
}
});
},
reload
:
function
(
event
)
{
...
...
platform-common/pom.xml
浏览文件 @
4ab56785
...
...
@@ -22,8 +22,10 @@
<jackson.version>
2.5.0
</jackson.version>
<poi.version>
3.15
</poi.version>
<yunpian-version>
1.2.7
</yunpian-version>
</properties>
<dependencies>
<!-- excel工具 -->
<dependency>
<groupId>
javax.servlet
</groupId>
<artifactId>
javax.servlet-api
</artifactId>
...
...
platform-common/src/main/java/com/platform/annotation/Excel.java
0 → 100644
浏览文件 @
4ab56785
package
com
.
platform
.
annotation
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
/**
* 自定义导出Excel数据注解
*
* @author ruoyi
*/
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
FIELD
)
public
@interface
Excel
{
/**
* 导出到Excel中的名字.
*/
public
String
name
()
default
""
;
/**
* 日期格式, 如: yyyy-MM-dd
*/
public
String
dateFormat
()
default
""
;
/**
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
*/
public
String
readConverterExp
()
default
""
;
/**
* 导出类型(0数字 1字符串)
*/
public
ColumnType
cellType
()
default
ColumnType
.
STRING
;
/**
* 导出时在excel中每个列的高度 单位为字符
*/
public
double
height
()
default
14
;
/**
* 导出时在excel中每个列的宽 单位为字符
*/
public
double
width
()
default
16
;
/**
* 文字后缀,如% 90 变成90%
*/
public
String
suffix
()
default
""
;
/**
* 当值为空时,字段的默认值
*/
public
String
defaultValue
()
default
""
;
/**
* 提示信息
*/
public
String
prompt
()
default
""
;
/**
* 设置只能选择不能输入的列内容.
*/
public
String
[]
combo
()
default
{};
/**
* 是否导出数据,应对需求:有时我们需要导出一份模板,这是标题需要但内容需要用户手工填写.
*/
public
boolean
isExport
()
default
true
;
/**
* 另一个类中的属性名称,支持多级获取,以小数点隔开
*/
public
String
targetAttr
()
default
""
;
/**
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
*/
Type
type
()
default
Type
.
ALL
;
public
enum
Type
{
ALL
(
0
),
EXPORT
(
1
),
IMPORT
(
2
);
private
final
int
value
;
Type
(
int
value
)
{
this
.
value
=
value
;
}
public
int
value
()
{
return
this
.
value
;
}
}
public
enum
ColumnType
{
NUMERIC
(
0
),
STRING
(
1
);
private
final
int
value
;
ColumnType
(
int
value
)
{
this
.
value
=
value
;
}
public
int
value
()
{
return
this
.
value
;
}
}
}
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论