lsw 1 年間 前
コミット
17b41917c3

+ 67 - 54
admin-ui/src/views/work/news/edit.vue

@@ -18,12 +18,24 @@
       <el-form-item label="内容" prop="contents">
         <editor v-model="form.contents" placeholder="请输入内容"></editor>
       </el-form-item>
-      <el-form-item label="状态" prop="state">
-        <el-select v-model="form.state" placeholder="请选择">
-          <el-option label="正常" :value="0"></el-option>
-          <el-option label="停用" :value="1"></el-option>
-        </el-select>
-      </el-form-item>
+      <el-row>
+        <el-col :span="12">
+          <el-form-item label="状态" prop="state">
+            <el-select v-model="form.state" placeholder="请选择">
+              <el-option label="正常" :value="0"></el-option>
+              <el-option label="停用" :value="1"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="12">
+          <el-form-item label="置顶" prop="top">
+            <el-select v-model="form.top" placeholder="请选择">
+              <el-option label="否" :value="0"></el-option>
+              <el-option label="是" :value="1"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
     </el-form>
     <div class="mfooter">
       <el-button type="primary" @click="submitForm">确 定</el-button>
@@ -33,57 +45,58 @@
 </template>
 
 <script>
-  export default {
-    dicts: ['news_type'],
-    data() {
-      return {
-        form: { state: 0 },
-        rules: {
-          title: [{ required: true, message: "标题不能为空", trigger: "blur" }],
-          type: [{ required: true, message: "类型不能为空", trigger: "blur" }],
-          contents: [{ required: true, message: "内容不能为空", trigger: "blur" }],
-          state: [{ required: true, message: "状态不能为空", trigger: "blur" }],
-        }
-      };
-    },
-    props: {
-      param: {
-        type: Object,
-        default: () => {
-          return {};
-        }
-      },
-      layerid: {
-        type: String
+export default {
+  dicts: ['news_type'],
+  data() {
+    return {
+      form: { state: 0, top: 0 },
+      rules: {
+        title: [{ required: true, message: '标题不能为空', trigger: 'blur' }],
+        type: [{ required: true, message: '类型不能为空', trigger: 'blur' }],
+        contents: [{ required: true, message: '内容不能为空', trigger: 'blur' }],
+        state: [{ required: true, message: '状态不能为空', trigger: 'blur' }]
       }
-    },
-    mounted() {
-      if (this.param.id) {
-        this.ajax({ url: '/work/news/detail/' + this.param.id }).then(response => {
-          this.form = response.data;
-        });
+    };
+  },
+  props: {
+    param: {
+      type: Object,
+      default: () => {
+        return {};
       }
     },
-    methods: {
-      submitForm() {
-        this.$refs["form"].validate(valid => {
-          if (valid) {
-            if (this.form.id) {
-              this.ajax({ method: 'post', url: '/work/news/edit', data: this.form }).then(response => {
-                this.$modal.msgSuccess("修改成功");
-                this.$layer.close(this.layerid);
-                this.$parent.getList();
-              });
-            } else {
-              this.ajax({ method: 'post', url: '/work/news/add', data: this.form }).then(response => {
-                this.$modal.msgSuccess("新增成功");
-                this.$layer.close(this.layerid);
-                this.$parent.getList();
-              });
-            }
+    layerid: {
+      type: String
+    }
+  },
+  mounted() {
+    if (this.param.id) {
+      this.ajax({ url: '/work/news/detail/' + this.param.id }).then((response) => {
+        this.form = response.data;
+        this.form.contents = response.data.contents.replace(new RegExp('/profile/upload/', 'g'), this.baseUrl + '/profile/upload/');
+      });
+    }
+  },
+  methods: {
+    submitForm() {
+      this.$refs['form'].validate((valid) => {
+        if (valid) {
+          if (this.form.id) {
+            this.ajax({ method: 'post', url: '/work/news/edit', data: this.form }).then((response) => {
+              this.$modal.msgSuccess('修改成功');
+              this.$layer.close(this.layerid);
+              this.$parent.getList();
+            });
+          } else {
+            this.ajax({ method: 'post', url: '/work/news/add', data: this.form }).then((response) => {
+              this.$modal.msgSuccess('新增成功');
+              this.$layer.close(this.layerid);
+              this.$parent.getList();
+            });
           }
-        });
-      }
+        }
+      });
     }
-  };
+  }
+};
 </script>

+ 62 - 58
admin-ui/src/views/work/news/index.vue

@@ -22,8 +22,8 @@
     </el-form>
     <el-row :gutter="10" class="mb8">
       <el-button type="primary" icon="el-icon-plus" :disabled="ids.length > 0" @click="op('add')" v-hasPermi="['work:news:add']">新增</el-button>
-      <el-button type="success" icon="el-icon-edit" :disabled="ids.length != 1" @click="op('edit',ids)" v-hasPermi="['work:news:edit']">修改</el-button>
-      <el-button type="danger" icon="el-icon-delete" :disabled="ids.length == 0" @click="del" v-hasPermi="['work:news:remove']">删除{{ids.length>0?'('+ids.length+')':''}}</el-button>
+      <el-button type="success" icon="el-icon-edit" :disabled="ids.length != 1" @click="op('edit', ids)" v-hasPermi="['work:news:edit']">修改</el-button>
+      <el-button type="danger" icon="el-icon-delete" :disabled="ids.length == 0" @click="del" v-hasPermi="['work:news:remove']">删除{{ ids.length > 0 ? '(' + ids.length + ')' : '' }}</el-button>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -31,6 +31,12 @@
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="标题" align="left" prop="title" />
       <el-table-column label="类型" align="center" prop="type" width="150" />
+      <el-table-column label="置顶" align="center" prop="top" width="140">
+        <template slot-scope="scope">
+          <el-tag type="success" v-if="scope.row.top == 1">是</el-tag>
+          <el-tag type="info" v-else>否</el-tag>
+        </template>
+      </el-table-column>
       <el-table-column label="状态" align="center" prop="state" width="140">
         <template slot-scope="scope">
           <el-tag type="success" v-if="scope.row.state == 0">启用</el-tag>
@@ -40,7 +46,7 @@
       <el-table-column label="创建时间" align="center" prop="createTime" width="200" />
       <el-table-column label="操作" align="center" width="200">
         <template slot-scope="scope">
-          <el-button size="mini" type="text" icon="el-icon-edit" @click="op('edit',scope.row)" v-hasPermi="['work:news:edit']">修改</el-button>
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="op('edit', scope.row)" v-hasPermi="['work:news:edit']">修改</el-button>
           <el-button size="mini" type="text" icon="el-icon-delete" @click="del(scope.row)" v-hasPermi="['work:news:remove']">删除</el-button>
         </template>
       </el-table-column>
@@ -48,68 +54,66 @@
         <el-empty></el-empty>
       </template>
     </el-table>
-    <pagination v-if="response.total>0" :total="response.total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
+    <pagination v-if="response.total > 0" :total="response.total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
   </div>
 </template>
 
 <script>
-  import edit from './edit'
-  export default {
-    name: "News",
-    dicts: ['news_type'],
-    data() {
-      return {
-        ids: [],
-        showSearch: true,
-        response: {},
-        queryParams: {
-          pageNum: 1,
-          pageSize: 10,
-          title: null,
-          type: null,
-          state: null,
-          orderByColumn: 'id',
-          isAsc: 'desc'
-        }
-      };
+import edit from './edit';
+export default {
+  name: 'News',
+  dicts: ['news_type'],
+  data() {
+    return {
+      ids: [],
+      showSearch: true,
+      response: {},
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        title: null,
+        type: null,
+        state: null
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    getList() {
+      this.ajax({ url: '/work/news/list', data: this.queryParams }).then((response) => {
+        this.response = response;
+      });
     },
-    created() {
+    handleQuery() {
+      this.queryParams.pageNum = 1;
       this.getList();
     },
-    methods: {
-      getList() {
-        this.ajax({ url: '/work/news/list', data: this.queryParams }).then(response => {
-          this.response = response;
-        });
-      },
-      handleQuery() {
-        this.queryParams.pageNum = 1;
-        this.getList();
-      },
-      resetQuery() {
-        this.resetForm("queryForm");
-        this.handleQuery();
-      },
-      selects(rows) {
-        this.ids = rows.map(item => item.id)
-      },
-      op(tag, row) {
-        if (tag == 'add') {
-          this.iframe({ obj: edit, param: {}, title: '新增', width: '58%', height: '73%' });
-        }
-        if (tag == 'edit') {
-          const id = row.id || this.ids[0];
-          this.iframe({ obj: edit, param: { id: id }, title: '编辑', width: '58%', height: '73%' });
-        }
-      },
-      del(row) {
-        this.$confirm('是否确认删除选中数据?', '警告', { type: 'warning' }).then(() => {
-          this.get({ url: '/work/news/remove/' + (row.id || this.ids) }).then(response => {
-            this.$modal.msgSuccess('删除成功');
-            this.getList();
-          });
-        });
+    resetQuery() {
+      this.resetForm('queryForm');
+      this.handleQuery();
+    },
+    selects(rows) {
+      this.ids = rows.map((item) => item.id);
+    },
+    op(tag, row) {
+      if (tag == 'add') {
+        this.iframe({ obj: edit, param: {}, title: '新增', width: '58%', height: '73%' });
+      }
+      if (tag == 'edit') {
+        const id = row.id || this.ids[0];
+        this.iframe({ obj: edit, param: { id: id }, title: '编辑', width: '58%', height: '73%' });
       }
+    },
+    del(row) {
+      this.$confirm('是否确认删除选中数据?', '警告', { type: 'warning' }).then(() => {
+        this.get({ url: '/work/news/remove/' + (row.id || this.ids) }).then((response) => {
+          this.$modal.msgSuccess('删除成功');
+          this.getList();
+        });
+      });
     }
-  };
+  }
+};
 </script>

+ 46 - 0
app/common/common.scss

@@ -449,4 +449,50 @@
 			padding-right: 5px;
 		}
 	}
+}
+.position {
+	.item {
+		border-radius: 7px;
+		background-color: white;
+		color: $font-c;
+		padding: 15px;
+		overflow: hidden;
+		margin-bottom: 12px;
+		.top {
+			overflow: hidden;
+			.title {
+				font-size: 17px;
+				float: left;
+				width: 78%;
+			}
+			.salary {
+				float: right;
+			}
+		}
+		.desc {
+			margin-top: 10px;
+			color: $font-c;
+			width: 100%;
+			font-size: 13px;
+			overflow: hidden;
+			.tag {
+				float: left;
+				padding: 1px 8px 8px 0px;
+				border-radius: 3px;
+				margin-right: 7px;
+			}
+			image {
+				width: 20px;
+				height: 20px;
+				border-radius: 50%;
+				margin-right: 5px;
+				float: left;
+				background-color: #a1a1a1;
+			}
+		}
+		.op {
+			float: right;
+			font-size: 15px;
+		}
+	}
 }

+ 14 - 0
app/pages.json

@@ -163,6 +163,20 @@
 			{
 				"navigationBarTitleText" : "职位发布"
 			}
+		},
+		{
+			"path" : "pages/news/index",
+			"style" : 
+			{
+				"navigationBarTitleText" : "新闻资讯"
+			}
+		},
+		{
+			"path" : "pages/news/detail",
+			"style" : 
+			{
+				"navigationBarTitleText" : "新闻详情"
+			}
 		}
 	],
 	"tabBar": {

+ 8 - 28
app/pages/job/position/manage/list.vue

@@ -3,38 +3,21 @@
 		<view class="tab">
 			<u-tabs :list="tab" :current="current" @click="click"></u-tabs>
 		</view>
-		<view class="cmain">
+		<view class="main">
 			<view class="position">
 				<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
 					<view class="top">
 						<view class="title omit">{{ item.title }}</view>
-						<view class="op" v-if="item.status != 0 && item.state == 0" style="color: #ccc">
+						<view class="op">
 							<text class="icon">&#xe622;</text>
 							<text>审核中</text>
 						</view>
-						<view class="op" v-if="item.status != 0 && item.state == 1" style="color: #07cb4c">
-							<text class="icon">&#xe622;</text>
-							<text>开放中</text>
-						</view>
-						<view class="op" v-if="item.status != 0 && item.state == 2" style="color: #ccc">
-							<text class="icon">&#xe622;</text>
-							<text>审核不通过</text>
-						</view>
-						<view class="op" v-if="item.status == 0 || item.state == 3" style="color: #ccc">
-							<text class="icon">&#xe622;</text>
-							<text>已关闭</text>
-						</view>
-						<view class="clear"></view>
 					</view>
-					<view class="con">
-						<view class="desc">
-							<text class="tag">{{ item.experience == '不限' ? '经验不限' : item.experience }}</text>
-							<text class="tag">{{ item.education == '不限' ? '学历不限' : item.education }}</text>
-							<text class="tag">{{ item.salary }}</text>
-							<view class="clear"></view>
-						</view>
-						<view class="clear"></view>
+					<view class="desc">
+						<text class="tag">{{ item.experience == '不限' ? '经验不限' : item.experience }}</text>
+						<text class="tag">{{ item.salary }}</text>
 					</view>
+					<view class="date">{{ item.createTime }}</view>
 				</view>
 				<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
 				<u-empty v-if="!loadMore && list.length == 0"></u-empty>
@@ -81,10 +64,7 @@ export default {
 				loading: 'false',
 				success: (res) => {
 					this.loadMore = res.data.pages > this.param.pageNum ? true : false;
-					res.data.rows.forEach((item) => {
-						item.createTime = uni.$u.timeFrom(Date.parse(item.createTime));
-						this.list.push(item);
-					});
+					this.list.push(...res.data.rows);
 				}
 			});
 		},
@@ -93,7 +73,7 @@ export default {
 			this.refresh();
 		},
 		detail(item) {
-			uni.navigateTo({ url: '/app/position/manage/push?id=' + item.id });
+			uni.navigateTo({ url: '/pages/job/position/manage/push?id=' + item.id });
 		},
 		selectClick(e) {
 			uni.navigateTo({ url: '/pages/job/position/manage/push?type=' + e.type });

+ 6 - 23
app/pages/job/position/manage/push.vue

@@ -99,7 +99,7 @@ export default {
 		}
 		if (e.id) {
 			this.http.request({
-				url: '/app/position/user/push/detail/' + e.id,
+				url: '/app/position/manage/detail/' + e.id,
 				success: (res) => {
 					this.item = res.data.data;
 					this.$refs.editor.setContents();
@@ -113,25 +113,6 @@ export default {
 		});
 	},
 	methods: {
-		backTo() {
-			this.http.request({
-				url: '/app/position/close/' + this.item.id,
-				success: (res) => {
-					uni.showToast({
-						title: '操作成功!'
-					});
-					setTimeout(() => {
-						uni.$emit('position');
-						uni.navigateBack();
-					}, 1500);
-				}
-			});
-		},
-		go(url) {
-			uni.navigateTo({
-				url: url
-			});
-		},
 		picker(e, tag) {
 			if (tag == 'startDate' || tag == 'endDate') {
 				this.item[tag] = e.detail.value;
@@ -150,6 +131,9 @@ export default {
 			}
 			this.$forceUpdate();
 		},
+		go(url) {
+			uni.navigateTo({ url: url });
+		},
 		chooseLocation() {
 			uni.chooseLocation({
 				success: (res) => {
@@ -158,8 +142,7 @@ export default {
 					//注意区分直辖市;
 					let city = addressList.length >= 3 ? addressList[1] : addressList[0];
 					let region = addressList.length >= 3 ? addressList[2] : addressList[1];
-					this.item.
-					this.item.location = res.name;
+					this.item.this.item.location = res.name;
 					this.item.address = res.address;
 					this.item.longitude = res.longitude;
 					this.item.latitude = res.latitude;
@@ -176,7 +159,7 @@ export default {
 				});
 				return false;
 			} */
-			this.item.type=0;
+			this.item.type = 0;
 			this.http.request({
 				url: '/app/position/edit',
 				data: this.item,

+ 56 - 0
app/pages/news/detail.vue

@@ -0,0 +1,56 @@
+<template>
+	<view class="main">
+		<view class="content">
+			<view class="title">{{ item.title }}</view>
+			<view class="desc">
+				<text>发布于:{{ item.createTime }}</text>
+			</view>
+			<view class="con">
+				<u-divider :dot="true"></u-divider>
+				<u-parse :content="item.contents"></u-parse>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			item: {}
+		};
+	},
+	onLoad(e) {
+		this.http.request({
+			url: '/app/news/detail/' + e.id,
+			success: (res) => {
+				this.item = res.data.data;
+				this.item.contents = res.data.data.contents.replace(new RegExp('/profile/upload/', 'g'), this.http.ip + '/profile/upload/');
+			}
+		});
+	},
+	methods: {}
+};
+</script>
+
+<style lang="scss">
+.main {
+	padding: 0px 10px 10px 10px;
+}
+.content {
+	padding: 15px;
+	background-color: white;
+	border-radius: 8px;
+	.title {
+		font-size: 18px;
+	}
+	.desc {
+		padding-top: 15px;
+		font-size: 13px;
+		color: #7c8388;
+		text {
+			padding-right: 25px;
+		}
+	}
+}
+</style>

+ 115 - 0
app/pages/news/index.vue

@@ -0,0 +1,115 @@
+<template>
+	<view>
+		<view class="tab">
+			<u-tabs :list="tab" :current="current" keyName="dictLabel" @click="click"></u-tabs>
+		</view>
+		<view class="list">
+			<view class="item" v-for="(item, index) in list" :key="index" @click="detail(item.id)">
+				<view class="title omit">{{ item.title }}</view>
+				<view class="desc">
+					<text>{{ item.type }}</text>
+					<text>发布于 {{ item.createTime }}</text>
+				</view>
+			</view>
+			<view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
+			<u-empty v-if="!loadMore && list.length == 0"></u-empty>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			current: 0,
+			tab: [],
+			list: [],
+			param: { pageNum: 1, pageSize: 10 },
+			loadMore: true
+		};
+	},
+	onLoad(e) {
+		this.getType();
+		this.getData();
+	},
+	methods: {
+		click(e) {
+			this.current = e.index;
+			this.param.type = e.dictValue;
+			this.refresh();
+		},
+		getData() {
+			this.http.request({
+				url: '/app/news/list',
+				data: this.param,
+				loading: 'false',
+				success: (res) => {
+					this.loadMore = res.data.pages > this.param.pageNum ? true : false;
+					res.data.rows.forEach((item) => {
+						item.createTime = uni.$u.timeFrom(Date.parse(item.createTime));
+						this.list.push(item);
+					});
+				}
+			});
+		},
+		getType() {
+			this.http.request({
+				url: '/app/common/type/news_type',
+				loading: 'false',
+				success: (res) => {
+					this.tab = res.data.data;
+					this.tab.unshift({ dictLabel: '全部新闻', dictValue: '' });
+				}
+			});
+		},
+		detail(id) {
+			uni.navigateTo({ url: '/pages/news/detail?id=' + id });
+		},
+		//刷新数据
+		refresh() {
+			this.loadMore = true;
+			this.param.pageNum = 1;
+			this.list = [];
+			this.getData();
+		}
+	},
+	//下拉刷新
+	onPullDownRefresh() {
+		setTimeout(() => {
+			this.refresh();
+			uni.stopPullDownRefresh();
+		}, 1000);
+	},
+	//上拉加载
+	onReachBottom() {
+		if (this.loadMore) {
+			this.param.pageNum++;
+			this.getData();
+		}
+	}
+};
+</script>
+
+<style lang="scss">
+.list {
+	padding: 12px;
+	.item {
+		background-color: white;
+		border-radius: 5px;
+		padding: 12px;
+		margin-bottom: 10px;
+		.title {
+			font-size: 15px;
+			font-weight: bold;
+		}
+		.desc {
+			font-size: 14px;
+			color: $font-c;
+			padding-top: 7px;
+			text {
+				padding-right: 20px;
+			}
+		}
+	}
+}
+</style>

+ 19 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/api/Api_CommonController.java

@@ -4,10 +4,13 @@ import com.google.code.kaptcha.Producer;
 import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.constant.CacheConstants;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.SysDictData;
 import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.common.utils.sign.Base64;
 import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.system.service.ISysDictTypeService;
 import com.ruoyi.web.work.api.config.BaseController;
 import com.ruoyi.web.work.api.util.AppUtil;
 import com.ruoyi.web.work.domain.Column;
@@ -24,6 +27,7 @@ import javax.annotation.Resource;
 import javax.imageio.ImageIO;
 import java.awt.image.BufferedImage;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
@@ -45,6 +49,21 @@ public class Api_CommonController extends BaseController {
     @Autowired
     IUserService userService;
 
+    @Autowired
+    private ISysDictTypeService dictTypeService;
+
+    /**
+     * 根据字典类型查询字典数据信息
+     */
+    @GetMapping(value = "/type/{dictType}")
+    public AjaxResult dictType(@PathVariable String dictType) {
+        List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
+        if (StringUtils.isNull(data)) {
+            data = new ArrayList<>();
+        }
+        return AjaxResult.success(data);
+    }
+
     //图片上传
     @PostMapping("/upload")
     public AjaxResult upload(MultipartHttpServletRequest multiReq) {

+ 7 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/api/Api_NewsController.java

@@ -1,11 +1,13 @@
 package com.ruoyi.web.work.api;
 
 import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.web.work.domain.News;
 import com.ruoyi.web.work.service.INewsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -31,4 +33,9 @@ public class Api_NewsController extends BaseController {
         List<News> list = newsService.selectList(news);
         return getDataTable(list);
     }
+
+    @GetMapping("/detail/{id}")
+    public AjaxResult detail(@PathVariable("id") Long id) {
+        return newsService.detail(id);
+    }
 }

+ 7 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/work/api/Api_PositionController.java

@@ -24,13 +24,18 @@ public class Api_PositionController extends BaseController {
     private IPositionService positionService;
 
     @GetMapping("/manage/list")
-    public TableDataInfo list(Position position) {
+    public TableDataInfo manageList(Position position) {
         position.setUserId(getUser().getId());
         startPage();
-        List<Position> list = positionService.selectList(position);
+        List<Position> list = positionService.manageList(position);
         return getDataTable(list);
     }
 
+    @GetMapping("/manage/detail/{id}")
+    public AjaxResult manageDetail(@PathVariable("id") Long id) {
+        return positionService.manageDetail(id);
+    }
+
     @PostMapping("/manage/edit")
     public AjaxResult edit(@Validated @RequestBody Position position) {
         return positionService.edit(position);

+ 5 - 6
ruoyi-admin/src/main/java/com/ruoyi/web/work/domain/News.java

@@ -9,6 +9,7 @@ import lombok.Data;
 import lombok.experimental.Accessors;
 
 import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import java.util.Date;
 /**
@@ -28,20 +29,18 @@ public class News{
     @ApiModelProperty(value = "标题")
     private String title;
 
-    @ApiModelProperty(value = "封面图")
-    private String pic;
-
     @NotBlank(message = "新闻类型不能为空")
     @ApiModelProperty(value = "新闻类型")
     private String type;
 
-    @ApiModelProperty(value = "简介")
-    private String brief;
-
     @NotBlank(message = "内容不能为空")
     @ApiModelProperty(value = "内容")
     private String contents;
 
+    @NotNull(message = "是否置顶不能为空")
+    @ApiModelProperty(value = "是否置顶")
+    private Integer top;
+
     @ApiModelProperty(value = "状态:0=正常,1=停用")
     private Integer state;
 

+ 5 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/work/mapper/PositionMapper.java

@@ -1,8 +1,9 @@
 package com.ruoyi.web.work.mapper;
 
-import java.util.List;
-import com.ruoyi.web.work.domain.Position;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.web.work.domain.Position;
+
+import java.util.List;
 
 /**
  * @author lsw
@@ -10,4 +11,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface PositionMapper extends BaseMapper<Position> {
     List<Position> selectList(Position position);
+
+    List<Position> manageList(Position position);
 }

+ 6 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/INewsService.java

@@ -1,8 +1,10 @@
 package com.ruoyi.web.work.service;
 
-import java.util.List;
-import com.ruoyi.web.work.domain.News;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.web.work.domain.News;
+
+import java.util.List;
 
 /**
  * @author lsw
@@ -10,4 +12,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface INewsService extends IService<News>{
     List<News> selectList(News news);
+
+    AjaxResult detail(Long id);
 }

+ 11 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/IPositionService.java

@@ -10,8 +10,18 @@ import java.util.List;
  * @author lsw
  * @date 2024-06-07
  */
-public interface IPositionService extends IService<Position>{
+public interface IPositionService extends IService<Position> {
     List<Position> selectList(Position position);
 
+    List<Position> manageList(Position position);
+
     AjaxResult edit(Position position);
+
+    /**
+     * 管理职位详情
+     *
+     * @param id
+     * @return
+     */
+    AjaxResult manageDetail(Long id);
 }

+ 16 - 5
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/NewsServiceImpl.java

@@ -1,12 +1,14 @@
 package com.ruoyi.web.work.service.impl;
 
-import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.web.work.mapper.NewsMapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.web.work.domain.News;
+import com.ruoyi.web.work.mapper.NewsMapper;
 import com.ruoyi.web.work.service.INewsService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
 
 /**
  * @author lsw
@@ -21,4 +23,13 @@ public class NewsServiceImpl extends ServiceImpl<NewsMapper, News> implements IN
     public List<News> selectList(News news) {
         return newsMapper.selectList(news);
     }
+
+    @Override
+    public AjaxResult detail(Long id) {
+        News news = getById(id);
+        if (news == null || news.getState() != 0) {
+            return AjaxResult.error("新闻不存在或停用");
+        }
+        return AjaxResult.success(news);
+    }
 }

+ 14 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/work/service/impl/PositionServiceImpl.java

@@ -32,6 +32,11 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
     }
 
     @Override
+    public List<Position> manageList(Position position) {
+        return positionMapper.manageList(position);
+    }
+
+    @Override
     public AjaxResult edit(Position position) {
         position.setUserId(AppUtil.getUser().getId());
         Column region = columnService.selectRegion(new Column().setTitle(position.getRegionName()).setLevel(3));
@@ -49,4 +54,13 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
         }
         return AjaxResult.success();
     }
+
+    @Override
+    public AjaxResult manageDetail(Long id) {
+        Position position = getById(id);
+        if (position == null || !position.getUserId().equals(AppUtil.getUser().getId())) {
+            return AjaxResult.error("职位不存在或非法操作");
+        }
+        return AjaxResult.success(position);
+    }
 }

+ 2 - 1
ruoyi-admin/src/main/resources/mapper/work/NewsMapper.xml

@@ -4,12 +4,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.web.work.mapper.NewsMapper">
     <select id="selectList" resultType="com.ruoyi.web.work.domain.News">
-        select * from tb_news
+        select id,title,state,type,top,create_time from tb_news
         <where>
             <if test="title != null  and title != ''"> and title like concat('%', #{title}, '%')</if>
             <if test="type != null  and type != ''"> and type = #{type}</if>
             <if test="state != null "> and state = #{state}</if>
         </where>
+        ORDER BY top DESC,id DESC
     </select>
 
 </mapper>

+ 1 - 0
ruoyi-admin/src/main/resources/mapper/work/NoticeMapper.xml

@@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="state != null "> and state = #{state}</if>
             <if test="type != null "> and type = #{type}</if>
         </where>
+        ORDER BY top DESC,id DESC
     </select>
     <select id="queryList" resultType="com.ruoyi.web.work.domain.Notice">
         SELECT id,title,create_time FROM tb_notice WHERE state=0 AND type = #{type} ORDER BY top DESC,id DESC LIMIT 10

+ 8 - 0
ruoyi-admin/src/main/resources/mapper/work/PositionMapper.xml

@@ -12,4 +12,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="title != null  and title != ''"> and title like concat('%', #{name}, '%')</if>
         </where>
     </select>
+    <select id="manageList" resultType="com.ruoyi.web.work.domain.Position">
+        select * from tb_position
+        <where>
+            <if test="userId != null "> and user_id = #{userId}</if>
+            <if test="type != null "> and type = #{type}</if>
+            <if test="title != null  and title != ''"> and title like concat('%', #{name}, '%')</if>
+        </where>
+    </select>
 </mapper>