资质管理后台完成
parent
6c33a9d1cf
commit
caa960c90a
|
|
@ -0,0 +1,77 @@
|
|||
package com.wyh.admin.controller.basic.company;
|
||||
|
||||
import com.wyh.admin.aop.Log;
|
||||
import com.wyh.admin.service.ICertificationCateService;
|
||||
import com.wyh.admin.validate.commons.IdValidate;
|
||||
import com.wyh.admin.validate.commons.PageValidate;
|
||||
import com.wyh.common.core.AjaxResult;
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.validator.annotation.IDMust;
|
||||
import com.wyh.common.validator.basic.company.CertificationCateCreateValidate;
|
||||
import com.wyh.common.validator.basic.company.CertificationCateSearchValidate;
|
||||
import com.wyh.common.validator.basic.company.CertificationCateUpdateValidate;
|
||||
import com.wyh.common.vo.basic.company.CertificationCateDetailVo;
|
||||
import com.wyh.common.vo.basic.company.CertificationCateListedVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/certificationCate")
|
||||
@Api(tags = "资质分类管理")
|
||||
public class CertificationCateController {
|
||||
|
||||
@Resource
|
||||
ICertificationCateService iCertificationCateService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value="资质分类列表")
|
||||
public AjaxResult<PageResult<CertificationCateListedVo>> list(@Validated PageValidate pageValidate,
|
||||
@Validated CertificationCateSearchValidate searchValidate) {
|
||||
PageResult<CertificationCateListedVo> list = iCertificationCateService.list(pageValidate, searchValidate);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("all")
|
||||
@ApiOperation(value="资质分类列表")
|
||||
public AjaxResult<List<CertificationCateListedVo>> all() {
|
||||
List<CertificationCateListedVo> list = iCertificationCateService.all();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperation(value="资质分类详情")
|
||||
public AjaxResult<CertificationCateDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
CertificationCateDetailVo detail = iCertificationCateService.detail(id);
|
||||
return AjaxResult.success(detail);
|
||||
}
|
||||
|
||||
@Log(title = "资质分类新增")
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value="资质分类新增")
|
||||
public AjaxResult<Object> add(@Validated @RequestBody CertificationCateCreateValidate createValidate) {
|
||||
iCertificationCateService.add(createValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "资质分类编辑")
|
||||
@PostMapping("/edit")
|
||||
@ApiOperation(value="资质分类编辑")
|
||||
public AjaxResult<Object> edit(@Validated @RequestBody CertificationCateUpdateValidate updateValidate) {
|
||||
iCertificationCateService.edit(updateValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "资质分类删除")
|
||||
@PostMapping("/del")
|
||||
@ApiOperation(value="资质分类删除")
|
||||
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
|
||||
iCertificationCateService.del(idValidate.getId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
package com.wyh.admin.controller.basic.company;
|
||||
|
||||
import com.wyh.admin.aop.Log;
|
||||
import com.wyh.admin.service.ICertificationService;
|
||||
import com.wyh.admin.validate.commons.IdValidate;
|
||||
import com.wyh.admin.validate.commons.PageValidate;
|
||||
import com.wyh.common.core.AjaxResult;
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.validator.annotation.IDMust;
|
||||
import com.wyh.common.validator.basic.company.CertificationCreateValidate;
|
||||
import com.wyh.common.validator.basic.company.CertificationSearchValidate;
|
||||
import com.wyh.common.validator.basic.company.CertificationUpdateValidate;
|
||||
import com.wyh.common.vo.basic.company.CertificationDetailVo;
|
||||
import com.wyh.common.vo.basic.company.CertificationListedVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/certification")
|
||||
@Api(tags = "资质信息管理")
|
||||
public class CertificationController {
|
||||
|
||||
@Resource
|
||||
ICertificationService iCertificationService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation(value="资质信息列表")
|
||||
public AjaxResult<PageResult<CertificationListedVo>> list(@Validated PageValidate pageValidate,
|
||||
@Validated CertificationSearchValidate searchValidate) {
|
||||
PageResult<CertificationListedVo> list = iCertificationService.list(pageValidate, searchValidate);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperation(value="资质信息详情")
|
||||
public AjaxResult<CertificationDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
CertificationDetailVo detail = iCertificationService.detail(id);
|
||||
return AjaxResult.success(detail);
|
||||
}
|
||||
|
||||
@Log(title = "资质信息新增")
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value="资质信息新增")
|
||||
public AjaxResult<Object> add(@Validated @RequestBody CertificationCreateValidate createValidate) {
|
||||
iCertificationService.add(createValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "资质信息编辑")
|
||||
@PostMapping("/edit")
|
||||
@ApiOperation(value="资质信息编辑")
|
||||
public AjaxResult<Object> edit(@Validated @RequestBody CertificationUpdateValidate updateValidate) {
|
||||
iCertificationService.edit(updateValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Log(title = "资质信息删除")
|
||||
@PostMapping("/del")
|
||||
@ApiOperation(value="资质信息删除")
|
||||
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
|
||||
iCertificationService.del(idValidate.getId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
package com.wyh.admin.service;
|
||||
|
||||
import com.wyh.admin.validate.commons.PageValidate;
|
||||
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.validator.basic.company.CertificationCateCreateValidate;
|
||||
import com.wyh.common.validator.basic.company.CertificationCateSearchValidate;
|
||||
import com.wyh.common.validator.basic.company.CertificationCateUpdateValidate;
|
||||
import com.wyh.common.vo.basic.company.CertificationCateDetailVo;
|
||||
import com.wyh.common.vo.basic.company.CertificationCateListedVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资质分类服务接口类
|
||||
* @author wyh
|
||||
*/
|
||||
public interface ICertificationCateService {
|
||||
|
||||
/**
|
||||
* 资质分类列表
|
||||
*
|
||||
* @author wyh
|
||||
* @param pageValidate 分页参数
|
||||
* @param searchValidate 搜索参数
|
||||
* @return PageResult<CertificationCateListedVo>
|
||||
*/
|
||||
PageResult<CertificationCateListedVo> list(PageValidate pageValidate, CertificationCateSearchValidate searchValidate);
|
||||
|
||||
/**
|
||||
* 资质分类详情
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键ID
|
||||
* @return CertificationCateDetailVo
|
||||
*/
|
||||
CertificationCateDetailVo detail(Integer id);
|
||||
|
||||
/**
|
||||
* 资质分类新增
|
||||
*
|
||||
* @author wyh
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
void add(CertificationCateCreateValidate createValidate);
|
||||
|
||||
/**
|
||||
* 资质分类编辑
|
||||
*
|
||||
* @author wyh
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
void edit(CertificationCateUpdateValidate updateValidate);
|
||||
|
||||
/**
|
||||
* 资质分类删除
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键ID
|
||||
*/
|
||||
void del(Integer id);
|
||||
|
||||
List<CertificationCateListedVo> all();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.wyh.admin.service;
|
||||
|
||||
import com.wyh.admin.validate.commons.PageValidate;
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.validator.basic.company.CertificationCreateValidate;
|
||||
import com.wyh.common.validator.basic.company.CertificationSearchValidate;
|
||||
import com.wyh.common.validator.basic.company.CertificationUpdateValidate;
|
||||
import com.wyh.common.vo.basic.company.CertificationDetailVo;
|
||||
import com.wyh.common.vo.basic.company.CertificationListedVo;
|
||||
|
||||
/**
|
||||
* 资质信息服务接口类
|
||||
* @author wyh
|
||||
*/
|
||||
public interface ICertificationService {
|
||||
|
||||
/**
|
||||
* 资质信息列表
|
||||
*
|
||||
* @author wyh
|
||||
* @param pageValidate 分页参数
|
||||
* @param searchValidate 搜索参数
|
||||
* @return PageResult<CertificationListedVo>
|
||||
*/
|
||||
PageResult<CertificationListedVo> list(PageValidate pageValidate, CertificationSearchValidate searchValidate);
|
||||
|
||||
/**
|
||||
* 资质信息详情
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键ID
|
||||
* @return CertificationDetailVo
|
||||
*/
|
||||
CertificationDetailVo detail(Integer id);
|
||||
|
||||
/**
|
||||
* 资质信息新增
|
||||
*
|
||||
* @author wyh
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
void add(CertificationCreateValidate createValidate);
|
||||
|
||||
/**
|
||||
* 资质信息编辑
|
||||
*
|
||||
* @author wyh
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
void edit(CertificationUpdateValidate updateValidate);
|
||||
|
||||
/**
|
||||
* 资质信息删除
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键ID
|
||||
*/
|
||||
void del(Integer id);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
package com.wyh.admin.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.yulichang.query.MPJQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wyh.admin.service.ICertificationCateService;
|
||||
import com.wyh.admin.validate.commons.PageValidate;
|
||||
import com.wyh.common.config.GlobalConfig;
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.entity.basic.company.CertificationCate;
|
||||
import com.wyh.common.mapper.basic.company.CertificationCateMapper;
|
||||
import com.wyh.common.util.ListUtils;
|
||||
import com.wyh.common.util.TimeUtils;
|
||||
import com.wyh.common.util.UrlUtils;
|
||||
import com.wyh.common.validator.basic.company.CertificationCateCreateValidate;
|
||||
import com.wyh.common.validator.basic.company.CertificationCateSearchValidate;
|
||||
import com.wyh.common.validator.basic.company.CertificationCateUpdateValidate;
|
||||
import com.wyh.common.vo.basic.company.CertificationCateDetailVo;
|
||||
import com.wyh.common.vo.basic.company.CertificationCateListedVo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 资质分类实现类
|
||||
* @author wyh
|
||||
*/
|
||||
@Service
|
||||
public class CertificationCateServiceImpl implements ICertificationCateService {
|
||||
|
||||
@Resource
|
||||
CertificationCateMapper certificationCateMapper;
|
||||
|
||||
/**
|
||||
* 资质分类列表
|
||||
*
|
||||
* @author wyh
|
||||
* @param pageValidate 分页参数
|
||||
* @param searchValidate 搜索参数
|
||||
* @return PageResult<CertificationCateListedVo>
|
||||
*/
|
||||
@Override
|
||||
public PageResult<CertificationCateListedVo> list(PageValidate pageValidate, CertificationCateSearchValidate searchValidate) {
|
||||
Integer page = pageValidate.getPageNo();
|
||||
Integer limit = pageValidate.getPageSize();
|
||||
|
||||
QueryWrapper<CertificationCate> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_delete", 0);
|
||||
queryWrapper.orderByDesc("id");
|
||||
|
||||
certificationCateMapper.setSearch(queryWrapper, searchValidate, new String[]{
|
||||
"like:name:str",
|
||||
});
|
||||
|
||||
IPage<CertificationCate> iPage = certificationCateMapper.selectPage(new Page<>(page, limit), queryWrapper);
|
||||
|
||||
List<CertificationCateListedVo> list = new LinkedList<>();
|
||||
for(CertificationCate item : iPage.getRecords()) {
|
||||
CertificationCateListedVo vo = new CertificationCateListedVo();
|
||||
BeanUtils.copyProperties(item, vo);
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime()));
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 资质分类详情
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键参数
|
||||
* @return CertificationCate
|
||||
*/
|
||||
@Override
|
||||
public CertificationCateDetailVo detail(Integer id) {
|
||||
CertificationCate model = certificationCateMapper.selectOne(
|
||||
new QueryWrapper<CertificationCate>()
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在");
|
||||
|
||||
CertificationCateDetailVo vo = new CertificationCateDetailVo();
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 资质分类新增
|
||||
*
|
||||
* @author wyh
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
@Override
|
||||
public void add(CertificationCateCreateValidate createValidate) {
|
||||
CertificationCate model = new CertificationCate();
|
||||
model.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
model.setName(createValidate.getName());
|
||||
certificationCateMapper.insert(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 资质分类编辑
|
||||
*
|
||||
* @author wyh
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
@Override
|
||||
public void edit(CertificationCateUpdateValidate updateValidate) {
|
||||
CertificationCate model = certificationCateMapper.selectOne(
|
||||
new QueryWrapper<CertificationCate>()
|
||||
.eq("id", updateValidate.getId())
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在!");
|
||||
|
||||
model.setId(updateValidate.getId());
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
model.setName(updateValidate.getName());
|
||||
certificationCateMapper.updateById(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 资质分类删除
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键ID
|
||||
*/
|
||||
@Override
|
||||
public void del(Integer id) {
|
||||
CertificationCate model = certificationCateMapper.selectOne(
|
||||
new QueryWrapper<CertificationCate>()
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在!");
|
||||
|
||||
model.setIsDelete(1);
|
||||
model.setDeleteTime(System.currentTimeMillis() / 1000);
|
||||
certificationCateMapper.updateById(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CertificationCateListedVo> all() {
|
||||
List<CertificationCate> certificationCates = certificationCateMapper.selectList(Wrappers.<CertificationCate>lambdaQuery().eq(CertificationCate::getIsDelete, 0).orderByDesc(CertificationCate::getId));
|
||||
List<CertificationCateListedVo> list = new LinkedList<>();
|
||||
for (CertificationCate certificationCate : certificationCates) {
|
||||
CertificationCateListedVo certificationCateListedVo = new CertificationCateListedVo();
|
||||
BeanUtils.copyProperties(certificationCate, certificationCateListedVo);
|
||||
list.add(certificationCateListedVo);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
package com.wyh.admin.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.github.yulichang.query.MPJQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wyh.admin.validate.commons.PageValidate;
|
||||
import com.wyh.admin.service.ICertificationService;
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.entity.basic.company.Certification;
|
||||
import com.wyh.common.entity.basic.company.CertificationCate;
|
||||
import com.wyh.common.mapper.basic.company.CertificationCateMapper;
|
||||
import com.wyh.common.mapper.basic.company.CertificationMapper;
|
||||
import com.wyh.common.util.ListUtils;
|
||||
import com.wyh.common.util.TimeUtils;
|
||||
import com.wyh.common.util.UrlUtils;
|
||||
import com.wyh.common.validator.basic.company.CertificationCreateValidate;
|
||||
import com.wyh.common.validator.basic.company.CertificationSearchValidate;
|
||||
import com.wyh.common.validator.basic.company.CertificationUpdateValidate;
|
||||
import com.wyh.common.vo.basic.company.CertificationDetailVo;
|
||||
import com.wyh.common.vo.basic.company.CertificationListedVo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 资质信息实现类
|
||||
* @author wyh
|
||||
*/
|
||||
@Service
|
||||
public class CertificationServiceImpl implements ICertificationService {
|
||||
|
||||
@Resource
|
||||
CertificationMapper certificationMapper;
|
||||
|
||||
@Resource
|
||||
CertificationCateMapper certificationCateMapper;
|
||||
|
||||
/**
|
||||
* 资质信息列表
|
||||
*
|
||||
* @author wyh
|
||||
* @param pageValidate 分页参数
|
||||
* @param searchValidate 搜索参数
|
||||
* @return PageResult<CertificationListedVo>
|
||||
*/
|
||||
@Override
|
||||
public PageResult<CertificationListedVo> list(PageValidate pageValidate, CertificationSearchValidate searchValidate) {
|
||||
Integer page = pageValidate.getPageNo();
|
||||
Integer limit = pageValidate.getPageSize();
|
||||
|
||||
QueryWrapper<Certification> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_delete", 0);
|
||||
queryWrapper.orderByDesc(Arrays.asList("sort", "id"));
|
||||
|
||||
certificationMapper.setSearch(queryWrapper, searchValidate, new String[]{
|
||||
"like:title:str",
|
||||
"=:img:str",
|
||||
"=:sort:int",
|
||||
"=:isShow@is_show:int",
|
||||
"=:cid@cid:int",
|
||||
});
|
||||
|
||||
IPage<Certification> iPage = certificationMapper.selectPage(new Page<>(page, limit), queryWrapper);
|
||||
|
||||
List<CertificationListedVo> list = new LinkedList<>();
|
||||
for(Certification item : iPage.getRecords()) {
|
||||
CertificationListedVo vo = new CertificationListedVo();
|
||||
BeanUtils.copyProperties(item, vo);
|
||||
vo.setImg(UrlUtils.toAbsoluteUrl(item.getImg()));
|
||||
vo.setCreateTime(TimeUtils.timestampToDate(item.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtils.timestampToDate(item.getUpdateTime()));
|
||||
if (item.getCid() != null){
|
||||
CertificationCate certificationCate = certificationCateMapper.selectById(item.getCid());
|
||||
vo.setCName(certificationCate !=null ? certificationCate.getName() : "");
|
||||
}
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 资质信息详情
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键参数
|
||||
* @return Certification
|
||||
*/
|
||||
@Override
|
||||
public CertificationDetailVo detail(Integer id) {
|
||||
Certification model = certificationMapper.selectOne(
|
||||
new QueryWrapper<Certification>()
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在");
|
||||
|
||||
CertificationDetailVo vo = new CertificationDetailVo();
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
vo.setImg(UrlUtils.toAbsoluteUrl(model.getImg()));
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 资质信息新增
|
||||
*
|
||||
* @author wyh
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
@Override
|
||||
public void add(CertificationCreateValidate createValidate) {
|
||||
Certification model = new Certification();
|
||||
model.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
model.setTitle(createValidate.getTitle());
|
||||
model.setImg(UrlUtils.toRelativeUrl(createValidate.getImg()));
|
||||
model.setSort(createValidate.getSort());
|
||||
model.setIsShow(createValidate.getIsShow());
|
||||
model.setCid(createValidate.getCid());
|
||||
certificationMapper.insert(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 资质信息编辑
|
||||
*
|
||||
* @author wyh
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
@Override
|
||||
public void edit(CertificationUpdateValidate updateValidate) {
|
||||
Certification model = certificationMapper.selectOne(
|
||||
new QueryWrapper<Certification>()
|
||||
.eq("id", updateValidate.getId())
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在!");
|
||||
|
||||
model.setId(updateValidate.getId());
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
model.setTitle(updateValidate.getTitle());
|
||||
model.setImg(UrlUtils.toRelativeUrl(updateValidate.getImg()));
|
||||
model.setSort(updateValidate.getSort());
|
||||
model.setIsShow(updateValidate.getIsShow());
|
||||
model.setCid(updateValidate.getCid());
|
||||
certificationMapper.updateById(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 资质信息删除
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键ID
|
||||
*/
|
||||
@Override
|
||||
public void del(Integer id) {
|
||||
Certification model = certificationMapper.selectOne(
|
||||
new QueryWrapper<Certification>()
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在!");
|
||||
|
||||
model.setIsDelete(1);
|
||||
model.setDeleteTime(System.currentTimeMillis() / 1000);
|
||||
certificationMapper.updateById(model);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.wyh.common.entity.basic.company;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("资质信息实体")
|
||||
public class Certification implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "是否删除: 0=否, 1=是")
|
||||
private Integer isDelete;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Long createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Long updateTime;
|
||||
|
||||
@ApiModelProperty(value = "删除时间")
|
||||
private Long deleteTime;
|
||||
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String img;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "是否展示0:否,1:是")
|
||||
private Integer isShow;
|
||||
|
||||
@ApiModelProperty(value = "分类id")
|
||||
private Integer cid;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package com.wyh.common.entity.basic.company;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("资质分类实体")
|
||||
public class CertificationCate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "是否删除: 0=否, 1=是")
|
||||
private Integer isDelete;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Long createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Long updateTime;
|
||||
|
||||
@ApiModelProperty(value = "删除时间")
|
||||
private Long deleteTime;
|
||||
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.wyh.common.mapper.basic.company;
|
||||
|
||||
import com.wyh.common.core.basics.IBaseMapper;
|
||||
import com.wyh.common.entity.basic.company.CertificationCate;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 资质分类Mapper
|
||||
* @author wyh
|
||||
*/
|
||||
@Mapper
|
||||
public interface CertificationCateMapper extends IBaseMapper<CertificationCate> {
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.wyh.common.mapper.basic.company;
|
||||
|
||||
import com.wyh.common.core.basics.IBaseMapper;
|
||||
import com.wyh.common.entity.basic.company.Certification;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 资质信息Mapper
|
||||
* @author wyh
|
||||
*/
|
||||
@Mapper
|
||||
public interface CertificationMapper extends IBaseMapper<Certification> {
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.wyh.common.validator.basic.company;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Data
|
||||
@ApiModel("资质分类创建参数")
|
||||
public class CertificationCateCreateValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "name参数缺失")
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.wyh.common.validator.basic.company;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("资质分类搜素参数")
|
||||
public class CertificationCateSearchValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.wyh.common.validator.basic.company;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import javax.validation.constraints.*;
|
||||
import com.wyh.common.validator.annotation.IDMust;
|
||||
|
||||
/**
|
||||
* 资质分类参数
|
||||
* @author wyh
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("资质分类更新参数")
|
||||
public class CertificationCateUpdateValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@IDMust(message = "id参数必传且需大于0")
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@NotNull(message = "name参数缺失")
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.wyh.common.validator.basic.company;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Data
|
||||
@ApiModel("资质信息创建参数")
|
||||
public class CertificationCreateValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "title参数缺失")
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
@NotNull(message = "img参数缺失")
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String img;
|
||||
|
||||
@NotNull(message = "sort参数缺失")
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@NotNull(message = "isShow参数缺失")
|
||||
@ApiModelProperty(value = "是否展示0:否,1:是")
|
||||
private Integer isShow;
|
||||
|
||||
@NotNull(message = "cid参数缺失")
|
||||
@ApiModelProperty(value = "分类id")
|
||||
private Integer cid;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.wyh.common.validator.basic.company;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("资质信息搜素参数")
|
||||
public class CertificationSearchValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String img;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "是否展示0:否,1:是")
|
||||
private Integer isShow;
|
||||
|
||||
@ApiModelProperty(value = "分类id")
|
||||
private Integer cid;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.wyh.common.validator.basic.company;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import javax.validation.constraints.*;
|
||||
import com.wyh.common.validator.annotation.IDMust;
|
||||
|
||||
/**
|
||||
* 资质信息参数
|
||||
* @author wyh
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("资质信息更新参数")
|
||||
public class CertificationUpdateValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@IDMust(message = "id参数必传且需大于0")
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@NotNull(message = "title参数缺失")
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
@NotNull(message = "img参数缺失")
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String img;
|
||||
|
||||
@NotNull(message = "sort参数缺失")
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@NotNull(message = "isShow参数缺失")
|
||||
@ApiModelProperty(value = "是否展示0:否,1:是")
|
||||
private Integer isShow;
|
||||
|
||||
@NotNull(message = "cid参数缺失")
|
||||
@ApiModelProperty(value = "分类id")
|
||||
private Integer cid;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package com.wyh.common.vo.basic.company;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("资质分类详情Vo")
|
||||
public class CertificationCateDetailVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.wyh.common.vo.basic.company;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("资质分类列表Vo")
|
||||
public class CertificationCateListedVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
private String name;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.wyh.common.vo.basic.company;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("资质信息详情Vo")
|
||||
public class CertificationDetailVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String img;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "是否展示0:否,1:是")
|
||||
private Integer isShow;
|
||||
|
||||
@ApiModelProperty(value = "分类id")
|
||||
private Integer cid;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.wyh.common.vo.basic.company;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("资质信息列表Vo")
|
||||
public class CertificationListedVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "图片")
|
||||
private String img;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "是否展示0:否,1:是")
|
||||
private Integer isShow;
|
||||
|
||||
@ApiModelProperty(value = "分类id")
|
||||
private Integer cid;
|
||||
|
||||
private String cName;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.wyh.front.controller;
|
||||
|
||||
import com.wyh.common.core.AjaxResult;
|
||||
import com.wyh.front.service.IIndexService;
|
||||
import com.wyh.front.vo.AboutDataVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/a")
|
||||
@Api(tags = "关于我们Tag")
|
||||
public class AboutDataController {
|
||||
|
||||
@Resource
|
||||
private IIndexService indexService;
|
||||
|
||||
@GetMapping("/aboutData")
|
||||
@ApiOperation(value = "关于我们")
|
||||
public AjaxResult<AboutDataVo> aboutData() {
|
||||
AboutDataVo aboutDataVo = indexService.aboutData();
|
||||
return AjaxResult.success(aboutDataVo);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -15,6 +15,8 @@ import com.wyh.common.validator.annotation.IDMust;
|
|||
import com.wyh.front.service.IBannerService;
|
||||
import com.wyh.front.service.IIndexService;
|
||||
import com.wyh.front.validate.common.SmsValidate;
|
||||
import com.wyh.front.vo.basic.banner.BannerListedVo;
|
||||
import com.wyh.front.vo.basic.bannerfront.BannerFrontListedVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
|
|
@ -32,14 +34,10 @@ import java.util.Map;
|
|||
@Api(tags = "公共数据")
|
||||
public class IndexController {
|
||||
|
||||
@Resource
|
||||
NoticeRecordMapper noticeRecordMapper;
|
||||
|
||||
@Resource
|
||||
IIndexService iIndexService;
|
||||
|
||||
@Resource
|
||||
IBannerService iBannerService;
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/index")
|
||||
|
|
@ -86,34 +84,18 @@ public class IndexController {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@NotLogin
|
||||
@PostMapping("/sendSms")
|
||||
@ApiOperation(value="发送短信" , notes="发送短信验证码")
|
||||
// @ApiIgnore
|
||||
public AjaxResult<Object> sendSms(@Validated @RequestBody SmsValidate smsValidate) {
|
||||
NoticeRecord noticeRecord = noticeRecordMapper.selectOne(new QueryWrapper<NoticeRecord>()
|
||||
.eq("account", smsValidate.getMobile())
|
||||
.eq("scene", smsValidate.getScene())
|
||||
.eq("status", Arrays.asList(NoticeEnum.STATUS_WAIT, NoticeEnum.STATUS_OK))
|
||||
.orderByDesc("id")
|
||||
.last("limit 1"));
|
||||
@GetMapping("/bannerPc")
|
||||
@ApiOperation(value="首页轮播图(PC端)")
|
||||
public AjaxResult<List<BannerListedVo>> bannerPc() {
|
||||
List<BannerListedVo> list = iIndexService.bannerPc();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
if (StringUtils.isNotNull(noticeRecord)) {
|
||||
if (noticeRecord.getCreateTime() >= (System.currentTimeMillis() / 1000 - 60)){
|
||||
throw new OperateException("操作频繁,请稍后再试!");
|
||||
}
|
||||
}
|
||||
|
||||
NoticeSmsVo params = new NoticeSmsVo()
|
||||
.setScene(smsValidate.getScene())
|
||||
.setMobile(smsValidate.getMobile())
|
||||
.setExpire(900)
|
||||
.setParams(new String[] {
|
||||
"code:" + ToolUtils.randomInt(4)
|
||||
});
|
||||
|
||||
NoticeDriver.handle(params);
|
||||
return AjaxResult.success();
|
||||
@GetMapping("/bannerFront")
|
||||
@ApiOperation(value="首页轮播图(小程序端)")
|
||||
public AjaxResult<List<BannerFrontListedVo>> bannerFront() {
|
||||
List<BannerFrontListedVo> list = iIndexService.bannerFront();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,19 @@
|
|||
package com.wyh.front.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.wyh.common.aop.NotLogin;
|
||||
import com.wyh.common.core.AjaxResult;
|
||||
import com.wyh.common.entity.notice.NoticeRecord;
|
||||
import com.wyh.common.enums.NoticeEnum;
|
||||
import com.wyh.common.exception.OperateException;
|
||||
import com.wyh.common.mapper.notice.NoticeRecordMapper;
|
||||
import com.wyh.common.plugin.notice.NoticeDriver;
|
||||
import com.wyh.common.plugin.notice.vo.NoticeSmsVo;
|
||||
import com.wyh.common.util.StringUtils;
|
||||
import com.wyh.common.util.ToolUtils;
|
||||
import com.wyh.front.ZJFrontThreadLocal;
|
||||
import com.wyh.front.service.ILoginService;
|
||||
import com.wyh.front.validate.common.SmsValidate;
|
||||
import com.wyh.front.validate.login.*;
|
||||
import com.wyh.front.vo.login.LoginUrlsVo;
|
||||
import com.wyh.front.vo.login.LoginTokenVo;
|
||||
|
|
@ -17,6 +27,7 @@ import springfox.documentation.annotations.ApiIgnore;
|
|||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
|
@ -26,6 +37,9 @@ import java.util.regex.Pattern;
|
|||
@Api(tags = "登录管理")
|
||||
public class LoginController {
|
||||
|
||||
|
||||
@Resource
|
||||
NoticeRecordMapper noticeRecordMapper;
|
||||
@Resource
|
||||
ILoginService iLoginService;
|
||||
|
||||
|
|
@ -146,5 +160,34 @@ public class LoginController {
|
|||
}
|
||||
|
||||
}
|
||||
@NotLogin
|
||||
@PostMapping("/sendSms")
|
||||
@ApiOperation(value="发送短信" , notes="发送短信验证码")
|
||||
// @ApiIgnore
|
||||
public AjaxResult<Object> sendSms(@Validated @RequestBody SmsValidate smsValidate) {
|
||||
NoticeRecord noticeRecord = noticeRecordMapper.selectOne(new QueryWrapper<NoticeRecord>()
|
||||
.eq("account", smsValidate.getMobile())
|
||||
.eq("scene", smsValidate.getScene())
|
||||
.eq("status", Arrays.asList(NoticeEnum.STATUS_WAIT, NoticeEnum.STATUS_OK))
|
||||
.orderByDesc("id")
|
||||
.last("limit 1"));
|
||||
|
||||
if (StringUtils.isNotNull(noticeRecord)) {
|
||||
if (noticeRecord.getCreateTime() >= (System.currentTimeMillis() / 1000 - 60)){
|
||||
throw new OperateException("操作频繁,请稍后再试!");
|
||||
}
|
||||
}
|
||||
|
||||
NoticeSmsVo params = new NoticeSmsVo()
|
||||
.setScene(smsValidate.getScene())
|
||||
.setMobile(smsValidate.getMobile())
|
||||
.setExpire(900)
|
||||
.setParams(new String[] {
|
||||
"code:" + ToolUtils.randomInt(4)
|
||||
});
|
||||
|
||||
NoticeDriver.handle(params);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
package com.wyh.front.service;
|
||||
|
||||
import com.wyh.front.vo.AboutDataVo;
|
||||
import com.wyh.front.vo.basic.banner.BannerListedVo;
|
||||
import com.wyh.front.vo.basic.bannerfront.BannerFrontListedVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -50,4 +54,15 @@ public interface IIndexService {
|
|||
*/
|
||||
List<String> hotSearch();
|
||||
|
||||
/**
|
||||
* 轮播图(pc)
|
||||
*
|
||||
* @author wyh
|
||||
* @return List<BannerListedVo>
|
||||
*/
|
||||
List<BannerListedVo> bannerPc();
|
||||
|
||||
List<BannerFrontListedVo> bannerFront();
|
||||
|
||||
AboutDataVo aboutData();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,32 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Assert;
|
||||
import com.wyh.common.config.GlobalConfig;
|
||||
import com.wyh.common.entity.article.Article;
|
||||
import com.wyh.common.entity.basic.banner.Banner;
|
||||
import com.wyh.common.entity.basic.bannerfront.BannerFront;
|
||||
import com.wyh.common.entity.basic.company.About;
|
||||
import com.wyh.common.entity.basic.company.Case;
|
||||
import com.wyh.common.entity.basic.company.Contact;
|
||||
import com.wyh.common.entity.basic.company.Jrwm;
|
||||
import com.wyh.common.entity.decorate.DecoratePage;
|
||||
import com.wyh.common.entity.decorate.DecorateTabbar;
|
||||
import com.wyh.common.entity.setting.HotSearch;
|
||||
import com.wyh.common.mapper.article.ArticleMapper;
|
||||
import com.wyh.common.mapper.basic.banner.BannerMapper;
|
||||
import com.wyh.common.mapper.basic.bannerfront.BannerFrontMapper;
|
||||
import com.wyh.common.mapper.basic.company.AboutMapper;
|
||||
import com.wyh.common.mapper.basic.company.CaseMapper;
|
||||
import com.wyh.common.mapper.basic.company.ContactMapper;
|
||||
import com.wyh.common.mapper.basic.company.JrwmMapper;
|
||||
import com.wyh.common.mapper.decorate.DecoratePageMapper;
|
||||
import com.wyh.common.mapper.decorate.DecorateTabbarMapper;
|
||||
import com.wyh.common.mapper.setting.HotSearchMapper;
|
||||
import com.wyh.front.service.IIndexService;
|
||||
import com.wyh.common.util.*;
|
||||
import com.wyh.front.vo.AboutDataVo;
|
||||
import com.wyh.front.vo.basic.banner.BannerListedVo;
|
||||
import com.wyh.front.vo.basic.bannerfront.BannerFrontListedVo;
|
||||
import com.wyh.front.vo.basic.company.AboutDetailVo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -36,19 +53,37 @@ public class IndexServiceImpl implements IIndexService {
|
|||
@Resource
|
||||
ArticleMapper articleMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
BannerMapper bannerMapper;
|
||||
|
||||
@Resource
|
||||
BannerFrontMapper bannerFrontMapper;
|
||||
|
||||
@Resource
|
||||
ContactMapper contactMapper;
|
||||
|
||||
@Resource
|
||||
CaseMapper caseMapper;
|
||||
|
||||
@Resource
|
||||
JrwmMapper jrwmMapper;
|
||||
@Resource
|
||||
AboutMapper aboutMapper;
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*
|
||||
* @author wyh
|
||||
* @return Map<String, Object>
|
||||
* @author wyh
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> index() {
|
||||
Map<String, Object> response = new LinkedHashMap<>();
|
||||
DecoratePage decoratePage = decoratePageMapper.selectOne(
|
||||
new QueryWrapper<DecoratePage>()
|
||||
.eq("id", 1)
|
||||
.last("limit 1"));
|
||||
.eq("id", 1)
|
||||
.last("limit 1"));
|
||||
|
||||
List<Map<String, Object>> articleList = new LinkedList<>();
|
||||
List<Article> articles = articleMapper.selectList(new QueryWrapper<Article>()
|
||||
|
|
@ -79,9 +114,9 @@ public class IndexServiceImpl implements IIndexService {
|
|||
/**
|
||||
* 装修
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键
|
||||
* @return Map<String, Object>
|
||||
* @author wyh
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> decorate(Integer id) {
|
||||
|
|
@ -102,8 +137,8 @@ public class IndexServiceImpl implements IIndexService {
|
|||
/**
|
||||
* 配置
|
||||
*
|
||||
* @author wyh
|
||||
* @return Map<String, Object>
|
||||
* @author wyh
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> config() {
|
||||
|
|
@ -112,7 +147,7 @@ public class IndexServiceImpl implements IIndexService {
|
|||
// 底部导航
|
||||
List<Map<String, String>> tabs = new LinkedList<>();
|
||||
List<DecorateTabbar> decorateTabbars = decorateTabbarMapper.selectList(new QueryWrapper<DecorateTabbar>().orderByAsc("id"));
|
||||
for (DecorateTabbar tab: decorateTabbars) {
|
||||
for (DecorateTabbar tab : decorateTabbars) {
|
||||
Map<String, String> map = new LinkedHashMap<>();
|
||||
map.put("name", tab.getName());
|
||||
map.put("selected", UrlUtils.toAbsoluteUrl(tab.getSelected()));
|
||||
|
|
@ -161,9 +196,9 @@ public class IndexServiceImpl implements IIndexService {
|
|||
/**
|
||||
* 政策
|
||||
*
|
||||
* @author wyh
|
||||
* @param type 类型 service=服务协议,privacy=隐私协议
|
||||
* @return Map<String, Object>
|
||||
* @author wyh
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> policy(String type) {
|
||||
|
|
@ -180,8 +215,8 @@ public class IndexServiceImpl implements IIndexService {
|
|||
/**
|
||||
* 热搜
|
||||
*
|
||||
* @author wyh
|
||||
* @return List<String>
|
||||
* @author wyh
|
||||
*/
|
||||
@Override
|
||||
public List<String> hotSearch() {
|
||||
|
|
@ -191,7 +226,7 @@ public class IndexServiceImpl implements IIndexService {
|
|||
if (Integer.parseInt(isHotSearch) == 1) {
|
||||
List<HotSearch> hotSearches = hotSearchMapper.selectList(
|
||||
new QueryWrapper<HotSearch>()
|
||||
.orderByDesc(Arrays.asList("sort", "id")));
|
||||
.orderByDesc(Arrays.asList("sort", "id")));
|
||||
|
||||
for (HotSearch hotSearch : hotSearches) {
|
||||
list.add(hotSearch.getName());
|
||||
|
|
@ -201,4 +236,55 @@ public class IndexServiceImpl implements IIndexService {
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BannerListedVo> bannerPc() {
|
||||
List<Banner> banners = bannerMapper.selectList(new QueryWrapper<Banner>().eq("is_delete", 0).eq("is_show", 1).orderByDesc(Arrays.asList("sort", "id")));
|
||||
List<BannerListedVo> bannerListedVos = new LinkedList<>();
|
||||
for (Banner banner : banners) {
|
||||
BannerListedVo bannerListedVo = new BannerListedVo();
|
||||
BeanUtils.copyProperties(banner, bannerListedVo);
|
||||
bannerListedVo.setImg(UrlUtils.toAbsoluteUrl(banner.getImg()));
|
||||
bannerListedVo.setCreateTime(TimeUtils.timestampToDate(banner.getCreateTime()));
|
||||
bannerListedVo.setUpdateTime(TimeUtils.timestampToDate(banner.getUpdateTime()));
|
||||
bannerListedVos.add(bannerListedVo);
|
||||
}
|
||||
return bannerListedVos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BannerFrontListedVo> bannerFront() {
|
||||
List<BannerFront> bannerFronts = bannerFrontMapper.selectList(new QueryWrapper<BannerFront>().eq("is_delete", 0).eq("is_show", 1).orderByDesc(Arrays.asList("sort", "id")));
|
||||
List<BannerFrontListedVo> bannerFrontListedVos = new LinkedList<>();
|
||||
for (BannerFront bannerFront : bannerFronts) {
|
||||
BannerFrontListedVo bannerFrontListedVo = new BannerFrontListedVo();
|
||||
BeanUtils.copyProperties(bannerFront, bannerFrontListedVo);
|
||||
bannerFrontListedVo.setImg(UrlUtils.toAbsoluteUrl(bannerFront.getImg()));
|
||||
bannerFrontListedVo.setCreateTime(TimeUtils.timestampToDate(bannerFront.getCreateTime()));
|
||||
bannerFrontListedVo.setUpdateTime(TimeUtils.timestampToDate(bannerFront.getUpdateTime()));
|
||||
bannerFrontListedVos.add(bannerFrontListedVo);
|
||||
}
|
||||
return bannerFrontListedVos;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public AboutDataVo aboutData() {
|
||||
AboutDataVo aboutDataVo = new AboutDataVo();
|
||||
// 关于我们
|
||||
About abouts = aboutMapper.selectById(1);
|
||||
AboutDetailVo aboutDetailVo = new AboutDetailVo();
|
||||
BeanUtils.copyProperties(abouts, aboutDetailVo);
|
||||
aboutDetailVo.setAboutImg(UrlUtils.toAbsoluteUrl(abouts.getAboutImg()));
|
||||
aboutDetailVo.setResearchImg(UrlUtils.toAbsoluteUrl(abouts.getResearchImg()));
|
||||
aboutDataVo.setAbout(aboutDetailVo);
|
||||
// 案例
|
||||
List<Case> cases = caseMapper.selectList(new QueryWrapper<Case>().eq("is_delete", 0).eq("is_show", 1).orderByDesc(Arrays.asList("sort", "id")));
|
||||
aboutDataVo.setCaseList(cases);
|
||||
// 荣誉
|
||||
// 联系我们
|
||||
List<Contact> contacts = contactMapper.selectList(new QueryWrapper<Contact>().eq("is_delete", 0).eq("is_show", 1).orderByDesc(Arrays.asList("sort", "id")));
|
||||
aboutDataVo.setContactList(contacts);
|
||||
return aboutDataVo;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.wyh.front.vo;
|
||||
|
||||
import com.wyh.common.entity.basic.company.About;
|
||||
import com.wyh.common.entity.basic.company.Case;
|
||||
import com.wyh.common.entity.basic.company.Contact;
|
||||
import com.wyh.common.entity.basic.company.Jrwm;
|
||||
import com.wyh.front.vo.basic.company.AboutDetailVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("关于我们VO")
|
||||
public class AboutDataVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private AboutDetailVo about;
|
||||
private List<Case> caseList;
|
||||
// private List<Jrwm> jrwmList;
|
||||
private List<Contact> contactList;
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 资质信息列表
|
||||
export function certificationLists(params?: Record<string, any>) {
|
||||
return request.get({ url: '/certification/list', params })
|
||||
}
|
||||
|
||||
// 资质信息详情
|
||||
export function certificationDetail(params: Record<string, any>) {
|
||||
return request.get({ url: '/certification/detail', params })
|
||||
}
|
||||
|
||||
// 资质信息新增
|
||||
export function certificationAdd(params: Record<string, any>) {
|
||||
return request.post({ url: '/certification/add', params })
|
||||
}
|
||||
|
||||
// 资质信息编辑
|
||||
export function certificationEdit(params: Record<string, any>) {
|
||||
return request.post({ url: '/certification/edit', params })
|
||||
}
|
||||
|
||||
// 资质信息删除
|
||||
export function certificationDelete(params: Record<string, any>) {
|
||||
return request.post({ url: '/certification/del', params })
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 资质分类列表
|
||||
export function certificationLists(params?: Record<string, any>) {
|
||||
return request.get({ url: '/certificationCate/list', params })
|
||||
}
|
||||
|
||||
// 资质分类详情
|
||||
export function certificationDetail(params: Record<string, any>) {
|
||||
return request.get({ url: '/certificationCate/detail', params })
|
||||
}
|
||||
|
||||
// 资质分类新增
|
||||
export function certificationAdd(params: Record<string, any>) {
|
||||
return request.post({ url: '/certificationCate/add', params })
|
||||
}
|
||||
|
||||
// 资质分类编辑
|
||||
export function certificationEdit(params: Record<string, any>) {
|
||||
return request.post({ url: '/certificationCate/edit', params })
|
||||
}
|
||||
|
||||
// 资质分类删除
|
||||
export function certificationDelete(params: Record<string, any>) {
|
||||
return request.post({ url: '/certificationCate/del', params })
|
||||
}
|
||||
|
||||
export function listAll() {
|
||||
return request.get({ url: '/certificationCate/all' })
|
||||
}
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="600px"
|
||||
:clickModalClose="true"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
||||
|
||||
<el-form-item label="分类" prop="cid">
|
||||
<el-select
|
||||
v-model="formData.cid"
|
||||
placeholder="请选择新闻分类"
|
||||
class="flex-1"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in cateOptions" :label="item.name" :value="item.id" :key="item.id"
|
||||
>
|
||||
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input v-model="formData.title" placeholder="请输入标题"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="案例图片" prop="img">
|
||||
<material-picker size="300px" v-model="formData.img"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否显示" prop="isShow">
|
||||
<el-radio-group class="flex-1" v-model="formData.isShow" placeholder="请选择是否显示">
|
||||
<el-radio :label="1">显示</el-radio>
|
||||
<el-radio :label="0">不显示</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
<div>
|
||||
<el-input-number v-model="formData.sort" :max="9999"/>
|
||||
<div class="form-tips">数值越大越排前</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import type {FormInstance} from 'element-plus'
|
||||
import {certificationEdit, certificationAdd, certificationDetail} from '@/api/certification'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
import type {PropType} from 'vue'
|
||||
import {listAll} from "@/api/certificationcate";
|
||||
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
const cateOptions = ref<any[]>([])
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == 'edit' ? '编辑资质信息' : '新增资质信息'
|
||||
})
|
||||
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
title: '',
|
||||
img: '',
|
||||
sort: '',
|
||||
isShow: '',
|
||||
cid: '',
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
id: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入主键',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
title: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入标题',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
img: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入图片',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
sort: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入排序',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
isShow: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择是否展示0:否,1:是',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
cid: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入分类id',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
const data: any = {...formData}
|
||||
mode.value == 'edit' ? await certificationEdit(data) : await certificationAdd(data)
|
||||
popupRef.value?.close()
|
||||
feedback.msgSuccess('操作成功')
|
||||
emit('success')
|
||||
}
|
||||
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
const setFormData = async (data: Record<string, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await certificationDetail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
const getCateList = async () => {
|
||||
const res: any = await listAll()
|
||||
cateOptions.value = res || []
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
|
||||
getCateList()
|
||||
</script>
|
||||
|
|
@ -0,0 +1,166 @@
|
|||
<template>
|
||||
<div class="index-lists">
|
||||
<el-card class="!border-none" shadow="never">
|
||||
<el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true">
|
||||
<el-form-item label="标题" prop="title">
|
||||
<el-input class="w-[280px]" v-model="queryParams.title" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否展示" prop="isShow">
|
||||
<el-select
|
||||
v-model="queryParams.isShow"
|
||||
class="w-[280px]"
|
||||
clearable
|
||||
>
|
||||
<el-option label="全部" value="" />
|
||||
<el-option
|
||||
v-for="(item, index) in dictData.Integer"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类" prop="cid">
|
||||
<el-select
|
||||
v-model="queryParams.cid"
|
||||
class="flex-1"
|
||||
clearable
|
||||
placeholder="请选择新闻分类"
|
||||
>
|
||||
<el-option v-for="item in cateOptions" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none mt-4" shadow="never">
|
||||
<div>
|
||||
<el-button v-perms="['certification:add']" type="primary" @click="handleAdd()">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
class="mt-4"
|
||||
size="large"
|
||||
v-loading="pager.loading"
|
||||
:data="pager.lists"
|
||||
>
|
||||
<el-table-column label="创建时间" prop="createTime" min-width="100" />
|
||||
<el-table-column label="更新时间" prop="updateTime" min-width="100" />
|
||||
<el-table-column label="标题" prop="title" min-width="100" />
|
||||
<el-table-column label="图片" prop="img" min-width="100" >
|
||||
<template #default="{ row }">
|
||||
<image-contain
|
||||
:width="100"
|
||||
:height="60"
|
||||
:src="row.img"
|
||||
:preview-src-list="[row.img]"
|
||||
preview-teleported
|
||||
hide-on-click-modal
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序" prop="sort" min-width="100" />
|
||||
<el-table-column label="是否展示" prop="isShow" min-width="100">
|
||||
<template #default="{ row }">
|
||||
<dict-value :options="dictData.Integer" :value="row.isShow" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类" prop="cname" min-width="100" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-perms="['certification:edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['certification:del']"
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex justify-end mt-4">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup
|
||||
v-if="showEdit"
|
||||
ref="editRef"
|
||||
:dict-data="dictData"
|
||||
@success="getLists"
|
||||
@close="showEdit = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="certification">
|
||||
import { certificationDelete, certificationLists } from '@/api/certification'
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
import {listAll} from "@/api/certificationcate";
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
const showEdit = ref(false)
|
||||
const queryParams = reactive({
|
||||
title: '',
|
||||
img: '',
|
||||
sort: '',
|
||||
isShow: '',
|
||||
cid: '',
|
||||
|
||||
})
|
||||
|
||||
const cateOptions = ref<any[]>([])
|
||||
const { pager, getLists, resetPage, resetParams } = usePaging({
|
||||
fetchFun: certificationLists,
|
||||
params: queryParams
|
||||
})
|
||||
|
||||
const { dictData } = useDictData<{
|
||||
Integer: any[]
|
||||
}>(['Integer'])
|
||||
|
||||
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('add')
|
||||
}
|
||||
|
||||
const handleEdit = async (data: any) => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('edit')
|
||||
editRef.value?.getDetail(data)
|
||||
}
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await certificationDelete({ id })
|
||||
feedback.msgSuccess('删除成功')
|
||||
getLists()
|
||||
}
|
||||
|
||||
const getCateList = async () => {
|
||||
const res: any = await listAll()
|
||||
cateOptions.value = res || []
|
||||
}
|
||||
|
||||
getCateList()
|
||||
getLists()
|
||||
</script>
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="550px"
|
||||
:clickModalClose="true"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
||||
<el-form-item label="分类名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入分类名称" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import { certificationEdit, certificationAdd, certificationDetail } from '@/api/certificationcate'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == 'edit' ? '编辑资质分类' : '新增资质分类'
|
||||
})
|
||||
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
id: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入主键',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入分类名称',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
const data: any = { ...formData }
|
||||
mode.value == 'edit' ? await certificationEdit(data) : await certificationAdd(data)
|
||||
popupRef.value?.close()
|
||||
feedback.msgSuccess('操作成功')
|
||||
emit('success')
|
||||
}
|
||||
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
const setFormData = async (data: Record<string, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await certificationDetail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
<template>
|
||||
<div class="index-lists">
|
||||
<el-card class="!border-none" shadow="never">
|
||||
<el-form ref="formRef" class="mb-[-16px]" :model="queryParams" :inline="true">
|
||||
<el-form-item label="分类名称" prop="name">
|
||||
<el-input class="w-[280px]" v-model="queryParams.name" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none mt-4" shadow="never">
|
||||
<div>
|
||||
<el-button v-perms="['certification:add']" type="primary" @click="handleAdd()">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
class="mt-4"
|
||||
size="large"
|
||||
v-loading="pager.loading"
|
||||
:data="pager.lists"
|
||||
>
|
||||
<el-table-column label="分类名称" prop="name" min-width="100" />
|
||||
<el-table-column label="创建时间" prop="createTime" min-width="100" />
|
||||
<el-table-column label="更新时间" prop="updateTime" min-width="100" />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
v-perms="['certification:edit']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['certification:del']"
|
||||
type="danger"
|
||||
link
|
||||
@click="handleDelete(row.id)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex justify-end mt-4">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup
|
||||
v-if="showEdit"
|
||||
ref="editRef"
|
||||
@success="getLists"
|
||||
@close="showEdit = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup name="certification">
|
||||
import { certificationDelete, certificationLists } from '@/api/certificationcate'
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
const showEdit = ref(false)
|
||||
const queryParams = reactive({
|
||||
name: '',
|
||||
})
|
||||
|
||||
const { pager, getLists, resetPage, resetParams } = usePaging({
|
||||
fetchFun: certificationLists,
|
||||
params: queryParams
|
||||
})
|
||||
|
||||
|
||||
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('add')
|
||||
}
|
||||
|
||||
const handleEdit = async (data: any) => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('edit')
|
||||
editRef.value?.getDetail(data)
|
||||
}
|
||||
|
||||
const handleDelete = async (id: number) => {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await certificationDelete({ id })
|
||||
feedback.msgSuccess('删除成功')
|
||||
getLists()
|
||||
}
|
||||
|
||||
getLists()
|
||||
</script>
|
||||
Loading…
Reference in New Issue