1
This commit is contained in:
parent
7653218c8e
commit
030ddab9f5
@ -178,4 +178,16 @@ public class BusiProdController extends BaseController
|
|||||||
prodRandomService.saveBatch(randomList);
|
prodRandomService.saveBatch(randomList);
|
||||||
return success();
|
return success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除产品关联的随机产品
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 9:38 2025/6/30
|
||||||
|
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||||
|
**/
|
||||||
|
@PostMapping("/delProdRandom")
|
||||||
|
public AjaxResult delProdRandom(@RequestBody ProdRandomVO randomVO){
|
||||||
|
prodRandomService.delProdRandom(randomVO.getProdId(),randomVO.getRandomId(),randomVO.getTenantId());
|
||||||
|
return success();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,125 @@
|
|||||||
|
package com.ruoyi.busi.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.busi.vo.RelationVO;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
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.RestController;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.busi.domain.BusiRelation;
|
||||||
|
import com.ruoyi.busi.service.IBusiRelationService;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品、新闻等与员工关系Controller
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-06-30
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/busi/relation")
|
||||||
|
public class BusiRelationController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IBusiRelationService busiRelationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询产品、新闻等与员工关系列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('busi:relation:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public AjaxResult list(BusiRelation busiRelation,
|
||||||
|
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||||
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
|
||||||
|
{
|
||||||
|
Page<BusiRelation> page = new Page<>(pageNum, pageSize);
|
||||||
|
IPage<BusiRelation> list = busiRelationService.queryListPage(busiRelation,page);
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出产品、新闻等与员工关系列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('busi:relation:export')")
|
||||||
|
@Log(title = "产品、新闻等与员工关系", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, BusiRelation busiRelation)
|
||||||
|
{
|
||||||
|
List<BusiRelation> list = busiRelationService.list();
|
||||||
|
ExcelUtil<BusiRelation> util = new ExcelUtil<BusiRelation>(BusiRelation.class);
|
||||||
|
util.exportExcel(response, list, "产品、新闻等与员工关系数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取产品、新闻等与员工关系详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('busi:relation:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||||
|
{
|
||||||
|
return success(busiRelationService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增产品、新闻等与员工关系
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('busi:relation:add')")
|
||||||
|
@Log(title = "产品、新闻等与员工关系", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody RelationVO busiRelation)
|
||||||
|
{
|
||||||
|
List<String> userIdList = Arrays.asList(busiRelation.getLeaderId().split(","));
|
||||||
|
List<BusiRelation> busiRelationList = new ArrayList<>();
|
||||||
|
userIdList.forEach(item->{
|
||||||
|
BusiRelation relation = new BusiRelation();
|
||||||
|
relation.setUserId(item);
|
||||||
|
relation.setProdId(busiRelation.getProdId());
|
||||||
|
relation.setTenantId(busiRelation.getTenantId());
|
||||||
|
busiRelationList.add(relation);
|
||||||
|
});
|
||||||
|
//先删除原来的负责人
|
||||||
|
busiRelationService.deleteByProdId(busiRelation.getProdId(),busiRelation.getTenantId());
|
||||||
|
busiRelationService.saveBatch(busiRelationList);
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改产品、新闻等与员工关系
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('busi:relation:edit')")
|
||||||
|
@Log(title = "产品、新闻等与员工关系", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody BusiRelation busiRelation)
|
||||||
|
{
|
||||||
|
return toAjax(busiRelationService.updateById(busiRelation));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除产品、新闻等与员工关系
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('busi:relation:remove')")
|
||||||
|
@Log(title = "产品、新闻等与员工关系", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids)
|
||||||
|
{
|
||||||
|
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
||||||
|
return toAjax(busiRelationService.removeByIds(list));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.ruoyi.busi.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.*;
|
||||||
|
import com.ruoyi.common.core.domain.DlBaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品、新闻等与员工关系对象 dl_busi_relation
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-06-30
|
||||||
|
*/
|
||||||
|
@TableName("dl_busi_relation")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class BusiRelation extends DlBaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键 */
|
||||||
|
@TableId(type = IdType.ASSIGN_UUID)
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/** 用户id */
|
||||||
|
@Excel(name = "用户id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
/** 产品、新闻id */
|
||||||
|
@Excel(name = "产品、新闻id")
|
||||||
|
private String prodId;
|
||||||
|
|
||||||
|
/** 站点唯一编码(租户id) */
|
||||||
|
@Excel(name = "站点唯一编码", readConverterExp = "租=户id")
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
}
|
@ -27,4 +27,14 @@ public interface BusiProdRandomMapper extends BaseMapper<BusiProdRandom>
|
|||||||
* @return java.util.List<com.ruoyi.busi.vo.ProdNewVO>
|
* @return java.util.List<com.ruoyi.busi.vo.ProdNewVO>
|
||||||
**/
|
**/
|
||||||
List<ProdNewVO> selectRandomList(@Param("map") BusiProdRandom prodRandom);
|
List<ProdNewVO> selectRandomList(@Param("map") BusiProdRandom prodRandom);
|
||||||
|
/**
|
||||||
|
* 删除产品关联的随机产品
|
||||||
|
*
|
||||||
|
* @param prodId 产品id
|
||||||
|
* @param randomId 随机产品id
|
||||||
|
* @param tenantId 租户id
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 9:40 2025/6/30
|
||||||
|
**/
|
||||||
|
Integer deleteProdRandom(@Param("prodId") String prodId,@Param("randomId") String randomId, @Param("tenantId") String tenantId);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.ruoyi.busi.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.busi.domain.BusiRelation;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品、新闻等与员工关系Mapper接口
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-06-30
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface BusiRelationMapper extends BaseMapper<BusiRelation>
|
||||||
|
{
|
||||||
|
IPage<BusiRelation> queryListPage(@Param("entity") BusiRelation entity, Page<BusiRelation> page);
|
||||||
|
|
||||||
|
Integer deleteByProdId(@Param("prodId")String prodId,@Param("tenantId")String tenantId);
|
||||||
|
}
|
@ -24,4 +24,14 @@ public interface IBusiProdRandomService extends IService<BusiProdRandom>
|
|||||||
* @return java.util.List<com.ruoyi.busi.vo.ProdNewVO>
|
* @return java.util.List<com.ruoyi.busi.vo.ProdNewVO>
|
||||||
**/
|
**/
|
||||||
List<ProdNewVO> randomList(BusiProdRandom prodRandom);
|
List<ProdNewVO> randomList(BusiProdRandom prodRandom);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除产品关联的随机产品
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 9:40 2025/6/30
|
||||||
|
* @param prodId 产品id
|
||||||
|
* @param randomId 随机产品id
|
||||||
|
* @param tenantId 租户id
|
||||||
|
**/
|
||||||
|
void delProdRandom(String prodId, String randomId, String tenantId);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.ruoyi.busi.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.busi.domain.BusiRelation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品、新闻等与员工关系Service接口
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-06-30
|
||||||
|
*/
|
||||||
|
public interface IBusiRelationService extends IService<BusiRelation>
|
||||||
|
{
|
||||||
|
IPage<BusiRelation> queryListPage(BusiRelation pageReqVO, Page<BusiRelation> page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除某产品的负责人
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 13:48 2025/6/30
|
||||||
|
* @param prodId TODO
|
||||||
|
* @param tenantId TODO
|
||||||
|
* @return java.lang.Integer
|
||||||
|
**/
|
||||||
|
Integer deleteByProdId(String prodId,String tenantId);
|
||||||
|
}
|
@ -41,4 +41,18 @@ public class BusiProdRandomServiceImpl extends ServiceImpl<BusiProdRandomMapper,
|
|||||||
public List<ProdNewVO> randomList(BusiProdRandom prodRandom) {
|
public List<ProdNewVO> randomList(BusiProdRandom prodRandom) {
|
||||||
return busiProdRandomMapper.selectRandomList(prodRandom);
|
return busiProdRandomMapper.selectRandomList(prodRandom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除产品关联的随机产品
|
||||||
|
*
|
||||||
|
* @param prodId 产品id
|
||||||
|
* @param randomId 随机产品id
|
||||||
|
* @param tenantId 租户id
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 9:40 2025/6/30
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public void delProdRandom(String prodId, String randomId, String tenantId) {
|
||||||
|
busiProdRandomMapper.deleteProdRandom(prodId,randomId,tenantId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.ruoyi.busi.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.busi.mapper.BusiRelationMapper;
|
||||||
|
import com.ruoyi.busi.domain.BusiRelation;
|
||||||
|
import com.ruoyi.busi.service.IBusiRelationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品、新闻等与员工关系Service业务层处理
|
||||||
|
*
|
||||||
|
* @author vinjor-m
|
||||||
|
* @date 2025-06-30
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BusiRelationServiceImpl extends ServiceImpl<BusiRelationMapper,BusiRelation> implements IBusiRelationService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private BusiRelationMapper busiRelationMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<BusiRelation> queryListPage(BusiRelation pageReqVO, Page<BusiRelation> page) {
|
||||||
|
return busiRelationMapper.queryListPage(pageReqVO, page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除某产品的负责人
|
||||||
|
*
|
||||||
|
* @param prodId TODO
|
||||||
|
* @param tenantId TODO
|
||||||
|
* @return java.lang.Integer
|
||||||
|
* @author vinjor-M
|
||||||
|
* @date 13:48 2025/6/30
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public Integer deleteByProdId(String prodId, String tenantId) {
|
||||||
|
return busiRelationMapper.deleteByProdId(prodId,tenantId);
|
||||||
|
}
|
||||||
|
}
|
@ -30,6 +30,12 @@ public class ProdNewVO extends BusiProdNew {
|
|||||||
@Excel(name = "产品发布者")
|
@Excel(name = "产品发布者")
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
|
/** 产品负责人-多个英文逗号隔开 */
|
||||||
|
@Excel(name = "产品负责人")
|
||||||
|
private String leaderName;
|
||||||
|
/** 产品负责人id-多个英文逗号隔开 */
|
||||||
|
private String leaderId;
|
||||||
|
|
||||||
/** 随机产品数量 */
|
/** 随机产品数量 */
|
||||||
private Integer randomNum;
|
private Integer randomNum;
|
||||||
|
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.ruoyi.busi.vo;
|
||||||
|
|
||||||
|
import com.ruoyi.busi.domain.BusiRelation;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class RelationVO extends BusiRelation {
|
||||||
|
/** 产品负责人id-多个英文逗号隔开 */
|
||||||
|
private String leaderId;
|
||||||
|
}
|
@ -30,6 +30,8 @@
|
|||||||
<result property="userName" column="user_name"/>
|
<result property="userName" column="user_name"/>
|
||||||
<result property="flag" column="flag"/>
|
<result property="flag" column="flag"/>
|
||||||
<result property="randomNum" column="randomNum"/>
|
<result property="randomNum" column="randomNum"/>
|
||||||
|
<result property="leaderName" column="leaderName"/>
|
||||||
|
<result property="leaderId" column="leaderId"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectBusiProdNewVo">
|
<sql id="selectBusiProdNewVo">
|
||||||
@ -62,13 +64,17 @@
|
|||||||
su.nick_name AS user_name,
|
su.nick_name AS user_name,
|
||||||
dbc.catg_name AS catg_name,
|
dbc.catg_name AS catg_name,
|
||||||
COUNT( dbpr.random_id ) AS randomNum,
|
COUNT( dbpr.random_id ) AS randomNum,
|
||||||
0 AS flag
|
0 AS flag,
|
||||||
|
GROUP_CONCAT(dbr.user_id SEPARATOR ', ') AS leaderId,
|
||||||
|
GROUP_CONCAT(su_temp.nick_name SEPARATOR ', ') AS leaderName
|
||||||
FROM
|
FROM
|
||||||
dl_busi_prod_new product
|
dl_busi_prod_new product
|
||||||
LEFT JOIN sys_user su ON product.creator = su.user_id
|
LEFT JOIN sys_user su ON product.creator = su.user_id
|
||||||
LEFT JOIN dl_busi_category dbc ON product.catg_id = dbc.id
|
LEFT JOIN dl_busi_category dbc ON product.catg_id = dbc.id
|
||||||
LEFT JOIN dl_busi_prod_random dbpr ON product.id = dbpr.prod_id
|
LEFT JOIN dl_busi_prod_random dbpr ON product.id = dbpr.prod_id
|
||||||
AND dbpr.del_flag = '0'
|
AND dbpr.del_flag = '0'
|
||||||
|
LEFT JOIN dl_busi_relation dbr ON product.id = dbr.prod_id AND dbr.del_flag = '0'
|
||||||
|
LEFT JOIN sys_user su_temp ON dbr.user_id = su_temp.user_id
|
||||||
<where>
|
<where>
|
||||||
product.del_flag = '0'
|
product.del_flag = '0'
|
||||||
AND product.tenant_id = #{entity.tenantId}
|
AND product.tenant_id = #{entity.tenantId}
|
||||||
|
@ -42,4 +42,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
ORDER BY
|
ORDER BY
|
||||||
dbpn.sort DESC
|
dbpn.sort DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteProdRandom">
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
dl_busi_prod_random
|
||||||
|
WHERE
|
||||||
|
prod_id = #{prodId}
|
||||||
|
AND random_id = #{randomId}
|
||||||
|
AND tenant_id = #{tenantId}
|
||||||
|
</delete>
|
||||||
</mapper>
|
</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.ruoyi.busi.mapper.BusiRelationMapper">
|
||||||
|
|
||||||
|
<resultMap type="BusiRelation" id="BusiRelationResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="userId" column="user_id" />
|
||||||
|
<result property="prodId" column="prod_id" />
|
||||||
|
<result property="tenantId" column="tenant_id" />
|
||||||
|
<result property="creator" column="creator" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updater" column="updater" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBusiRelationVo">
|
||||||
|
select id, user_id, prod_id, tenant_id, creator, create_time, updater, update_time, del_flag from dl_busi_relation
|
||||||
|
</sql>
|
||||||
|
<delete id="deleteByProdId">
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
dl_busi_relation
|
||||||
|
WHERE
|
||||||
|
prod_id = #{prodId}
|
||||||
|
AND tenant_id = #{tenantId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="queryListPage" parameterType="BusiRelation" resultMap="BusiRelationResult">
|
||||||
|
<include refid="selectBusiRelationVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="entity.userId != null and entity.userId != ''"> and user_id = #{entity.userId}</if>
|
||||||
|
<if test="entity.prodId != null and entity.prodId != ''"> and prod_id = #{entity.prodId}</if>
|
||||||
|
<if test="entity.tenantId != null and entity.tenantId != ''"> and tenant_id = #{entity.tenantId}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -68,7 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
AND u.user_id = #{userId}
|
AND u.user_id = #{userId}
|
||||||
</if>
|
</if>
|
||||||
<if test="userName != null and userName != ''">
|
<if test="userName != null and userName != ''">
|
||||||
AND u.user_name like concat('%', #{userName}, '%')
|
AND (u.nick_name like concat('%', #{userName}, '%') OR u.user_name like concat('%', #{userName}, '%'))
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null and status != ''">
|
<if test="status != null and status != ''">
|
||||||
AND u.status = #{status}
|
AND u.status = #{status}
|
||||||
|
@ -69,3 +69,12 @@ export function saveRandom(data) {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除关联产品
|
||||||
|
export function delProdRandom(data) {
|
||||||
|
return request({
|
||||||
|
url: '/busi/prod/delProdRandom',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
44
dl_vue/src/api/busi/relation.js
Normal file
44
dl_vue/src/api/busi/relation.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询产品、新闻等与员工关系列表
|
||||||
|
export function listRelation(query) {
|
||||||
|
return request({
|
||||||
|
url: '/busi/relation/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询产品、新闻等与员工关系详细
|
||||||
|
export function getRelation(id) {
|
||||||
|
return request({
|
||||||
|
url: '/busi/relation/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增产品、新闻等与员工关系
|
||||||
|
export function addRelation(data) {
|
||||||
|
return request({
|
||||||
|
url: '/busi/relation',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改产品、新闻等与员工关系
|
||||||
|
export function updateRelation(data) {
|
||||||
|
return request({
|
||||||
|
url: '/busi/relation',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除产品、新闻等与员工关系
|
||||||
|
export function delRelation(id) {
|
||||||
|
return request({
|
||||||
|
url: '/busi/relation/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
@ -71,7 +71,8 @@
|
|||||||
<image-preview :src="scope.row.mainPic" :width="50" :height="50"/>
|
<image-preview :src="scope.row.mainPic" :width="50" :height="50"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="产品简介" align="center" prop="description" />
|
<el-table-column label="产品负责人" align="center" prop="leaderName" />
|
||||||
|
<!-- <el-table-column label="产品简介" align="center" prop="description" />-->
|
||||||
<el-table-column width="100" label="排序" align="center" prop="sort">
|
<el-table-column width="100" label="排序" align="center" prop="sort">
|
||||||
<template slot="header" slot-scope="scope">
|
<template slot="header" slot-scope="scope">
|
||||||
<span>排序</span>
|
<span>排序</span>
|
||||||
@ -104,7 +105,15 @@
|
|||||||
</el-switch>
|
</el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column width="80" label="随机产品" align="center" prop="randomNum">
|
<el-table-column width="90" label="随机产品" align="center" prop="randomNum">
|
||||||
|
<template slot="header" slot-scope="scope">
|
||||||
|
<span>随机产品</span>
|
||||||
|
<el-tooltip class="item" effect="dark" content="鼠标单机数据可查看关联产品明细"
|
||||||
|
placement="bottom"
|
||||||
|
>
|
||||||
|
<i class="el-icon-question"></i>
|
||||||
|
</el-tooltip>
|
||||||
|
</template>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-tag style="cursor: pointer" @click="managerRandom(scope.row)">{{scope.row.randomNum}}</el-tag>
|
<el-tag style="cursor: pointer" @click="managerRandom(scope.row)">{{scope.row.randomNum}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
@ -137,13 +146,13 @@
|
|||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['busi:prod:edit']"
|
v-hasPermi="['busi:prod:edit']"
|
||||||
>修改</el-button>
|
>修改</el-button>
|
||||||
<el-button
|
<el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['busi:prod:remove', 'busi:relation:add']">
|
||||||
size="mini"
|
<el-button size="mini" type="text" icon="el-icon-d-arrow-right">更多</el-button>
|
||||||
type="text"
|
<el-dropdown-menu slot="dropdown">
|
||||||
icon="el-icon-delete"
|
<el-dropdown-item command="handleDelete" icon="el-icon-delete" v-hasPermi="['busi:prod:remove']">删除</el-dropdown-item>
|
||||||
@click="handleDelete(scope.row)"
|
<el-dropdown-item command="handleSetRelation" icon="el-icon-key" v-hasPermi="['busi:relation:add']">分配负责人</el-dropdown-item>
|
||||||
v-hasPermi="['busi:prod:remove']"
|
</el-dropdown-menu>
|
||||||
>删除</el-button>
|
</el-dropdown>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -184,7 +193,7 @@
|
|||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDeleteRandom(scope.row)"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -219,15 +228,19 @@
|
|||||||
<el-button @click="cancelSelect">取 消</el-button>
|
<el-button @click="cancelSelect">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<select-all-user @chooseUserFun ref="select" @ok="chooseUserFun" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listProdNew, getProdNew, delProdNew, addProdNew, updateProdNew,listRandomProd,saveRandom } from "@/api/busi/prod";
|
import { listProdNew, getProdNew, delProdNew, addProdNew,delProdRandom, updateProdNew,listRandomProd,saveRandom } from "@/api/busi/prod";
|
||||||
|
import { addRelation } from "@/api/busi/relation";
|
||||||
|
import selectAllUser from "@/views/system/user/selectAllUser";
|
||||||
export default {
|
export default {
|
||||||
name: "Prod",
|
name: "Prod",
|
||||||
dicts: ['sys_yes_no'],
|
dicts: ['sys_yes_no'],
|
||||||
|
components: { selectAllUser },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
@ -325,6 +338,19 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 更多操作触发
|
||||||
|
handleCommand(command, row) {
|
||||||
|
switch (command) {
|
||||||
|
case "handleDelete":
|
||||||
|
this.handleDelete(row)
|
||||||
|
break;
|
||||||
|
case "handleSetRelation":
|
||||||
|
this.handleSetRelation(row);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
/** 查询产品、文章列表 */
|
/** 查询产品、文章列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@ -454,13 +480,24 @@ export default {
|
|||||||
},
|
},
|
||||||
// 取消按钮--修改随机产品
|
// 取消按钮--修改随机产品
|
||||||
cancelRandom() {
|
cancelRandom() {
|
||||||
this.randomOpen = false;
|
|
||||||
this.getList()
|
this.getList()
|
||||||
},
|
|
||||||
// 确定按钮--修改随机产品
|
|
||||||
submitRandom(){
|
|
||||||
this.randomOpen = false;
|
this.randomOpen = false;
|
||||||
},
|
},
|
||||||
|
// 删除随机产品
|
||||||
|
handleDeleteRandom(row){
|
||||||
|
let data = {
|
||||||
|
prodId:this.nowDealId,
|
||||||
|
randomId:row.id
|
||||||
|
}
|
||||||
|
this.$modal.confirm('是否确认删除关联的随机产品?').then(function() {
|
||||||
|
return delProdRandom(data);
|
||||||
|
}).then(() => {
|
||||||
|
this.getRandomList()
|
||||||
|
this.getList()
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
this.randomOpen = false;
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加随机产品
|
* 添加随机产品
|
||||||
@ -498,6 +535,29 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 分配负责员工
|
||||||
|
* @param row
|
||||||
|
*/
|
||||||
|
handleSetRelation(row){
|
||||||
|
this.nowDealId = row.id
|
||||||
|
this.$refs.select.show(row.leaderId);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 确定选中的用户
|
||||||
|
* @param userIds
|
||||||
|
*/
|
||||||
|
chooseUserFun(userIds){
|
||||||
|
let dataObj={
|
||||||
|
prodId:this.nowDealId,
|
||||||
|
leaderId:userIds
|
||||||
|
}
|
||||||
|
addRelation(dataObj).then(response => {
|
||||||
|
this.$modal.msgSuccess('分配成功')
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -157,6 +157,8 @@ export default {
|
|||||||
getProdInfo(id){
|
getProdInfo(id){
|
||||||
getProdNew(id).then(response => {
|
getProdNew(id).then(response => {
|
||||||
this.form= response.data
|
this.form= response.data
|
||||||
|
this.form.id=null
|
||||||
|
this.initData()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
172
dl_vue/src/views/system/user/selectAllUser.vue
Normal file
172
dl_vue/src/views/system/user/selectAllUser.vue
Normal file
@ -0,0 +1,172 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 授权用户 -->
|
||||||
|
<el-dialog title="选择用户" :visible.sync="visible" width="800px" top="5vh" append-to-body>
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
|
||||||
|
<el-form-item label="用户名称" prop="userName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.userName"
|
||||||
|
placeholder="请输入用户名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="手机号码" prop="phonenumber">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.phonenumber"
|
||||||
|
placeholder="请输入手机号码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="部门" prop="deptId">
|
||||||
|
<treeselect style="width: 200px" v-model="queryParams.deptId" :options="deptOptions" :normalizer="normalizer" placeholder="选择部门" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<el-row>
|
||||||
|
<el-table @row-click="clickRow" ref="table" :data="userList" @selection-change="handleSelectionChange" height="260px">
|
||||||
|
<el-table-column type="selection" width="55"></el-table-column>
|
||||||
|
<el-table-column label="用户名称" prop="userName" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="用户昵称" prop="nickName" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="邮箱" prop="email" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="手机" prop="phonenumber" :show-overflow-tooltip="true" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</el-row>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="handleSelectUser">确 定</el-button>
|
||||||
|
<el-button @click="visible = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listDept } from "@/api/system/dept";
|
||||||
|
import { listUser } from "@/api/system/user";
|
||||||
|
import Treeselect from "@riophae/vue-treeselect";
|
||||||
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
dicts: ['sys_normal_disable'],
|
||||||
|
components: { Treeselect },
|
||||||
|
props: {
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 部门树选项
|
||||||
|
deptOptions: [],
|
||||||
|
// 遮罩层
|
||||||
|
visible: false,
|
||||||
|
// 选中数组值
|
||||||
|
userIds: [],
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 未授权用户数据
|
||||||
|
userList: [],
|
||||||
|
//默认选中的数据
|
||||||
|
leaderIds:[],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
deptId:null,
|
||||||
|
userName: undefined,
|
||||||
|
phonenumber: undefined
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.initData()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initData(){
|
||||||
|
listDept().then(response => {
|
||||||
|
this.deptOptions = this.handleTree(response.data, "deptId");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 转换部门数据结构 */
|
||||||
|
normalizer(node) {
|
||||||
|
if (node.children && !node.children.length) {
|
||||||
|
delete node.children;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: node.deptId,
|
||||||
|
label: node.deptName,
|
||||||
|
children: node.children
|
||||||
|
};
|
||||||
|
},
|
||||||
|
// 显示弹框
|
||||||
|
show(leaderId) {
|
||||||
|
if(leaderId){
|
||||||
|
|
||||||
|
this.leaderIds = leaderId.split(",")
|
||||||
|
}
|
||||||
|
this.getList();
|
||||||
|
this.visible = true;
|
||||||
|
},
|
||||||
|
clickRow(row) {
|
||||||
|
this.$refs.table.toggleRowSelection(row);
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.userIds = selection.map(item => item.userId);
|
||||||
|
},
|
||||||
|
// 查询表数据
|
||||||
|
getList() {
|
||||||
|
listUser(this.queryParams).then(res => {
|
||||||
|
this.userList = res.rows;
|
||||||
|
// this.$nextTick(() => {
|
||||||
|
// if (this.$refs.table) {
|
||||||
|
// this.userList.forEach(item => {
|
||||||
|
// if (this.leaderIds.indexOf(item.userId+'')!=-1) {
|
||||||
|
// this.$refs.table.toggleRowSelection(item, true);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
this.total = res.total;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 选择授权用户操作 */
|
||||||
|
handleSelectUser() {
|
||||||
|
const userIds = this.userIds.join(",");
|
||||||
|
if (userIds == "") {
|
||||||
|
this.$modal.msgError("请选择要分配的用户");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$refs.table.clearSelection();
|
||||||
|
this.visible = false;
|
||||||
|
this.$emit("ok",userIds)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user