feat:商户分类
This commit is contained in:
1 parent
e9f039e1ce
commit
42a218e99c
10 files changed
+146
-48
No files matched your search
+5
@@ -23,4 +23,9 @@ public class MchManageDto extends MchManageEntity {
|
||||
private String type;
|
||||
|
||||
private Boolean parentIsNull = true;
|
||||
|
||||
/**
|
||||
* 分类名
|
||||
*/
|
||||
private String catgoryName;
|
||||
}
|
||||
+7
-1
@@ -60,6 +60,12 @@ public class MchManageEntity extends Model<MchManageEntity> {
|
||||
@Schema(description = "店铺类型,逗号分隔")
|
||||
private String types;
|
||||
|
||||
/**
|
||||
* 分类id
|
||||
*/
|
||||
@Schema(description = "分类id")
|
||||
private Long catgoryId;
|
||||
|
||||
/**
|
||||
* 商户logo图片
|
||||
*/
|
||||
@@ -118,7 +124,7 @@ public class MchManageEntity extends Model<MchManageEntity> {
|
||||
private Long sort;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
* 超市类型
|
||||
*/
|
||||
@Schema(description = "超市类型")
|
||||
private String supType;
|
||||
|
||||
+5
@@ -27,4 +27,9 @@ public class MchManageVo extends MchManageEntity implements BaseDeptInterface, B
|
||||
|
||||
private List<MchManageVo> children;
|
||||
|
||||
/**
|
||||
* 分类名
|
||||
*/
|
||||
private String catgoryName;
|
||||
|
||||
}
|
||||
+4
@@ -39,7 +39,9 @@ public class MchCatgoryController {
|
||||
@GetMapping("/select")
|
||||
public R select(@ParameterObject Page page, @ParameterObject MchCatgoryEntity mchCatgory) {
|
||||
LambdaQueryWrapper<MchCatgoryEntity> wrapper = new LambdaQueryWrapper<MchCatgoryEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(mchCatgory.getBizType()), MchCatgoryEntity::getBizType, mchCatgory.getBizType())
|
||||
.like(ObjectUtil.isNotEmpty(mchCatgory.getName()), MchCatgoryEntity::getName, mchCatgory.getName())
|
||||
.orderByDesc(MchCatgoryEntity::getSort)
|
||||
.orderByDesc(MchCatgoryEntity::getCreateTime)
|
||||
.orderByDesc(MchCatgoryEntity::getId);
|
||||
return R.ok(mchCatgoryService.page(page, wrapper));
|
||||
@@ -50,7 +52,9 @@ public class MchCatgoryController {
|
||||
@PreAuthorize("@pms.hasPermission('waller_mchCatgory_view')")
|
||||
public R getMchCatgoryPage(@ParameterObject Page page, @ParameterObject MchCatgoryEntity mchCatgory) {
|
||||
LambdaQueryWrapper<MchCatgoryEntity> wrapper = new LambdaQueryWrapper<MchCatgoryEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(mchCatgory.getBizType()), MchCatgoryEntity::getBizType, mchCatgory.getBizType())
|
||||
.like(ObjectUtil.isNotEmpty(mchCatgory.getName()), MchCatgoryEntity::getName, mchCatgory.getName())
|
||||
.orderByDesc(MchCatgoryEntity::getSort)
|
||||
.orderByDesc(MchCatgoryEntity::getCreateTime)
|
||||
.orderByDesc(MchCatgoryEntity::getId);
|
||||
return R.ok(mchCatgoryService.page(page, wrapper));
|
||||
|
||||
+7
-3
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
|
||||
@@ -148,20 +149,23 @@ public class MchManageController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_mchManage_view')")
|
||||
public R<Page<MchManageVo>> getMchManagePageJoin(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
|
||||
return R.ok(mchManageService.scopePageList(page, dto));
|
||||
DataScope dataScope = null;
|
||||
return R.ok(mchManageService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页级联", description = "分页级联")
|
||||
@GetMapping("/cascade-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_mchManage_view')")
|
||||
public R<Page<MchManageVo>> cascadeJoin(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
|
||||
return R.ok(mchManageService.cascadeJoin(page, dto));
|
||||
DataScope dataScope = null;
|
||||
return R.ok(mchManageService.cascadeJoin(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页不要权限下拉", description = "分页不要权限下拉")
|
||||
@GetMapping("/select")
|
||||
public R getSelect(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
|
||||
return R.ok(mchManageService.scopePageList(page, dto));
|
||||
DataScope dataScope = null;
|
||||
return R.ok(mchManageService.scopePageList(page, dto, dataScope));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+3
-36
@@ -14,6 +14,7 @@ import com.github.yulichang.query.MPJLambdaQueryWrapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -42,43 +43,9 @@ public interface MchManageMapper extends PjcloudBaseMapper<MchManageEntity> {
|
||||
return selectJoinOne(MchManageVo.class, wrapper);
|
||||
}
|
||||
|
||||
default List<MchManageVo> list(MchManageDto dto) {
|
||||
MPJLambdaQueryWrapper<MchManageEntity> wrapper = new MPJLambdaQueryWrapper<MchManageEntity>()
|
||||
.selectAll(MchManageEntity.class)
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getIsSyncZy()), MchManageEntity::getIsSyncZy, dto.getIsSyncZy())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getVisibleMobile()), MchManageEntity::getVisibleMobile, dto.getVisibleMobile())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getId()), MchManageEntity::getId, dto.getId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getParentId()), MchManageEntity::getParentId, dto.getParentId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getDeptId()), MchManageEntity::getDeptId, dto.getDeptId())
|
||||
.likeIfExists(MchManageEntity::getName, dto.getName())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), MchManageEntity::getDeptId, dto.getDeptIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getIds()), MchManageEntity::getId, dto.getIds())
|
||||
.orderByDesc(MchManageEntity::getSort)
|
||||
.orderByDesc(MchManageEntity::getCreateTime)
|
||||
.orderByDesc(MchManageEntity::getId);
|
||||
return selectJoinList(MchManageVo.class, wrapper);
|
||||
}
|
||||
List<MchManageVo> scopeList(@Param("dto") MchManageDto dto, DataScope dataScope);
|
||||
|
||||
default Page<MchManageVo> scopePageList(Page page, MchManageDto dto) {
|
||||
LambdaQueryWrapper<MchManageEntity> wrapper = new LambdaQueryWrapper<MchManageEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getTypes()), MchManageEntity::getTypes, dto.getTypes())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getVisibleMobile()), MchManageEntity::getVisibleMobile, dto.getVisibleMobile())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getIsSyncZy()), MchManageEntity::getIsSyncZy, dto.getIsSyncZy())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getDeptId()), MchManageEntity::getDeptId, dto.getDeptId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getSupType()), MchManageEntity::getSupType, dto.getSupType())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getParentId()), MchManageEntity::getParentId, dto.getParentId())
|
||||
.eq(dto.getParentIsNull(), MchManageEntity::getParentId, -1L)
|
||||
.like(ObjectUtil.isNotEmpty(dto.getName()), MchManageEntity::getName, dto.getName())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), MchManageEntity::getDeptId, dto.getDeptIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getIds()), MchManageEntity::getId, dto.getIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getNotIds()), MchManageEntity::getId, dto.getNotIds())
|
||||
.orderByDesc(MchManageEntity::getSort)
|
||||
.orderByDesc(MchManageEntity::getDeptId)
|
||||
.orderByDesc(MchManageEntity::getCreateTime);
|
||||
Page list = selectPageByScope(page, wrapper, DataScope.of());
|
||||
list.setRecords(BeanUtils.toBean(list.getRecords(), MchManageVo.class));
|
||||
return list;
|
||||
}
|
||||
Page<MchManageVo> scopePageList(Page page, @Param("dto") MchManageDto dto, DataScope dataScope);
|
||||
|
||||
default List<MchManageEntity> scopeList(MchManageDto dto) {
|
||||
LambdaQueryWrapper<MchManageEntity> wrapper = new LambdaQueryWrapper<MchManageEntity>()
|
||||
|
||||
+3
-2
@@ -3,6 +3,7 @@ package com.bsd.pjcloud.wallet.service;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.wallet.api.dto.MchManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.mch.MchManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
@@ -25,9 +26,9 @@ public interface MchManageService extends IService<MchManageEntity> {
|
||||
/**
|
||||
* 分页级联
|
||||
*/
|
||||
Page<MchManageVo> cascadeJoin(Page page, MchManageDto dto);
|
||||
Page<MchManageVo> cascadeJoin(Page page, MchManageDto dto, DataScope dataScope);
|
||||
|
||||
Page<MchManageVo> scopePageList(Page page, MchManageDto dto);
|
||||
Page<MchManageVo> scopePageList(Page page, MchManageDto dto, DataScope dataScope);
|
||||
|
||||
MchManageVo join(Long id);
|
||||
|
||||
|
||||
+5
@@ -3,6 +3,7 @@ package com.bsd.pjcloud.wallet.service.impl.mch;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.MerchantTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.entity.mch.MchCatgoryEntity;
|
||||
import com.bsd.pjcloud.wallet.mapper.mch.MchCatgoryMapper;
|
||||
import com.bsd.pjcloud.wallet.service.MchCatgoryService;
|
||||
@@ -26,6 +27,9 @@ public class MchCatgoryServiceImpl extends ServiceImpl<MchCatgoryMapper, MchCatg
|
||||
@Override
|
||||
public Long create(MchCatgoryEntity dto) {
|
||||
if (existName(dto)) throw new RuntimeException("分类名不能重复");
|
||||
if (ObjectUtil.isEmpty(dto.getBizType())) {
|
||||
dto.setBizType(MerchantTypeEnum.SUPERMARKET.getType());
|
||||
}
|
||||
baseMapper.insert(dto);
|
||||
return dto.getId();
|
||||
}
|
||||
@@ -46,6 +50,7 @@ public class MchCatgoryServiceImpl extends ServiceImpl<MchCatgoryMapper, MchCatg
|
||||
private boolean existName(MchCatgoryEntity dto) {
|
||||
Long count = baseMapper.selectCount(new LambdaQueryWrapper<MchCatgoryEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getName()), MchCatgoryEntity::getName, dto.getName())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getBizType()), MchCatgoryEntity::getBizType, dto.getBizType())
|
||||
.ne(ObjectUtil.isNotEmpty(dto.getId()), MchCatgoryEntity::getId, dto.getId())
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(dto.getId())) {
|
||||
|
||||
+7
-6
@@ -155,7 +155,7 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
public void delByIds(ArrayList<Long> list) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 判断下面是否有订单
|
||||
List<MchManageVo> mchList = baseMapper.list(MchManageDto.builder().ids(list).build());
|
||||
List<MchManageVo> mchList = baseMapper.scopeList(MchManageDto.builder().ids(list).build(), null);
|
||||
for (MchManageVo v : mchList) {
|
||||
Long count = remoteHardOrderService.getMchCountById(v.getId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(count) && count > 0) {
|
||||
@@ -190,12 +190,13 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
* 分页级联
|
||||
*/
|
||||
@Override
|
||||
public Page<MchManageVo> cascadeJoin(Page page, MchManageDto dto) {
|
||||
Page<MchManageVo> pageList = scopePageList(page, dto);
|
||||
public Page<MchManageVo> cascadeJoin(Page page, MchManageDto dto, DataScope dataScope) {
|
||||
Page<MchManageVo> pageList = scopePageList(page, dto, dataScope);
|
||||
if (ObjectUtil.isEmpty(pageList.getRecords())) return pageList;
|
||||
for (MchManageVo v : pageList.getRecords()) {
|
||||
MchManageDto childrenDto = new MchManageDto();
|
||||
childrenDto.setParentId(v.getId());
|
||||
childrenDto.setParentIsNull(false);
|
||||
List<MchManageVo> list = list(childrenDto);
|
||||
if (ObjectUtil.isEmpty(list)) continue;
|
||||
v.setChildren(list);
|
||||
@@ -204,8 +205,8 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<MchManageVo> scopePageList(Page page, MchManageDto dto) {
|
||||
Page<MchManageVo> list = baseMapper.scopePageList(page, dto);
|
||||
public Page<MchManageVo> scopePageList(Page page, MchManageDto dto, DataScope dataScope) {
|
||||
Page<MchManageVo> list = baseMapper.scopePageList(page, dto, dataScope);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(MchManageVo::getDeptId).distinct().toList();
|
||||
@@ -245,7 +246,7 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
|
||||
@Override
|
||||
public List<MchManageVo> list(MchManageDto dto) {
|
||||
List<MchManageVo> list = baseMapper.list(dto);
|
||||
List<MchManageVo> list = baseMapper.scopeList(dto, null);
|
||||
if (ObjectUtil.isEmpty(list)) return null;
|
||||
// 部门
|
||||
List<Long> deptIds = list.stream().map(MchManageVo::getDeptId).distinct().toList();
|
||||
|
||||
@@ -25,4 +25,104 @@
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectA">
|
||||
select a.id,
|
||||
a.parent_id,
|
||||
a.dept_id,
|
||||
a.default_wallet_type_id,
|
||||
a.name,
|
||||
a.types,
|
||||
a.catgory_id,
|
||||
a.logo_pic,
|
||||
a.collection_code,
|
||||
a.swiper_pic,
|
||||
a.phone,
|
||||
a.address_des,
|
||||
a.job_time,
|
||||
a.is_sync_zy,
|
||||
a.visible_mobile,
|
||||
a.sort,
|
||||
a.sup_type,
|
||||
a.discounts_price,
|
||||
a.cooperation_status,
|
||||
a.mch_count,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.tenant_id,
|
||||
</sql>
|
||||
|
||||
<sql id="whereA">
|
||||
a.del_flag = 0
|
||||
<if test="dto.types != null">
|
||||
and a.types = #{dto.types}
|
||||
</if>
|
||||
<if test="dto.catgoryId != null">
|
||||
and a.catgory_id = #{dto.catgoryId}
|
||||
</if>
|
||||
<if test="dto.visibleMobile != null">
|
||||
and a.visible_mobile = #{dto.visibleMobile}
|
||||
</if>
|
||||
<if test="dto.isSyncZy != null">
|
||||
and a.is_sync_zy = #{dto.isSyncZy}
|
||||
</if>
|
||||
<if test="dto.deptId != null">
|
||||
and a.dept_id = #{dto.deptId}
|
||||
</if>
|
||||
<if test="dto.supType != null">
|
||||
and a.sup_type = #{dto.supType}
|
||||
</if>
|
||||
<if test="dto.parentId != null">
|
||||
and a.parent_id = #{dto.parentId}
|
||||
</if>
|
||||
<if test="dto.parentIsNull != null and dto.parentIsNull == true">
|
||||
and a.parent_id = -1
|
||||
</if>
|
||||
<if test="dto.name != null">
|
||||
and a.name like concat('%', #{dto.name}, '%')
|
||||
</if>
|
||||
<if test="dto.deptIds != null and dto.deptIds.size() != 0">
|
||||
and a.dept_id in
|
||||
<foreach collection="dto.deptIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.ids != null and dto.ids.size() != 0">
|
||||
and a.id in
|
||||
<foreach collection="dto.ids" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.notIds != null and dto.notIds.size() != 0">
|
||||
and a.id in
|
||||
<foreach collection="dto.notIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="scopePageList" resultType="com.bsd.pjcloud.wallet.api.vo.MchManageVo">
|
||||
<include refid="selectA"/>
|
||||
c.name as catgoryName
|
||||
from mch_manage a
|
||||
left join mch_catgory c on c.id = a.catgory_id
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
order by a.sort desc , a.dept_id desc , a.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="scopeList" resultType="com.bsd.pjcloud.wallet.api.vo.MchManageVo">
|
||||
<include refid="selectA"/>
|
||||
c.name as catgoryName
|
||||
from mch_manage a
|
||||
left join mch_catgory c on c.id = a.catgory_id
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
order by a.sort desc , a.dept_id desc , a.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user