浏览代码

单位管理,数据阈值代码开发

gao.qiang 2 年之前
父节点
当前提交
de960b9338

+ 15 - 0
purchase-admin/src/main/java/com/ozs/web/controller/system/SysProcurementStandardController.java

@@ -48,5 +48,20 @@ public class SysProcurementStandardController {
         }
         return R.ok();
     }
+
+    @ApiOperation("修改采购单位管理中标准信息")
+    @PostMapping("update")
+    public R<String> update(@RequestBody List<SysProcurementStandardVo> sysProcurementStandardVoList) {
+        boolean isSuccess = false;
+        SysProcurementStandard sysProcurementStandard = new SysProcurementStandard();
+        for (SysProcurementStandardVo sysProcurementStandardVo : sysProcurementStandardVoList) {
+            BeanUtils.copyProperties(sysProcurementStandardVo, sysProcurementStandard);
+            isSuccess = sysProcurementStandardService.updateById(sysProcurementStandard);
+            if (!isSuccess) {
+                return R.fail();
+            }
+        }
+        return R.ok();
+    }
 }
 

+ 26 - 0
purchase-common/src/main/java/com/ozs/common/core/domain/entity/SysDept.java

@@ -54,6 +54,30 @@ public class SysDept extends BaseEntity
 
     /** 子部门 */
     private List<SysDept> children = new ArrayList<SysDept>();
+    /**
+     * 备注
+     */
+    private  String remarks;
+    /**
+     * 地址
+     */
+    private String address;
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
 
     public Long getDeptId()
     {
@@ -198,6 +222,8 @@ public class SysDept extends BaseEntity
             .append("createTime", getCreateTime())
             .append("updateBy", getUpdateBy())
             .append("updateTime", getUpdateTime())
+            .append("remarks",getRemarks())
+            .append("address",getAddress())
             .toString();
     }
 }

+ 43 - 0
purchase-system/src/main/java/com/ozs/system/domain/vo/requestVo/SysDeptRequestVo.java

@@ -0,0 +1,43 @@
+package com.ozs.system.domain.vo.requestVo;
+
+
+import java.io.Serializable;
+
+/**
+ * @author Administrator
+ */
+public class SysDeptRequestVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 部门ID
+     */
+    private Long deptId;
+
+    /**
+     * 父部门ID
+     */
+    private Long parentId;
+
+    /**
+     * 部门名称
+     */
+    private String deptName;
+
+    /**
+     * 显示顺序
+     */
+    private Integer orderNum;
+    /**
+     * 联系电话
+     */
+    private String phone;
+    /**
+     * 备注
+     */
+    private String remarks;
+    /**
+     * 地址
+     */
+    private String address;
+}

+ 46 - 0
purchase-system/src/main/java/com/ozs/system/domain/vo/responseVo/SysDeptResponseVo.java

@@ -0,0 +1,46 @@
+package com.ozs.system.domain.vo.responseVo;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author Administrator
+ */
+@Data
+public class SysDeptResponseVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 部门ID
+     */
+    private Long deptId;
+
+    /**
+     * 父部门ID
+     */
+    private Long parentId;
+
+    /**
+     * 部门名称
+     */
+    private String deptName;
+
+    /**
+     * 显示顺序
+     */
+    private Integer orderNum;
+    /**
+     * 联系电话
+     */
+    private String phone;
+    /**
+     * 备注
+     */
+    private String remarks;
+    /**
+     * 地址
+     */
+    private String address;
+}

+ 3 - 1
purchase-system/src/main/java/com/ozs/system/service/ISysDeptService.java

@@ -1,6 +1,8 @@
 package com.ozs.system.service;
 
 import java.util.List;
+import java.util.Map;
+
 import com.ozs.common.core.domain.TreeSelect;
 import com.ozs.common.core.domain.entity.SysDept;
 
@@ -57,7 +59,7 @@ public interface ISysDeptService
      * @param deptId 部门ID
      * @return 部门信息
      */
-    public SysDept selectDeptById(Long deptId);
+    public Map<String, Object> selectDeptById(Long deptId);
 
     /**
      * 根据ID查询所有子部门(正常状态)

+ 22 - 2
purchase-system/src/main/java/com/ozs/system/service/impl/SysDeptServiceImpl.java

@@ -1,13 +1,20 @@
 package com.ozs.system.service.impl;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ozs.common.core.domain.entity.SysProcurementStandard;
+import com.ozs.system.domain.vo.responseVo.SysDeptResponseVo;
 import com.ozs.system.mapper.SysDeptMapper;
+import com.ozs.system.mapper.SysProcurementStandardMapper;
 import com.ozs.system.mapper.SysRoleMapper;
 import com.ozs.system.service.ISysDeptService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ozs.common.annotation.DataScope;
@@ -22,6 +29,8 @@ import com.ozs.common.utils.SecurityUtils;
 import com.ozs.common.utils.StringUtils;
 import com.ozs.common.utils.spring.SpringUtils;
 
+import javax.annotation.Resource;
+
 /**
  * 部门管理 服务实现
  *
@@ -35,6 +44,8 @@ public class SysDeptServiceImpl implements ISysDeptService
 
     @Autowired
     private SysRoleMapper roleMapper;
+    @Resource
+    private SysProcurementStandardMapper sysProcurementStandardMapper;
 
     /**
      * 查询部门管理数据
@@ -122,9 +133,18 @@ public class SysDeptServiceImpl implements ISysDeptService
      * @return 部门信息
      */
     @Override
-    public SysDept selectDeptById(Long deptId)
+    public Map<String, Object> selectDeptById(Long deptId)
     {
-        return deptMapper.selectDeptById(deptId);
+        SysDept sysDept = deptMapper.selectDeptById(deptId);
+        SysDeptResponseVo sysDeptResponseVo = new SysDeptResponseVo();
+        BeanUtils.copyProperties(sysDept, sysDeptResponseVo);
+        QueryWrapper<SysProcurementStandard> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("dept_id",deptId);
+        List<SysProcurementStandard> sysProcurementStandardsList = sysProcurementStandardMapper.selectList(queryWrapper);
+        Map<String, Object> returnMap = new HashMap<>();
+        returnMap.put("sysDept",sysDeptResponseVo);
+        returnMap.put("sysProcurementStandardsList",sysProcurementStandardsList);
+        return returnMap;
     }
 
     /**

+ 121 - 114
purchase-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -1,62 +1,63 @@
 <?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">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ozs.system.mapper.SysDeptMapper">
 
-	<resultMap type="SysDept" id="SysDeptResult">
-		<id     property="deptId"     column="dept_id"     />
-		<result property="parentId"   column="parent_id"   />
-		<result property="ancestors"  column="ancestors"   />
-		<result property="deptName"   column="dept_name"   />
-		<result property="orderNum"   column="order_num"   />
-		<result property="leader"     column="leader"      />
-		<result property="phone"      column="phone"       />
-		<result property="email"      column="email"       />
-		<result property="status"     column="status"      />
-		<result property="delFlag"    column="del_flag"    />
-		<result property="parentName" column="parent_name" />
-		<result property="createBy"   column="create_by"   />
-		<result property="createTime" column="create_time" />
-		<result property="updateBy"   column="update_by"   />
-		<result property="updateTime" column="update_time" />
-	</resultMap>
-
-	<sql id="selectDeptVo">
+    <resultMap type="SysDept" id="SysDeptResult">
+        <id property="deptId" column="dept_id"/>
+        <result property="parentId" column="parent_id"/>
+        <result property="ancestors" column="ancestors"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="orderNum" column="order_num"/>
+        <result property="leader" column="leader"/>
+        <result property="phone" column="phone"/>
+        <result property="email" column="email"/>
+        <result property="status" column="status"/>
+        <result property="delFlag" column="del_flag"/>
+        <result property="parentName" column="parent_name"/>
+        <result property="createBy" column="create_by"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectDeptVo">
         select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
         from sys_dept d
     </sql>
 
-	<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
+    <select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
         <include refid="selectDeptVo"/>
         where d.del_flag = '0'
-		<if test="deptId != null and deptId != 0">
-			AND dept_id = #{deptId}
-		</if>
+        <if test="deptId != null and deptId != 0">
+            AND dept_id = #{deptId}
+        </if>
         <if test="parentId != null and parentId != 0">
-			AND parent_id = #{parentId}
-		</if>
-		<if test="deptName != null and deptName != ''">
-			AND dept_name like concat('%', #{deptName}, '%')
-		</if>
-		<if test="status != null and status != ''">
-			AND status = #{status}
-		</if>
-		<!-- 数据范围过滤 -->
-		${params.dataScope}
-		order by d.parent_id, d.order_num
+            AND parent_id = #{parentId}
+        </if>
+        <if test="deptName != null and deptName != ''">
+            AND dept_name like concat('%', #{deptName}, '%')
+        </if>
+        <if test="status != null and status != ''">
+            AND status = #{status}
+        </if>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+        order by d.parent_id, d.order_num
     </select>
 
     <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
+        select d.dept_id
+        from sys_dept d
+        left join sys_role_dept rd on d.dept_id = rd.dept_id
         where rd.role_id = #{roleId}
-            <if test="deptCheckStrictly">
-              and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
-            </if>
-		order by d.parent_id, d.order_num
-	</select>
+        <if test="deptCheckStrictly">
+            and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id =
+            rd.dept_id and rd.role_id = #{roleId})
+        </if>
+        order by d.parent_id, d.order_num
+    </select>
 
     <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
 		select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
@@ -69,90 +70,96 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
 	</select>
 
-	<select id="hasChildByDeptId" parameterType="Long" resultType="int">
+    <select id="hasChildByDeptId" parameterType="Long" resultType="int">
 		select count(1) from sys_dept
 		where del_flag = '0' and parent_id = #{deptId} limit 1
 	</select>
 
-	<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
+    <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
 		select * from sys_dept where find_in_set(#{deptId}, ancestors)
 	</select>
 
-	<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
+    <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
 		select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
 	</select>
 
-	<select id="checkDeptNameUnique" resultMap="SysDeptResult">
-	    <include refid="selectDeptVo"/>
-		where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
-	</select>
+    <select id="checkDeptNameUnique" resultMap="SysDeptResult">
+        <include refid="selectDeptVo"/>
+        where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
+    </select>
 
     <insert id="insertDept" parameterType="SysDept">
- 		insert into sys_dept(
- 			<if test="deptId != null and deptId != 0">dept_id,</if>
- 			<if test="parentId != null and parentId != 0">parent_id,</if>
- 			<if test="deptName != null and deptName != ''">dept_name,</if>
- 			<if test="ancestors != null and ancestors != ''">ancestors,</if>
- 			<if test="orderNum != null">order_num,</if>
- 			<if test="leader != null and leader != ''">leader,</if>
- 			<if test="phone != null and phone != ''">phone,</if>
- 			<if test="email != null and email != ''">email,</if>
- 			<if test="status != null">status,</if>
- 			<if test="createBy != null and createBy != ''">create_by,</if>
- 			create_time
- 		)values(
- 			<if test="deptId != null and deptId != 0">#{deptId},</if>
- 			<if test="parentId != null and parentId != 0">#{parentId},</if>
- 			<if test="deptName != null and deptName != ''">#{deptName},</if>
- 			<if test="ancestors != null and ancestors != ''">#{ancestors},</if>
- 			<if test="orderNum != null">#{orderNum},</if>
- 			<if test="leader != null and leader != ''">#{leader},</if>
- 			<if test="phone != null and phone != ''">#{phone},</if>
- 			<if test="email != null and email != ''">#{email},</if>
- 			<if test="status != null">#{status},</if>
- 			<if test="createBy != null and createBy != ''">#{createBy},</if>
- 			sysdate()
- 		)
-	</insert>
-
-	<update id="updateDept" parameterType="SysDept">
- 		update sys_dept
- 		<set>
- 			<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
- 			<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
- 			<if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
- 			<if test="orderNum != null">order_num = #{orderNum},</if>
- 			<if test="leader != null">leader = #{leader},</if>
- 			<if test="phone != null">phone = #{phone},</if>
- 			<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>
- 			update_time = sysdate()
- 		</set>
- 		where dept_id = #{deptId}
-	</update>
-
-	<update id="updateDeptChildren" parameterType="java.util.List">
-	    update sys_dept set ancestors =
-	    <foreach collection="depts" item="item" index="index"
-	        separator=" " open="case dept_id" close="end">
-	        when #{item.deptId} then #{item.ancestors}
-	    </foreach>
-	    where dept_id in
-	    <foreach collection="depts" item="item" index="index"
-	        separator="," open="(" close=")">
-	        #{item.deptId}
-	    </foreach>
-	</update>
-
-	<update id="updateDeptStatusNormal" parameterType="Long">
- 	    update sys_dept set status = '0' where dept_id in
- 	    <foreach collection="array" item="deptId" open="(" separator="," close=")">
-        	#{deptId}
+        insert into sys_dept(
+        <if test="deptId != null and deptId != 0">dept_id,</if>
+        <if test="parentId != null and parentId != 0">parent_id,</if>
+        <if test="deptName != null and deptName != ''">dept_name,</if>
+        <if test="ancestors != null and ancestors != ''">ancestors,</if>
+        <if test="orderNum != null">order_num,</if>
+        <if test="leader != null and leader != ''">leader,</if>
+        <if test="phone != null and phone != ''">phone,</if>
+        <if test="email != null and email != ''">email,</if>
+        <if test="address != null and address != ''">address,</if>
+        <if test="remarks != null and remarks != ''">remarks,</if>
+        <if test="status != null">status,</if>
+        <if test="createBy != null and createBy != ''">create_by,</if>
+        create_time
+        )values(
+        <if test="deptId != null and deptId != 0">#{deptId},</if>
+        <if test="parentId != null and parentId != 0">#{parentId},</if>
+        <if test="deptName != null and deptName != ''">#{deptName},</if>
+        <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
+        <if test="orderNum != null">#{orderNum},</if>
+        <if test="leader != null and leader != ''">#{leader},</if>
+        <if test="phone != null and phone != ''">#{phone},</if>
+        <if test="email != null and email != ''">#{email},</if>
+        <if test="address != null and address != ''">#{address},</if>
+        <if test="remarks != null and remarks != ''">#{remarks},</if>
+        <if test="status != null">#{status},</if>
+        <if test="createBy != null and createBy != ''">#{createBy},</if>
+        sysdate()
+        )
+    </insert>
+
+    <update id="updateDept" parameterType="SysDept">
+        update sys_dept
+        <set>
+            <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
+            <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
+            <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
+            <if test="address != null and address != ''">#{address},</if>
+            <if test="remarks != null and remarks != ''">#{remarks},</if>
+            <if test="orderNum != null">order_num = #{orderNum},</if>
+            <if test="leader != null">leader = #{leader},</if>
+            <if test="phone != null">phone = #{phone},</if>
+            <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>
+            update_time = sysdate()
+        </set>
+        where dept_id = #{deptId}
+    </update>
+
+    <update id="updateDeptChildren" parameterType="java.util.List">
+        update sys_dept set ancestors =
+        <foreach collection="depts" item="item" index="index"
+                 separator=" " open="case dept_id" close="end">
+            when #{item.deptId} then #{item.ancestors}
+        </foreach>
+        where dept_id in
+        <foreach collection="depts" item="item" index="index"
+                 separator="," open="(" close=")">
+            #{item.deptId}
+        </foreach>
+    </update>
+
+    <update id="updateDeptStatusNormal" parameterType="Long">
+        update sys_dept set status = '0' where dept_id in
+        <foreach collection="array" item="deptId" open="(" separator="," close=")">
+            #{deptId}
         </foreach>
-	</update>
+    </update>
 
-	<delete id="deleteDeptById" parameterType="Long">
+    <delete id="deleteDeptById" parameterType="Long">
 		update sys_dept set del_flag = '2' where dept_id = #{deptId}
 	</delete>