edit
This commit is contained in:
@@ -6,60 +6,21 @@ import lombok.Data;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 问题反馈
|
* 问题反馈
|
||||||
*
|
|
||||||
* @author Administrator
|
|
||||||
*
|
*
|
||||||
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class Bug {
|
public class Bug {
|
||||||
|
|
||||||
public Integer getId() {
|
private Integer id;
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Integer id) {
|
private String product;
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProduct() {
|
private String bugRemark;
|
||||||
return product;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProduct(String product) {
|
private String createBy;
|
||||||
this.product = product;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBugRemark() {
|
private Date createDate;
|
||||||
return bugRemark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBugRemark(String bugRemark) {
|
private String answer;
|
||||||
this.bugRemark = bugRemark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCreateBy() {
|
|
||||||
return createBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateBy(String createBy) {
|
|
||||||
this.createBy = createBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreateDate() {
|
|
||||||
return createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateDate(Date createDate) {
|
|
||||||
this.createDate = createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Integer id;
|
|
||||||
|
|
||||||
private String product;
|
|
||||||
|
|
||||||
private String bugRemark;
|
|
||||||
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
private Date createDate;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,78 +28,85 @@ import lingtao.net.service.BugService;
|
|||||||
@RestController
|
@RestController
|
||||||
public class BugController {
|
public class BugController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BugService bugService;
|
private BugService bugService;
|
||||||
|
|
||||||
private String localPrefix = "abc\\bug";
|
private String localPrefix = "abc\\bug";
|
||||||
|
|
||||||
private String localPath = "C:\\lingtao\\quote_price\\upload";
|
private String localPath = "C:\\lingtao\\quote_price\\upload";
|
||||||
|
|
||||||
//private String localDomain = "http://47.114.150.226:8080/erp";
|
//private String localDomain = "http://47.114.150.226:8080/erp";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bug列表
|
* bug列表
|
||||||
*
|
*
|
||||||
* @param page
|
* @param page
|
||||||
* @param limit
|
* @param limit
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/getBugs")
|
@RequestMapping("/getBugs")
|
||||||
public PageInfo<Bug> getBugs(@RequestParam(value = "page", defaultValue = "1") Integer page,
|
public PageInfo<Bug> getBugs(@RequestParam(value = "page", defaultValue = "1") Integer page,
|
||||||
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Bug bug) {
|
@RequestParam(value = "limit", defaultValue = "10") Integer limit, Bug bug) {
|
||||||
PageHelper.startPage(page, limit);
|
PageHelper.startPage(page, limit);
|
||||||
List<Bug> bugList = bugService.getBugs(bug);
|
List<Bug> bugList = bugService.getBugs(bug);
|
||||||
PageInfo<Bug> pageInfo = new PageInfo<Bug>(bugList);
|
PageInfo<Bug> pageInfo = new PageInfo<Bug>(bugList);
|
||||||
return pageInfo;
|
return pageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加角色
|
* 添加
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/addBug")
|
@RequestMapping("/addBug")
|
||||||
public Msg addBug(Bug bug, HttpSession session) {
|
public Msg addBug(Bug bug, HttpSession session) {
|
||||||
return bugService.addBug(bug, session);
|
return bugService.addBug(bug, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 图片上传及新增
|
/**
|
||||||
@RequestMapping("/bugUpload")
|
* 更新
|
||||||
public Msg upload(@RequestParam("file") MultipartFile file) throws Exception {
|
*/
|
||||||
if (file.isEmpty()) {
|
@RequestMapping("/updateBug")
|
||||||
return Msg.fail("文件不能为空");
|
public Msg updateBug(Bug bug, HttpSession session) {
|
||||||
}
|
return bugService.updateBug(bug);
|
||||||
// 获取文件名后缀
|
}
|
||||||
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
|
||||||
// 获取path
|
|
||||||
String path = getPath(extension, FilenameUtils.getBaseName(file.getOriginalFilename()));
|
|
||||||
// 保存文件信息
|
|
||||||
File newFile = new File(localPath + File.separator + path);
|
|
||||||
try {
|
|
||||||
FileUtils.copyInputStreamToFile(new ByteArrayInputStream(file.getBytes()), newFile);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeErrorException(null, "");
|
|
||||||
}
|
|
||||||
return Msg.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// 图片上传及新增
|
||||||
*
|
@RequestMapping("/bugUpload")
|
||||||
* @param prefixSelf 根据上传的接口存入自己的文件夹
|
public Msg upload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||||
* @param suffix 文件的后缀
|
if (file.isEmpty()) {
|
||||||
* @param fileName 文件名
|
return Msg.fail("文件不能为空");
|
||||||
* @return
|
}
|
||||||
*/
|
// 获取文件名后缀
|
||||||
public String getPath(String suffix, String fileName) {
|
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
||||||
|
// 获取path
|
||||||
|
String path = getPath(extension, FilenameUtils.getBaseName(file.getOriginalFilename()));
|
||||||
|
// 保存文件信息
|
||||||
|
File newFile = new File(localPath + File.separator + path);
|
||||||
|
try {
|
||||||
|
FileUtils.copyInputStreamToFile(new ByteArrayInputStream(file.getBytes()), newFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeErrorException(null, "");
|
||||||
|
}
|
||||||
|
return Msg.success();
|
||||||
|
}
|
||||||
|
|
||||||
// 生成uuid
|
/**
|
||||||
// String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
* @param prefixSelf 根据上传的接口存入自己的文件夹
|
||||||
String path = null;
|
* @param suffix 文件的后缀
|
||||||
|
* @param fileName 文件名
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getPath(String suffix, String fileName) {
|
||||||
|
|
||||||
// 文件路径
|
// 生成uuid
|
||||||
path = DateUtils.formatDate(new Date(), "yyyyMMdd") + File.separator + fileName;
|
// String uuid = UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
|
String path = null;
|
||||||
|
|
||||||
path = localPrefix + File.separator + File.separator + path;
|
// 文件路径
|
||||||
|
path = DateUtils.formatDate(new Date(), "yyyyMMdd") + File.separator + fileName;
|
||||||
|
|
||||||
return path + "." + suffix;
|
path = localPrefix + File.separator + File.separator + path;
|
||||||
}
|
|
||||||
|
return path + "." + suffix;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import lingtao.net.bean.Bug;
|
|||||||
|
|
||||||
public interface BugMapper {
|
public interface BugMapper {
|
||||||
|
|
||||||
List<Bug> getBugs(Bug bug);
|
List<Bug> getBugs(Bug bug);
|
||||||
|
|
||||||
int addBug(Bug bug);
|
int addBug(Bug bug);
|
||||||
|
|
||||||
|
int updateBug(Bug bug);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,21 +15,29 @@ import lingtao.net.dao.BugMapper;
|
|||||||
@Service
|
@Service
|
||||||
public class BugService {
|
public class BugService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BugMapper bugMapper;
|
private BugMapper bugMapper;
|
||||||
|
|
||||||
public List<Bug> getBugs(Bug bug) {
|
public List<Bug> getBugs(Bug bug) {
|
||||||
return bugMapper.getBugs(bug);
|
return bugMapper.getBugs(bug);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Msg addBug(Bug bug, HttpSession session) {
|
public Msg addBug(Bug bug, HttpSession session) {
|
||||||
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
SysUser user = (SysUser) session.getAttribute("USER_SESSION");
|
||||||
bug.setCreateBy(user.getRealname());
|
bug.setCreateBy(user.getRealname());
|
||||||
int i = bugMapper.addBug(bug);
|
int i = bugMapper.addBug(bug);
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
return Msg.fail();
|
return Msg.fail();
|
||||||
}
|
}
|
||||||
return Msg.success();
|
return Msg.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Msg updateBug(Bug bug) {
|
||||||
|
int i = bugMapper.updateBug(bug);
|
||||||
|
if (i < 0) {
|
||||||
|
return Msg.fail();
|
||||||
|
}
|
||||||
|
return Msg.success();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,36 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="lingtao.net.dao.BugMapper">
|
<mapper namespace="lingtao.net.dao.BugMapper">
|
||||||
|
<select id="getBugs" parameterType="Bug" resultType="Bug">
|
||||||
<select id="getBugs" parameterType="Bug" resultType="Bug">
|
SELECT
|
||||||
SELECT
|
*
|
||||||
*
|
FROM
|
||||||
FROM
|
bug
|
||||||
bug
|
<where>
|
||||||
<where>
|
<if test="createBy !=null and createBy != '' ">
|
||||||
<if test="createBy !=null and createBy != '' ">
|
createBy like '%${createBy}%'
|
||||||
createBy like '%${createBy}%'
|
</if>
|
||||||
</if>
|
</where>
|
||||||
</where>
|
ORDER BY id DESC
|
||||||
ORDER BY id DESC
|
</select>
|
||||||
</select>
|
|
||||||
|
|
||||||
|
|
||||||
<insert id="addBug" parameterType="Bug">
|
<insert id="addBug" parameterType="Bug">
|
||||||
INSERT INTO bug
|
INSERT INTO bug
|
||||||
(
|
(id,
|
||||||
id,
|
product,
|
||||||
product,
|
bugRemark,
|
||||||
bugRemark,
|
createBy,
|
||||||
createBy,
|
createDate)
|
||||||
createDate
|
VALUES (NULL,
|
||||||
)
|
#{product},
|
||||||
VALUES
|
#{bugRemark},
|
||||||
(
|
#{createBy},
|
||||||
NULL,
|
now())
|
||||||
#{product},
|
|
||||||
#{bugRemark},
|
|
||||||
#{createBy},
|
|
||||||
now()
|
|
||||||
)
|
|
||||||
</insert>
|
</insert>
|
||||||
|
<update id="updateBug" parameterType="Bug">
|
||||||
|
update bug
|
||||||
|
set answer = #{answer}
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user