This commit is contained in:
磷叶 2025-01-23 18:04:54 +08:00
parent 6102a63d5c
commit 9d69470d3f
8 changed files with 59 additions and 79 deletions

View File

@ -1,16 +1,16 @@
package com.ruoyi.common.core.domain.entity; package com.ruoyi.common.core.domain.entity;
import com.ruoyi.common.annotation.Excel; import java.util.ArrayList;
import com.ruoyi.common.core.domain.BaseEntity; import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Email; import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List; import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
/** /**
* 部门表 sys_dept * 部门表 sys_dept
@ -61,19 +61,6 @@ public class SysDept extends BaseEntity
/** 父部门名称 */ /** 父部门名称 */
private String parentName; private String parentName;
@ApiModelProperty("负责人ID列表")
private List<Long> leaderIds;
@Excel(name = "负责工序")
@ApiModelProperty("负责工序")
private String process;
// ERP部门ID
private String erpId;
// ERP部门编码
private String erpNumber;
/** 子部门 */ /** 子部门 */
private List<? extends SysDept> children = new ArrayList<SysDept>(); private List<? extends SysDept> children = new ArrayList<SysDept>();
} }

View File

@ -1,5 +1,7 @@
package com.ruoyi.bst.customer.domain; package com.ruoyi.bst.customer.domain;
import java.util.List;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -11,4 +13,7 @@ public class CustomerQuery extends CustomerVO{
@ApiModelProperty("排除ID") @ApiModelProperty("排除ID")
private Long excludeId; private Long excludeId;
@ApiModelProperty("ID列表")
private List<Long> ids;
} }

View File

@ -42,6 +42,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.deleted == null "> and bc.deleted = false</if> <if test="query.deleted == null "> and bc.deleted = false</if>
<if test="query.eqCode != null and query.eqCode != ''"> and bc.code = #{query.eqCode}</if> <if test="query.eqCode != null and query.eqCode != ''"> and bc.code = #{query.eqCode}</if>
<if test="query.excludeId != null "> and bc.id != #{query.excludeId}</if> <if test="query.excludeId != null "> and bc.id != #{query.excludeId}</if>
<if test="query.ids != null and query.ids.size() > 0">
and bc.id in
<foreach collection="query.ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
${query.params.dataScope} ${query.params.dataScope}
</sql> </sql>

View File

@ -68,4 +68,11 @@ public interface CustomerService
* @return * @return
*/ */
public int selectCount(CustomerQuery query); public int selectCount(CustomerQuery query);
/**
* 查询客户列表ByIds
* @param ids
* @return
*/
List<CustomerVO> selectCustomerListByIds(List<Long> ids);
} }

View File

@ -1,5 +1,6 @@
package com.ruoyi.bst.customer.service.impl; package com.ruoyi.bst.customer.service.impl;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -13,6 +14,7 @@ import com.ruoyi.bst.customer.mapper.CustomerMapper;
import com.ruoyi.bst.customer.service.CustomerService; import com.ruoyi.bst.customer.service.CustomerService;
import com.ruoyi.bst.customer.service.CustomerValidator; import com.ruoyi.bst.customer.service.CustomerValidator;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.collection.CollectionUtils;
/** /**
* 客户Service业务层处理 * 客户Service业务层处理
@ -130,4 +132,14 @@ public class CustomerServiceImpl implements CustomerService
public int selectCount(CustomerQuery query) { public int selectCount(CustomerQuery query) {
return customerMapper.selectCount(query); return customerMapper.selectCount(query);
} }
@Override
public List<CustomerVO> selectCustomerListByIds(List<Long> ids) {
if (CollectionUtils.isEmptyElement(ids)) {
return Collections.emptyList();
}
CustomerQuery query = new CustomerQuery();
query.setIds(ids);
return customerMapper.selectCustomerList(query);
}
} }

View File

@ -1,11 +1,8 @@
package com.ruoyi.system.dept.domain; package com.ruoyi.system.dept.domain;
import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.system.user.domain.SysUserVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List; import lombok.Data;
/** /**
* @author wjh * @author wjh
@ -14,7 +11,4 @@ import java.util.List;
@Data @Data
public class SysDeptVO extends SysDept { public class SysDeptVO extends SysDept {
@ApiModelProperty("负责人列表")
private List<SysUserVO> leaderList;
} }

View File

@ -6,17 +6,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="SysDeptVO" id="SysDeptResult" autoMapping="true"> <resultMap type="SysDeptVO" id="SysDeptResult" autoMapping="true">
<id column="dept_id" property="deptId"/> <id column="dept_id" property="deptId"/>
<result property="leaderIds" column="leader_ids" typeHandler="com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler"/>
<collection property="leaderList" javaType="java.util.List" ofType="SysUserVO">
<id column="leader_id" property="userId"/>
<result column="leader_name" property="nickName"/>
</collection>
</resultMap> </resultMap>
<sql id="selectDeptVo"> <sql id="selectDeptVo">
select select
d.dept_id, d.dept_id,
d.parent_id, d.parent_id,
d.ancestors, d.ancestors,
d.dept_name, d.dept_name,
d.order_num, d.order_num,
@ -27,25 +22,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.del_flag, d.del_flag,
d.create_by, d.create_by,
d.create_time, d.create_time,
d.erp_id, p.dept_name as parent_name
d.erp_number, from sys_dept d
d.leader_ids,
d.process,
p.dept_name as parent_name,
l.user_id as leader_id,
l.nick_name as leader_name
from sys_dept d
left join sys_dept p on d.parent_id = p.dept_id left join sys_dept p on d.parent_id = p.dept_id
left join sys_user l on find_in_set(l.user_id, d.leader_ids)
</sql> </sql>
<select id="selectDeptList" parameterType="SysDeptQuery" resultMap="SysDeptResult"> <select id="selectDeptList" parameterType="SysDeptQuery" resultMap="SysDeptResult">
<include refid="selectDeptVo"/> <include refid="selectDeptVo"/>
where d.del_flag = '0' where d.del_flag = '0'
<if test="deptId != null and deptId != 0"> <if test="deptId != null and deptId != 0">
AND d.dept_id = #{deptId} AND d.dept_id = #{deptId}
</if> </if>
<if test="parentId != null and parentId != 0"> <if test="parentId != null and parentId != 0">
AND d.parent_id = #{parentId} AND d.parent_id = #{parentId}
</if> </if>
<if test="deptName != null and deptName != ''"> <if test="deptName != null and deptName != ''">
@ -54,30 +42,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''"> <if test="status != null and status != ''">
AND d.status = #{status} AND d.status = #{status}
</if> </if>
<if test="erpId != null">
AND d.erp_id = #{erpId}
</if>
<if test="leaderId != null">
AND l.user_id = #{leaderId}
</if>
<if test="leaderName != null and leaderName != ''">
AND l.nick_name like concat('%', #{leaderName}, '%')
</if>
<if test="process != null and process != ''">
AND d.process like concat('%', #{process}, '%')
</if>
<if test="deptNames != null and deptNames.size() > 0"> <if test="deptNames != null and deptNames.size() > 0">
AND d.dept_name in AND d.dept_name in
<foreach collection="deptNames" item="item" open="(" separator="," close=")"> <foreach collection="deptNames" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="erpIds != null and erpIds.size() > 0">
AND d.erp_id in
<foreach collection="erpIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="deptIds != null and deptIds.size() > 0"> <if test="deptIds != null and deptIds.size() > 0">
AND d.dept_id in AND d.dept_id in
<foreach collection="deptIds" item="item" open="(" separator="," close=")"> <foreach collection="deptIds" item="item" open="(" separator="," close=")">
@ -93,9 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 数据范围过滤 --> <!-- 数据范围过滤 -->
${params.dataScope} ${params.dataScope}
order by d.parent_id, d.order_num order by d.parent_id, d.order_num
</select> </select>
<select id="selectDeptListByRoleId" resultType="Long"> <select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id select d.dept_id
from sys_dept d from sys_dept d
left join sys_role_dept rd on d.dept_id = rd.dept_id left join sys_role_dept rd on d.dept_id = rd.dept_id
@ -106,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by d.parent_id, d.order_num order by d.parent_id, d.order_num
</select> </select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult"> <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
<include refid="selectDeptVo"/> <include refid="selectDeptVo"/>
where d.dept_id = #{deptId} where d.dept_id = #{deptId}
${@com.ruoyi.framework.util.DataScopeUtil@dataScope("d", null, scope)} ${@com.ruoyi.framework.util.DataScopeUtil@dataScope("d", null, scope)}
@ -146,10 +116,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null and email != ''">email,</if> <if test="email != null and email != ''">email,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
<if test="erpId != null and erpId != ''">erp_id,</if>
<if test="erpNumber != null and erpNumber != ''">erp_number,</if>
<if test="leaderIds != null">leader_ids,</if>
<if test="process != null">process,</if>
create_time create_time
)values( )values(
<if test="deptId != null and deptId != 0">#{deptId},</if> <if test="deptId != null and deptId != 0">#{deptId},</if>
@ -162,10 +128,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null and email != ''">#{email},</if> <if test="email != null and email != ''">#{email},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="erpId != null and erpId != ''">#{erpId},</if>
<if test="erpNumber != null and erpNumber != ''">#{erpNumber},</if>
<if test="leaderIds != null">#{leaderIds,typeHandler=com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler},</if>
<if test="process != null">#{process},</if>
sysdate() sysdate()
) )
</insert> </insert>
@ -182,10 +144,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null">email = #{email},</if> <if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">`status` = #{status},</if> <if test="status != null and status != ''">`status` = #{status},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="erpId != null and erpId != ''">erp_id = #{erpId},</if>
<if test="erpNumber != null and erpNumber != ''">erp_number = #{erpNumber},</if>
<if test="leaderIds != null">leader_ids = #{leaderIds,typeHandler=com.ruoyi.common.mybatis.typehandler.LongSplitListTypeHandler},</if>
<if test="process != null">`process` = #{process},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where dept_id = #{deptId} where dept_id = #{deptId}

View File

@ -58,6 +58,17 @@ public class CustomerController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 查询客户列表ByIds
*/
@PreAuthorize("@ss.hasPermi('bst:customer:list')")
@PostMapping("/listByIds")
public AjaxResult listByIds(@RequestBody List<Long> ids)
{
List<CustomerVO> list = customerService.selectCustomerListByIds(ids);
return success(list);
}
/** /**
* 导出客户列表 * 导出客户列表
*/ */