Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
0a1c16a2
提交
0a1c16a2
authored
12月 23, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
属性管理
上级
2f13ad95
隐藏空白字符变更
内嵌
并排
正在显示
13 个修改的文件
包含
751 行增加
和
108 行删除
+751
-108
AttributesController.java
...in/java/com/platform/controller/AttributesController.java
+41
-29
AttributesDescController.java
...ava/com/platform/controller/AttributesDescController.java
+109
-0
AttributesDao.java
...m-admin/src/main/java/com/platform/dao/AttributesDao.java
+6
-0
AttributesDescDao.java
...min/src/main/java/com/platform/dao/AttributesDescDao.java
+18
-0
AttributesDescEntity.java
...c/main/java/com/platform/entity/AttributesDescEntity.java
+136
-0
AttributesEntity.java
...n/src/main/java/com/platform/entity/AttributesEntity.java
+17
-16
AttributesDescService.java
...main/java/com/platform/service/AttributesDescService.java
+73
-0
AttributesService.java
...src/main/java/com/platform/service/AttributesService.java
+5
-2
AttributesDescServiceImpl.java
.../com/platform/service/impl/AttributesDescServiceImpl.java
+64
-0
AttributesServiceImpl.java
...java/com/platform/service/impl/AttributesServiceImpl.java
+42
-5
AttributesExtends.java
...dmin/src/main/java/com/platform/vo/AttributesExtends.java
+39
-0
AttributesDao.xml
...min/src/main/resources/com/platform/dao/AttributesDao.xml
+81
-56
AttributesDescDao.xml
...src/main/resources/com/platform/dao/AttributesDescDao.xml
+120
-0
没有找到文件。
platform-admin/src/main/java/com/platform/controller/AttributesController.java
浏览文件 @
0a1c16a2
package
com
.
platform
.
controller
;
import
com.platform.annotation.IgnoreAuth
;
import
com.platform.entity.AttributesDescEntity
;
import
com.platform.entity.AttributesEntity
;
import
com.platform.entity.TbCfItemParamEntity
;
import
com.platform.entity.TbCfStationItemEntity
;
import
com.platform.service.AttributesDescService
;
import
com.platform.service.AttributesService
;
import
com.platform.service.TbCfItemParamService
;
import
com.platform.utils.PageUtils
;
import
com.platform.utils.Query
;
import
com.platform.utils.R
;
import
com.platform.utils.util.StringUtil
;
import
com.platform.vo.AttributesExtends
;
import
com.platform.vo.AttributesVo
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
...
...
@@ -36,6 +39,8 @@ public class AttributesController {
private
AttributesService
attributesService
;
@Autowired
private
TbCfItemParamService
itemParamService
;
@Autowired
private
AttributesDescService
attributesDescService
;
/**
...
...
@@ -48,10 +53,16 @@ public class AttributesController {
//查询列表数据
Query
query
=
new
Query
(
params
);
List
<
AttributesEntity
>
list
=
new
ArrayList
<>();
List
<
AttributesEntity
>
attributesList
=
attributesService
.
queryList
(
query
);
attributesList
.
forEach
(
attr
->
{
List
<
AttributesDescEntity
>
descs
=
attributesDescService
.
queryByAttrId
(
attr
.
getId
());
attr
.
setDescs
(
descs
);
list
.
add
(
attr
);
});
int
total
=
attributesService
.
queryTotal
(
query
);
PageUtils
pageUtil
=
new
PageUtils
(
attributesL
ist
,
total
,
query
.
getLimit
(),
query
.
getPage
());
PageUtils
pageUtil
=
new
PageUtils
(
l
ist
,
total
,
query
.
getLimit
(),
query
.
getPage
());
return
R
.
ok
().
put
(
"page"
,
pageUtil
);
}
...
...
@@ -64,7 +75,8 @@ public class AttributesController {
@ResponseBody
public
R
info
(
@PathVariable
(
"id"
)
String
id
)
{
AttributesEntity
attributes
=
attributesService
.
queryObject
(
id
);
List
<
AttributesDescEntity
>
desc
=
attributesDescService
.
queryByAttrId
(
attributes
.
getId
());
attributes
.
setDescs
(
desc
);
return
R
.
ok
().
put
(
"attributes"
,
attributes
);
}
...
...
@@ -74,7 +86,7 @@ public class AttributesController {
@RequestMapping
(
"/save"
)
@RequiresPermissions
(
"attributes:save"
)
@ResponseBody
public
R
save
(
@RequestBody
AttributesE
ntity
attributes
)
{
public
R
save
(
@RequestBody
AttributesE
xtends
attributes
)
{
attributesService
.
save
(
attributes
);
return
R
.
ok
();
...
...
@@ -86,7 +98,7 @@ public class AttributesController {
@RequestMapping
(
"/update"
)
@RequiresPermissions
(
"attributes:update"
)
@ResponseBody
public
R
update
(
@RequestBody
AttributesE
ntity
attributes
)
{
public
R
update
(
@RequestBody
AttributesE
xtends
attributes
)
{
attributesService
.
update
(
attributes
);
return
R
.
ok
();
...
...
@@ -143,31 +155,31 @@ public class AttributesController {
* @param attrDesc 搜索关键字 如(l)
* @return url(../attributes/queryAttrDescs?id=2&attrDesc=l)
*/
@RequestMapping
(
"/queryAttrDescs"
)
@ResponseBody
@IgnoreAuth
public
R
queryAttrDescs
(
@RequestParam
(
"id"
)
String
id
,
@RequestParam
(
value
=
"attrDesc"
,
required
=
false
)
String
attrDesc
)
{
if
(
StringUtils
.
isBlank
(
id
))
{
return
R
.
error
(
"id不能为空!"
);
}
AttributesEntity
attributes
=
attributesService
.
queryObject
(
id
);
List
<
String
>
list
=
new
ArrayList
<>();
if
(
attributes
!=
null
)
{
String
[]
descs
=
attributes
.
getAttrDesc
().
split
(
","
);
list
=
Arrays
.
asList
(
descs
);
list
=
list
.
stream
().
sorted
(
String:
:
compareTo
).
collect
(
Collectors
.
toList
());
}
if
(
attrDesc
!=
null
&&
list
.
size
()
>
0
&&
list
!=
null
)
{
/*for (String attr : list) {
if (attr.indexOf(attrDesc) <= -1)
list.remove(attr);
}*/
list
=
list
.
stream
().
filter
(
attr
->
attr
.
indexOf
(
attrDesc
)
>
-
1
).
collect
(
Collectors
.
toList
());
}
return
R
.
ok
().
put
(
"list"
,
list
);
}
//
@RequestMapping("/queryAttrDescs")
//
@ResponseBody
//
@IgnoreAuth
//
public R queryAttrDescs(@RequestParam("id") String id,
//
@RequestParam(value = "attrDesc", required = false) String attrDesc) {
//
if (StringUtils.isBlank(id)) {
//
return R.error("id不能为空!");
//
}
//
AttributesEntity attributes = attributesService.queryObject(id);
//
List<String> list = new ArrayList<>();
//
if (attributes != null) {
//
String[] descs = attributes.getAttrDesc().split(",");
//
list = Arrays.asList(descs);
//
list = list.stream().sorted(String::compareTo).collect(Collectors.toList());
//
}
//
//
if (attrDesc != null && list.size() > 0 && list != null) {
//
/*for (String attr : list) {
//
if (attr.indexOf(attrDesc) <= -1)
//
list.remove(attr);
//
}*/
//
list = list.stream().filter(attr -> attr.indexOf(attrDesc) > -1).collect(Collectors.toList());
//
}
//
return R.ok().put("list", list);
//
}
/**
* 新版商品属性(整合旧版数据)
...
...
platform-admin/src/main/java/com/platform/controller/AttributesDescController.java
0 → 100644
浏览文件 @
0a1c16a2
package
com
.
platform
.
controller
;
import
com.platform.entity.AttributesDescEntity
;
import
com.platform.service.AttributesDescService
;
import
com.platform.utils.PageUtils
;
import
com.platform.utils.Query
;
import
com.platform.utils.R
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.util.List
;
import
java.util.Map
;
/**
* Controller
*
* @author lipengjun
* @date 2020-12-23 11:00:57
*/
@Controller
@RequestMapping
(
"attributesdesc"
)
public
class
AttributesDescController
{
@Autowired
private
AttributesDescService
attributesDescService
;
/**
* 查看列表
*/
@RequestMapping
(
"/list"
)
@RequiresPermissions
(
"attributesdesc:list"
)
@ResponseBody
public
R
list
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
//查询列表数据
Query
query
=
new
Query
(
params
);
List
<
AttributesDescEntity
>
attributesDescList
=
attributesDescService
.
queryList
(
query
);
int
total
=
attributesDescService
.
queryTotal
(
query
);
PageUtils
pageUtil
=
new
PageUtils
(
attributesDescList
,
total
,
query
.
getLimit
(),
query
.
getPage
());
return
R
.
ok
().
put
(
"page"
,
pageUtil
);
}
/**
* 查看信息
*/
@RequestMapping
(
"/info/{attrDescId}"
)
@RequiresPermissions
(
"attributesdesc:info"
)
@ResponseBody
public
R
info
(
@PathVariable
(
"attrDescId"
)
String
attrDescId
)
{
AttributesDescEntity
attributesDesc
=
attributesDescService
.
queryObject
(
attrDescId
);
return
R
.
ok
().
put
(
"attributesDesc"
,
attributesDesc
);
}
/**
* 保存
*/
@RequestMapping
(
"/save"
)
@RequiresPermissions
(
"attributesdesc:save"
)
@ResponseBody
public
R
save
(
@RequestBody
AttributesDescEntity
attributesDesc
)
{
attributesDescService
.
save
(
attributesDesc
);
return
R
.
ok
();
}
/**
* 修改
*/
@RequestMapping
(
"/update"
)
@RequiresPermissions
(
"attributesdesc:update"
)
@ResponseBody
public
R
update
(
@RequestBody
AttributesDescEntity
attributesDesc
)
{
attributesDescService
.
update
(
attributesDesc
);
return
R
.
ok
();
}
/**
* 删除
*/
@RequestMapping
(
"/delete"
)
@RequiresPermissions
(
"attributesdesc:delete"
)
@ResponseBody
public
R
delete
(
@RequestBody
String
[]
attrDescIds
)
{
attributesDescService
.
deleteBatch
(
attrDescIds
);
return
R
.
ok
();
}
/**
* 查看所有列表
*/
@RequestMapping
(
"/queryAll"
)
@ResponseBody
public
R
queryAll
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
List
<
AttributesDescEntity
>
list
=
attributesDescService
.
queryList
(
params
);
return
R
.
ok
().
put
(
"list"
,
list
);
}
}
platform-admin/src/main/java/com/platform/dao/AttributesDao.java
浏览文件 @
0a1c16a2
package
com
.
platform
.
dao
;
import
com.platform.entity.AttributesEntity
;
import
com.platform.vo.AttributesExtends
;
import
java.util.List
;
import
java.util.Map
;
/**
* Dao
...
...
@@ -10,4 +14,6 @@ import com.platform.entity.AttributesEntity;
*/
public
interface
AttributesDao
extends
BaseDao
<
AttributesEntity
>
{
List
<
AttributesExtends
>
queryAttributesList
(
Map
<
String
,
Object
>
map
);
}
platform-admin/src/main/java/com/platform/dao/AttributesDescDao.java
0 → 100644
浏览文件 @
0a1c16a2
package
com
.
platform
.
dao
;
import
com.platform.entity.AttributesDescEntity
;
import
java.util.List
;
/**
* Dao
*
* @author lipengjun
* @date 2020-12-23 11:00:57
*/
public
interface
AttributesDescDao
extends
BaseDao
<
AttributesDescEntity
>
{
List
<
AttributesDescEntity
>
queryByAttrId
(
String
id
);
}
platform-admin/src/main/java/com/platform/entity/AttributesDescEntity.java
0 → 100644
浏览文件 @
0a1c16a2
package
com
.
platform
.
entity
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 实体
* 表名 attributes_desc
*
* @author lipengjun
* @date 2020-12-23 11:00:57
*/
public
class
AttributesDescEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 属性描述ID
*/
private
String
attrDescId
;
/**
* 属性ID
*/
private
String
attrId
;
/**
* 属性值
*/
private
String
attrValue
;
/**
* 属性描述(中文)
*/
private
String
attrDesc
;
/**
* 状态
*/
private
Integer
status
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
* 设置:属性描述ID
*/
public
void
setAttrDescId
(
String
attrDescId
)
{
this
.
attrDescId
=
attrDescId
;
}
/**
* 获取:属性描述ID
*/
public
String
getAttrDescId
()
{
return
attrDescId
;
}
/**
* 设置:属性ID
*/
public
void
setAttrId
(
String
attrId
)
{
this
.
attrId
=
attrId
;
}
/**
* 获取:属性ID
*/
public
String
getAttrId
()
{
return
attrId
;
}
/**
* 设置:属性值
*/
public
void
setAttrValue
(
String
attrValue
)
{
this
.
attrValue
=
attrValue
;
}
/**
* 获取:属性值
*/
public
String
getAttrValue
()
{
return
attrValue
;
}
/**
* 设置:属性描述(中文)
*/
public
void
setAttrDesc
(
String
attrDesc
)
{
this
.
attrDesc
=
attrDesc
;
}
/**
* 获取:属性描述(中文)
*/
public
String
getAttrDesc
()
{
return
attrDesc
;
}
/**
* 设置:状态
*/
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
/**
* 获取:状态
*/
public
Integer
getStatus
()
{
return
status
;
}
/**
* 设置:创建时间
*/
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
/**
* 获取:创建时间
*/
public
Date
getCreateTime
()
{
return
createTime
;
}
/**
* 设置:更新时间
*/
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
/**
* 获取:更新时间
*/
public
Date
getUpdateTime
()
{
return
updateTime
;
}
}
platform-admin/src/main/java/com/platform/entity/AttributesEntity.java
浏览文件 @
0a1c16a2
package
com
.
platform
.
entity
;
import
org.hibernate.validator.constraints.EAN
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 实体
...
...
@@ -21,10 +24,7 @@ public class AttributesEntity implements Serializable {
* 属性名
*/
private
String
attrName
;
/**
* 属性描述
*/
private
String
attrDesc
;
/**
* 状态 0:隐藏 1:正常
*/
...
...
@@ -46,6 +46,19 @@ public class AttributesEntity implements Serializable {
*/
private
Date
updateTime
;
public
List
<
AttributesDescEntity
>
getDescs
()
{
return
descs
;
}
public
void
setDescs
(
List
<
AttributesDescEntity
>
descs
)
{
this
.
descs
=
descs
;
}
private
List
<
AttributesDescEntity
>
descs
;
/**
* 设置:商品属性ID
*/
...
...
@@ -72,19 +85,7 @@ public class AttributesEntity implements Serializable {
public
String
getAttrName
()
{
return
attrName
;
}
/**
* 设置:属性描述
*/
public
void
setAttrDesc
(
String
attrDesc
)
{
this
.
attrDesc
=
attrDesc
;
}
/**
* 获取:属性描述
*/
public
String
getAttrDesc
()
{
return
attrDesc
;
}
/**
* 设置:状态 0:隐藏 1:正常
*/
...
...
platform-admin/src/main/java/com/platform/service/AttributesDescService.java
0 → 100644
浏览文件 @
0a1c16a2
package
com
.
platform
.
service
;
import
com.platform.entity.AttributesDescEntity
;
import
java.util.List
;
import
java.util.Map
;
/**
* Service接口
*
* @author lipengjun
* @date 2020-12-23 11:00:57
*/
public
interface
AttributesDescService
{
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
AttributesDescEntity
queryObject
(
String
attrDescId
);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List
<
AttributesDescEntity
>
queryList
(
Map
<
String
,
Object
>
map
);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int
queryTotal
(
Map
<
String
,
Object
>
map
);
/**
* 保存实体
*
* @param attributesDesc 实体
* @return 保存条数
*/
int
save
(
AttributesDescEntity
attributesDesc
);
/**
* 根据主键更新实体
*
* @param attributesDesc 实体
* @return 更新条数
*/
int
update
(
AttributesDescEntity
attributesDesc
);
/**
* 根据主键删除
*
* @param attrDescId
* @return 删除条数
*/
int
delete
(
String
attrDescId
);
/**
* 根据主键批量删除
*
* @param attrDescIds
* @return 删除条数
*/
int
deleteBatch
(
String
[]
attrDescIds
);
List
<
AttributesDescEntity
>
queryByAttrId
(
String
id
);
}
platform-admin/src/main/java/com/platform/service/AttributesService.java
浏览文件 @
0a1c16a2
package
com
.
platform
.
service
;
import
com.platform.entity.AttributesEntity
;
import
com.platform.vo.AttributesExtends
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -43,7 +44,7 @@ public interface AttributesService {
* @param attributes 实体
* @return 保存条数
*/
int
save
(
AttributesE
ntity
attributes
);
int
save
(
AttributesE
xtends
attributes
);
/**
* 根据主键更新实体
...
...
@@ -51,7 +52,7 @@ public interface AttributesService {
* @param attributes 实体
* @return 更新条数
*/
int
update
(
AttributesE
ntity
attributes
);
int
update
(
AttributesE
xtends
attributes
);
/**
* 根据主键删除
...
...
@@ -68,4 +69,6 @@ public interface AttributesService {
* @return 删除条数
*/
int
deleteBatch
(
String
[]
ids
);
List
<
AttributesExtends
>
queryAttributesList
(
Map
<
String
,
Object
>
map
);
}
platform-admin/src/main/java/com/platform/service/impl/AttributesDescServiceImpl.java
0 → 100644
浏览文件 @
0a1c16a2
package
com
.
platform
.
service
.
impl
;
import
com.platform.dao.AttributesDescDao
;
import
com.platform.entity.AttributesDescEntity
;
import
com.platform.service.AttributesDescService
;
import
com.platform.utils.IdUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
/**
* Service实现类
*
* @author lipengjun
* @date 2020-12-23 11:00:57
*/
@Service
(
"attributesDescService"
)
public
class
AttributesDescServiceImpl
implements
AttributesDescService
{
@Autowired
private
AttributesDescDao
attributesDescDao
;
@Override
public
AttributesDescEntity
queryObject
(
String
attrDescId
)
{
return
attributesDescDao
.
queryObject
(
attrDescId
);
}
@Override
public
List
<
AttributesDescEntity
>
queryList
(
Map
<
String
,
Object
>
map
)
{
return
attributesDescDao
.
queryList
(
map
);
}
@Override
public
int
queryTotal
(
Map
<
String
,
Object
>
map
)
{
return
attributesDescDao
.
queryTotal
(
map
);
}
@Override
public
int
save
(
AttributesDescEntity
attributesDesc
)
{
attributesDesc
.
setAttrDescId
(
IdUtil
.
createIdbyUUID
());
return
attributesDescDao
.
save
(
attributesDesc
);
}
@Override
public
int
update
(
AttributesDescEntity
attributesDesc
)
{
return
attributesDescDao
.
update
(
attributesDesc
);
}
@Override
public
int
delete
(
String
attrDescId
)
{
return
attributesDescDao
.
delete
(
attrDescId
);
}
@Override
public
int
deleteBatch
(
String
[]
attrDescIds
)
{
return
attributesDescDao
.
deleteBatch
(
attrDescIds
);
}
@Override
public
List
<
AttributesDescEntity
>
queryByAttrId
(
String
id
)
{
return
attributesDescDao
.
queryByAttrId
(
id
);
}
}
platform-admin/src/main/java/com/platform/service/impl/AttributesServiceImpl.java
浏览文件 @
0a1c16a2
package
com
.
platform
.
service
.
impl
;
import
com.platform.dao.AttributesDao
;
import
com.platform.dao.AttributesDescDao
;
import
com.platform.entity.AttributesDescEntity
;
import
com.platform.entity.AttributesEntity
;
import
com.platform.service.AttributesService
;
import
com.platform.utils.IdUtil
;
import
com.platform.vo.AttributesExtends
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -20,6 +24,8 @@ import java.util.Map;
public
class
AttributesServiceImpl
implements
AttributesService
{
@Autowired
private
AttributesDao
attributesDao
;
@Autowired
private
AttributesDescDao
attributesDescDao
;
@Override
public
AttributesEntity
queryObject
(
String
id
)
{
...
...
@@ -37,14 +43,40 @@ public class AttributesServiceImpl implements AttributesService {
}
@Override
public
int
save
(
AttributesEntity
attributes
)
{
attributes
.
setId
(
IdUtil
.
createIdbyUUID
());
return
attributesDao
.
save
(
attributes
);
public
int
save
(
AttributesExtends
attributes
)
{
//属性
String
id
=
IdUtil
.
createIdbyUUID
();
attributes
.
setId
(
id
);
Date
date
=
new
Date
();
attributes
.
setCreateTime
(
date
);
attributes
.
setUpdateTime
(
date
);
int
res1
=
attributesDao
.
save
(
attributes
);
//属性描述
AttributesDescEntity
descEntity
=
new
AttributesDescEntity
();
descEntity
.
setAttrDescId
(
IdUtil
.
createIdbyUUID
());
descEntity
.
setAttrId
(
id
);
descEntity
.
setAttrValue
(
attributes
.
getAttrValue
());
descEntity
.
setAttrDesc
(
attributes
.
getAttrDesc
());
descEntity
.
setStatus
(
1
);
descEntity
.
setCreateTime
(
date
);
descEntity
.
setUpdateTime
(
date
);
int
res2
=
attributesDescDao
.
save
(
descEntity
);
return
(
res1
>
0
&&
res2
>
0
)
?
1
:
0
;
}
@Override
public
int
update
(
AttributesEntity
attributes
)
{
return
attributesDao
.
update
(
attributes
);
public
int
update
(
AttributesExtends
attributes
)
{
Date
date
=
new
Date
();
attributes
.
setUpdateTime
(
date
);
int
res1
=
attributesDao
.
update
(
attributes
);
AttributesDescEntity
descEntity
=
attributesDescDao
.
queryObject
(
attributes
.
getAttrDescId
());
descEntity
.
setAttrValue
(
attributes
.
getAttrValue
());
descEntity
.
setAttrDesc
(
attributes
.
getAttrDesc
());
descEntity
.
setUpdateTime
(
date
);
int
res2
=
attributesDescDao
.
update
(
descEntity
);
return
(
res1
>
0
&&
res2
>
0
)
?
1
:
0
;
}
@Override
...
...
@@ -56,4 +88,9 @@ public class AttributesServiceImpl implements AttributesService {
public
int
deleteBatch
(
String
[]
ids
)
{
return
attributesDao
.
deleteBatch
(
ids
);
}
@Override
public
List
<
AttributesExtends
>
queryAttributesList
(
Map
<
String
,
Object
>
map
)
{
return
attributesDao
.
queryAttributesList
(
map
);
}
}
platform-admin/src/main/java/com/platform/vo/AttributesExtends.java
0 → 100644
浏览文件 @
0a1c16a2
package
com
.
platform
.
vo
;
import
com.platform.entity.AttributesEntity
;
/**
* @Auther: wudepeng
* @Date: 2020/12/23
* @Description:
*/
public
class
AttributesExtends
extends
AttributesEntity
{
private
String
attrDescId
;
private
String
attrValue
;
private
String
attrDesc
;
public
String
getAttrDescId
()
{
return
attrDescId
;
}
public
void
setAttrDescId
(
String
attrDescId
)
{
this
.
attrDescId
=
attrDescId
;
}
public
String
getAttrValue
()
{
return
attrValue
;
}
public
void
setAttrValue
(
String
attrValue
)
{
this
.
attrValue
=
attrValue
;
}
public
String
getAttrDesc
()
{
return
attrDesc
;
}
public
void
setAttrDesc
(
String
attrDesc
)
{
this
.
attrDesc
=
attrDesc
;
}
}
platform-admin/src/main/resources/com/platform/dao/AttributesDao.xml
浏览文件 @
0a1c16a2
...
...
@@ -3,22 +3,23 @@
<mapper
namespace=
"com.platform.dao.AttributesDao"
>
<resultMap
type=
"com.platform.
entity.AttributesEntity
"
id=
"attributesMap"
>
<resultMap
type=
"com.platform.
vo.AttributesExtends
"
id=
"attributesMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"attrName"
column=
"attr_name"
/>
<result
property=
"attrDesc"
column=
"attr_desc"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"sort"
column=
"sort"
/>
<result
property=
"isNeed"
column=
"is_need"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"need"
column=
"is_need"
/>
<result
property=
"attrDescId"
column=
"attr_desc_id"
/>
<result
property=
"attrValue"
column=
"attr_value"
/>
<result
property=
"attrDesc"
column=
"attr_desc"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<select
id=
"queryObject"
resultType=
"com.platform.entity.AttributesEntity"
>
<select
id=
"queryObject"
resultType=
"com.platform.entity.AttributesEntity"
>
select
`id`,
`attr_name`,
`attr_desc`,
`status`,
`sort`,
`is_need`,
...
...
@@ -28,47 +29,74 @@
where id = #{id}
</select>
<select
id=
"queryList"
resultType=
"com.platform.entity.AttributesEntity"
>
select
`id`,
`attr_name`,
`attr_desc`,
`status`,
`sort`,
`is_need`,
`create_time`,
`update_time`
from attributes
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
AND (attr_name LIKE concat('%',#{name},'%') OR attr_desc LIKE concat('%',#{name},'%'))
</if>
<select
id=
"queryList"
resultType=
"com.platform.entity.AttributesEntity"
>
select
`id`,
`attr_name`,
`status`,
`sort`,
`create_time`,
`update_time`
from attributes
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
AND (attr_name LIKE concat('%',#{name},'%') )
</if>
<choose>
<when
test=
"sidx != null and sidx.trim() != ''"
>
order by ${sidx} ${order}
</when>
<otherwise>
<otherwise>
order by sort
</otherwise>
</otherwise>
</choose>
<if
test=
"offset != null and limit != null"
>
limit #{offset}, #{limit}
</if>
</select>
<if
test=
"offset != null and limit != null"
>
limit #{offset}, #{limit}
</if>
</select>
<select
id=
"queryTotal"
resultType=
"int"
>
select count(*) from attributes
WHERE 1=1
<select
id=
"queryAttributesList"
resultType=
"com.platform.vo.AttributesExtends"
>
SELECT
a.`id`,
a.`attr_name`,
a.`status`,
a.`sort`,
a.`is_need`,
d.attr_desc_id,
d.attr_value,
d.attr_desc,
a.`create_time`,
a.`update_time`
FROM attributes a LEFT join attributes_desc d on a.id=d.attr_id
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
AND (attr_name LIKE concat('%',#{name},'%') OR attr_desc LIKE concat('%',#{name},'%')
)
AND (attr_name LIKE concat('%',#{name},'%')
)
</if>
</select>
<choose>
<when
test=
"sidx != null and sidx.trim() != ''"
>
order by ${sidx} ${order}
</when>
<otherwise>
order by sort
</otherwise>
</choose>
<if
test=
"offset != null and limit != null"
>
limit #{offset}, #{limit}
</if>
</select>
<insert
id=
"save"
parameterType=
"com.platform.entity.AttributesEntity"
>
<select
id=
"queryTotal"
resultType=
"int"
>
select count(*) from attributes
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
AND (attr_name LIKE concat('%',#{name},'%'))
</if>
</select>
<insert
id=
"save"
parameterType=
"com.platform.entity.AttributesEntity"
>
insert into attributes(
`id`,
`attr_name`,
`attr_desc`,
`status`,
`sort`,
`is_need`,
...
...
@@ -77,7 +105,6 @@
values(
#{id},
#{attrName},
#{attrDesc},
#{status},
#{sort},
#{isNeed},
...
...
@@ -85,31 +112,29 @@
#{updateTime})
</insert>
<update
id=
"update"
parameterType=
"com.platform.entity.AttributesEntity"
>
update attributes
<set>
<if
test=
"attrName != null"
>
`attr_name` = #{attrName},
</if>
<if
test=
"attrDesc != null"
>
`attr_desc` = #{attrDesc},
</if>
<if
test=
"status != null"
>
`status` = #{status},
</if>
<if
test=
"sort != null"
>
`sort` = #{sort},
</if>
<if
test=
"isNeed != null"
>
`is_need` = #{isNeed},
</if>
<if
test=
"createTime != null"
>
`create_time` = #{createTime},
</if>
<if
test=
"updateTime != null"
>
`update_time` = #{updateTime}
</if>
</set>
where id = #{id}
</update>
<update
id=
"update"
parameterType=
"com.platform.entity.AttributesEntity"
>
update attributes
<set>
<if
test=
"attrName != null"
>
`attr_name` = #{attrName},
</if>
<if
test=
"status != null"
>
`status` = #{status},
</if>
<if
test=
"sort != null"
>
`sort` = #{sort},
</if>
<if
test=
"isNeed != null"
>
`is_need` = #{isNeed},
</if>
<if
test=
"createTime != null"
>
`create_time` = #{createTime},
</if>
<if
test=
"updateTime != null"
>
`update_time` = #{updateTime}
</if>
</set>
where id = #{id}
</update>
<delete
id=
"delete"
>
<delete
id=
"delete"
>
delete from attributes where id = #{value}
</delete>
<delete
id=
"deleteBatch"
>
delete from attributes where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
<delete
id=
"deleteBatch"
>
delete from attributes where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</mapper>
platform-admin/src/main/resources/com/platform/dao/AttributesDescDao.xml
0 → 100644
浏览文件 @
0a1c16a2
<?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.platform.dao.AttributesDescDao"
>
<resultMap
type=
"com.platform.entity.AttributesDescEntity"
id=
"attributesDescMap"
>
<result
property=
"attrDescId"
column=
"attr_desc_id"
/>
<result
property=
"attrId"
column=
"attr_id"
/>
<result
property=
"attrValue"
column=
"attr_value"
/>
<result
property=
"attrDesc"
column=
"attr_desc"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
<select
id=
"queryObject"
resultType=
"com.platform.entity.AttributesDescEntity"
>
select
`attr_desc_id`,
`attr_id`,
`attr_value`,
`attr_desc`,
`status`,
`create_time`,
`update_time`
from attributes_desc
where attr_desc_id = #{id}
</select>
<select
id=
"queryByAttrId"
resultType=
"com.platform.entity.AttributesDescEntity"
>
select
`attr_desc_id`,
`attr_id`,
`attr_value`,
`attr_desc`,
`status`,
`create_time`,
`update_time`
from attributes_desc
where attr_id = #{id}
</select>
<select
id=
"queryList"
resultType=
"com.platform.entity.AttributesDescEntity"
>
select
`attr_desc_id`,
`attr_id`,
`attr_value`,
`attr_desc`,
`status`,
`create_time`,
`update_time`
from attributes_desc
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when
test=
"sidx != null and sidx.trim() != ''"
>
order by ${sidx} ${order}
</when>
<otherwise>
order by attr_desc_id desc
</otherwise>
</choose>
<if
test=
"offset != null and limit != null"
>
limit #{offset}, #{limit}
</if>
</select>
<select
id=
"queryTotal"
resultType=
"int"
>
select count(*) from attributes_desc
WHERE 1=1
<if
test=
"name != null and name.trim() != ''"
>
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert
id=
"save"
parameterType=
"com.platform.entity.AttributesDescEntity"
>
insert into attributes_desc(
`attr_desc_id`,
`attr_id`,
`attr_value`,
`attr_desc`,
`status`,
`create_time`,
`update_time`)
values(
#{attrDescId},
#{attrId},
#{attrValue},
#{attrDesc},
#{status},
#{createTime},
#{updateTime})
</insert>
<update
id=
"update"
parameterType=
"com.platform.entity.AttributesDescEntity"
>
update attributes_desc
<set>
<if
test=
"attrId != null"
>
`attr_id` = #{attrId},
</if>
<if
test=
"attrValue != null"
>
`attr_value` = #{attrValue},
</if>
<if
test=
"attrDesc != null"
>
`attr_desc` = #{attrDesc},
</if>
<if
test=
"status != null"
>
`status` = #{status},
</if>
<if
test=
"createTime != null"
>
`create_time` = #{createTime},
</if>
<if
test=
"updateTime != null"
>
`update_time` = #{updateTime}
</if>
</set>
where attr_desc_id = #{attrDescId}
</update>
<delete
id=
"delete"
>
delete from attributes_desc where attr_desc_id = #{value}
</delete>
<delete
id=
"deleteBatch"
>
delete from attributes_desc where attr_desc_id in
<foreach
item=
"attrDescId"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{attrDescId}
</foreach>
</delete>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论