24282 %!s(int64=2) %!d(string=hai) anos
pai
achega
1206b0a9bc

+ 1 - 1
hx-base/src/main/java/com/fjhx/base/system/SysMenuController.java

@@ -33,7 +33,7 @@ public class SysMenuController extends BaseController {
     /**
      * 获取菜单列表
      */
-    @PreAuthorize("@ss.hasPermi('system:menu:list')")
+    // @PreAuthorize("@ss.hasPermi('system:menu:list')")
     @GetMapping("/list")
     public AjaxResult list(SysMenu menu) {
         List<SysMenu> menus = menuService.selectMenuList(menu, getUserId());

+ 80 - 0
hx-tenant/src/main/java/com/fjhx/tenant/controller/tenant/SysPostController.java

@@ -0,0 +1,80 @@
+package com.fjhx.tenant.controller.tenant;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.ruoyi.common.annotation.TenantIgnore;
+import com.ruoyi.common.constant.BaseSourceConstant;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.system.domain.SysPost;
+import com.ruoyi.system.service.ISysPostService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@TenantIgnore
+@DS(BaseSourceConstant.BASE)
+@RestController
+@RequestMapping("/tenantPost")
+public class SysPostController extends BaseController {
+
+    @Autowired
+    private ISysPostService postService;
+
+    /**
+     * 获取岗位列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(SysPost post) {
+        startPage();
+        List<SysPost> list = postService.selectPostList(post);
+        return getDataTable(list);
+    }
+
+    /**
+     * 根据岗位编号获取详细信息
+     */
+    @GetMapping(value = "/{postId}")
+    public AjaxResult getInfo(@PathVariable Long postId) {
+        return success(postService.selectPostById(postId));
+    }
+
+    /**
+     * 新增岗位
+     */
+    @PostMapping
+    public AjaxResult add(@Validated @RequestBody SysPost post) {
+        if (!postService.checkPostNameUnique(post)) {
+            return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
+        } else if (!postService.checkPostCodeUnique(post)) {
+            return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
+        }
+        post.setCreateBy(getUsername());
+        return toAjax(postService.insertPost(post));
+    }
+
+    /**
+     * 修改岗位
+     */
+    @PutMapping
+    public AjaxResult edit(@Validated @RequestBody SysPost post) {
+        if (!postService.checkPostNameUnique(post)) {
+            return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
+        } else if (!postService.checkPostCodeUnique(post)) {
+            return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
+        }
+        post.setUpdateBy(getUsername());
+        return toAjax(postService.updatePost(post));
+    }
+
+    /**
+     * 删除岗位
+     */
+    @DeleteMapping("/{postIds}")
+    public AjaxResult remove(@PathVariable Long[] postIds) {
+        return toAjax(postService.deletePostByIds(postIds));
+    }
+
+}

+ 24 - 14
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysPost.java

@@ -4,8 +4,6 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.annotation.Excel.ColumnType;
 import com.ruoyi.common.core.domain.BaseEntity;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
@@ -17,6 +15,7 @@ import javax.validation.constraints.Size;
  * @author ruoyi
  */
 public class SysPost extends BaseEntity {
+
     private static final long serialVersionUID = 1L;
 
     /**
@@ -51,6 +50,11 @@ public class SysPost extends BaseEntity {
     private String status;
 
     /**
+     * 租户id
+     */
+    private String tenantId;
+
+    /**
      * 用户是否存在此岗位标识 默认不存在
      */
     private boolean flag = false;
@@ -108,19 +112,25 @@ public class SysPost extends BaseEntity {
         this.flag = flag;
     }
 
+    public String getTenantId() {
+        return tenantId;
+    }
+
+    public void setTenantId(String tenantId) {
+        this.tenantId = tenantId;
+    }
+
     @Override
     public String toString() {
-        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
-                .append("postId", getPostId())
-                .append("postCode", getPostCode())
-                .append("postName", getPostName())
-                .append("postSort", getPostSort())
-                .append("status", getStatus())
-                .append("createBy", getCreateBy())
-                .append("createTime", getCreateTime())
-                .append("updateBy", getUpdateBy())
-                .append("updateTime", getUpdateTime())
-                .append("remark", getRemark())
-                .toString();
+        return "SysPost{" +
+                "postId=" + postId +
+                ", postCode='" + postCode + '\'' +
+                ", postName='" + postName + '\'' +
+                ", postSort=" + postSort +
+                ", status='" + status + '\'' +
+                ", tenantId='" + tenantId + '\'' +
+                ", flag=" + flag +
+                '}';
     }
+
 }

+ 31 - 16
ruoyi-system/src/main/resources/mapper/system/SysPostMapper.xml

@@ -15,15 +15,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<result property="updateBy"      column="update_by"     />
 		<result property="updateTime"    column="update_time"   />
 		<result property="remark"        column="remark"        />
+		<result property="tenantId" column="tenant_id"/>
 	</resultMap>
 	
 	<sql id="selectPostVo">
-        select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark 
+		select post_id,
+			   post_code,
+			   post_name,
+			   post_sort,
+			   status,
+			   create_by,
+			   create_time,
+			   remark,
+			   tenant_id
 		from sys_post
-    </sql>
-	
+	</sql>
+
 	<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
-	    <include refid="selectPostVo"/>
+		<include refid="selectPostVo"/>
 		<where>
 			<if test="postCode != null and postCode != ''">
 				AND post_code like concat('%', #{postCode}, '%')
@@ -34,6 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			<if test="postName != null and postName != ''">
 				AND post_name like concat('%', #{postName}, '%')
 			</if>
+			<if test="tenantId != null and tenantId != ''">
+				AND tenant_id = #{tenantId}
+			</if>
 		</where>
 	</select>
 	
@@ -71,19 +83,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<include refid="selectPostVo"/>
 		 where post_code=#{postCode} limit 1
 	</select>
-	
+
 	<update id="updatePost" parameterType="SysPost">
- 		update sys_post
- 		<set>
- 			<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
- 			<if test="postName != null and postName != ''">post_name = #{postName},</if>
- 			<if test="postSort != null">post_sort = #{postSort},</if>
- 			<if test="status != null and status != ''">status = #{status},</if>
- 			<if test="remark != null">remark = #{remark},</if>
- 			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
- 			update_time = sysdate()
- 		</set>
- 		where post_id = #{postId}
+		update sys_post
+		<set>
+			<if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
+			<if test="postName != null and postName != ''">post_name = #{postName},</if>
+			<if test="postSort != null">post_sort = #{postSort},</if>
+			<if test="status != null and status != ''">status = #{status},</if>
+			<if test="remark != null">remark = #{remark},</if>
+			<if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>
+			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
+			update_time = sysdate()
+		</set>
+		where post_id = #{postId}
 	</update>
  	
  	<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
@@ -94,6 +107,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="postSort != null">post_sort,</if>
  			<if test="status != null and status != ''">status,</if>
  			<if test="remark != null and remark != ''">remark,</if>
+		<if test="tenantId != null and tenantId != ''">tenant_id,</if>
  			<if test="createBy != null and createBy != ''">create_by,</if>
  			create_time
  		)values(
@@ -103,6 +117,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="postSort != null">#{postSort},</if>
  			<if test="status != null and status != ''">#{status},</if>
  			<if test="remark != null and remark != ''">#{remark},</if>
+		<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
  			sysdate()
  		)