Merge remote-tracking branch 'origin/master'
# Conflicts: # ruoyi-web/src/main/java/com/ruoyi/web/app/AppAdController.java
This commit is contained in:
commit
1622cac9a9
|
@ -36,6 +36,10 @@ public class Ad extends BaseEntity
|
|||
@ApiModelProperty("运营商id")
|
||||
private Long storeId;
|
||||
|
||||
@Excel(name = "运营区id")
|
||||
@ApiModelProperty("运营区id")
|
||||
private Long areaId;
|
||||
|
||||
@Excel(name = "跳转链接")
|
||||
@ApiModelProperty("跳转链接")
|
||||
private String url;
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.ruoyi.bst.ad.domain.Ad;
|
|||
import com.ruoyi.bst.ad.domain.AdVO;
|
||||
import com.ruoyi.bst.ad.domain.AdQuery;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
|
||||
/**
|
||||
* 广告Mapper接口
|
||||
|
@ -73,4 +74,8 @@ public interface AdMapper
|
|||
public int deleteAdByAdIds(@Param("array") List<Long> adIds);
|
||||
|
||||
AdVO selectOne(@Param("query") AdQuery query);
|
||||
|
||||
public int logicalDel(@Param("array") List<Long> adIds);
|
||||
|
||||
int countByAreaId(@Param("areaId") Long areaId, @Param("adId") Long adId);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="type" column="type" />
|
||||
<result property="belong" column="belong" />
|
||||
<result property="storeId" column="store_id" />
|
||||
<result property="areaId" column="area_id" />
|
||||
<result property="picture" column="picture" />
|
||||
<result property="url" column="url" />
|
||||
<result property="createBy" column="create_by" />
|
||||
|
@ -21,9 +22,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectAdVo">
|
||||
select
|
||||
select DISTINCT
|
||||
bad.ad_id,
|
||||
bad.store_id,
|
||||
bad.area_id,
|
||||
bad.type,
|
||||
bad.belong,
|
||||
bad.picture,
|
||||
|
@ -35,17 +37,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bad.remark,
|
||||
bad.deleted,
|
||||
bad.url_type,
|
||||
bo.user_id,
|
||||
ba.name as area_name
|
||||
from bst_ad bad
|
||||
left join bst_area ba on bad.store_id = ba.user_id
|
||||
left join bst_order bo on ba.id = bo.area_id
|
||||
ba.name AS areaName,
|
||||
su.agent_id
|
||||
from bst_ad bad
|
||||
left join bst_area ba on bad.area_id = ba.id
|
||||
left join bst_order bo ON ba.id = bo.area_id
|
||||
left join sys_user su on bo.user_id = su.user_id
|
||||
</sql>
|
||||
|
||||
<sql id="searchCondition">
|
||||
<if test="query.storeId != null and query.storeId != ''">
|
||||
and bad.store_id = #{query.storeId}
|
||||
</if>
|
||||
<if test="query.areaId != null and query.areaId != ''"> and bad.area_id = #{query.areaId} </if>
|
||||
<if test="query.storeId != null and query.storeId != ''"> and bad.store_id = #{query.storeId}</if>
|
||||
<if test="query.adId != null and query.adId != ''"> and bad.ad_id = #{query.adId} </if>
|
||||
<if test="query.type != null and query.type != ''"> and bad.type = #{query.type}</if>
|
||||
<if test="query.belong != null and query.belong != ''"> and bad.belong = #{query.belong}</if>
|
||||
|
@ -55,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.urlType != null and query.urlType != ''"> and bad.url_type = #{query.urlType}</if>
|
||||
${@com.ruoyi.framework.util.DataScopeUtil@dataScope(
|
||||
null,
|
||||
"bad.store_id,bo.user_id",
|
||||
"bad.store_id,su.agent_id",
|
||||
null,
|
||||
null,
|
||||
query.scope
|
||||
|
@ -80,13 +82,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
limit 1
|
||||
order by bad.create_time desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="countByAreaId" resultType="java.lang.Integer">
|
||||
SELECT COUNT(1)
|
||||
FROM bst_ad bad
|
||||
WHERE bad.area_id = #{areaId}
|
||||
AND bad.ad_id != #{adId}
|
||||
AND deleted = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertAd" parameterType="Ad" useGeneratedKeys="true" keyProperty="adId">
|
||||
insert into bst_ad
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="storeId != null">store_id,</if>
|
||||
<if test="areaId != null">area_id,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="belong != null">belong,</if>
|
||||
<if test="picture != null">picture,</if>
|
||||
|
@ -101,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="storeId != null">#{storeId},</if>
|
||||
<if test="areaId != null">#{areaId},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="belong != null">#{belong},</if>
|
||||
<if test="picture != null">#{picture},</if>
|
||||
|
@ -274,10 +286,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where ad_id = #{data.adId}
|
||||
</update>
|
||||
|
||||
<update id="logicalDel">
|
||||
update bst_ad ba set ba.deleted = 1 where ba.ad_id in
|
||||
<foreach item="adId" collection="array" open="(" separator="," close=")">
|
||||
#{adId}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<sql id="updateColumns">
|
||||
<if test="data.storeId != null">store_id = #{data.storeId},</if>
|
||||
<if test="data.areaId != null">area_id = #{data.areaId},</if>
|
||||
<if test="data.type != null">type = #{data.type},</if>
|
||||
<if test="data.picture != null">picture = #{data.picture},</if>
|
||||
<if test="data.url != null">url = #{data.url},</if>
|
||||
<if test="data.belong != null">belong = #{data.belong},</if>
|
||||
<if test="data.createBy != null">create_by = #{data.createBy},</if>
|
||||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||
<if test="data.updateBy != null">update_by = #{data.updateBy},</if>
|
||||
|
|
|
@ -63,7 +63,8 @@ public interface AdService
|
|||
|
||||
AdVO selectOne(AdQuery adQuery);
|
||||
|
||||
List<AdVO> toVOList();
|
||||
|
||||
List<AdVO> toAppVOList();
|
||||
|
||||
public int logicalDel(List<Long> adIds);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ public class AdConverterImpl implements AdConverter {
|
|||
@Override
|
||||
public AdQuery toAdQueryByCreate(Ad ad) {
|
||||
AdQuery query = new AdQuery();
|
||||
query.setStoreId(ad.getStoreId());
|
||||
query.setAreaId(ad.getAreaId());
|
||||
query.setBelong(ad.getBelong());
|
||||
return query;
|
||||
}
|
||||
|
||||
|
@ -29,7 +30,6 @@ public class AdConverterImpl implements AdConverter {
|
|||
public AdQuery toAdStoreVO() {
|
||||
AdQuery query = new AdQuery();
|
||||
query.setUserId(SecurityUtils.getUserId());
|
||||
query.setStoreId(SecurityUtils.getUserId());
|
||||
query.setBelong(AdBlong.STORE.getCode());
|
||||
return query;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.ruoyi.common.core.domain.entity.User;
|
|||
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.system.user.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -65,7 +66,6 @@ public class AdServiceImpl implements AdService
|
|||
@Override
|
||||
public List<AdVO> selectAdList(AdQuery ad)
|
||||
{
|
||||
|
||||
return adMapper.selectAdList(ad);
|
||||
}
|
||||
|
||||
|
@ -78,6 +78,16 @@ public class AdServiceImpl implements AdService
|
|||
@Override
|
||||
public int insertAd(Ad ad)
|
||||
{
|
||||
if (ad.getBelong() == null || ad.getBelong().equals("")){
|
||||
ad.setBelong(AdBlong.STORE.getCode());
|
||||
}
|
||||
AdQuery query = new AdQuery();
|
||||
query.setAreaId(ad.getAreaId());
|
||||
if (ad.getAreaId() != null){
|
||||
AreaVO area = areaService.selectAreaById(ad.getAreaId());
|
||||
ad.setStoreId(area.getUserId());
|
||||
ServiceUtil.assertion(adMapper.selectOne(query)!=null,"当前运营区存在广告已达上限");
|
||||
}
|
||||
ad.setCreateTime(DateUtils.getNowDate());
|
||||
return adMapper.insertAd(ad);
|
||||
}
|
||||
|
@ -91,6 +101,16 @@ public class AdServiceImpl implements AdService
|
|||
@Override
|
||||
public int updateAd(Ad ad)
|
||||
{
|
||||
if (ad.getAreaId() != null){
|
||||
AdVO oldAd = adMapper.selectAdByAdId(ad.getAdId());
|
||||
ServiceUtil.assertion(oldAd == null,"广告不存在");
|
||||
if (!oldAd.getAreaId().equals(ad.getAreaId())){
|
||||
int count = adMapper.countByAreaId(ad.getAreaId(),ad.getAdId());
|
||||
ServiceUtil.assertion(count>0,"该运营区下广告已达上限");
|
||||
}
|
||||
}
|
||||
AreaVO area = areaService.selectAreaById(ad.getAreaId());
|
||||
ad.setStoreId(area.getUserId());
|
||||
ad.setUpdateTime(DateUtils.getNowDate());
|
||||
return adMapper.updateAd(ad);
|
||||
}
|
||||
|
@ -124,39 +144,32 @@ public class AdServiceImpl implements AdService
|
|||
return adMapper.selectOne(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdVO> toVOList() {
|
||||
// 管理员可以查看所有的广告
|
||||
if (SecurityUtils.isAdmin()){
|
||||
return adMapper.selectAdList(new AdQuery());
|
||||
}
|
||||
// 查询对应商户的广告
|
||||
List<AdVO> voList = new ArrayList<>();
|
||||
UserVO user = userService.selectUserById(SecurityUtils.getUserId());
|
||||
if (user != null) {
|
||||
if (user.getAreaId() != null) {
|
||||
AdVO vo = adMapper.selectOne(adConverter.toAdStoreVO());
|
||||
voList.add(vo);
|
||||
}
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdVO> toAppVOList() {
|
||||
// 查询管理员发布的广告
|
||||
List<AdVO> voList = new ArrayList<>();
|
||||
List<AdVO> adminVOList = adMapper.selectAdList(adConverter.toAdAdminVO());
|
||||
|
||||
// 查询对应商户的广告
|
||||
UserVO user = userService.selectUserById(SecurityUtils.getUserId());
|
||||
if (user != null) {
|
||||
if (user.getAreaId() != null) {
|
||||
AdVO vo = adMapper.selectOne(adConverter.toAdStoreVO());
|
||||
voList.add(vo);
|
||||
List<AdVO> list = new ArrayList<>();
|
||||
OrderQuery orderQuery = new OrderQuery();
|
||||
orderQuery.setUserId(SecurityUtils.getUserId());
|
||||
OrderVO orderVO = orderService.selectOne(orderQuery);
|
||||
// 如果有订单,查询对应商户的广告
|
||||
if (orderVO != null) {
|
||||
AdQuery adStoreVO = adConverter.toAdStoreVO();
|
||||
adStoreVO.setStoreId(orderVO.getAreaUserId());
|
||||
AdVO vo = adMapper.selectOne(adStoreVO);
|
||||
if (vo != null) {
|
||||
list.add(vo);
|
||||
}
|
||||
}
|
||||
voList.addAll(adminVOList);
|
||||
return voList;
|
||||
// 查询管理员发布的广告
|
||||
List<AdVO> adminVOList = adMapper.selectAdList(adConverter.toAdAdminVO());
|
||||
if (adminVOList != null) {
|
||||
list.addAll(adminVOList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int logicalDel(List<Long> adIds) {
|
||||
return adMapper.logicalDel(adIds);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,4 +73,6 @@ public interface AgreementMapper
|
|||
public int deleteAgreementByIds(@Param("array") List<Long> ids);
|
||||
|
||||
public AgreementVO selectDistinct(Agreement agreement);
|
||||
|
||||
public AgreementVO selectLatest(AgreementQuery query);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
bag.update_time,
|
||||
su.user_name,
|
||||
ba.name as area_name
|
||||
<include refid="searchTables"></include>
|
||||
</sql>
|
||||
|
||||
<sql id="searchTables">
|
||||
from bst_agreement bag
|
||||
left join sys_user su on bag.store_id = su.user_id
|
||||
left join bst_area ba on bag.area_id = ba.id
|
||||
|
@ -69,7 +73,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
<select id="selectDistinct" resultType="com.ruoyi.bst.agreement.domain.AgreementVO">
|
||||
<include refid="selectAgreementVo"/>
|
||||
where bag.store_id = #{storeId} and bag.agreement_type = #{agreementType} and (bag.id != #{id} or #{id} is null)
|
||||
where bag.area_id = #{areaId} and bag.agreement_type = #{agreementType} and (bag.id != #{id} or #{id} is null)
|
||||
</select>
|
||||
|
||||
<!--查询最新的协议信息-->
|
||||
<select id="selectLatest" resultType="com.ruoyi.bst.agreement.domain.AgreementVO">
|
||||
<include refid="selectAgreementVo"></include>
|
||||
where bag.area_id = #{areaId} and bag.agreement_type = #{agreementType}
|
||||
order by create_time desc limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertAgreement" parameterType="Agreement" useGeneratedKeys="true" keyProperty="id">
|
||||
|
|
|
@ -35,7 +35,7 @@ public interface AgreementService
|
|||
* @param agreement 协议
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAgreement(Agreement agreement);
|
||||
public int insertAgreement(AgreementQuery agreement);
|
||||
|
||||
/**
|
||||
* 修改协议
|
||||
|
@ -60,4 +60,6 @@ public interface AgreementService
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteAgreementById(Long id);
|
||||
|
||||
AgreementVO selectLatest(AgreementQuery query);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import com.ruoyi.bst.area.domain.AreaQuery;
|
||||
import com.ruoyi.bst.area.domain.AreaVO;
|
||||
import com.ruoyi.bst.area.service.AreaService;
|
||||
import com.ruoyi.common.core.domain.vo.UserVO;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.system.user.service.UserService;
|
||||
|
@ -29,6 +30,8 @@ public class AgreementServiceImpl implements AgreementService
|
|||
private AgreementMapper agreementMapper;
|
||||
@Autowired
|
||||
private AreaService areaService;
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 查询协议
|
||||
|
@ -61,13 +64,16 @@ public class AgreementServiceImpl implements AgreementService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAgreement(Agreement agreement)
|
||||
public int insertAgreement(AgreementQuery agreement)
|
||||
{
|
||||
agreement.setCreateTime(DateUtils.getNowDate());
|
||||
AreaVO area = areaService.selectAreaById(agreement.getAreaId());
|
||||
if (area !=null){
|
||||
agreement.setStoreId(area.getUserId());
|
||||
};
|
||||
UserVO user = userService.selectUserById(agreement.getUserId());
|
||||
if (user != null){
|
||||
if (user.getAreaId() != null){
|
||||
agreement.setAreaId(user.getAreaId());
|
||||
}
|
||||
agreement.setStoreId(agreement.getUserId());
|
||||
}
|
||||
distinct(agreement);
|
||||
return agreementMapper.insertAgreement(agreement);
|
||||
}
|
||||
|
@ -87,13 +93,12 @@ public class AgreementServiceImpl implements AgreementService
|
|||
}
|
||||
|
||||
private void distinct(Agreement agreement) {
|
||||
AreaQuery areaQuery = new AreaQuery();
|
||||
areaQuery.setUserId(agreement.getStoreId());
|
||||
AreaVO areaVO = areaService.selectOne(areaQuery);
|
||||
if (areaVO != null) {
|
||||
agreement.setAreaId(areaVO.getId());
|
||||
if (agreement.getAreaId() != null){
|
||||
AreaVO area = areaService.selectAreaById(agreement.getAreaId());
|
||||
ServiceUtil.assertion(area == null,"当前区域不存在");
|
||||
agreement.setStoreId(area.getUserId());
|
||||
ServiceUtil.assertion(agreementMapper.selectDistinct(agreement)!= null,"当前运营区已存在同类协议");
|
||||
}
|
||||
ServiceUtil.assertion(agreementMapper.selectDistinct(agreement)!= null,"当前分类已存在协议");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,4 +124,14 @@ public class AgreementServiceImpl implements AgreementService
|
|||
{
|
||||
return agreementMapper.deleteAgreementById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询最新的协议信息
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AgreementVO selectLatest(AgreementQuery query) {
|
||||
return agreementMapper.selectLatest(query);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ public class FaultConverterImpl implements FaultConverter {
|
|||
po.setUserName(fault.getCreateBy());
|
||||
po.setUserId(fault.getUserId());
|
||||
|
||||
po.setStoreId(device.getMchId());
|
||||
if (device.getOrderId() != null && fault.getOrderId().equals(device.getOrderId())) {
|
||||
po.setOrderId(device.getOrderId());
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
package com.ruoyi.web.app;
|
||||
|
||||
import com.ruoyi.bst.ad.domain.AdQuery;
|
||||
import com.ruoyi.bst.ad.service.AdService;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/ad")
|
||||
|
@ -19,10 +20,8 @@ public class AppAdController extends BaseController {
|
|||
|
||||
@ApiOperation("获取广告")
|
||||
@GetMapping
|
||||
@Anonymous
|
||||
public TableDataInfo getAd() {
|
||||
startPage();
|
||||
return getDataTable(adService.toAppVOList());
|
||||
public AjaxResult getAd() {
|
||||
return success(adService.toAppVOList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,12 +3,10 @@ package com.ruoyi.web.app;
|
|||
import com.ruoyi.bst.agreement.domain.AgreementQuery;
|
||||
import com.ruoyi.bst.agreement.service.AgreementService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/app/agreement")
|
||||
|
@ -17,12 +15,10 @@ public class AppAgreementController extends BaseController {
|
|||
@Autowired
|
||||
private AgreementService agreementService;
|
||||
|
||||
@ApiOperation("查询协议")
|
||||
@GetMapping
|
||||
public TableDataInfo getAgreement(AgreementQuery query) {
|
||||
startPage();
|
||||
startOrderBy();
|
||||
return getDataTable(agreementService.selectAgreementList(query));
|
||||
@ApiOperation("查询最新协议")
|
||||
@GetMapping("/latest")
|
||||
public AjaxResult getAgreement(AgreementQuery query) {
|
||||
return success(agreementService.selectLatest(query));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.ruoyi.bst.ad.enums.AdBlong;
|
|||
import com.ruoyi.bst.ad.service.AdConverter;
|
||||
import com.ruoyi.bst.ad.service.AdService;
|
||||
import com.ruoyi.bst.ad.service.AdValidator;
|
||||
import com.ruoyi.bst.area.service.AreaService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
@ -42,6 +43,8 @@ public class AdController extends BaseController
|
|||
private AdConverter adConverter;
|
||||
@Autowired
|
||||
private AdValidator adValidator;
|
||||
@Autowired
|
||||
private AreaService areaService;
|
||||
|
||||
/**
|
||||
* 查询广告列表
|
||||
|
@ -53,7 +56,8 @@ public class AdController extends BaseController
|
|||
startPage();
|
||||
startOrderBy();
|
||||
query.setScope(true);
|
||||
return getDataTable(adService.toVOList());
|
||||
query.setDeleted(false);
|
||||
return getDataTable(adService.selectAdList(query));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,14 +91,6 @@ public class AdController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Ad ad)
|
||||
{
|
||||
ad.setStoreId(getUserId());
|
||||
ad.setBelong(AdBlong.ADMIN.getCode());
|
||||
// 若当前商户不是超级管理员只能够创建一个广告
|
||||
if (!SecurityUtils.isSysAdmin()){
|
||||
AdVO vo = adService.selectOne(adConverter.toAdQueryByCreate(ad));
|
||||
ad.setBelong(AdBlong.ADMIN.getCode());
|
||||
ServiceUtil.assertion(vo!=null,"该商户可创建广告已达上限");
|
||||
}
|
||||
return toAjax(adService.insertAd(ad));
|
||||
}
|
||||
|
||||
|
@ -123,6 +119,6 @@ public class AdController extends BaseController
|
|||
if (!adValidator.canDeleteAll(adIds)) {
|
||||
return AjaxResult.error("您没有权限删除ID为" + adIds + "的广告信息");
|
||||
}
|
||||
return toAjax(adService.deleteAdByAdIds(adIds));
|
||||
return toAjax(adService.logicalDel(adIds));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,8 +76,9 @@ public class AgreementController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('bst:agreement:add')")
|
||||
@Log(title = "协议", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Agreement agreement)
|
||||
public AjaxResult add(@RequestBody AgreementQuery agreement)
|
||||
{
|
||||
agreement.setUserId(getUserId());
|
||||
return toAjax(agreementService.insertAgreement(agreement));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user