Browse Source

Merge branch 'master' into test

syh 5 years ago
parent
commit
69d788bb6f

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/config/ureport/ServletConfig.java

@@ -9,7 +9,7 @@ import org.springframework.context.annotation.ImportResource;
 import javax.servlet.Servlet;
 
 @Configuration
-//@ImportResource("classpath:ureport-console-context.xml")
+@ImportResource("classpath:ureport-console-context.xml")
 public class ServletConfig {
 
     @Bean

+ 184 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DramaInfoController.java

@@ -0,0 +1,184 @@
+package org.jeecg.modules.ctop.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.ctop.entity.DramaInfo;
+import org.jeecg.modules.ctop.service.IDramaInfoService;
+import org.jeecg.modules.system.entity.SysCategory;
+import org.jeecg.modules.system.service.ISysCategoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 剧本信息
+ * @author jeecg-boot
+ * @date   2020-03-04
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="剧本信息")
+@RestController
+@RequestMapping("/ctop/dramaInfo")
+public class DramaInfoController {
+	@Autowired
+	private IDramaInfoService dramaInfoService;
+	@Autowired
+	private ISysCategoryService categoryService;
+
+	/**
+	  * 分页列表查询
+	 * @param dramaInfo
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@AutoLog(value = "剧本信息-分页列表查询")
+	@ApiOperation(value="剧本信息-分页列表查询", notes="剧本信息-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<DramaInfo>> queryPageList(DramaInfo dramaInfo,
+												  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+												  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+												  HttpServletRequest req) {
+		Result<IPage<DramaInfo>> result = new Result<IPage<DramaInfo>>();
+		QueryWrapper<DramaInfo> queryWrapper = QueryGenerator.initQueryWrapper(dramaInfo, req.getParameterMap());
+		Page<DramaInfo> page = new Page<DramaInfo>(pageNo, pageSize);
+		IPage<DramaInfo> pageList = dramaInfoService.page(page, queryWrapper);
+		if (pageList != null && pageList.getRecords() != null && pageList.getRecords().size() > 0) {
+			List<DramaInfo> list = new ArrayList<>();
+			for (int i = 0; i < pageList.getRecords().size(); i++) {
+				DramaInfo getDramaInfo = pageList.getRecords().get(i);
+				SysCategory sysCategory = categoryService.getById(getDramaInfo.getCategory());
+				if (sysCategory != null) {
+					getDramaInfo.setCategory(sysCategory.getName());
+				}
+				list.add(getDramaInfo);
+			}
+			pageList.setRecords(list);
+		}
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param dramaInfo
+	 * @return
+	 */
+	@AutoLog(value = "剧本信息-添加")
+	@ApiOperation(value="剧本信息-添加", notes="剧本信息-添加")
+	@PostMapping(value = "/add")
+	public Result<DramaInfo> add(@RequestBody DramaInfo dramaInfo) {
+		Result<DramaInfo> result = new Result<>();
+		try {
+			// 获取登录用户信息
+			LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+			dramaInfo.setUserId(sysUser.getId());
+			dramaInfo.setUserName(sysUser.getUsername());
+			dramaInfo.setUpdateTime(new Date());
+			dramaInfoService.save(dramaInfo);
+
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param dramaInfo
+	 * @return
+	 */
+	@AutoLog(value = "剧本信息-编辑")
+	@ApiOperation(value="剧本信息-编辑", notes="剧本信息-编辑")
+	@PutMapping(value = "/edit")
+	public Result<DramaInfo> edit(@RequestBody DramaInfo dramaInfo) {
+		Result<DramaInfo> result = new Result<DramaInfo>();
+		DramaInfo dramaInfoEntity = dramaInfoService.getById(dramaInfo.getId());
+		if(dramaInfoEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = dramaInfoService.updateById(dramaInfo);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "剧本信息-通过id删除")
+	@ApiOperation(value="剧本信息-通过id删除", notes="剧本信息-通过id删除")
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			dramaInfoService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "剧本信息-批量删除")
+	@ApiOperation(value="剧本信息-批量删除", notes="剧本信息-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<DramaInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<DramaInfo> result = new Result<DramaInfo>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.dramaInfoService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "剧本信息-通过id查询")
+	@ApiOperation(value="剧本信息-通过id查询", notes="剧本信息-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<DramaInfo> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<DramaInfo> result = new Result<DramaInfo>();
+		DramaInfo dramaInfo = dramaInfoService.getById(id);
+		if(dramaInfo==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(dramaInfo);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+}

+ 37 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/DramaInfo.java

@@ -0,0 +1,37 @@
+package org.jeecg.modules.ctop.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 剧本信息
+ * @author jeecg-boot
+ * @date   2020-03-04
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_drama_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value="ctop_drama_info对象", description="剧本信息")
+public class DramaInfo {
+	@TableId(type = IdType.AUTO)
+	private Long id;
+	private String userId;
+	private String category;
+	private String dramaName;
+	private String tag;
+	private String userName;
+	private Integer nonpublic;
+	private String introduction;
+	private Integer status;
+	private Date createTime;
+	private Date updateTime;
+}

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/DramaInfoMapper.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.ctop.entity.DramaInfo;
+
+/**
+ * 剧本信息
+ * @author: jeecg-boot
+ * @date:   2020-03-04
+ * @cersion: V1.0
+ */
+public interface DramaInfoMapper extends BaseMapper<DramaInfo> {
+
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/DramaInfoMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.ctop.mapper.DramaInfoMapper">
+
+</mapper>

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IDramaInfoService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.DramaInfo;
+
+/**
+ * 剧本信息
+ * @author jeecg-boot
+ * @date   2020-03-04
+ * @version V1.0
+ */
+public interface IDramaInfoService extends IService<DramaInfo> {
+
+}

+ 18 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/DramaInfoServiceImpl.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.ctop.entity.DramaInfo;
+import org.jeecg.modules.ctop.mapper.DramaInfoMapper;
+import org.jeecg.modules.ctop.service.IDramaInfoService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 剧本信息
+ * @author jeecg-boot
+ * @date   2020-03-04
+ * @version V1.0
+ */
+@Service
+public class DramaInfoServiceImpl extends ServiceImpl<DramaInfoMapper, DramaInfo> implements IDramaInfoService {
+
+}