文章广告
This commit is contained in:
parent
7752a981ed
commit
b9437e3e8c
|
|
@ -1,21 +1,113 @@
|
|||
package com.ruoyi.content.controller;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.content.domain.CmsArticleAdInfo;
|
||||
import com.ruoyi.content.service.ICmsArticleAdInfoService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* @program: ruoyi->AdvertisementController
|
||||
* @description: 广告
|
||||
* @author: LiuShenlu
|
||||
* @create: 2021-03-23 16:26
|
||||
**/
|
||||
* 文章广告Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-03-23
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("adverts")
|
||||
@RequestMapping("/content/adverts")
|
||||
public class AdvertisementController extends BaseController {
|
||||
|
||||
private String prefix = "adverts";
|
||||
private String prefix = "content/adverts";
|
||||
|
||||
@Autowired
|
||||
private ICmsArticleAdInfoService cmsArticleAdInfoService;
|
||||
|
||||
@RequiresPermissions("content:adverts:view")
|
||||
@GetMapping()
|
||||
public String adverts() {
|
||||
return prefix + "/adverts";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文章广告列表
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(CmsArticleAdInfo cmsArticleAdInfo) {
|
||||
startPage();
|
||||
List<CmsArticleAdInfo> list = cmsArticleAdInfoService.selectCmsArticleAdInfoList(cmsArticleAdInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出文章广告列表
|
||||
*/
|
||||
@Log(title = "文章广告", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(CmsArticleAdInfo cmsArticleAdInfo) {
|
||||
List<CmsArticleAdInfo> list = cmsArticleAdInfoService.selectCmsArticleAdInfoList(cmsArticleAdInfo);
|
||||
ExcelUtil<CmsArticleAdInfo> util = new ExcelUtil<CmsArticleAdInfo>(CmsArticleAdInfo.class);
|
||||
return util.exportExcel(list, "adverts");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文章广告
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add() {
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存文章广告
|
||||
*/
|
||||
@Log(title = "文章广告", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(CmsArticleAdInfo cmsArticleAdInfo) {
|
||||
return toAjax(cmsArticleAdInfoService.insertCmsArticleAdInfo(cmsArticleAdInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文章广告
|
||||
*/
|
||||
public String edit(@PathVariable("adId") Long adId, ModelMap mmap) {
|
||||
CmsArticleAdInfo cmsArticleAdInfo = cmsArticleAdInfoService.selectCmsArticleAdInfoById(adId);
|
||||
mmap.put("cmsArticleAdInfo", cmsArticleAdInfo);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存文章广告
|
||||
*/
|
||||
@Log(title = "文章广告", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(CmsArticleAdInfo cmsArticleAdInfo) {
|
||||
return toAjax(cmsArticleAdInfoService.updateCmsArticleAdInfo(cmsArticleAdInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文章广告
|
||||
*/
|
||||
@Log(title = "文章广告", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
return toAjax(cmsArticleAdInfoService.deleteCmsArticleAdInfoByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.content.mapper;
|
|||
|
||||
|
||||
import com.ruoyi.content.domain.CmsArticleAdInfo;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -11,8 +12,8 @@ import java.util.List;
|
|||
* @author ruoyi
|
||||
* @date 2021-03-23
|
||||
*/
|
||||
public interface CmsArticleAdInfoMapper
|
||||
{
|
||||
@Repository
|
||||
public interface CmsArticleAdInfoMapper {
|
||||
/**
|
||||
* 查询文章广告
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ruoyi.content.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -16,8 +17,8 @@ import com.ruoyi.common.core.text.Convert;
|
|||
* @date 2021-03-23
|
||||
*/
|
||||
@Service
|
||||
public class CmsArticleAdInfoServiceImpl implements ICmsArticleAdInfoService
|
||||
{
|
||||
public class CmsArticleAdInfoServiceImpl implements ICmsArticleAdInfoService {
|
||||
|
||||
@Autowired
|
||||
private CmsArticleAdInfoMapper cmsArticleAdInfoMapper;
|
||||
|
||||
|
|
@ -28,8 +29,7 @@ public class CmsArticleAdInfoServiceImpl implements ICmsArticleAdInfoService
|
|||
* @return 文章广告
|
||||
*/
|
||||
@Override
|
||||
public CmsArticleAdInfo selectCmsArticleAdInfoById(Long adId)
|
||||
{
|
||||
public CmsArticleAdInfo selectCmsArticleAdInfoById(Long adId) {
|
||||
return cmsArticleAdInfoMapper.selectCmsArticleAdInfoById(adId);
|
||||
}
|
||||
|
||||
|
|
@ -40,8 +40,7 @@ public class CmsArticleAdInfoServiceImpl implements ICmsArticleAdInfoService
|
|||
* @return 文章广告
|
||||
*/
|
||||
@Override
|
||||
public List<CmsArticleAdInfo> selectCmsArticleAdInfoList(CmsArticleAdInfo cmsArticleAdInfo)
|
||||
{
|
||||
public List<CmsArticleAdInfo> selectCmsArticleAdInfoList(CmsArticleAdInfo cmsArticleAdInfo) {
|
||||
return cmsArticleAdInfoMapper.selectCmsArticleAdInfoList(cmsArticleAdInfo);
|
||||
}
|
||||
|
||||
|
|
@ -52,8 +51,7 @@ public class CmsArticleAdInfoServiceImpl implements ICmsArticleAdInfoService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertCmsArticleAdInfo(CmsArticleAdInfo cmsArticleAdInfo)
|
||||
{
|
||||
public int insertCmsArticleAdInfo(CmsArticleAdInfo cmsArticleAdInfo) {
|
||||
cmsArticleAdInfo.setCreateTime(DateUtils.getNowDate());
|
||||
return cmsArticleAdInfoMapper.insertCmsArticleAdInfo(cmsArticleAdInfo);
|
||||
}
|
||||
|
|
@ -65,8 +63,7 @@ public class CmsArticleAdInfoServiceImpl implements ICmsArticleAdInfoService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateCmsArticleAdInfo(CmsArticleAdInfo cmsArticleAdInfo)
|
||||
{
|
||||
public int updateCmsArticleAdInfo(CmsArticleAdInfo cmsArticleAdInfo) {
|
||||
cmsArticleAdInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return cmsArticleAdInfoMapper.updateCmsArticleAdInfo(cmsArticleAdInfo);
|
||||
}
|
||||
|
|
@ -78,8 +75,7 @@ public class CmsArticleAdInfoServiceImpl implements ICmsArticleAdInfoService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCmsArticleAdInfoByIds(String ids)
|
||||
{
|
||||
public int deleteCmsArticleAdInfoByIds(String ids) {
|
||||
return cmsArticleAdInfoMapper.deleteCmsArticleAdInfoByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
|
|
@ -90,8 +86,7 @@ public class CmsArticleAdInfoServiceImpl implements ICmsArticleAdInfoService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteCmsArticleAdInfoById(Long adId)
|
||||
{
|
||||
public int deleteCmsArticleAdInfoById(Long adId) {
|
||||
return cmsArticleAdInfoMapper.deleteCmsArticleAdInfoById(adId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,132 +0,0 @@
|
|||
<?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="com.ruoyi.content.mapper.CmsArticleAdInfoMapper">
|
||||
|
||||
<resultMap type="CmsArticleAdInfo" id="CmsArticleAdInfoResult">
|
||||
<result property="adId" column="AD_ID" />
|
||||
<result property="companyId" column="COMPANY_ID" />
|
||||
<result property="adType" column="AD_TYPE" />
|
||||
<result property="adTypeName" column="AD_TYPE_NAME" />
|
||||
<result property="adLinkUrl" column="AD_LINK_URL" />
|
||||
<result property="adTitle" column="AD_TITLE" />
|
||||
<result property="adName" column="AD_NAME" />
|
||||
<result property="adSummary" column="AD_SUMMARY" />
|
||||
<result property="adColorType" column="AD_COLOR_TYPE" />
|
||||
<result property="adImageUrl" column="AD_IMAGE_URL" />
|
||||
<result property="adState" column="AD_STATE" />
|
||||
<result property="createDate" column="CREATE_DATE" />
|
||||
<result property="createTime" column="CREATE_TIME" />
|
||||
<result property="createUser" column="CREATE_USER" />
|
||||
<result property="updateUser" column="UPDATE_USER" />
|
||||
<result property="updateDate" column="UPDATE_DATE" />
|
||||
<result property="updateTime" column="UPDATE_TIME" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCmsArticleAdInfoVo">
|
||||
select AD_ID, COMPANY_ID, AD_TYPE, AD_TYPE_NAME, AD_LINK_URL, AD_TITLE, AD_NAME, AD_SUMMARY, AD_COLOR_TYPE, AD_IMAGE_URL, AD_STATE, CREATE_DATE, CREATE_TIME, CREATE_USER, UPDATE_USER, UPDATE_DATE, UPDATE_TIME from cms_article_ad_info
|
||||
</sql>
|
||||
|
||||
<select id="selectCmsArticleAdInfoList" parameterType="CmsArticleAdInfo" resultMap="CmsArticleAdInfoResult">
|
||||
<include refid="selectCmsArticleAdInfoVo"/>
|
||||
<where>
|
||||
<if test="companyId != null and companyId != ''"> and COMPANY_ID = #{companyId}</if>
|
||||
<if test="adType != null and adType != ''"> and AD_TYPE = #{adType}</if>
|
||||
<if test="adTypeName != null and adTypeName != ''"> and AD_TYPE_NAME like concat('%', #{adTypeName}, '%')</if>
|
||||
<if test="adLinkUrl != null and adLinkUrl != ''"> and AD_LINK_URL = #{adLinkUrl}</if>
|
||||
<if test="adTitle != null and adTitle != ''"> and AD_TITLE = #{adTitle}</if>
|
||||
<if test="adName != null and adName != ''"> and AD_NAME like concat('%', #{adName}, '%')</if>
|
||||
<if test="adSummary != null and adSummary != ''"> and AD_SUMMARY = #{adSummary}</if>
|
||||
<if test="adColorType != null and adColorType != ''"> and AD_COLOR_TYPE = #{adColorType}</if>
|
||||
<if test="adImageUrl != null and adImageUrl != ''"> and AD_IMAGE_URL = #{adImageUrl}</if>
|
||||
<if test="adState != null and adState != ''"> and AD_STATE = #{adState}</if>
|
||||
<if test="createDate != null and createDate != ''"> and CREATE_DATE = #{createDate}</if>
|
||||
<if test="createTime != null and createTime != ''"> and CREATE_TIME = #{createTime}</if>
|
||||
<if test="createUser != null and createUser != ''"> and CREATE_USER = #{createUser}</if>
|
||||
<if test="updateUser != null and updateUser != ''"> and UPDATE_USER = #{updateUser}</if>
|
||||
<if test="updateDate != null and updateDate != ''"> and UPDATE_DATE = #{updateDate}</if>
|
||||
<if test="updateTime != null and updateTime != ''"> and UPDATE_TIME = #{updateTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectCmsArticleAdInfoById" parameterType="Long" resultMap="CmsArticleAdInfoResult">
|
||||
<include refid="selectCmsArticleAdInfoVo"/>
|
||||
where AD_ID = #{adId}
|
||||
</select>
|
||||
|
||||
<insert id="insertCmsArticleAdInfo" parameterType="CmsArticleAdInfo" useGeneratedKeys="true" keyProperty="adId">
|
||||
insert into cms_article_ad_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="companyId != null">COMPANY_ID,</if>
|
||||
<if test="adType != null">AD_TYPE,</if>
|
||||
<if test="adTypeName != null">AD_TYPE_NAME,</if>
|
||||
<if test="adLinkUrl != null">AD_LINK_URL,</if>
|
||||
<if test="adTitle != null">AD_TITLE,</if>
|
||||
<if test="adName != null">AD_NAME,</if>
|
||||
<if test="adSummary != null">AD_SUMMARY,</if>
|
||||
<if test="adColorType != null">AD_COLOR_TYPE,</if>
|
||||
<if test="adImageUrl != null">AD_IMAGE_URL,</if>
|
||||
<if test="adState != null">AD_STATE,</if>
|
||||
<if test="createDate != null">CREATE_DATE,</if>
|
||||
<if test="createTime != null">CREATE_TIME,</if>
|
||||
<if test="createUser != null">CREATE_USER,</if>
|
||||
<if test="updateUser != null">UPDATE_USER,</if>
|
||||
<if test="updateDate != null">UPDATE_DATE,</if>
|
||||
<if test="updateTime != null">UPDATE_TIME,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="companyId != null">#{companyId},</if>
|
||||
<if test="adType != null">#{adType},</if>
|
||||
<if test="adTypeName != null">#{adTypeName},</if>
|
||||
<if test="adLinkUrl != null">#{adLinkUrl},</if>
|
||||
<if test="adTitle != null">#{adTitle},</if>
|
||||
<if test="adName != null">#{adName},</if>
|
||||
<if test="adSummary != null">#{adSummary},</if>
|
||||
<if test="adColorType != null">#{adColorType},</if>
|
||||
<if test="adImageUrl != null">#{adImageUrl},</if>
|
||||
<if test="adState != null">#{adState},</if>
|
||||
<if test="createDate != null">#{createDate},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createUser != null">#{createUser},</if>
|
||||
<if test="updateUser != null">#{updateUser},</if>
|
||||
<if test="updateDate != null">#{updateDate},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateCmsArticleAdInfo" parameterType="CmsArticleAdInfo">
|
||||
update cms_article_ad_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="companyId != null">COMPANY_ID = #{companyId},</if>
|
||||
<if test="adType != null">AD_TYPE = #{adType},</if>
|
||||
<if test="adTypeName != null">AD_TYPE_NAME = #{adTypeName},</if>
|
||||
<if test="adLinkUrl != null">AD_LINK_URL = #{adLinkUrl},</if>
|
||||
<if test="adTitle != null">AD_TITLE = #{adTitle},</if>
|
||||
<if test="adName != null">AD_NAME = #{adName},</if>
|
||||
<if test="adSummary != null">AD_SUMMARY = #{adSummary},</if>
|
||||
<if test="adColorType != null">AD_COLOR_TYPE = #{adColorType},</if>
|
||||
<if test="adImageUrl != null">AD_IMAGE_URL = #{adImageUrl},</if>
|
||||
<if test="adState != null">AD_STATE = #{adState},</if>
|
||||
<if test="createDate != null">CREATE_DATE = #{createDate},</if>
|
||||
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
|
||||
<if test="createUser != null">CREATE_USER = #{createUser},</if>
|
||||
<if test="updateUser != null">UPDATE_USER = #{updateUser},</if>
|
||||
<if test="updateDate != null">UPDATE_DATE = #{updateDate},</if>
|
||||
<if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
|
||||
</trim>
|
||||
where AD_ID = #{adId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCmsArticleAdInfoById" parameterType="Long">
|
||||
delete from cms_article_ad_info where AD_ID = #{adId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteCmsArticleAdInfoByIds" parameterType="String">
|
||||
delete from cms_article_ad_info where AD_ID in
|
||||
<foreach item="adId" collection="array" open="(" separator="," close=")">
|
||||
#{adId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -90,16 +90,16 @@
|
|||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="content:adverts:add">
|
||||
<a class="btn btn-success" onclick="$.operate.add()">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="content:adverts:edit">
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="content:adverts:remove">
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="content:adverts:export">
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -110,8 +110,6 @@
|
|||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('content:adverts:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('content:adverts:remove')}]];
|
||||
var prefix = ctx + "content/adverts";
|
||||
|
||||
$(function() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue