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;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
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
@ -61,19 +61,6 @@ public class SysDept extends BaseEntity
/** 父部门名称 */
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>();
}

View File

@ -1,5 +1,7 @@
package com.ruoyi.bst.customer.domain;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -11,4 +13,7 @@ public class CustomerQuery extends CustomerVO{
@ApiModelProperty("排除ID")
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.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.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}
</sql>

View File

@ -68,4 +68,11 @@ public interface CustomerService
* @return
*/
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;
import java.util.Collections;
import java.util.List;
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.CustomerValidator;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.collection.CollectionUtils;
/**
* 客户Service业务层处理
@ -130,4 +132,14 @@ public class CustomerServiceImpl implements CustomerService
public int selectCount(CustomerQuery 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;
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
@ -14,7 +11,4 @@ import java.util.List;
@Data
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">
<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>
<sql id="selectDeptVo">
select
d.dept_id,
d.parent_id,
select
d.dept_id,
d.parent_id,
d.ancestors,
d.dept_name,
d.order_num,
@ -27,25 +22,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
d.del_flag,
d.create_by,
d.create_time,
d.erp_id,
d.erp_number,
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
p.dept_name as parent_name
from sys_dept d
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>
<select id="selectDeptList" parameterType="SysDeptQuery" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<include refid="selectDeptVo"/>
where d.del_flag = '0'
<if test="deptId != null and deptId != 0">
AND d.dept_id = #{deptId}
</if>
<if test="parentId != null and parentId != 0">
<if test="parentId != null and parentId != 0">
AND d.parent_id = #{parentId}
</if>
<if test="deptName != null and deptName != ''">
@ -54,30 +42,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">
AND d.status = #{status}
</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">
AND d.dept_name in
<foreach collection="deptNames" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</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">
AND d.dept_id in
<foreach collection="deptIds" item="item" open="(" separator="," close=")">
@ -93,9 +63,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 数据范围过滤 -->
${params.dataScope}
order by d.parent_id, d.order_num
</select>
</select>
<select id="selectDeptListByRoleId" resultType="Long">
<select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id
from sys_dept d
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
</select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.dept_id = #{deptId}
${@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="status != null">status,</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
)values(
<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="status != null">#{status},</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()
)
</insert>
@ -182,10 +144,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="email != null">email = #{email},</if>
<if test="status != null and status != ''">`status` = #{status},</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()
</set>
where dept_id = #{deptId}

View File

@ -58,6 +58,17 @@ public class CustomerController extends BaseController
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);
}
/**
* 导出客户列表
*/