mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
feat: 增加网站管理接口
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
package cn.lihongjie.coal.website.controller;
|
||||
|
||||
import cn.lihongjie.coal.annotation.OrgScope;
|
||||
import cn.lihongjie.coal.annotation.SysLog;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.website.dto.CreateWebsiteDto;
|
||||
import cn.lihongjie.coal.website.dto.UpdateWebsiteDto;
|
||||
import cn.lihongjie.coal.website.dto.WebsiteDto;
|
||||
import cn.lihongjie.coal.website.service.WebsiteService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/website")
|
||||
@SysLog(module = "网站")
|
||||
@Slf4j
|
||||
@OrgScope
|
||||
public class WebsiteController {
|
||||
@Autowired private WebsiteService service;
|
||||
|
||||
@PostMapping("/create")
|
||||
public WebsiteDto create(@RequestBody CreateWebsiteDto request) {
|
||||
return this.service.create(request);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public WebsiteDto update(@RequestBody UpdateWebsiteDto request) {
|
||||
return this.service.update(request);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody IdRequest request) {
|
||||
this.service.delete(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
@PostMapping("/getById")
|
||||
public WebsiteDto getById(@RequestBody IdRequest request) {
|
||||
return this.service.getById(request.getId());
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public Page<WebsiteDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request);
|
||||
}
|
||||
|
||||
@PostMapping("/archive")
|
||||
public Object archive(@RequestBody IdRequest request) {
|
||||
this.service.archive(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
@PostMapping("/unarchive")
|
||||
public Object unarchive(@RequestBody IdRequest request) {
|
||||
this.service.unarchive(request);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package cn.lihongjie.coal.website.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CreateWebsiteDto extends OrgCommonDto {
|
||||
private String url;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.lihongjie.coal.website.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdateWebsiteDto extends OrgCommonDto {
|
||||
|
||||
private String url;
|
||||
}
|
||||
17
src/main/java/cn/lihongjie/coal/website/dto/WebsiteDto.java
Normal file
17
src/main/java/cn/lihongjie/coal/website/dto/WebsiteDto.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package cn.lihongjie.coal.website.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import cn.lihongjie.coal.common.DictCode;
|
||||
import cn.lihongjie.coal.pojoProcessor.DictTranslate;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WebsiteDto extends OrgCommonDto {
|
||||
private String archiveStatus;
|
||||
|
||||
@DictTranslate(dictKey = DictCode.ARCHIVESTATUS)
|
||||
private String archiveStatusName;
|
||||
|
||||
private String url;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.lihongjie.coal.website.entity;
|
||||
|
||||
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(
|
||||
indexes =
|
||||
@jakarta.persistence.Index(
|
||||
name = "idx_website_org_id",
|
||||
columnList = "organization_id"))
|
||||
public class WebsiteEntity extends OrgCommonEntity {
|
||||
@Comment("归档状态")
|
||||
@ColumnDefault("'0'")
|
||||
private String archiveStatus = "0";
|
||||
|
||||
|
||||
private String url;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.lihongjie.coal.website.mapper;
|
||||
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonEntityMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||
import cn.lihongjie.coal.website.dto.CreateWebsiteDto;
|
||||
import cn.lihongjie.coal.website.dto.UpdateWebsiteDto;
|
||||
import cn.lihongjie.coal.website.dto.WebsiteDto;
|
||||
import cn.lihongjie.coal.website.entity.WebsiteEntity;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
|
||||
@Mapper(
|
||||
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||
uses = {CommonMapper.class, CommonEntityMapper.class},
|
||||
mappingControl = DeepClone.class)
|
||||
public interface WebsiteMapper
|
||||
extends BaseMapper<WebsiteEntity, WebsiteDto, CreateWebsiteDto, UpdateWebsiteDto> {}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.lihongjie.coal.website.repository;
|
||||
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
import cn.lihongjie.coal.website.entity.WebsiteEntity;
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface WebsiteRepository extends BaseRepository<WebsiteEntity> {
|
||||
@Query("select false")
|
||||
boolean isLinked(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package cn.lihongjie.coal.website.service;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
import cn.lihongjie.coal.dbFunctions.DbFunctionService;
|
||||
import cn.lihongjie.coal.exception.BizException;
|
||||
import cn.lihongjie.coal.website.dto.CreateWebsiteDto;
|
||||
import cn.lihongjie.coal.website.dto.UpdateWebsiteDto;
|
||||
import cn.lihongjie.coal.website.dto.WebsiteDto;
|
||||
import cn.lihongjie.coal.website.entity.WebsiteEntity;
|
||||
import cn.lihongjie.coal.website.mapper.WebsiteMapper;
|
||||
import cn.lihongjie.coal.website.repository.WebsiteRepository;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional
|
||||
public class WebsiteService extends BaseService<WebsiteEntity, WebsiteRepository> {
|
||||
@Autowired private WebsiteRepository repository;
|
||||
|
||||
@Autowired private WebsiteMapper mapper;
|
||||
|
||||
@Autowired private ConversionService conversionService;
|
||||
|
||||
@Autowired private DbFunctionService dbFunctionService;
|
||||
|
||||
public WebsiteDto create(CreateWebsiteDto request) {
|
||||
WebsiteEntity entity = mapper.toEntity(request);
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public WebsiteDto update(UpdateWebsiteDto request) {
|
||||
WebsiteEntity entity = this.repository.get(request.getId());
|
||||
if (this.repository.containArchived(request.getId())) {
|
||||
throw new BizException("部分数据已归档,无法编辑或删除");
|
||||
}
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
if (this.repository.containArchived(request)) {
|
||||
throw new BizException("部分数据已归档,无法编辑或删除");
|
||||
}
|
||||
boolean linked = this.repository.isLinked(request.getIds());
|
||||
|
||||
if (linked) {
|
||||
throw new BizException("数据已被关联,无法删除");
|
||||
}
|
||||
this.repository.deleteAllById(request.getIds());
|
||||
}
|
||||
|
||||
public WebsiteDto getById(String id) {
|
||||
WebsiteEntity entity = repository.get(id);
|
||||
|
||||
return mapper.toDto(entity);
|
||||
}
|
||||
|
||||
public Page<WebsiteDto> list(CommonQuery query) {
|
||||
Page<WebsiteEntity> page =
|
||||
repository.findAll(
|
||||
query.specification(conversionService),
|
||||
PageRequest.of(
|
||||
query.getPageNo(),
|
||||
query.getPageSize(),
|
||||
Sort.by(query.getOrders())));
|
||||
|
||||
return page.map(this.mapper::toDto);
|
||||
}
|
||||
|
||||
public void archive(IdRequest dto) {
|
||||
this.repository.archive(dto);
|
||||
}
|
||||
|
||||
public void unarchive(IdRequest dto) {
|
||||
this.repository.unArchive(dto);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package cn.lihongjie.coal.websiteAccount.controller;
|
||||
|
||||
import cn.lihongjie.coal.annotation.OrgScope;
|
||||
import cn.lihongjie.coal.annotation.SysLog;
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.websiteAccount.dto.CreateWebsiteAccountDto;
|
||||
import cn.lihongjie.coal.websiteAccount.dto.UpdateWebsiteAccountDto;
|
||||
import cn.lihongjie.coal.websiteAccount.dto.WebsiteAccountDto;
|
||||
import cn.lihongjie.coal.websiteAccount.service.WebsiteAccountService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/websiteAccount")
|
||||
@SysLog(module = "网站用户")
|
||||
@Slf4j
|
||||
@OrgScope
|
||||
public class WebsiteAccountController {
|
||||
@Autowired private WebsiteAccountService service;
|
||||
|
||||
@PostMapping("/create")
|
||||
public WebsiteAccountDto create(@RequestBody CreateWebsiteAccountDto request) {
|
||||
return this.service.create(request);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public WebsiteAccountDto update(@RequestBody UpdateWebsiteAccountDto request) {
|
||||
return this.service.update(request);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public Object delete(@RequestBody IdRequest request) {
|
||||
this.service.delete(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
@PostMapping("/getById")
|
||||
public WebsiteAccountDto getById(@RequestBody IdRequest request) {
|
||||
return this.service.getById(request.getId());
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
public Page<WebsiteAccountDto> list(@RequestBody CommonQuery request) {
|
||||
return this.service.list(request);
|
||||
}
|
||||
|
||||
@PostMapping("/archive")
|
||||
public Object archive(@RequestBody IdRequest request) {
|
||||
this.service.archive(request);
|
||||
return true;
|
||||
}
|
||||
|
||||
@PostMapping("/unarchive")
|
||||
public Object unarchive(@RequestBody IdRequest request) {
|
||||
this.service.unarchive(request);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.lihongjie.coal.websiteAccount.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CreateWebsiteAccountDto extends OrgCommonDto {
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.lihongjie.coal.websiteAccount.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdateWebsiteAccountDto extends OrgCommonDto {
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.lihongjie.coal.websiteAccount.dto;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.OrgCommonDto;
|
||||
import cn.lihongjie.coal.common.DictCode;
|
||||
import cn.lihongjie.coal.pojoProcessor.DictTranslate;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WebsiteAccountDto extends OrgCommonDto {
|
||||
private String archiveStatus;
|
||||
|
||||
@DictTranslate(dictKey = DictCode.ARCHIVESTATUS)
|
||||
private String archiveStatusName;
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.lihongjie.coal.websiteAccount.entity;
|
||||
|
||||
import cn.lihongjie.coal.base.entity.OrgCommonEntity;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(
|
||||
indexes =
|
||||
@jakarta.persistence.Index(
|
||||
name = "idx_websiteAccount_org_id",
|
||||
columnList = "organization_id"))
|
||||
public class WebsiteAccountEntity extends OrgCommonEntity {
|
||||
@Comment("归档状态")
|
||||
@ColumnDefault("'0'")
|
||||
private String archiveStatus = "0";
|
||||
|
||||
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.lihongjie.coal.websiteAccount.mapper;
|
||||
|
||||
import cn.lihongjie.coal.base.mapper.BaseMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonEntityMapper;
|
||||
import cn.lihongjie.coal.base.mapper.CommonMapper;
|
||||
import cn.lihongjie.coal.websiteAccount.dto.CreateWebsiteAccountDto;
|
||||
import cn.lihongjie.coal.websiteAccount.dto.UpdateWebsiteAccountDto;
|
||||
import cn.lihongjie.coal.websiteAccount.dto.WebsiteAccountDto;
|
||||
import cn.lihongjie.coal.websiteAccount.entity.WebsiteAccountEntity;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.control.DeepClone;
|
||||
|
||||
@Mapper(
|
||||
componentModel = org.mapstruct.MappingConstants.ComponentModel.SPRING,
|
||||
uses = {CommonMapper.class, CommonEntityMapper.class},
|
||||
mappingControl = DeepClone.class)
|
||||
public interface WebsiteAccountMapper
|
||||
extends BaseMapper<
|
||||
WebsiteAccountEntity,
|
||||
WebsiteAccountDto,
|
||||
CreateWebsiteAccountDto,
|
||||
UpdateWebsiteAccountDto> {}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.lihongjie.coal.websiteAccount.repository;
|
||||
|
||||
import cn.lihongjie.coal.base.dao.BaseRepository;
|
||||
import cn.lihongjie.coal.websiteAccount.entity.WebsiteAccountEntity;
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface WebsiteAccountRepository extends BaseRepository<WebsiteAccountEntity> {
|
||||
@Query("select false")
|
||||
boolean isLinked(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package cn.lihongjie.coal.websiteAccount.service;
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery;
|
||||
import cn.lihongjie.coal.base.dto.IdRequest;
|
||||
import cn.lihongjie.coal.base.service.BaseService;
|
||||
import cn.lihongjie.coal.dbFunctions.DbFunctionService;
|
||||
import cn.lihongjie.coal.exception.BizException;
|
||||
import cn.lihongjie.coal.websiteAccount.dto.CreateWebsiteAccountDto;
|
||||
import cn.lihongjie.coal.websiteAccount.dto.UpdateWebsiteAccountDto;
|
||||
import cn.lihongjie.coal.websiteAccount.dto.WebsiteAccountDto;
|
||||
import cn.lihongjie.coal.websiteAccount.entity.WebsiteAccountEntity;
|
||||
import cn.lihongjie.coal.websiteAccount.mapper.WebsiteAccountMapper;
|
||||
import cn.lihongjie.coal.websiteAccount.repository.WebsiteAccountRepository;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.convert.ConversionService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional
|
||||
public class WebsiteAccountService
|
||||
extends BaseService<WebsiteAccountEntity, WebsiteAccountRepository> {
|
||||
@Autowired private WebsiteAccountRepository repository;
|
||||
|
||||
@Autowired private WebsiteAccountMapper mapper;
|
||||
|
||||
@Autowired private ConversionService conversionService;
|
||||
|
||||
@Autowired private DbFunctionService dbFunctionService;
|
||||
|
||||
public WebsiteAccountDto create(CreateWebsiteAccountDto request) {
|
||||
WebsiteAccountEntity entity = mapper.toEntity(request);
|
||||
|
||||
this.repository.save(entity);
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public WebsiteAccountDto update(UpdateWebsiteAccountDto request) {
|
||||
WebsiteAccountEntity entity = this.repository.get(request.getId());
|
||||
if (this.repository.containArchived(request.getId())) {
|
||||
throw new BizException("部分数据已归档,无法编辑或删除");
|
||||
}
|
||||
this.mapper.updateEntity(entity, request);
|
||||
|
||||
this.repository.save(entity);
|
||||
|
||||
return getById(entity.getId());
|
||||
}
|
||||
|
||||
public void delete(IdRequest request) {
|
||||
if (this.repository.containArchived(request)) {
|
||||
throw new BizException("部分数据已归档,无法编辑或删除");
|
||||
}
|
||||
boolean linked = this.repository.isLinked(request.getIds());
|
||||
|
||||
if (linked) {
|
||||
throw new BizException("数据已被关联,无法删除");
|
||||
}
|
||||
this.repository.deleteAllById(request.getIds());
|
||||
}
|
||||
|
||||
public WebsiteAccountDto getById(String id) {
|
||||
WebsiteAccountEntity entity = repository.get(id);
|
||||
|
||||
return mapper.toDto(entity);
|
||||
}
|
||||
|
||||
public Page<WebsiteAccountDto> list(CommonQuery query) {
|
||||
Page<WebsiteAccountEntity> page =
|
||||
repository.findAll(
|
||||
query.specification(conversionService),
|
||||
PageRequest.of(
|
||||
query.getPageNo(),
|
||||
query.getPageSize(),
|
||||
Sort.by(query.getOrders())));
|
||||
|
||||
return page.map(this.mapper::toDto);
|
||||
}
|
||||
|
||||
public void archive(IdRequest dto) {
|
||||
this.repository.archive(dto);
|
||||
}
|
||||
|
||||
public void unarchive(IdRequest dto) {
|
||||
this.repository.unArchive(dto);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
|
||||
package scripts.dict
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery
|
||||
import cn.lihongjie.coal.websiteAccount.controller.WebsiteAccountController
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import org.springframework.context.ApplicationContext
|
||||
|
||||
ApplicationContext ioc = ioc
|
||||
|
||||
def controller = ioc.getBean(WebsiteAccountController.class)
|
||||
def objectMapper = ioc.getBean(ObjectMapper.class) as ObjectMapper
|
||||
|
||||
|
||||
|
||||
|
||||
return controller.list(params!=null ? objectMapper.convertValue(params, CommonQuery.class ) : new CommonQuery())
|
||||
|
||||
|
||||
19
src/main/resources/scripts/dict/enum/websiteDict.groovy
Normal file
19
src/main/resources/scripts/dict/enum/websiteDict.groovy
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
package scripts.dict
|
||||
|
||||
import cn.lihongjie.coal.base.dto.CommonQuery
|
||||
import cn.lihongjie.coal.website.controller.WebsiteController
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import org.springframework.context.ApplicationContext
|
||||
|
||||
ApplicationContext ioc = ioc
|
||||
|
||||
def controller = ioc.getBean(WebsiteController.class)
|
||||
def objectMapper = ioc.getBean(ObjectMapper.class) as ObjectMapper
|
||||
|
||||
|
||||
|
||||
|
||||
return controller.list(params!=null ? objectMapper.convertValue(params, CommonQuery.class ) : new CommonQuery())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user