Commit be93c5c5 by 唐功亮

【新增】 案例介绍列表查询

parent e4ea037f
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.PartnersEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.office.modules.manage.entity.CasesEntity;
import io.office.modules.manage.service.CasesService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* 案例介绍
*
* @author tgl
* @email
* @date 2021-12-09 10:33:11
*/
@RestController
@RequestMapping("/cases")
public class CasesController {
@Autowired
private CasesService casesService;
/**
* 前台查询列表
*/
@RequestMapping("/api/frontList")
@Login
// @RequiresPermissions("manage:partners:list")
public R frontList(){
List<CasesEntity> casesList = this.casesService.frontList();
return R.ok().put("casesList", casesList);
}
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:cases:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = casesService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:cases:info")
public R info(@PathVariable("id") Integer id){
CasesEntity cases = casesService.getById(id);
return R.ok().put("cases", cases);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:cases:save")
public R save(@RequestBody CasesEntity cases){
casesService.save(cases);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:cases:update")
public R update(@RequestBody CasesEntity cases){
casesService.updateById(cases);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:cases:delete")
public R delete(@RequestBody Integer[] ids){
casesService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.CasesEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-09 10:33:11
*/
@Mapper
public interface CasesDao extends BaseMapper<CasesEntity> {
@Select("select * from Cases where status=#{status} and levels>#{levels} order by id desc")
List<CasesEntity> selectByStatusAndLevels(String status, String levels);
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-09 10:33:11
*/
@Data
@TableName("Cases")
public class CasesEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId
private Integer id;
/**
* $column.comments
*/
private String title;
/**
* $column.comments
*/
private String brief;
/**
* $column.comments
*/
private String service;
/**
* $column.comments
*/
private Date registerdate;
/**
* $column.comments
*/
private Date updatedate;
/**
* $column.comments
*/
private String showtime;
/**
* $column.comments
*/
private String editor;
/**
* $column.comments
*/
private String lasteditor;
/**
* $column.comments
*/
private Integer levels;
/**
* $column.comments
*/
private Integer status;
/**
* $column.comments
*/
private String auditor;
/**
* $column.comments
*/
private Date checkdate;
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.CasesEntity;
import java.util.List;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-12-09 10:33:11
*/
public interface CasesService extends IService<CasesEntity> {
PageUtils queryPage(Map<String, Object> params);
List<CasesEntity> frontList();
}
package io.office.modules.manage.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.CasesDao;
import io.office.modules.manage.entity.CasesEntity;
import io.office.modules.manage.service.CasesService;
@Service("casesService")
public class CasesServiceImpl extends ServiceImpl<CasesDao, CasesEntity> implements CasesService {
@Autowired
private CasesDao casesDao;
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<CasesEntity> page = this.page(
new Query<CasesEntity>().getPage(params),
new QueryWrapper<CasesEntity>()
);
return new PageUtils(page);
}
@Override
public List<CasesEntity> frontList() {
String status="1";//代表审核状态,编辑从后台提交专题后,默认初始状态为status=0,审核成功status=1,审核失败status=-1
String levels="0";//levels代表级别,取值从0到9。其中,0代表隐藏,1级以上可以显示,9级为最高级
return casesDao.selectByStatusAndLevels(status,levels);
}
}
\ No newline at end of file
......@@ -55,7 +55,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> impl
String passWord_repeat = params.get("passWord_repeat") == null ? "" : String.valueOf( params.get("passWord_repeat")); //重复密码
//判断用户名合法性
if (!checkUserName(userName)){
throw new RRException("用户名只能是数字加字母,长度2-8位");
throw new RRException("用户名不能是纯数字,长度2-8位");
}
//判断密码合法性
if (!checkPassWord(passWord)){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment