md
This commit is contained in:
parent
34ff578fa9
commit
420d924f31
@ -23,6 +23,7 @@ import com.xdadan.erp.oms.service.IEmisArticleLikeRecordService;
|
||||
import com.xdadan.erp.oms.service.IEmisArticleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
@ -55,6 +56,15 @@ public class Oms2cArticleController extends BaseController
|
||||
{
|
||||
startPage();
|
||||
List<EmisArticle> list = emisArticleService.selectEmisArticleList(emisArticle);
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
for (EmisArticle art:list) {
|
||||
EmisArticleLikeRecord emisArticleLikeRecord = new EmisArticleLikeRecord();
|
||||
emisArticleLikeRecord.setArticleId(art.getId());
|
||||
emisArticleLikeRecord.setUserId(getUserId());
|
||||
int cnt=emisArticleLikeRecordService.checkIsGiveLike(emisArticleLikeRecord);
|
||||
art.setIsGiveLike(String.valueOf(cnt));
|
||||
}
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -76,6 +86,9 @@ public class Oms2cArticleController extends BaseController
|
||||
@GetMapping("/getDetail")
|
||||
public AjaxResult getDetail(Long id)
|
||||
{
|
||||
// 更新点击次数
|
||||
emisArticleService.addArticleClickCount(id);
|
||||
|
||||
return AjaxResult.success(emisArticleService.selectEmisArticleById(id));
|
||||
}
|
||||
|
||||
@ -94,6 +107,7 @@ public class Oms2cArticleController extends BaseController
|
||||
}else{
|
||||
upd.setIsGiveLike("1");
|
||||
}
|
||||
|
||||
return toAjax(emisArticleLikeRecordService.updateEmisArticleLikeRecord(upd));
|
||||
|
||||
}else{
|
||||
|
||||
@ -14,6 +14,7 @@ package com.xdadan.erp.oms.web;
|
||||
import com.xdadan.erp.oms.common.core.controller.BaseController;
|
||||
import com.xdadan.erp.oms.common.core.domain.AjaxResult;
|
||||
import com.xdadan.erp.oms.common.core.domain.entity.SysOmsUser;
|
||||
import com.xdadan.erp.oms.system.service.ISysOmsUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -33,6 +34,11 @@ import java.util.List;
|
||||
public class Oms2cCustomerUserController extends BaseController
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private ISysOmsUserService sysOmsUserService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 实名认证
|
||||
* @param emisCustomerUser
|
||||
@ -42,6 +48,9 @@ public class Oms2cCustomerUserController extends BaseController
|
||||
public AjaxResult idVerification(@RequestBody SysOmsUser emisCustomerUser)
|
||||
{
|
||||
try {
|
||||
|
||||
SysOmsUser user=sysOmsUserService.selectSysOmsUserById(getLoginUser().getUser().getId());
|
||||
|
||||
// EmisCustomerUser oldUser=emisBaseService.getCustomerUserByPhone(emisCustomerUser.getPhone());
|
||||
// if(oldUser!=null){
|
||||
// return AjaxResult.error("该客户电话号码已被占用,请使用新号码");
|
||||
|
||||
@ -48,6 +48,8 @@ public interface EmisArticleLikeRecordMapper extends BaseMapper<EmisArticleLikeR
|
||||
public int checkUnique(EmisArticleLikeRecord emisArticleLikeRecord);
|
||||
|
||||
|
||||
public int checkIsGiveLike(EmisArticleLikeRecord emisArticleLikeRecord);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
|
||||
@ -64,6 +64,12 @@ public interface EmisArticleMapper extends BaseMapper<EmisArticle>
|
||||
*/
|
||||
public int updateEmisArticle(EmisArticle emisArticle);
|
||||
|
||||
|
||||
public int addArticleClickCount(Long id);
|
||||
|
||||
|
||||
public int minusArticleClickCount(Long id);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
|
||||
@ -46,6 +46,9 @@ package com.xdadan.erp.oms.service;
|
||||
*/
|
||||
public int checkUnique(EmisArticleLikeRecord emisArticleLikeRecord);
|
||||
|
||||
|
||||
public int checkIsGiveLike(EmisArticleLikeRecord emisArticleLikeRecord);
|
||||
|
||||
/**
|
||||
* 新增文章点赞记录
|
||||
*
|
||||
|
||||
@ -62,6 +62,13 @@ package com.xdadan.erp.oms.service;
|
||||
*/
|
||||
public int updateEmisArticle(EmisArticle emisArticle);
|
||||
|
||||
|
||||
public int addArticleClickCount(Long id);
|
||||
|
||||
|
||||
public int minusArticleClickCount(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除文章管理
|
||||
*
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
package com.xdadan.erp.oms.service.impl;
|
||||
|
||||
import com.xdadan.erp.oms.domain.EmisArticle;
|
||||
import com.xdadan.erp.oms.domain.EmisArticleCat;
|
||||
import com.xdadan.erp.oms.mapper.EmisArticleCatMapper;
|
||||
import com.xdadan.erp.oms.service.IEmisArticleCatService;
|
||||
@ -91,6 +92,10 @@ package com.xdadan.erp.oms.service.impl;
|
||||
return emisArticleCatMapper.updateEmisArticleCat(emisArticleCat);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除文章类型
|
||||
*
|
||||
|
||||
@ -67,6 +67,13 @@ package com.xdadan.erp.oms.service.impl;
|
||||
return emisArticleLikeRecordMapper.checkUnique(emisArticleLikeRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkIsGiveLike(EmisArticleLikeRecord emisArticleLikeRecord)
|
||||
{
|
||||
return emisArticleLikeRecordMapper.checkIsGiveLike(emisArticleLikeRecord);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增文章点赞记录
|
||||
*
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
package com.xdadan.erp.oms.service.impl;
|
||||
|
||||
import com.xdadan.erp.oms.domain.EmisArticle;
|
||||
import com.xdadan.erp.oms.domain.EmisArticleCat;
|
||||
import com.xdadan.erp.oms.mapper.EmisArticleMapper;
|
||||
import com.xdadan.erp.oms.service.IEmisArticleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -115,4 +116,20 @@ package com.xdadan.erp.oms.service.impl;
|
||||
return emisArticleMapper.deleteEmisArticleById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int addArticleClickCount(Long id)
|
||||
{
|
||||
return emisArticleMapper.addArticleClickCount(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minusArticleClickCount(Long id)
|
||||
{
|
||||
return emisArticleMapper.minusArticleClickCount(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -31,6 +31,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkIsGiveLike" parameterType="EmisArticleLikeRecord" resultType="int">
|
||||
select count(1) from emis_article_like_record
|
||||
where del_flag='0'
|
||||
and article_id = #{articleId}
|
||||
and user_id = #{userId}
|
||||
and is_give_like ='1'
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="checkUnique" parameterType="EmisArticleLikeRecord" resultType="int">
|
||||
select count(1) from emis_article_like_record
|
||||
where del_flag='0'
|
||||
|
||||
@ -174,6 +174,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
<update id="addArticleClickCount" parameterType="EmisArticle">
|
||||
update emis_article set click_count=click_count+1 where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="minusArticleClickCount" parameterType="EmisArticle">
|
||||
update emis_article set click_count=click_count-1 where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmisArticleById" parameterType="Long">
|
||||
delete from emis_article where id = #{id}
|
||||
</delete>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user