diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/controller/AnnualCompGroupController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/controller/AnnualCompGroupController.java new file mode 100644 index 00000000..a3242bb1 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/controller/AnnualCompGroupController.java @@ -0,0 +1,217 @@ +package org.jeecg.modules.demo.annualcompgroup.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.annualcompgroup.entity.AnnualCompGroup; +import org.jeecg.modules.demo.annualcompgroup.service.IAnnualCompGroupService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecg.modules.demo.comp.entity.Comp; +import org.jeecg.modules.demo.comp.service.ICompService; +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.apache.shiro.authz.annotation.RequiresPermissions; + + /** + * @Description: 年度比赛项目专家小组 + * @Author: jeecg-boot + * @Date: 2023-10-13 + * @Version: V1.0 + */ +@Api(tags="年度比赛项目专家小组") +@RestController +@RequestMapping("/annualcompgroup/annualCompGroup") +@Slf4j +public class AnnualCompGroupController extends JeecgController { + @Autowired + private IAnnualCompGroupService annualCompGroupService; + + @Autowired + private ICompService compService; + + + /** + * 分页列表查询 + * + * @param annualCompGroup + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "年度比赛项目专家小组-分页列表查询") + @ApiOperation(value="年度比赛项目专家小组-分页列表查询", notes="年度比赛项目专家小组-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(AnnualCompGroup annualCompGroup, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(annualCompGroup, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = annualCompGroupService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param annualCompGroup + * @return + */ + @AutoLog(value = "年度比赛项目专家小组-添加") + @ApiOperation(value="年度比赛项目专家小组-添加", notes="年度比赛项目专家小组-添加") + //@RequiresPermissions("annualcompgroup:annual_comp_group:add") + @PostMapping(value = "/add") + public Result add(@RequestBody AnnualCompGroup annualCompGroup) { + annualCompGroupService.save(annualCompGroup); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param annualCompGroup + * @return + */ + @AutoLog(value = "年度比赛项目专家小组-编辑") + @ApiOperation(value="年度比赛项目专家小组-编辑", notes="年度比赛项目专家小组-编辑") + //@RequiresPermissions("annualcompgroup:annual_comp_group:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody AnnualCompGroup annualCompGroup) { + annualCompGroupService.updateById(annualCompGroup); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "年度比赛项目专家小组-通过id删除") + @ApiOperation(value="年度比赛项目专家小组-通过id删除", notes="年度比赛项目专家小组-通过id删除") + //@RequiresPermissions("annualcompgroup:annual_comp_group:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + annualCompGroupService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "年度比赛项目专家小组-批量删除") + @ApiOperation(value="年度比赛项目专家小组-批量删除", notes="年度比赛项目专家小组-批量删除") + //@RequiresPermissions("annualcompgroup:annual_comp_group:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.annualCompGroupService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 获取当前登录用户对应的比赛id + * + * @return + */ + @ApiOperation(value="获取当前登录用户对应的比赛id", notes="获取当前登录用户对应的比赛id") + @GetMapping(value = "/queryCompId") + public Result queryCompId(HttpServletRequest req) { + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + Comp comp = new Comp(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(comp, req.getParameterMap()); + queryWrapper.like("comp_admin",user.getId()); + List list = compService.list(queryWrapper); + String str = ""; + for(int i = 0 ; i < list.size() ; i++){ + if(list.size()==1){ + str = "compid='"+list.get(i).getId()+"'"; + }else{ + if(i==list.size()-1){ + str = str + "compid='"+list.get(i).getId()+"'"; + }else { + str = "compid='"+list.get(i).getId()+"' or "+str; + } + + } + + } + return Result.OK(str); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "年度比赛项目专家小组-通过id查询") + @ApiOperation(value="年度比赛项目专家小组-通过id查询", notes="年度比赛项目专家小组-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + AnnualCompGroup annualCompGroup = annualCompGroupService.getById(id); + if(annualCompGroup==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(annualCompGroup); + } + + /** + * 导出excel + * + * @param request + * @param annualCompGroup + */ + //@RequiresPermissions("annualcompgroup:annual_comp_group:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, AnnualCompGroup annualCompGroup) { + return super.exportXls(request, annualCompGroup, AnnualCompGroup.class, "年度比赛项目专家小组"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + //@RequiresPermissions("annualcompgroup:annual_comp_group:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, AnnualCompGroup.class); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/entity/AnnualCompGroup.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/entity/AnnualCompGroup.java new file mode 100644 index 00000000..cda82fda --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/entity/AnnualCompGroup.java @@ -0,0 +1,77 @@ +package org.jeecg.modules.demo.annualcompgroup.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.TableLogic; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 年度比赛项目专家小组 + * @Author: jeecg-boot + * @Date: 2023-10-13 + * @Version: V1.0 + */ +@Data +@TableName("annual_comp_group") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="annual_comp_group对象", description="年度比赛项目专家小组") +public class AnnualCompGroup implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private java.lang.String sysOrgCode; + /**年度*/ + @Excel(name = "年度", width = 15, dictTable = "annual", dicText = "annual_name", dicCode = "id") + @Dict(dictTable = "annual", dicText = "annual_name", dicCode = "id") + @ApiModelProperty(value = "年度") + private java.lang.String annal; + /**年度比赛项目*/ + @Excel(name = "年度比赛项目", width = 15, dictTable = "annual_comp_point", dicText = "obj_name", dicCode = "id") + @Dict(dictTable = "annual_comp_point", dicText = "obj_name", dicCode = "id") + @ApiModelProperty(value = "年度比赛项目") + private java.lang.String annCompP; + /**小组名称*/ + @Excel(name = "小组名称", width = 15) + @ApiModelProperty(value = "小组名称") + private java.lang.String name; + /**年度比赛*/ + @Excel(name = "年度比赛", width = 15, dictTable = "annual_comp", dicText = "name", dicCode = "id") + @Dict(dictTable = "annual_comp", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "年度比赛") + private java.lang.String annalComp; +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/mapper/AnnualCompGroupMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/mapper/AnnualCompGroupMapper.java new file mode 100644 index 00000000..f8d932cf --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/mapper/AnnualCompGroupMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.annualcompgroup.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.annualcompgroup.entity.AnnualCompGroup; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 年度比赛项目专家小组 + * @Author: jeecg-boot + * @Date: 2023-10-13 + * @Version: V1.0 + */ +public interface AnnualCompGroupMapper extends BaseMapper { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/mapper/xml/AnnualCompGroupMapper.xml b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/mapper/xml/AnnualCompGroupMapper.xml new file mode 100644 index 00000000..3bb8808a --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/mapper/xml/AnnualCompGroupMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/service/IAnnualCompGroupService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/service/IAnnualCompGroupService.java new file mode 100644 index 00000000..629affa0 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/service/IAnnualCompGroupService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.demo.annualcompgroup.service; + +import org.jeecg.modules.demo.annualcompgroup.entity.AnnualCompGroup; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 年度比赛项目专家小组 + * @Author: jeecg-boot + * @Date: 2023-10-13 + * @Version: V1.0 + */ +public interface IAnnualCompGroupService extends IService { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/service/impl/AnnualCompGroupServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/service/impl/AnnualCompGroupServiceImpl.java new file mode 100644 index 00000000..2169c45f --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/annualcompgroup/service/impl/AnnualCompGroupServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.demo.annualcompgroup.service.impl; + +import org.jeecg.modules.demo.annualcompgroup.entity.AnnualCompGroup; +import org.jeecg.modules.demo.annualcompgroup.mapper.AnnualCompGroupMapper; +import org.jeecg.modules.demo.annualcompgroup.service.IAnnualCompGroupService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 年度比赛项目专家小组 + * @Author: jeecg-boot + * @Date: 2023-10-13 + * @Version: V1.0 + */ +@Service +public class AnnualCompGroupServiceImpl extends ServiceImpl implements IAnnualCompGroupService { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/controller/ExpertController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/controller/ExpertController.java index 8704291a..1a6f900e 100644 --- a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/controller/ExpertController.java +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expert/controller/ExpertController.java @@ -18,6 +18,9 @@ import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.util.PasswordUtil; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.base.service.BaseCommonService; +import org.jeecg.modules.demo.annualcomp.entity.AnnualComp; +import org.jeecg.modules.demo.annualcomp.service.IAnnualCompService; +import org.jeecg.modules.demo.annualcompgroup.service.IAnnualCompGroupService; import org.jeecg.modules.demo.compexp.entity.CompExp; import org.jeecg.modules.demo.compexp.service.ICompExpService; import org.jeecg.modules.demo.expert.entity.Expert; @@ -28,6 +31,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.demo.expgroup.entity.ExpGroup; +import org.jeecg.modules.demo.expgroup.service.IExpGroupService; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.service.ISysUserService; import org.jeecgframework.poi.excel.ExcelImportUtil; @@ -70,6 +75,19 @@ public class ExpertController extends JeecgController { @Autowired private ISysUserService sysUserService; + @Autowired + private IAnnualCompService annualCompService; + + @Autowired + private IAnnualCompGroupService annualCompGroupService; + + @Autowired + private IExpGroupService expGroupService; + + + + + /** * 分页列表查询 * @@ -85,8 +103,26 @@ public class ExpertController extends JeecgController { public Result> queryPageList(Expert expert, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req) { + HttpServletRequest req,@RequestParam(name="ndbsxzid",required=true) String ndbsxzid) { + AnnualComp annualComp = annualCompService.getById(annualCompGroupService.getById(ndbsxzid).getAnnalComp()); + CompExp compExp = new CompExp(); + QueryWrapper queryWrapperce = QueryGenerator.initQueryWrapper(compExp, req.getParameterMap()); + queryWrapperce.eq("compid",annualComp.getCompid()); + queryWrapperce.eq("stat","Y"); + List listce = compExpService.list(queryWrapperce); + String expids= ""; + for (int i = 0 ; i queryWrappereg = QueryGenerator.initQueryWrapper(expGroup, req.getParameterMap()); + queryWrappereg.eq("grouid",listce.get(i).getExpid()); + //queryWrappereg.eq("ann_comp_groupid",ndbsxzid); + List listeg = expGroupService.list(queryWrappereg); + if(listeg.size()==0){ + expids = expids+listce.get(i).getExpid()+","; + } + } QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(expert, req.getParameterMap()); + queryWrapper.in("id",expids.split(",")); Page page = new Page(pageNo, pageSize); IPage pageList = expertService.page(page, queryWrapper); return Result.OK(pageList); @@ -95,15 +131,22 @@ public class ExpertController extends JeecgController { /** * 添加 * - * @param expert + * @param ids * @return */ @AutoLog(value = "专家表-添加") @ApiOperation(value="专家表-添加", notes="专家表-添加") - @RequiresPermissions("expert:expert:add") - @PostMapping(value = "/add") - public Result add(@RequestBody Expert expert) { - expertService.save(expert); + //@RequiresPermissions("expert:expert:add") + @GetMapping(value = "/add") + public Result add(@RequestParam(name="ids",required=true) String ids,@RequestParam(name="ndbsxzid",required=true) String ndbsxzid) { + String str[] =ids.split(","); + for (int i = 0 ; i < str.length;i++){ + ExpGroup expGroup = new ExpGroup(); + expGroup.setGrouid(str[i]); + expGroup.setIslead("N"); + expGroup.setAnnCompGroupid(ndbsxzid); + expGroupService.save(expGroup); + } return Result.OK("添加成功!"); } @@ -115,7 +158,7 @@ public class ExpertController extends JeecgController { */ @AutoLog(value = "专家表-编辑") @ApiOperation(value="专家表-编辑", notes="专家表-编辑") - @RequiresPermissions("expert:expert:edit") + //@RequiresPermissions("expert:expert:edit") @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) public Result edit(@RequestBody Expert expert) { expertService.updateById(expert); @@ -130,7 +173,7 @@ public class ExpertController extends JeecgController { */ @AutoLog(value = "专家表-通过id删除") @ApiOperation(value="专家表-通过id删除", notes="专家表-通过id删除") - @RequiresPermissions("expert:expert:delete") + //@RequiresPermissions("expert:expert:delete") @DeleteMapping(value = "/delete") public Result delete(@RequestParam(name="id",required=true) String id) { expertService.removeById(id); @@ -145,7 +188,7 @@ public class ExpertController extends JeecgController { */ @AutoLog(value = "专家表-批量删除") @ApiOperation(value="专家表-批量删除", notes="专家表-批量删除") - @RequiresPermissions("expert:expert:deleteBatch") + //@RequiresPermissions("expert:expert:deleteBatch") @DeleteMapping(value = "/deleteBatch") public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.expertService.removeByIds(Arrays.asList(ids.split(","))); @@ -317,7 +360,7 @@ public class ExpertController extends JeecgController { * @param request * @param expert */ - @RequiresPermissions("expert:expert:exportXls") + //@RequiresPermissions("expert:expert:exportXls") @RequestMapping(value = "/exportXls") public ModelAndView exportXls(HttpServletRequest request, Expert expert) { return super.exportXls(request, expert, Expert.class, "专家表"); @@ -330,7 +373,7 @@ public class ExpertController extends JeecgController { * @param response * @return */ - @RequiresPermissions("expert:expert:importExcel") + //@RequiresPermissions("expert:expert:importExcel") @RequestMapping(value = "/importExcel", method = RequestMethod.POST) public Result importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, Expert.class); diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/controller/ExpGroupController.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/controller/ExpGroupController.java new file mode 100644 index 00000000..ca3e4deb --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/controller/ExpGroupController.java @@ -0,0 +1,208 @@ +package org.jeecg.modules.demo.expgroup.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.expgroup.entity.ExpGroup; +import org.jeecg.modules.demo.expgroup.service.IExpGroupService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.apache.shiro.authz.annotation.RequiresPermissions; + + /** + * @Description: 专家组成员 + * @Author: jeecg-boot + * @Date: 2023-10-16 + * @Version: V1.0 + */ +@Api(tags="专家组成员") +@RestController +@RequestMapping("/expgroup/expGroup") +@Slf4j +public class ExpGroupController extends JeecgController { + @Autowired + private IExpGroupService expGroupService; + + /** + * 分页列表查询 + * + * @param expGroup + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "专家组成员-分页列表查询") + @ApiOperation(value="专家组成员-分页列表查询", notes="专家组成员-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(ExpGroup expGroup, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req,@RequestParam(name="ndbsxzid",required=true) String ndbsxzid) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(expGroup, req.getParameterMap()); + queryWrapper.eq("ann_comp_groupid",ndbsxzid); + Page page = new Page(pageNo, pageSize); + IPage pageList = expGroupService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param expGroup + * @return + */ + @AutoLog(value = "专家组成员-添加") + @ApiOperation(value="专家组成员-添加", notes="专家组成员-添加") + //@RequiresPermissions("expgroup:exp_group:add") + @PostMapping(value = "/add") + public Result add(@RequestBody ExpGroup expGroup) { + expGroupService.save(expGroup); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param expGroup + * @return + */ + @AutoLog(value = "专家组成员-编辑") + @ApiOperation(value="专家组成员-编辑", notes="专家组成员-编辑") + //@RequiresPermissions("expgroup:exp_group:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody ExpGroup expGroup) { + expGroupService.updateById(expGroup); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "专家组成员-通过id删除") + @ApiOperation(value="专家组成员-通过id删除", notes="专家组成员-通过id删除") + //@RequiresPermissions("expgroup:exp_group:delete") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + expGroupService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "专家组成员-批量删除") + @ApiOperation(value="专家组成员-批量删除", notes="专家组成员-批量删除") + //@RequiresPermissions("expgroup:exp_group:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.expGroupService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 设置队长 + * + * @param id,ndbsxzid + * @return + */ + //@AutoLog(value = "设置队长") + @ApiOperation(value="设置队长", notes="设置队长") + @GetMapping(value = "/szOne") + public Result szOne(@RequestParam(name="id",required=true) String id,@RequestParam(name="ndbsxzid",required=true) String ndbsxzid,HttpServletRequest req) { + ExpGroup expGroup = new ExpGroup(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(expGroup, req.getParameterMap()); + queryWrapper.eq("ann_comp_groupid",ndbsxzid); + List list = expGroupService.list(queryWrapper); + for (int i = 0 ; i < list.size() ; i++){ + ExpGroup expGroup1 = list.get(i); + expGroup1.setIslead("N"); + expGroupService.updateById(expGroup1); + } + expGroup = expGroupService.getById(id); + if(expGroup==null) { + return Result.error("未找到对应数据"); + }else { + expGroup.setIslead("Y"); + expGroupService.updateById(expGroup); + } + return Result.OK("设置成功"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "专家组成员-通过id查询") + @ApiOperation(value="专家组成员-通过id查询", notes="专家组成员-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + ExpGroup expGroup = expGroupService.getById(id); + if(expGroup==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(expGroup); + } + + /** + * 导出excel + * + * @param request + * @param expGroup + */ + //@RequiresPermissions("expgroup:exp_group:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, ExpGroup expGroup) { + return super.exportXls(request, expGroup, ExpGroup.class, "专家组成员"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + //@RequiresPermissions("expgroup:exp_group:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, ExpGroup.class); + } + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/entity/ExpGroup.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/entity/ExpGroup.java new file mode 100644 index 00000000..91ac7053 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/entity/ExpGroup.java @@ -0,0 +1,72 @@ +package org.jeecg.modules.demo.expgroup.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.TableLogic; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 专家组成员 + * @Author: jeecg-boot + * @Date: 2023-10-16 + * @Version: V1.0 + */ +@Data +@TableName("exp_group") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="exp_group对象", description="专家组成员") +public class ExpGroup implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**所属部门*/ + @ApiModelProperty(value = "所属部门") + private java.lang.String sysOrgCode; + /**成员*/ + @Excel(name = "成员", width = 15, dictTable = "expert", dicText = "name", dicCode = "id") + @Dict(dictTable = "expert", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "成员") + private java.lang.String grouid; + /**是否队长*/ + @Excel(name = "是否队长", width = 15) + @ApiModelProperty(value = "是否队长") + private java.lang.String islead; + /**年度比赛项目专家小组*/ + @Excel(name = "年度比赛项目专家小组", width = 15, dictTable = "annual_comp_group", dicText = "name", dicCode = "id") + @Dict(dictTable = "annual_comp_group", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "年度比赛项目专家小组") + private java.lang.String annCompGroupid; +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/mapper/ExpGroupMapper.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/mapper/ExpGroupMapper.java new file mode 100644 index 00000000..952102bc --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/mapper/ExpGroupMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.demo.expgroup.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.demo.expgroup.entity.ExpGroup; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 专家组成员 + * @Author: jeecg-boot + * @Date: 2023-10-16 + * @Version: V1.0 + */ +public interface ExpGroupMapper extends BaseMapper { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/mapper/xml/ExpGroupMapper.xml b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/mapper/xml/ExpGroupMapper.xml new file mode 100644 index 00000000..b5b3eb22 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/mapper/xml/ExpGroupMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/service/IExpGroupService.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/service/IExpGroupService.java new file mode 100644 index 00000000..0206c07c --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/service/IExpGroupService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.demo.expgroup.service; + +import org.jeecg.modules.demo.expgroup.entity.ExpGroup; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 专家组成员 + * @Author: jeecg-boot + * @Date: 2023-10-16 + * @Version: V1.0 + */ +public interface IExpGroupService extends IService { + +} diff --git a/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/service/impl/ExpGroupServiceImpl.java b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/service/impl/ExpGroupServiceImpl.java new file mode 100644 index 00000000..11a0b5a1 --- /dev/null +++ b/jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/expgroup/service/impl/ExpGroupServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.demo.expgroup.service.impl; + +import org.jeecg.modules.demo.expgroup.entity.ExpGroup; +import org.jeecg.modules.demo.expgroup.mapper.ExpGroupMapper; +import org.jeecg.modules.demo.expgroup.service.IExpGroupService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 专家组成员 + * @Author: jeecg-boot + * @Date: 2023-10-16 + * @Version: V1.0 + */ +@Service +public class ExpGroupServiceImpl extends ServiceImpl implements IExpGroupService { + +}