Jinyuanyuan
5 months ago
8 changed files with 314 additions and 0 deletions
@ -0,0 +1,97 @@ |
|||
package com.easy.admin.modules.huzhou.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.easy.admin.common.api.vo.Result; |
|||
import com.easy.admin.common.core.exception.EasyException; |
|||
import com.easy.admin.modules.huzhou.entity.HuzhouPeriodicallab; |
|||
import com.easy.admin.modules.huzhou.entity.HuzhouPeriodicallabCount; |
|||
import com.easy.admin.modules.huzhou.service.IHuzhouPeriodicallabCountService; |
|||
import com.easy.admin.modules.huzhou.service.IHuzhouPeriodicallabService; |
|||
import com.easy.admin.modules.huzhou.vo.PeriodicallabCountOV; |
|||
import com.easy.admin.modules.huzhou.vo.PeriodicallabCountPage; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.IOException; |
|||
|
|||
@RestController |
|||
@RequestMapping("/huzhouPeriodicallabCount") |
|||
public class HuzhouPeriodicallabCountController { |
|||
@Autowired |
|||
private IHuzhouPeriodicallabCountService periodicallabCountService; |
|||
|
|||
/** |
|||
* 查询月度期刊分页 |
|||
* @param periodicallabCount 条件 |
|||
* @param pageNo 分页 |
|||
* @param pageSize 页码 |
|||
* @return |
|||
*/ |
|||
@GetMapping("/periodicallabCountPageList") |
|||
public Result<?> periodicallabCountPageList(HuzhouPeriodicallabCount periodicallabCount, |
|||
@RequestParam(name="current", defaultValue="1") Integer pageNo, |
|||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize){ |
|||
|
|||
Page<PeriodicallabCountOV> pageList = periodicallabCountService.getPeriodicallabCountPageList(periodicallabCount, pageNo, pageSize); |
|||
return Result.ok(pageList); |
|||
} |
|||
|
|||
/** |
|||
* 根据id获取详情月度期刊 |
|||
* @param id |
|||
* @return |
|||
*/ |
|||
@GetMapping("/getperiodicallabById") |
|||
public Result<?> getperiodicallabCountById(String id){ |
|||
HuzhouPeriodicallabCount byId = periodicallabCountService.getById(id); |
|||
return Result.ok(byId); |
|||
} |
|||
|
|||
/** |
|||
* 添加月度期刊 |
|||
* @param file |
|||
* @param periodicallab |
|||
* @return |
|||
* @throws IOException |
|||
*/ |
|||
@PostMapping("/addPeriodicallabCount") |
|||
public Result<?> addPeriodicallabCount(HuzhouPeriodicallabCount periodicallabCount){ |
|||
periodicallabCountService.addPeriodicallabCount(periodicallabCount); |
|||
return Result.ok("新增成功"); |
|||
} |
|||
|
|||
/** |
|||
* 修改阅读期刊 |
|||
* @param file |
|||
* @param periodicallab |
|||
* @return |
|||
* @throws IOException |
|||
*/ |
|||
@PostMapping("/modifyPeriodicallabCount") |
|||
public Result<?> modifyPeriodicallabCount(HuzhouPeriodicallabCount periodicallabCount){ |
|||
Boolean aBoolean = periodicallabCountService.modifyPeriodicallabCount(periodicallabCount); |
|||
if(aBoolean){ |
|||
return Result.ok("修改成功"); |
|||
} |
|||
throw new EasyException("修改失败"); |
|||
} |
|||
|
|||
/** |
|||
* 删除阅读期刊 |
|||
* @param periodicallab |
|||
* @return |
|||
* @throws IOException |
|||
*/ |
|||
@PostMapping("/deletePeriodicallabCount") |
|||
public Result<?> deletePeriodicallabCount(@RequestBody HuzhouPeriodicallabCount periodicallabCount){ |
|||
Boolean aBoolean = periodicallabCountService.deletePeriodicallabCount(periodicallabCount); |
|||
if(aBoolean){ |
|||
return Result.ok("删除成功"); |
|||
} |
|||
throw new EasyException("删除失败"); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,14 @@ |
|||
package com.easy.admin.modules.huzhou.dao; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.easy.admin.modules.huzhou.entity.HuzhouPeriodicallab; |
|||
import com.easy.admin.modules.huzhou.entity.HuzhouPeriodicallabCount; |
|||
import com.easy.admin.modules.huzhou.vo.PeriodicallabCountPage; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface HuzhouPeriodicallabCountMapper extends BaseMapper<HuzhouPeriodicallabCount> { |
|||
|
|||
|
|||
} |
@ -0,0 +1,41 @@ |
|||
package com.easy.admin.modules.huzhou.entity; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import io.swagger.v3.oas.models.security.SecurityScheme; |
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import lombok.experimental.Accessors; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* (HuzhouPeriodicallab)实体类 |
|||
* |
|||
* @author makejava |
|||
* @since 2024-02-29 11:03:40 |
|||
*/ |
|||
@Data |
|||
@Accessors(chain = true) |
|||
@Builder(toBuilder = true) |
|||
public class HuzhouPeriodicallabCount extends BaseEntity implements Serializable { |
|||
private static final long serialVersionUID = -50005828024123796L; |
|||
|
|||
/** |
|||
|
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
private String workplace; |
|||
|
|||
private String adminDivision; |
|||
|
|||
private Integer countNumber; |
|||
|
|||
private Integer editNumber; |
|||
|
|||
|
|||
} |
|||
|
@ -0,0 +1,24 @@ |
|||
package com.easy.admin.modules.huzhou.service; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import com.easy.admin.modules.huzhou.entity.HuzhouPeriodicallab; |
|||
import com.easy.admin.modules.huzhou.entity.HuzhouPeriodicallabCount; |
|||
import com.easy.admin.modules.huzhou.vo.PeriodicallabCountOV; |
|||
import com.easy.admin.modules.huzhou.vo.PeriodicallabCountPage; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.IOException; |
|||
|
|||
public interface IHuzhouPeriodicallabCountService extends IService<HuzhouPeriodicallabCount> { |
|||
Page<PeriodicallabCountOV> getPeriodicallabCountPageList(HuzhouPeriodicallabCount periodicallabCount, Integer pageNo, |
|||
Integer pageSize); |
|||
Boolean addPeriodicallabCount(HuzhouPeriodicallabCount periodicallabCount); |
|||
Boolean modifyPeriodicallabCount(HuzhouPeriodicallabCount periodicallabCount); |
|||
|
|||
Boolean deletePeriodicallabCount(HuzhouPeriodicallabCount periodicallabCount); |
|||
|
|||
String findId(String workplace); |
|||
} |
@ -0,0 +1,95 @@ |
|||
package com.easy.admin.modules.huzhou.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.easy.admin.auth.model.SysUser; |
|||
import com.easy.admin.common.util.CommonUtils; |
|||
import com.easy.admin.modules.huzhou.dao.HuzhouPeriodicallabCountMapper; |
|||
import com.easy.admin.modules.huzhou.dao.HuzhouPeriodicallabMapper; |
|||
import com.easy.admin.modules.huzhou.entity.HuzhouPeriodicallab; |
|||
import com.easy.admin.modules.huzhou.entity.HuzhouPeriodicallabCount; |
|||
import com.easy.admin.modules.huzhou.service.IHuzhouPeriodicallabCountService; |
|||
import com.easy.admin.modules.huzhou.service.IHuzhouPeriodicallabService; |
|||
import com.easy.admin.modules.huzhou.vo.PeriodicallabCountOV; |
|||
import com.easy.admin.modules.huzhou.vo.PeriodicallabCountPage; |
|||
import com.easy.admin.util.ShiroUtil; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.util.FileCopyUtils; |
|||
import org.springframework.web.multipart.MultipartFile; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import java.io.File; |
|||
import java.io.FileInputStream; |
|||
import java.io.IOException; |
|||
import java.text.SimpleDateFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
import java.util.zip.ZipEntry; |
|||
import java.util.zip.ZipOutputStream; |
|||
|
|||
@Service |
|||
public class HuzhouPeriodicallabCountServiceImpl extends ServiceImpl<HuzhouPeriodicallabCountMapper, HuzhouPeriodicallabCount> implements IHuzhouPeriodicallabCountService { |
|||
|
|||
@Autowired |
|||
HuzhouPeriodicallabCountMapper periodicallabCountMapper; |
|||
@Override |
|||
public Page<PeriodicallabCountOV> getPeriodicallabCountPageList(HuzhouPeriodicallabCount periodicallabCount, Integer pageNo, Integer pageSize) { |
|||
LambdaQueryWrapper<HuzhouPeriodicallabCount> queryWrapper = new LambdaQueryWrapper<>(); |
|||
Page<HuzhouPeriodicallabCount> page = new Page<>(pageNo, pageSize); |
|||
String workplace = periodicallabCount.getWorkplace(); |
|||
String adminDivision = periodicallabCount.getAdminDivision(); |
|||
|
|||
queryWrapper.like(StringUtils.isNotBlank(workplace),HuzhouPeriodicallabCount::getWorkplace,workplace); |
|||
queryWrapper.eq(StringUtils.isNotBlank(adminDivision),HuzhouPeriodicallabCount::getAdminDivision,adminDivision); |
|||
|
|||
Page<HuzhouPeriodicallabCount> periodicallabCountPage = this.page(page, queryWrapper); |
|||
List<HuzhouPeriodicallabCount> records = periodicallabCountPage.getRecords(); |
|||
List<PeriodicallabCountOV> newRecords=new ArrayList<>(); |
|||
for(HuzhouPeriodicallabCount r:records){ |
|||
PeriodicallabCountOV ov = new PeriodicallabCountOV(); |
|||
BeanUtils.copyProperties(r,ov); |
|||
if(r.getEditNumber() == null){ |
|||
ov.setShowNumber(r.getCountNumber()); |
|||
}else { |
|||
ov.setShowNumber(r.getEditNumber()); |
|||
} |
|||
newRecords.add(ov); |
|||
} |
|||
Page<PeriodicallabCountOV> result=new Page<>(); |
|||
result.setRecords(newRecords).setTotal(periodicallabCountPage.getTotal()).setCurrent(periodicallabCountPage.getCurrent()).setSize(periodicallabCountPage.getSize()); |
|||
|
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
public Boolean addPeriodicallabCount(HuzhouPeriodicallabCount periodicallabCount) { |
|||
return this.save(periodicallabCount); |
|||
} |
|||
|
|||
@Override |
|||
public Boolean modifyPeriodicallabCount(HuzhouPeriodicallabCount periodicallabCount) { |
|||
return this.updateById(periodicallabCount); |
|||
} |
|||
|
|||
@Override |
|||
public Boolean deletePeriodicallabCount(HuzhouPeriodicallabCount periodicallabCount) { |
|||
String id=periodicallabCount.getId(); |
|||
return this.removeById(id); |
|||
} |
|||
|
|||
@Override |
|||
public String findId(String workplace) { |
|||
LambdaQueryWrapper<HuzhouPeriodicallabCount> query = new LambdaQueryWrapper<>(); |
|||
query.eq(StringUtils.isNotBlank(workplace),HuzhouPeriodicallabCount::getWorkplace,workplace); |
|||
List<?> result = periodicallabCountMapper.selectObjs(query); |
|||
return result == null || result.isEmpty() ? null : (String) result.get(0); |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.easy.admin.modules.huzhou.vo; |
|||
|
|||
|
|||
import lombok.Builder; |
|||
import lombok.Data; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
@Data |
|||
public class PeriodicallabCountOV { |
|||
/** |
|||
|
|||
* id |
|||
*/ |
|||
private String id; |
|||
|
|||
private String workplace; |
|||
|
|||
private String adminDivision; |
|||
|
|||
private Integer countNumber; |
|||
|
|||
private Integer editNumber; |
|||
|
|||
private Integer showNumber; |
|||
} |
Loading…
Reference in new issue