Commit 0a028ad6 by 吴迪

Merge remote-tracking branch 'origin/master'

parents ad63f44d 0456bb14
......@@ -2,17 +2,17 @@ package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.office.modules.manage.entity.MedicalEntity;
import io.office.modules.manage.utils.IdKeysConstant;
import io.office.modules.manage.utils.IdWorkerUtils;
import io.office.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import io.office.modules.manage.entity.LogisticsEntity;
import io.office.modules.manage.service.LogisticsService;
......@@ -20,7 +20,6 @@ import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
......@@ -30,7 +29,7 @@ import io.office.common.utils.R;
*/
@RestController
@RequestMapping("/logistics")
public class LogisticsController {
public class LogisticsController extends AbstractController {
@Autowired
private LogisticsService logisticsService;
......@@ -64,6 +63,9 @@ public class LogisticsController {
public R save(@RequestBody LogisticsEntity logistics){
logistics.setId(IdWorkerUtils.getSEQByKey(IdKeysConstant.ID_SEQ_KEY));
logistics.setInputdate(new Date());
String username = getUser().getUsername();
logistics.setEditor(username);
logistics.setLasteditor(username);
logisticsService.save(logistics);
return R.ok("新增成功!");
}
......@@ -74,6 +76,10 @@ public class LogisticsController {
@RequestMapping("/update")
// @RequiresPermissions("manage:logistics:update")
public R update(@RequestBody LogisticsEntity logistics){
String username = getUser().getUsername();
logistics.setEditor(username);
logistics.setLasteditor(username);
logistics.setUpdatetime(new Date());
logisticsService.updateById(logistics);
return R.ok("修改成功!");
}
......@@ -83,9 +89,32 @@ public class LogisticsController {
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:logistics:delete")
public R delete(@RequestBody String[] ids){
logisticsService.removeByIds(Arrays.asList(ids));
public R delete(@RequestBody List<String> ids){
LogisticsEntity logistics = new LogisticsEntity();
String username = getUser().getUsername();
logistics.setEditor(username);
logistics.setLasteditor(username);
logistics.setUpdatetime(new Date());
logistics.setLevel(0);
QueryWrapper<LogisticsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id",ids);
logisticsService.update(logistics,queryWrapper);
return R.ok("删除成功!");
}
@PostMapping("/verifyLogistics")
public R verifyMedical(@RequestBody LogisticsEntity logistics){
String username = getUser().getUsername();
logistics.setEditor(username);
logistics.setLasteditor(username);
logistics.setUpdatetime(new Date());
logistics.setCheckname(username);
logistics.setChecktime(new Date());
QueryWrapper<LogisticsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",logistics.getId());
logisticsService.update(logistics,queryWrapper);
return R.ok("审核成功!");
}
}
......@@ -2,10 +2,12 @@ package io.office.modules.manage.controller;
import java.util.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.office.modules.manage.entity.MedicalEntity;
import io.office.modules.manage.service.MedicalService;
import io.office.modules.manage.utils.IdKeysConstant;
import io.office.modules.manage.utils.IdWorkerUtils;
import io.office.modules.sys.controller.AbstractController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -24,7 +26,7 @@ import io.office.common.utils.R;
*/
@RestController
@RequestMapping("/medical")
public class MedicalController {
public class MedicalController extends AbstractController {
@Autowired
private MedicalService medicalService;
......@@ -57,7 +59,10 @@ public class MedicalController {
// @RequiresPermissions("manage:medical:save")
public R save(@RequestBody MedicalEntity medical){
medical.setId(IdWorkerUtils.getSEQByKey(IdKeysConstant.ID_SEQ_KEY));
String username = getUser().getUsername();
medical.setInputDate(new Date());
medical.setEditor(username);
medical.setLasteditor(username);
medicalService.save(medical);
return R.ok("新增成功!");
}
......@@ -68,6 +73,10 @@ public class MedicalController {
@RequestMapping("/update")
// @RequiresPermissions("manage:medical:update")
public R update(@RequestBody MedicalEntity medical){
String username = getUser().getUsername();
medical.setEditor(username);
medical.setLasteditor(username);
medical.setUpdatetime(new Date());
medicalService.updateById(medical);
return R.ok("修改成功!");
}
......@@ -77,8 +86,16 @@ public class MedicalController {
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:medical:delete")
public R delete(@RequestBody String[] ids){
medicalService.removeByIds(Arrays.asList(ids));
public R delete(@RequestBody List<String> ids){
MedicalEntity medical = new MedicalEntity();
String username = getUser().getUsername();
medical.setEditor(username);
medical.setLasteditor(username);
medical.setUpdatetime(new Date());
medical.setLevel(0);
QueryWrapper<MedicalEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id",ids);
medicalService.update(medical,queryWrapper);
return R.ok("删除成功!");
}
......@@ -88,4 +105,19 @@ public class MedicalController {
return R.ok().put("list",list);
}
@PostMapping("/verifyMedical")
public R verifyMedical(@RequestBody MedicalEntity medical){
String username = getUser().getUsername();
medical.setEditor(username);
medical.setLasteditor(username);
medical.setUpdatetime(new Date());
medical.setCheckname(username);
medical.setChecktime(new Date());
QueryWrapper<MedicalEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",medical.getId());
medicalService.update(medical,queryWrapper);
return R.ok("审核成功!");
}
}
......@@ -6,6 +6,7 @@ import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.app.annotation.Login;
import io.office.modules.manage.entity.MedicalEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
......@@ -162,4 +163,67 @@ public class NewsController extends AbstractController {
NewsEntity news = newsService.getById(id);
return R.ok().put("data", news);
}
/**
* 行业应用
*/
@Login
@PostMapping("/api/industryApplication")
public R industryApplication(@RequestBody NewsParams newsParams) {
Page<NewsEntity> page = this.newsService.industryApplication(newsParams,
new Page(newsParams.getPage(), newsParams.getLimit()));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("data", pageUtils);
}
/**
* 医疗卫生
*/
@Login
@PostMapping("/api/medicalList")
public R medicalList(@RequestBody NewsParams newsParams) {
Page<MedicalEntity> page = this.newsService.medicalList(newsParams,
new Page(newsParams.getPage(), newsParams.getLimit()));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("data", pageUtils);
}
/**
* 物联网
*/
@Login
@PostMapping("/api/iotList")
public R iotList(@RequestBody NewsParams newsParams) {
Page<NewsEntity> page = this.newsService.iotList(newsParams,
new Page(newsParams.getPage(), newsParams.getLimit()));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("data", pageUtils);
}
/**
* 物联网
*/
@Login
@PostMapping("/api/otherList")
public R otherList(@RequestBody NewsParams newsParams) {
Page<NewsEntity> page = this.newsService.otherList(newsParams,
new Page(newsParams.getPage(), newsParams.getLimit()));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("data", pageUtils);
}
/**
* 食品安全追溯
*/
@Login
@PostMapping("/api/foodSafetyList")
public R foodSafetyList(@RequestBody NewsParams newsParams) {
Page<NewsEntity> page = this.newsService.foodSafetyList(newsParams,
new Page(newsParams.getPage(), newsParams.getLimit()));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("data", pageUtils);
}
}
package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.manage.entity.MedicalEntity;
import io.office.modules.manage.entity.NewsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.office.modules.manage.entity.dto.NewsParams;
......@@ -35,4 +36,14 @@ public interface NewsDao extends BaseMapper<NewsEntity> {
List<NewsEntity> getHdbdList(@Param("newsParams")NewsParams newsParams, Page page);
String selectClassName(Integer classid);
List<NewsEntity> industryApplication(NewsParams newsParams, Page page);
List<MedicalEntity> medicalList(NewsParams newsParams, Page page);
List<NewsEntity> iotList(NewsParams newsParams, Page page);
List<NewsEntity> otherList(NewsParams newsParams, Page page);
List<NewsEntity> foodSafetyList(NewsParams newsParams, Page page);
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -81,4 +82,17 @@ public class LogisticsEntity implements Serializable {
@TableId("inputdate")
private Date inputdate;
private String status;
private String checkname;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date checktime;
private String editor;
private String lasteditor;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatetime;
@TableField("oldtitle")
private String titleOld;
}
......@@ -79,4 +79,19 @@ public class MedicalEntity implements Serializable {
@TableField("inputDate")
private Date inputDate;
private String status;
private String checkname;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date checktime;
private String editor;
private String lasteditor;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updatetime;
@TableField("oldtitle")
private String titleOld;
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.MedicalEntity;
import io.office.modules.manage.entity.NewsEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.sys.entity.SysUserEntity;
......@@ -36,5 +37,15 @@ public interface NewsService extends IService<NewsEntity> {
Page<NewsEntity> selectRealTimeInfo(NewsParams newsParams, Page page);
String selectClassName(Integer classid);
Page<NewsEntity> industryApplication(NewsParams newsParams, Page page);
Page<MedicalEntity> medicalList(NewsParams newsParams, Page page);
Page<NewsEntity> iotList(NewsParams newsParams, Page page);
Page<NewsEntity> otherList(NewsParams newsParams, Page page);
Page<NewsEntity> foodSafetyList(NewsParams newsParams, Page page);
}
......@@ -3,6 +3,7 @@ package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.R;
import io.office.modules.manage.entity.MedicalEntity;
import io.office.modules.manage.entity.dto.NewsParams;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -125,6 +126,45 @@ public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements
String name = this.newsDao.selectClassName(classid);
return name;
}
/**
*
* 行业应用
*
* */
@Override
public Page<NewsEntity> industryApplication(NewsParams newsParams, Page page) {
List<NewsEntity> list = this.newsDao.industryApplication(newsParams,page);
page.setRecords(list);
return page;
}
@Override
public Page<MedicalEntity> medicalList(NewsParams newsParams, Page page) {
List<MedicalEntity> list = this.newsDao.medicalList(newsParams,page);
page.setRecords(list);
return page;
}
@Override
public Page<NewsEntity> iotList(NewsParams newsParams, Page page) {
List<NewsEntity> list = this.newsDao.iotList(newsParams,page);
page.setRecords(list);
return page;
}
@Override
public Page<NewsEntity> otherList(NewsParams newsParams, Page page) {
List<NewsEntity> list = this.newsDao.otherList(newsParams,page);
page.setRecords(list);
return page;
}
@Override
public Page<NewsEntity> foodSafetyList(NewsParams newsParams, Page page) {
List<NewsEntity> list = this.newsDao.foodSafetyList(newsParams,page);
page.setRecords(list);
return page;
}
}
\ No newline at end of file
......@@ -204,7 +204,7 @@
and t.classid = #{newsParams.classId}
and t.levels > 0
and t.status = '1'
order by t.levels desc,t.showtime desc ,t.id desc
order by t.levels desc,t.id desc
</select>
<select id="getHdbdList" resultMap="newsMap">
......@@ -235,4 +235,83 @@
<select id="selectClassName" resultType="java.lang.String">
SELECT name FROM newsClass t where id = #{classid}
</select>
<!--行业应用-->
<select id="industryApplication" resultMap="newsMap">
SELECT
ltrim(b.name) classname ,a.*
FROM
news a
LEFT JOIN newsclass b ON a.classid = b.id
WHERE
status = 1
AND levels > 0
AND p_id NOT IN (2, 3)
AND b.name LIKE '%应用%'
ORDER BY
a.levels DESC,
a.showtime DESC,
a.id DESC
</select>
<!--医疗卫生-->
<select id="medicalList" resultType="io.office.modules.manage.entity.MedicalEntity">
SELECT * FROM medical t
where t.level >0
ORDER BY
t.level DESC,
t.id DESC
</select>
<!--物联网-->
<select id="iotList" resultMap="newsMap">
SELECT
*
FROM
news
WHERE
1 = 1
AND (keyword LIKE '%物联网%')
AND (
(classid BETWEEN 5 AND 8)
OR (
classid IN (
SELECT
Id
FROM
newsClass
WHERE
p_id = 5
)
)
)
ORDER BY
releasedate DESC
</select>
<select id="otherList" resultMap="newsMap">
SELECT
*
FROM
news
WHERE
classid IN ('18','19','20','21')
AND levels > 0
AND status = 1
ORDER BY
levels DESC,
id DESC
</select>
<select id="foodSafetyList" resultMap="newsMap">
SELECT
*
FROM
news
WHERE
classid = 16
AND levels > 0
AND status = 1
ORDER BY
levels DESC,
id DESC
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment