新闻
This commit is contained in:
parent
8650200345
commit
3837e277dd
@ -32,21 +32,18 @@ import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/benyi/news")
|
||||
public class BySchoolNewsController extends BaseController
|
||||
{
|
||||
public class BySchoolNewsController extends BaseController {
|
||||
@Autowired
|
||||
private IBySchoolNewsService bySchoolNewsService;
|
||||
@Autowired
|
||||
private SchoolCommon schoolCommon;
|
||||
|
||||
/**
|
||||
* 查询新闻中心列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:news:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BySchoolNews bySchoolNews)
|
||||
{
|
||||
bySchoolNews.setDeptId(SecurityUtils.getLoginUser().getUser().getDeptId());
|
||||
/**
|
||||
* 查询新闻中心列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:news:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BySchoolNews bySchoolNews) {
|
||||
startPage();
|
||||
List<BySchoolNews> list = bySchoolNewsService.selectBySchoolNewsList(bySchoolNews);
|
||||
return getDataTable(list);
|
||||
@ -58,8 +55,7 @@ public class BySchoolNewsController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('benyi:news:export')")
|
||||
@Log(title = "新闻中心", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(BySchoolNews bySchoolNews)
|
||||
{
|
||||
public AjaxResult export(BySchoolNews bySchoolNews) {
|
||||
List<BySchoolNews> list = bySchoolNewsService.selectBySchoolNewsList(bySchoolNews);
|
||||
ExcelUtil<BySchoolNews> util = new ExcelUtil<BySchoolNews>(BySchoolNews.class);
|
||||
return util.exportExcel(list, "news");
|
||||
@ -70,8 +66,7 @@ public class BySchoolNewsController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('benyi:news:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(bySchoolNewsService.selectBySchoolNewsById(id));
|
||||
}
|
||||
|
||||
@ -81,15 +76,12 @@ public class BySchoolNewsController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('benyi:news:add')")
|
||||
@Log(title = "新闻中心", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BySchoolNews bySchoolNews)
|
||||
{
|
||||
bySchoolNews.setIsdel("N");
|
||||
bySchoolNews.setCreateTime(new Date());
|
||||
bySchoolNews.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
|
||||
bySchoolNews.setIscheck("N");
|
||||
bySchoolNews.setDeptId(SecurityUtils.getLoginUser().getUser().getDeptId());
|
||||
bySchoolNews.setType("1");
|
||||
return toAjax(bySchoolNewsService.insertBySchoolNews(bySchoolNews));
|
||||
public AjaxResult add(@RequestBody BySchoolNews bySchoolNews) {
|
||||
bySchoolNews.setCreateTime(new Date());
|
||||
bySchoolNews.setCreateuserid(SecurityUtils.getLoginUser().getUser().getUserId());
|
||||
bySchoolNews.setDeptId(SecurityUtils.getLoginUser().getUser().getDeptId());
|
||||
bySchoolNews.setType("1");
|
||||
return toAjax(bySchoolNewsService.insertBySchoolNews(bySchoolNews));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -98,8 +90,7 @@ public class BySchoolNewsController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('benyi:news:edit')")
|
||||
@Log(title = "新闻中心", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BySchoolNews bySchoolNews)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody BySchoolNews bySchoolNews) {
|
||||
return toAjax(bySchoolNewsService.updateBySchoolNews(bySchoolNews));
|
||||
}
|
||||
|
||||
@ -109,8 +100,7 @@ public class BySchoolNewsController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('benyi:news:remove')")
|
||||
@Log(title = "新闻中心", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(bySchoolNewsService.deleteBySchoolNewsByIds(ids));
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,8 @@ package com.ruoyi.project.benyi.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.project.benyi.mapper.BySchoolNewsMapper;
|
||||
import com.ruoyi.project.benyi.domain.BySchoolNews;
|
||||
@ -39,6 +40,7 @@ public class BySchoolNewsServiceImpl implements IBySchoolNewsService
|
||||
* @return 新闻中心
|
||||
*/
|
||||
@Override
|
||||
@DataScope(deptAlias = "d")
|
||||
public List<BySchoolNews> selectBySchoolNewsList(BySchoolNews bySchoolNews)
|
||||
{
|
||||
return bySchoolNewsMapper.selectBySchoolNewsList(bySchoolNews);
|
||||
|
@ -22,30 +22,32 @@
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBySchoolNewsVo">
|
||||
select id, title, imgurl, abstractcontent, type, content, isdel, createuserid, create_time, dept_id, istop, ischeck, checkuserid, check_time from by_school_news
|
||||
select d.id, d.title, d.imgurl, d.abstractcontent, d.type, d.content, d.isdel, d.createuserid, d.create_time, d.dept_id, d.istop, d.ischeck, d.checkuserid, d.check_time from by_school_news d
|
||||
</sql>
|
||||
|
||||
<select id="selectBySchoolNewsList" parameterType="BySchoolNews" resultMap="BySchoolNewsResult">
|
||||
<include refid="selectBySchoolNewsVo"/>
|
||||
<where>
|
||||
<if test="title != null and title != ''">and title = #{title}</if>
|
||||
<if test="imgurl != null and imgurl != ''">and imgurl = #{imgurl}</if>
|
||||
<if test="abstractcontent != null and abstractcontent != ''">and abstractcontent = #{abstractcontent}</if>
|
||||
<if test="type != null and type != ''">and type = #{type}</if>
|
||||
<if test="content != null and content != ''">and content = #{content}</if>
|
||||
<if test="isdel != null and isdel != ''">and isdel = #{isdel}</if>
|
||||
<if test="createuserid != null ">and createuserid = #{createuserid}</if>
|
||||
<if test="deptId != null ">and dept_id = #{deptId}</if>
|
||||
<if test="istop != null and istop != ''">and istop = #{istop}</if>
|
||||
<if test="ischeck != null and ischeck != ''">and ischeck = #{ischeck}</if>
|
||||
<if test="checkuserid != null ">and checkuserid = #{checkuserid}</if>
|
||||
<if test="checkTime != null ">and check_time = #{checkTime}</if>
|
||||
d.isdel = 'N'
|
||||
<if test="title != null and title != ''">and d.title = #{title}</if>
|
||||
<if test="imgurl != null and imgurl != ''">and d.imgurl = #{imgurl}</if>
|
||||
<if test="abstractcontent != null and abstractcontent != ''">and d.abstractcontent = #{abstractcontent}</if>
|
||||
<if test="type != null and type != ''">and d.type = #{type}</if>
|
||||
<if test="content != null and content != ''">and d.content = #{content}</if>
|
||||
<if test="createuserid != null ">and d.createuserid = #{createuserid}</if>
|
||||
<if test="deptId != null ">and d.dept_id = #{deptId}</if>
|
||||
<if test="istop != null and istop != ''">and d.istop = #{istop}</if>
|
||||
<if test="ischeck != null and ischeck != ''">and d.ischeck = #{ischeck}</if>
|
||||
<if test="checkuserid != null ">and d.checkuserid = #{checkuserid}</if>
|
||||
<if test="checkTime != null ">and d.check_time = #{checkTime}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectBySchoolNewsById" parameterType="Long" resultMap="BySchoolNewsResult">
|
||||
<include refid="selectBySchoolNewsVo"/>
|
||||
where id = #{id}
|
||||
where d.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertBySchoolNews" parameterType="BySchoolNews" useGeneratedKeys="true" keyProperty="id">
|
||||
|
Loading…
x
Reference in New Issue
Block a user