PC端-商品分类移植,资讯信息功能移植
This commit is contained in:
parent
444d1f8400
commit
9a65e67e61
@ -0,0 +1,529 @@
|
||||
package com.xinelu.common.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 缓存前缀
|
||||
*
|
||||
* @version 4.1
|
||||
* @Author 李甲辉
|
||||
* @since 1.0
|
||||
*/
|
||||
@Getter
|
||||
public enum CachePrefix {
|
||||
|
||||
|
||||
/**
|
||||
* nonce
|
||||
*/
|
||||
NONCE,
|
||||
|
||||
/**
|
||||
* 在线人数
|
||||
*/
|
||||
ONLINE_NUM,
|
||||
|
||||
|
||||
/**
|
||||
* 会员分布数据
|
||||
*/
|
||||
MEMBER_DISTRIBUTION,
|
||||
|
||||
/**
|
||||
* 在线会员统计
|
||||
*/
|
||||
ONLINE_MEMBER,
|
||||
|
||||
/**
|
||||
* token 信息
|
||||
*/
|
||||
ACCESS_TOKEN,
|
||||
/**
|
||||
* token 信息
|
||||
*/
|
||||
REFRESH_TOKEN,
|
||||
/**
|
||||
* 联合登录响应
|
||||
*/
|
||||
CONNECT_RESULT,
|
||||
/**
|
||||
* 微信联合登陆 session key
|
||||
*/
|
||||
SESSION_KEY,
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
PERMISSION_LIST,
|
||||
/**
|
||||
* 部门id列表
|
||||
*/
|
||||
DEPARTMENT_IDS,
|
||||
|
||||
/**
|
||||
* 用户错误登录限制
|
||||
*/
|
||||
LOGIN_TIME_LIMIT,
|
||||
/**
|
||||
* 系统设置
|
||||
*/
|
||||
SETTING,
|
||||
|
||||
/**
|
||||
* 验证码滑块源
|
||||
*/
|
||||
VERIFICATION,
|
||||
|
||||
/**
|
||||
* 验证码滑块源
|
||||
*/
|
||||
VERIFICATION_IMAGE,
|
||||
|
||||
/**
|
||||
* 快递平台
|
||||
*/
|
||||
EXPRESS,
|
||||
|
||||
/**
|
||||
* 图片验证码
|
||||
*/
|
||||
CAPTCHA,
|
||||
|
||||
/**
|
||||
* 商品
|
||||
*/
|
||||
GOODS,
|
||||
|
||||
/**
|
||||
* 商品SKU
|
||||
*/
|
||||
GOODS_SKU,
|
||||
|
||||
/**
|
||||
* 运费模板脚本
|
||||
*/
|
||||
SHIP_SCRIPT,
|
||||
|
||||
/**
|
||||
* 商品sku
|
||||
*/
|
||||
SKU,
|
||||
|
||||
/**
|
||||
* sku库存
|
||||
*/
|
||||
SKU_STOCK,
|
||||
|
||||
/**
|
||||
* 促销商品sku库存
|
||||
*/
|
||||
PROMOTION_GOODS_STOCK,
|
||||
|
||||
/**
|
||||
* 商品库存
|
||||
*/
|
||||
GOODS_STOCK,
|
||||
|
||||
/**
|
||||
* 商品分类 树状结构
|
||||
*/
|
||||
CATEGORY,
|
||||
/**
|
||||
* 商品分类 集合
|
||||
*/
|
||||
CATEGORY_ARRAY,
|
||||
/**
|
||||
* 浏览次数
|
||||
*/
|
||||
VISIT_COUNT,
|
||||
/**
|
||||
* 存储方案
|
||||
*/
|
||||
UPLOADER,
|
||||
/**
|
||||
* 地区
|
||||
*/
|
||||
REGION,
|
||||
|
||||
/**
|
||||
* 短信网关
|
||||
*/
|
||||
SPlATFORM,
|
||||
/**
|
||||
* 短信验证码前缀
|
||||
*/
|
||||
_CODE_PREFIX,
|
||||
/**
|
||||
* smtp
|
||||
*/
|
||||
SMTP,
|
||||
/**
|
||||
* 系统设置
|
||||
*/
|
||||
SETTINGS,
|
||||
/**
|
||||
* 电子面单
|
||||
*/
|
||||
WAYBILL,
|
||||
/**
|
||||
* 短信验证码
|
||||
*/
|
||||
SMS_CODE,
|
||||
/**
|
||||
* 邮箱验证码
|
||||
*/
|
||||
EMAIL_CODE,
|
||||
/**
|
||||
* 管理员角色权限对照表
|
||||
*/
|
||||
ADMIN_URL_ROLE,
|
||||
|
||||
/**
|
||||
* 店铺管理员角色权限对照表
|
||||
*/
|
||||
STORE_URL_ROLE,
|
||||
|
||||
/**
|
||||
* 手机验证标识
|
||||
*/
|
||||
MOBILE_VALIDATE,
|
||||
|
||||
/**
|
||||
* 邮箱验证标识
|
||||
*/
|
||||
EMAIL_VALIDATE,
|
||||
|
||||
/**
|
||||
* 店铺运费模版列表
|
||||
*/
|
||||
SHIP_TEMPLATE,
|
||||
|
||||
/**
|
||||
* 店铺中某个运费模版
|
||||
*/
|
||||
SHIP_TEMPLATE_ONE,
|
||||
|
||||
//================促销=================
|
||||
/**
|
||||
* 促销活动
|
||||
*/
|
||||
PROMOTION,
|
||||
/**
|
||||
* 当前优惠券活动
|
||||
*/
|
||||
CURRENT_COUPON_ACTIVITY,
|
||||
/**
|
||||
* 促销活动
|
||||
*/
|
||||
PROMOTION_GOODS,
|
||||
|
||||
/*** 单品立减 */
|
||||
STORE_ID_MINUS,
|
||||
|
||||
/*** 第二件半价 */
|
||||
STORE_ID_HALF_PRICE,
|
||||
|
||||
/*** 满优惠 */
|
||||
STORE_ID_FULL_DISCOUNT,
|
||||
|
||||
/**
|
||||
* 秒杀活动活动缓存key前缀
|
||||
*/
|
||||
STORE_ID_SECKILL,
|
||||
|
||||
/**
|
||||
* 团购活动缓存key前缀
|
||||
*/
|
||||
STORE_ID_GROUP_BUY,
|
||||
|
||||
/**
|
||||
* 积分商品缓存key前缀
|
||||
*/
|
||||
STORE_ID_EXCHANGE,
|
||||
/**
|
||||
* 会员领取标记
|
||||
*/
|
||||
MEMBER_COUPON_SIGN,
|
||||
|
||||
|
||||
//================交易=================
|
||||
|
||||
/**
|
||||
* 购物车原始数据
|
||||
*/
|
||||
CART_ORIGIN_DATA_PREFIX,
|
||||
|
||||
/**
|
||||
* 立即购买原始数据
|
||||
*/
|
||||
BUY_NOW_ORIGIN_DATA_PREFIX,
|
||||
|
||||
/**
|
||||
* 交易原始数据
|
||||
*/
|
||||
TRADE_ORIGIN_DATA_PREFIX,
|
||||
|
||||
/**
|
||||
* 立即购买sku
|
||||
*/
|
||||
CART_SKU_PREFIX,
|
||||
|
||||
/**
|
||||
* 购物车视图
|
||||
*/
|
||||
CART_MEMBER_ID_PREFIX,
|
||||
|
||||
/**
|
||||
* 购物车,用户选择的促销信息
|
||||
*/
|
||||
CART_PROMOTION_PREFIX,
|
||||
|
||||
|
||||
/**
|
||||
* 交易_交易价格的前缀
|
||||
*/
|
||||
PRICE_SESSION_ID_PREFIX,
|
||||
|
||||
/**
|
||||
* 交易_交易单
|
||||
*/
|
||||
TRADE_SESSION_ID_PREFIX,
|
||||
|
||||
|
||||
/**
|
||||
* 结算参数
|
||||
*/
|
||||
CHECKOUT_PARAM_ID_PREFIX,
|
||||
|
||||
/**
|
||||
* 交易单号前缀
|
||||
*/
|
||||
TRADE_SN_CACHE_PREFIX,
|
||||
|
||||
/**
|
||||
* 订单编号前缀
|
||||
*/
|
||||
ORDER_SN_CACHE_PREFIX,
|
||||
/**
|
||||
* 订单编号标记
|
||||
*/
|
||||
ORDER_SN_SIGN_CACHE_PREFIX,
|
||||
/**
|
||||
* 订单编号前缀
|
||||
*/
|
||||
PAY_LOG_SN_CACHE_PREFIX,
|
||||
|
||||
/**
|
||||
* 合同编号
|
||||
*/
|
||||
CONTRACT_SN_CACHE_PREFIX,
|
||||
|
||||
|
||||
/**
|
||||
* 零钱
|
||||
*/
|
||||
SMALL_CHANGE_CACHE_PREFIX,
|
||||
|
||||
/**
|
||||
* 售后服务单号前缀
|
||||
*/
|
||||
AFTER_SALE_SERVICE_PREFIX,
|
||||
|
||||
/**
|
||||
* 交易
|
||||
*/
|
||||
TRADE,
|
||||
|
||||
/**
|
||||
* 站点导航栏
|
||||
*/
|
||||
SITE_NAVIGATION,
|
||||
|
||||
/**
|
||||
* 支付参数
|
||||
*/
|
||||
PAYMENT_CONFIG,
|
||||
|
||||
/**
|
||||
* 流程控制
|
||||
*/
|
||||
FLOW,
|
||||
|
||||
/**
|
||||
* 热门搜索
|
||||
*/
|
||||
HOT_WORD,
|
||||
|
||||
/**
|
||||
* 会员积分
|
||||
*/
|
||||
MEMBER_POINT,
|
||||
|
||||
/**
|
||||
* 会员积分
|
||||
*/
|
||||
POINT_ORDER,
|
||||
|
||||
|
||||
/**
|
||||
* 微博登录
|
||||
*/
|
||||
WEIBO_STATE,
|
||||
/**
|
||||
* 微博登录
|
||||
*/
|
||||
QQ_STATE,
|
||||
/**
|
||||
* 微博登录
|
||||
*/
|
||||
GITHUB_STATE,
|
||||
/**
|
||||
* 验证码key
|
||||
*/
|
||||
VERIFICATION_KEY,
|
||||
/**
|
||||
* 验证码验证结果
|
||||
*/
|
||||
VERIFICATION_RESULT,
|
||||
/**
|
||||
* 微信CGItoken
|
||||
*/
|
||||
WECHAT_CGI_ACCESS_TOKEN,
|
||||
/**
|
||||
* 微信JSApitoken
|
||||
*/
|
||||
WECHAT_JS_API_TOKEN,
|
||||
/**
|
||||
* 微信会话信息
|
||||
*/
|
||||
WECHAT_SESSION_PARAMS,
|
||||
/**
|
||||
* 第三方用户权限
|
||||
*/
|
||||
ALIPAY_CONFIG,
|
||||
/**
|
||||
* 微信支付配置
|
||||
*/
|
||||
WECHAT_PAY_CONFIG,
|
||||
/**
|
||||
* 微信支付平台证书配置
|
||||
*/
|
||||
WECHAT_PLAT_FORM_CERT,
|
||||
/**
|
||||
* 第三方用户权限
|
||||
*/
|
||||
CONNECT_AUTH,
|
||||
/**
|
||||
* 平台PageView 统计
|
||||
*/
|
||||
PV,
|
||||
/**
|
||||
* 平台UserView 统计
|
||||
*/
|
||||
UV,
|
||||
/**
|
||||
* 平台 商品PV 统计
|
||||
*/
|
||||
GOODS_PV,
|
||||
/**
|
||||
* 平台 商品UV 统计
|
||||
*/
|
||||
GOODS_UV,
|
||||
/**
|
||||
* 店铺PageView 统计
|
||||
*/
|
||||
STORE_PV,
|
||||
/**
|
||||
* 店铺UserView 统计
|
||||
*/
|
||||
STORE_UV,
|
||||
/**
|
||||
* 店铺 商品PV 统计
|
||||
*/
|
||||
STORE_GOODS_PV,
|
||||
/**
|
||||
* 店铺 商品UV 统计
|
||||
*/
|
||||
STORE_GOODS_UV,
|
||||
/**
|
||||
* 分销员
|
||||
*/
|
||||
DISTRIBUTION,
|
||||
/**
|
||||
* 邀请人
|
||||
*/
|
||||
INVITER,
|
||||
|
||||
/**
|
||||
* 找回手机
|
||||
*/
|
||||
FIND_MOBILE,
|
||||
/**
|
||||
* 文章分类
|
||||
*/
|
||||
ARTICLE_CATEGORY,
|
||||
/**
|
||||
* 文章
|
||||
*/
|
||||
ARTICLE_CACHE,
|
||||
|
||||
/**
|
||||
* 初始化索引
|
||||
*/
|
||||
INIT_INDEX_PROCESS,
|
||||
|
||||
/**
|
||||
* 初始化索引标示
|
||||
*/
|
||||
INIT_INDEX_FLAG,
|
||||
|
||||
/**
|
||||
* 店铺
|
||||
*/
|
||||
STORE,
|
||||
/**
|
||||
* 店铺分类
|
||||
*/
|
||||
STORE_CATEGORY,
|
||||
/**
|
||||
* 用户菜单
|
||||
*/
|
||||
MENU_USER_ID,
|
||||
/**
|
||||
* 用户菜单
|
||||
* <p>
|
||||
* 这个缓存并非永久缓存,而是300秒缓存,也就是说修改用户关联的部门,关联的角色,
|
||||
* 部门关联的角色,角色关联的菜单等等,最多需要5分钟才能生效
|
||||
*/
|
||||
STORE_MENU_USER_ID,
|
||||
/**
|
||||
* 用户菜单
|
||||
*/
|
||||
USER_MENU,
|
||||
/**
|
||||
* 用户菜单
|
||||
*/
|
||||
STORE_USER_MENU,
|
||||
/**
|
||||
* 订单暂时缓存
|
||||
*/
|
||||
ORDER,
|
||||
/**
|
||||
* 敏感词
|
||||
*/
|
||||
SENSITIVE,
|
||||
|
||||
/**
|
||||
* 扫码登录
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
QR_CODE_LOGIN_SESSION;
|
||||
|
||||
|
||||
public static String removePrefix(String str) {
|
||||
return str.substring(str.lastIndexOf("}_") + 2);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,124 @@
|
||||
package com.xinelu.manage.controller.goodsCategory;
|
||||
|
||||
import com.xinelu.common.annotation.Log;
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.page.TableDataInfo;
|
||||
import com.xinelu.common.custominterface.Insert;
|
||||
import com.xinelu.common.custominterface.Update;
|
||||
import com.xinelu.common.enums.BusinessType;
|
||||
import com.xinelu.common.utils.poi.ExcelUtil;
|
||||
import com.xinelu.manage.domain.goodsCategory.GoodsCategory;
|
||||
import com.xinelu.manage.service.goodsCategory.IGoodsCategoryService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 商品分类信息Controller
|
||||
*
|
||||
* @author xinyilu
|
||||
* @date 2022-10-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/goodsCategory")
|
||||
public class GoodsCategoryController extends BaseController {
|
||||
@Resource
|
||||
private IGoodsCategoryService goodsCategoryService;
|
||||
|
||||
/**
|
||||
* 查询商品分类信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:goodsCategory:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(GoodsCategory goodsCategory) {
|
||||
startPage();
|
||||
List<GoodsCategory> list = goodsCategoryService.selectGoodsCategoryList(goodsCategory);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出商品分类信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:goodsCategory:export')")
|
||||
@Log(title = "商品分类信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, GoodsCategory goodsCategory) {
|
||||
List<GoodsCategory> list = goodsCategoryService.selectGoodsCategoryList(goodsCategory);
|
||||
ExcelUtil<GoodsCategory> util = new ExcelUtil<>(GoodsCategory.class);
|
||||
util.exportExcel(response, list, "商品分类信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品分类信息详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:goodsCategory:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
if (Objects.isNull(id)) {
|
||||
return AjaxResult.error("商品分类信息不能为空!");
|
||||
}
|
||||
return AjaxResult.success(goodsCategoryService.selectGoodsCategoryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品分类信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:goodsCategory:add')")
|
||||
@Log(title = "商品分类信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(Insert.class) GoodsCategory goodsCategory) {
|
||||
return goodsCategoryService.insertGoodsCategory(goodsCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品分类信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:goodsCategory:edit')")
|
||||
@Log(title = "商品分类信息", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody @Validated(Update.class) GoodsCategory goodsCategory) {
|
||||
return goodsCategoryService.updateGoodsCategory(goodsCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品分类信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:goodsCategory:remove')")
|
||||
@Log(title = "商品分类信息", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return goodsCategoryService.deleteGoodsCategoryByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品分类信息集合树图
|
||||
*
|
||||
* @param goodsCategory 查询条件
|
||||
* @return 返回结果信息
|
||||
*/
|
||||
@GetMapping("/getStationCategoryList")
|
||||
public AjaxResult getStationCategoryList(GoodsCategory goodsCategory) {
|
||||
return AjaxResult.success(goodsCategoryService.selectGoodsCategoryList(goodsCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有的分类 (暂时不用 可做demo)
|
||||
*
|
||||
* @param parentId 查询条件 父级id
|
||||
* @return 返回结果信息
|
||||
*/
|
||||
@GetMapping(value = "/getListAllChildren/{parentId}")
|
||||
public AjaxResult getListAllChildren(@PathVariable String parentId) {
|
||||
if (StringUtils.isBlank(parentId)) {
|
||||
return AjaxResult.error("请输入父级id");
|
||||
}
|
||||
return AjaxResult.success(goodsCategoryService.listAllChildren(parentId));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package com.xinelu.manage.controller.information;
|
||||
|
||||
import com.xinelu.common.annotation.Log;
|
||||
import com.xinelu.common.core.controller.BaseController;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.core.page.TableDataInfo;
|
||||
import com.xinelu.common.custominterface.Insert;
|
||||
import com.xinelu.common.custominterface.Update;
|
||||
import com.xinelu.common.enums.BusinessType;
|
||||
import com.xinelu.common.utils.poi.ExcelUtil;
|
||||
import com.xinelu.manage.domain.information.Information;
|
||||
import com.xinelu.manage.service.information.IInformationService;
|
||||
import com.xinelu.manage.vo.information.InformationVO;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资讯信息管理Controller
|
||||
*
|
||||
* @author xinyilu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/informationInfo")
|
||||
public class InformationController extends BaseController {
|
||||
@Resource
|
||||
private IInformationService informationService;
|
||||
|
||||
/**
|
||||
* 查询资讯信息管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:informationInfo:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Information information) {
|
||||
startPage();
|
||||
List<InformationVO> list = informationService.selectInformationList(information);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出资讯信息管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:informationInfo:export')")
|
||||
@Log(title = "资讯信息管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Information information) {
|
||||
List<InformationVO> list = informationService.selectInformationList(information);
|
||||
ExcelUtil<InformationVO> util = new ExcelUtil<>(InformationVO.class);
|
||||
util.exportExcel(response, list, "资讯信息管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资讯信息管理详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:informationInfo:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(informationService.selectInformationById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资讯信息管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:informationInfo:add')")
|
||||
@Log(title = "资讯信息管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody @Validated(Insert.class) Information information) {
|
||||
return toAjax(informationService.insertInformation(information));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资讯信息管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:informationInfo:edit')")
|
||||
@Log(title = "资讯信息管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody @Validated(Update.class) Information information) {
|
||||
return informationService.updateInformation(information);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资讯信息管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:informationInfo:remove')")
|
||||
@Log(title = "资讯信息管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return informationService.deleteInformationByIds(ids);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,153 @@
|
||||
package com.xinelu.manage.domain.information;
|
||||
|
||||
import com.xinelu.common.annotation.Excel;
|
||||
import com.xinelu.common.core.domain.BaseDomain;
|
||||
import com.xinelu.common.custominterface.Insert;
|
||||
import com.xinelu.common.custominterface.Update;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 资讯信息管理对象 information
|
||||
*
|
||||
* @author xinyilu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "资讯信息管理对象", description = "information")
|
||||
public class Information extends BaseDomain {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "资讯信息不能为空!", groups = {Update.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 资讯所属分类id
|
||||
*/
|
||||
@ApiModelProperty(value = "资讯所属分类id")
|
||||
@Excel(name = "资讯所属分类id")
|
||||
@NotNull(message = "资讯所属分类信息不能为空!", groups = {Insert.class, Update.class})
|
||||
private Long informationCategoryId;
|
||||
|
||||
/**
|
||||
* 资讯标题
|
||||
*/
|
||||
@ApiModelProperty(value = "资讯标题")
|
||||
@Excel(name = "资讯标题")
|
||||
@NotBlank(message = "资讯标题不能为空!", groups = {Insert.class, Update.class})
|
||||
private String informationTitle;
|
||||
|
||||
/**
|
||||
* 资讯编码
|
||||
*/
|
||||
@ApiModelProperty(value = "资讯编码")
|
||||
@Excel(name = "资讯编码")
|
||||
private String informationCode;
|
||||
|
||||
/**
|
||||
* 资讯图文内容,富文本
|
||||
*/
|
||||
@ApiModelProperty(value = "资讯图文内容,富文本")
|
||||
@Excel(name = "资讯图文内容,富文本")
|
||||
@NotBlank(message = "资讯图文内容不能为空!", groups = {Insert.class, Update.class})
|
||||
private String informationContent;
|
||||
|
||||
/**
|
||||
* 资讯点击次数
|
||||
*/
|
||||
@ApiModelProperty(value = "资讯点击次数")
|
||||
@Excel(name = "资讯点击次数")
|
||||
private Integer informationClickCount;
|
||||
|
||||
/**
|
||||
* 资讯跳转路径
|
||||
*/
|
||||
@ApiModelProperty(value = "资讯跳转路径")
|
||||
@Excel(name = "资讯跳转路径")
|
||||
private String informationJumpLink;
|
||||
|
||||
/**
|
||||
* 资讯来源,枚举类型
|
||||
*/
|
||||
@ApiModelProperty(value = "资讯来源,枚举类型")
|
||||
@Excel(name = "资讯来源,枚举类型")
|
||||
private String informationSource;
|
||||
|
||||
/**
|
||||
* 资讯主缩略图地址
|
||||
*/
|
||||
@ApiModelProperty(value = "资讯主缩略图地址")
|
||||
@Excel(name = "资讯主缩略图地址")
|
||||
@NotBlank(message = "资讯主缩略图地址不能为空!", groups = {Insert.class, Update.class})
|
||||
private String leadThumbnailUrl;
|
||||
|
||||
/**
|
||||
* 资讯负缩略图1地址
|
||||
*/
|
||||
@ApiModelProperty(value = "资讯负缩略图1地址")
|
||||
@Excel(name = "资讯负缩略图1地址")
|
||||
private String negativeOneThumbnailUrl;
|
||||
|
||||
/**
|
||||
* 资讯负缩略图2地址
|
||||
*/
|
||||
@ApiModelProperty(value = "资讯负缩略图2地址")
|
||||
@Excel(name = "资讯负缩略图2地址")
|
||||
private String negativeTwoThumbnailUrl;
|
||||
|
||||
/**
|
||||
* 资讯大图地址
|
||||
*/
|
||||
@ApiModelProperty(value = "资讯大图地址")
|
||||
@Excel(name = "资讯大图地址")
|
||||
private String largePictureUrl;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序")
|
||||
@Excel(name = "显示顺序")
|
||||
@NotNull(message = "显示顺序不能为空!", groups = {Insert.class, Update.class})
|
||||
@Size(min = 0, max = 5, message = "显示顺序不能超过5个字符")
|
||||
private Integer informationSort;
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("informationCategoryId", getInformationCategoryId())
|
||||
.append("informationTitle", getInformationTitle())
|
||||
.append("informationCode", getInformationCode())
|
||||
.append("informationContent", getInformationContent())
|
||||
.append("informationClickCount", getInformationClickCount())
|
||||
.append("informationJumpLink", getInformationJumpLink())
|
||||
.append("informationSource", getInformationSource())
|
||||
.append("leadThumbnailUrl", getLeadThumbnailUrl())
|
||||
.append("negativeOneThumbnailUrl", getNegativeOneThumbnailUrl())
|
||||
.append("negativeTwoThumbnailUrl", getNegativeTwoThumbnailUrl())
|
||||
.append("largePictureUrl", getLargePictureUrl())
|
||||
.append("informationSort", getInformationSort())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package com.xinelu.manage.mapper.information;
|
||||
|
||||
import com.xinelu.manage.domain.information.Information;
|
||||
import com.xinelu.manage.domain.informationcategory.InformationCategory;
|
||||
import com.xinelu.manage.vo.information.InformationVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 资讯信息管理Mapper接口
|
||||
*
|
||||
* @author xinyilu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface InformationMapper {
|
||||
/**
|
||||
* 查询资讯信息管理
|
||||
*
|
||||
* @param id 资讯信息管理主键
|
||||
* @return 资讯信息管理
|
||||
*/
|
||||
Information selectInformationById(Long id);
|
||||
|
||||
/**
|
||||
* 查询资讯信息管理列表
|
||||
*
|
||||
* @param information 资讯信息管理
|
||||
* @return 资讯信息管理集合
|
||||
*/
|
||||
List<Information> selectInformationList(Information information);
|
||||
|
||||
/**
|
||||
* 新增资讯信息管理
|
||||
*
|
||||
* @param information 资讯信息管理
|
||||
* @return 结果
|
||||
*/
|
||||
int insertInformation(Information information);
|
||||
|
||||
/**
|
||||
* 修改资讯信息管理
|
||||
*
|
||||
* @param information 资讯信息管理
|
||||
* @return 结果
|
||||
*/
|
||||
int updateInformation(Information information);
|
||||
|
||||
/**
|
||||
* 删除资讯信息管理
|
||||
*
|
||||
* @param id 资讯信息管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteInformationById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除资讯信息管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteInformationByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询资讯信息管理及分类名称
|
||||
*
|
||||
* @param id 资讯信息管理主键
|
||||
* @return 资讯信息管理
|
||||
*/
|
||||
InformationVO getInformationById(Long id);
|
||||
|
||||
/**
|
||||
* 根据id数组查询资讯信息(资讯批量删除)
|
||||
*
|
||||
* @param ids 数组
|
||||
* @return List<Information>
|
||||
*/
|
||||
List<Information> selectInformationByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 查询资讯信息管理列表
|
||||
*
|
||||
* @param information 资讯信息管理
|
||||
* @return 资讯信息管理集合
|
||||
*/
|
||||
List<InformationVO> selectInformationVoList(Information information);
|
||||
|
||||
/**
|
||||
* 根据分类查询资讯信息管理列表
|
||||
*
|
||||
* @param informationCategory 资讯信息管理
|
||||
* @return 资讯信息管理集合
|
||||
*/
|
||||
List<Information> selectInformationByCategory(InformationCategory informationCategory);
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
package com.xinelu.manage.service.goodsCategory;
|
||||
|
||||
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.manage.domain.goodsCategory.GoodsCategory;
|
||||
import com.xinelu.manage.vo.goodsCategory.GoodsCategoryVO;
|
||||
import com.xinelu.manage.vo.goodsCategory.ParentCategory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品分类信息Service接口
|
||||
*
|
||||
* @author xinyilu
|
||||
* @date 2022-10-17
|
||||
*/
|
||||
public interface IGoodsCategoryService {
|
||||
/**
|
||||
* 查询商品分类信息
|
||||
*
|
||||
* @param id 商品分类信息主键
|
||||
* @return 商品分类信息
|
||||
*/
|
||||
ParentCategory selectGoodsCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询商品分类信息列表
|
||||
*
|
||||
* @param goodsCategory 商品分类信息
|
||||
* @return 商品分类信息集合
|
||||
*/
|
||||
List<GoodsCategory> selectGoodsCategoryList(GoodsCategory goodsCategory);
|
||||
|
||||
/**
|
||||
* 新增商品分类信息
|
||||
*
|
||||
* @param goodsCategory 商品分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult insertGoodsCategory(GoodsCategory goodsCategory);
|
||||
|
||||
/**
|
||||
* 修改商品分类信息
|
||||
*
|
||||
* @param goodsCategory 商品分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult updateGoodsCategory(GoodsCategory goodsCategory);
|
||||
|
||||
/**
|
||||
* 批量删除商品分类信息
|
||||
*
|
||||
* @param ids 需要删除的商品分类信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult deleteGoodsCategoryByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除商品分类信息信息
|
||||
*
|
||||
* @param id 商品分类信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteGoodsCategoryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询所有的分类,父子关系
|
||||
*
|
||||
* @param parentId 分类父ID
|
||||
* @return 所有的分类,父子关系
|
||||
*/
|
||||
List<GoodsCategoryVO> listAllChildren(String parentId);
|
||||
|
||||
/**
|
||||
* 获取分类树
|
||||
*
|
||||
* @return 分类树
|
||||
*/
|
||||
List<GoodsCategoryVO> categoryTree();
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,312 @@
|
||||
package com.xinelu.manage.service.goodsCategory.impl;
|
||||
|
||||
import com.xinelu.common.constant.Constants;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.enums.CachePrefix;
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
|
||||
import com.xinelu.manage.domain.goodsCategory.GoodsCategory;
|
||||
import com.xinelu.manage.mapper.goodsCategory.GoodsCategoryMapper;
|
||||
import com.xinelu.manage.service.goodsCategory.IGoodsCategoryService;
|
||||
import com.xinelu.manage.service.nursestationitem.INurseStationItemService;
|
||||
import com.xinelu.manage.service.patientinfo.IPatientInfoService;
|
||||
import com.xinelu.manage.vo.goodsCategory.GoodsCategoryVO;
|
||||
import com.xinelu.manage.vo.goodsCategory.ParentCategory;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.sun.corba.se.impl.util.RepositoryId.cache;
|
||||
|
||||
|
||||
/**
|
||||
* 商品分类信息Service业务层处理
|
||||
*
|
||||
* @author xinyilu
|
||||
* @date 2022-10-17
|
||||
*/
|
||||
@Service
|
||||
public class GoodsCategoryServiceImpl implements IGoodsCategoryService {
|
||||
@Resource
|
||||
private GoodsCategoryMapper goodsCategoryMapper;
|
||||
@Resource
|
||||
private GenerateSystemCodeUtil generateSystemCodeUtil;
|
||||
@Resource
|
||||
private INurseStationItemService nurseStationItemService;
|
||||
@Resource
|
||||
private IPatientInfoService patientInfoService;
|
||||
|
||||
/**
|
||||
* 商品分类的跟级别
|
||||
*/
|
||||
private static final String GOODS_CATEGORY_PARENT_ID = "0";
|
||||
|
||||
/**
|
||||
* 商品分类的一级分类的父级id默认值
|
||||
*/
|
||||
private static final Long GOODS_CATEGORY_PARENT_IDS = 0L;
|
||||
|
||||
/**
|
||||
* 商品分类的一级分类的级别默认值
|
||||
*/
|
||||
private static final Integer GOODS_CATEGORY_ROOT_LEVEL = 1;
|
||||
|
||||
/**
|
||||
* 查询商品分类信息
|
||||
*
|
||||
* @param id 商品分类信息主键
|
||||
* @return 商品分类信息
|
||||
*/
|
||||
@Override
|
||||
public ParentCategory selectGoodsCategoryById(Long id) {
|
||||
return goodsCategoryMapper.selectParentIdById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品分类信息列表
|
||||
*
|
||||
* @param goodsCategory 商品分类信息
|
||||
* @return 商品分类信息
|
||||
*/
|
||||
@Override
|
||||
public List<GoodsCategory> selectGoodsCategoryList(GoodsCategory goodsCategory) {
|
||||
return goodsCategoryMapper.selectGoodsCategoryList(goodsCategory);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增商品分类信息
|
||||
*
|
||||
* @param goodsCategory 商品分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public AjaxResult insertGoodsCategory(GoodsCategory goodsCategory) {
|
||||
//根据商品分类名称查询名称数量
|
||||
int count = goodsCategoryMapper.getGoodsCategoryNameCount(null, goodsCategory.getGoodsCategoryName());
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("商品分类名称重复,请重新录入!");
|
||||
}
|
||||
|
||||
//若商品分类为一级分类则商品分类图片不能为空
|
||||
boolean parentIdEmpty = Objects.isNull(goodsCategory.getParentId()) || goodsCategory.getParentId() == 0;
|
||||
boolean pictureEmpty = StringUtils.isEmpty(goodsCategory.getGoodsCategoryPicture());
|
||||
if (BooleanUtils.isTrue(parentIdEmpty) && BooleanUtils.isTrue(pictureEmpty)) {
|
||||
return AjaxResult.error("商品主分类图片不能为空!");
|
||||
}
|
||||
//若新增父级id为null,则新增一级分类,否则增父级的下级分类
|
||||
if (Objects.isNull(goodsCategory.getParentId()) || goodsCategory.getParentId() == 0) {
|
||||
goodsCategory.setCategoryLevel(GOODS_CATEGORY_ROOT_LEVEL);
|
||||
goodsCategory.setParentId(GOODS_CATEGORY_PARENT_IDS);
|
||||
} else {
|
||||
//查询父级分类信息
|
||||
GoodsCategory selectGoodsCategory = goodsCategoryMapper.selectGoodsCategoryById(goodsCategory.getParentId());
|
||||
if (Objects.isNull(selectGoodsCategory) || Objects.isNull(selectGoodsCategory.getCategoryLevel())) {
|
||||
throw new ServiceException("当前分类所属的父级分类信息不存在,请联系管理员!");
|
||||
}
|
||||
goodsCategory.setCategoryLevel(selectGoodsCategory.getCategoryLevel() + 1);
|
||||
}
|
||||
//设置创建人创建时间以及生成唯一的商品分类编码
|
||||
goodsCategory.setCreateBy(SecurityUtils.getUsername());
|
||||
goodsCategory.setCreateTime(LocalDateTime.now());
|
||||
goodsCategory.setGoodsCategoryCode(Constants.GOODS_CATEGORY_CODE + generateSystemCodeUtil.generateSystemCode(Constants.GOODS_CATEGORY_CODE));
|
||||
int insert = goodsCategoryMapper.insertGoodsCategory(goodsCategory);
|
||||
if (insert <= 0) {
|
||||
throw new ServiceException("新增商品分类信息失败,请联系管理员!");
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品分类信息
|
||||
*
|
||||
* @param goodsCategory 商品分类信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public AjaxResult updateGoodsCategory(GoodsCategory goodsCategory) {
|
||||
GoodsCategory goodsCategoryUrl = goodsCategoryMapper.selectGoodsCategoryById(goodsCategory.getId());
|
||||
if (Objects.isNull(goodsCategoryUrl)) {
|
||||
return AjaxResult.error("当前商品分类信息不存在,请联系管理员!");
|
||||
}
|
||||
if (Objects.nonNull(goodsCategory.getParentId()) && goodsCategory.getParentId().equals(goodsCategory.getId())) {
|
||||
return AjaxResult.error("父级分类名称不能选择当前商品分类名称,请重新选择!");
|
||||
}
|
||||
//根据商品分类名称查询名称数量
|
||||
if (!goodsCategory.getGoodsCategoryName().equals(goodsCategoryUrl.getGoodsCategoryName())) {
|
||||
int count = goodsCategoryMapper.getGoodsCategoryNameCount(goodsCategory.getId(), goodsCategory.getGoodsCategoryName());
|
||||
if (count > 0) {
|
||||
return AjaxResult.error("商品分类名称重复,请重新录入!");
|
||||
}
|
||||
}
|
||||
//若父级id为null,则新增一级分类,否则增父级的下级分类
|
||||
if (Objects.isNull(goodsCategory.getParentId()) || goodsCategory.getParentId() == 0) {
|
||||
goodsCategory.setCategoryLevel(GOODS_CATEGORY_ROOT_LEVEL);
|
||||
goodsCategory.setParentId(GOODS_CATEGORY_PARENT_IDS);
|
||||
} else {
|
||||
GoodsCategory selectGoodsCategory = goodsCategoryMapper.selectGoodsCategoryById(goodsCategory.getParentId());
|
||||
if (Objects.isNull(selectGoodsCategory) || Objects.isNull(selectGoodsCategory.getCategoryLevel())) {
|
||||
throw new ServiceException("当前分类所属的父级分类信息不存在,请联系管理员!");
|
||||
}
|
||||
goodsCategory.setCategoryLevel(selectGoodsCategory.getCategoryLevel() + 1);
|
||||
}
|
||||
//设置修改人以及修改时间
|
||||
goodsCategory.setUpdateBy(SecurityUtils.getUsername());
|
||||
goodsCategory.setUpdateTime(LocalDateTime.now());
|
||||
int update = goodsCategoryMapper.updateGoodsCategory(goodsCategory);
|
||||
if (update <= 0) {
|
||||
throw new ServiceException("修改商品分类信息失败,请联系管理员!");
|
||||
}
|
||||
//删除原有上传的分类图片
|
||||
if (StringUtils.isNotBlank(goodsCategoryUrl.getGoodsCategoryPicture()) && StringUtils.isNotBlank(goodsCategory.getGoodsCategoryPicture())
|
||||
&& !goodsCategory.getGoodsCategoryPicture().equals(goodsCategoryUrl.getGoodsCategoryPicture())) {
|
||||
nurseStationItemService.deletePictureUrl(goodsCategoryUrl.getGoodsCategoryPicture());
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品分类信息
|
||||
*
|
||||
* @param ids 需要删除的商品分类信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult deleteGoodsCategoryByIds(Long[] ids) {
|
||||
//根据id查询本级及下级信息
|
||||
List<GoodsCategory> goodsCategories = goodsCategoryMapper.selectCategoryByIds(ids);
|
||||
if (ids.length != goodsCategories.size()) {
|
||||
return AjaxResult.error("删除失败!该分类存在下级分类!");
|
||||
}
|
||||
//循环查询本级图片
|
||||
List<String> formerPicture = goodsCategories.stream().filter(Objects::nonNull).filter(item -> StringUtils.isNotBlank(item.getGoodsCategoryPicture())).map(GoodsCategory::getGoodsCategoryPicture).distinct().collect(Collectors.toList());
|
||||
//删除商品分类信息
|
||||
int count = goodsCategoryMapper.deleteGoodsCategoryByIds(ids);
|
||||
if (count <= 0) {
|
||||
throw new ServiceException("删除商品分类信息失败,请联系管理员!");
|
||||
}
|
||||
//删除商品主表的图片地址
|
||||
if (CollectionUtils.isNotEmpty(formerPicture)) {
|
||||
patientInfoService.updatePicture(formerPicture);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品分类信息信息
|
||||
*
|
||||
* @param id 商品分类信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteGoodsCategoryById(Long id) {
|
||||
return goodsCategoryMapper.deleteGoodsCategoryById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据父id查询分类
|
||||
*
|
||||
* @param parentId 父id
|
||||
* @return java.util.List<com.xinyilu.base.vo.goodsCategory.GoodsCategoryVO>
|
||||
**/
|
||||
@Override
|
||||
public List<GoodsCategoryVO> listAllChildren(String parentId) {
|
||||
if (GOODS_CATEGORY_PARENT_ID.equals(parentId)) {
|
||||
return categoryTree();
|
||||
}
|
||||
//循环代码,找到对象,把他的子分类返回
|
||||
List<GoodsCategoryVO> topCatList = categoryTree();
|
||||
for (GoodsCategoryVO item : topCatList) {
|
||||
if (item.getId().toString().equals(parentId)) {
|
||||
return item.getChildren();
|
||||
} else {
|
||||
return getChildren(parentId, item.getChildren());
|
||||
}
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 找出子分类返回
|
||||
*
|
||||
* @return java.util.List<com.xinyilu.base.vo.goodsCategory.GoodsCategoryVO>
|
||||
**/
|
||||
@Override
|
||||
public List<GoodsCategoryVO> categoryTree() {
|
||||
List<GoodsCategoryVO> categoryVOList = (List<GoodsCategoryVO>) cache.get(CachePrefix.CATEGORY);
|
||||
if (categoryVOList != null) {
|
||||
return categoryVOList;
|
||||
}
|
||||
//获取全部分类
|
||||
GoodsCategory goodsCategory = new GoodsCategory();
|
||||
List<GoodsCategory> list = goodsCategoryMapper.selectGoodsCategoryList(goodsCategory);
|
||||
//构造分类树
|
||||
categoryVOList = new ArrayList<>();
|
||||
for (GoodsCategory category : list) {
|
||||
if (GOODS_CATEGORY_PARENT_IDS.equals(category.getParentId())) {
|
||||
GoodsCategoryVO categoryVO = new GoodsCategoryVO(category);
|
||||
categoryVO.setChildren(findChildren(list, categoryVO));
|
||||
categoryVOList.add(categoryVO);
|
||||
}
|
||||
}
|
||||
categoryVOList.sort(Comparator.comparing(GoodsCategory::getSort));
|
||||
if (!categoryVOList.isEmpty()) {
|
||||
cache.put(CachePrefix.CATEGORY, categoryVOList);
|
||||
cache.put(CachePrefix.CATEGORY_ARRAY, list);
|
||||
}
|
||||
return categoryVOList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 递归自身,找到id等于parentId的对象,获取他的children 返回
|
||||
*
|
||||
* @param parentId 父ID
|
||||
* @param categoryVOList 分类VO
|
||||
* @return 子分类列表VO
|
||||
*/
|
||||
private List<GoodsCategoryVO> getChildren(String parentId, List<GoodsCategoryVO> categoryVOList) {
|
||||
for (GoodsCategoryVO item : categoryVOList) {
|
||||
if (item.getId().toString().equals(parentId)) {
|
||||
return item.getChildren();
|
||||
}
|
||||
if (item.getChildren() != null && !item.getChildren().isEmpty()) {
|
||||
return getChildren(parentId, item.getChildren());
|
||||
}
|
||||
}
|
||||
return categoryVOList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归树形VO
|
||||
*
|
||||
* @param categories 分类列表
|
||||
* @param categoryVO 分类VO
|
||||
* @return 分类VO列表
|
||||
*/
|
||||
private List<GoodsCategoryVO> findChildren(List<GoodsCategory> categories, GoodsCategoryVO categoryVO) {
|
||||
List<GoodsCategoryVO> children = new ArrayList<>();
|
||||
categories.forEach(item -> {
|
||||
if (item.getParentId().equals(categoryVO.getId())) {
|
||||
GoodsCategoryVO temp = new GoodsCategoryVO(item);
|
||||
temp.setChildren(findChildren(categories, temp));
|
||||
children.add(temp);
|
||||
}
|
||||
});
|
||||
return children;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.xinelu.manage.service.information;
|
||||
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.manage.domain.information.Information;
|
||||
import com.xinelu.manage.vo.information.InformationVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 资讯信息管理Service接口
|
||||
*
|
||||
* @author xinyilu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface IInformationService {
|
||||
/**
|
||||
* 查询资讯信息管理
|
||||
*
|
||||
* @param id 资讯信息管理主键
|
||||
* @return 资讯信息管理
|
||||
*/
|
||||
Information selectInformationById(Long id);
|
||||
|
||||
/**
|
||||
* 查询资讯信息管理列表
|
||||
*
|
||||
* @param information 资讯信息管理
|
||||
* @return 资讯信息管理集合
|
||||
*/
|
||||
List<InformationVO> selectInformationList(Information information);
|
||||
|
||||
/**
|
||||
* 新增资讯信息管理
|
||||
*
|
||||
* @param information 资讯信息管理
|
||||
* @return 结果
|
||||
*/
|
||||
int insertInformation(Information information);
|
||||
|
||||
/**
|
||||
* 修改资讯信息管理
|
||||
*
|
||||
* @param information 资讯信息管理
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult updateInformation(Information information);
|
||||
|
||||
/**
|
||||
* 批量删除资讯信息管理
|
||||
*
|
||||
* @param ids 需要删除的资讯信息管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult deleteInformationByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除资讯信息管理信息
|
||||
*
|
||||
* @param id 资讯信息管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteInformationById(Long id);
|
||||
}
|
||||
@ -0,0 +1,176 @@
|
||||
package com.xinelu.manage.service.information.impl;
|
||||
|
||||
import com.xinelu.common.constant.Constants;
|
||||
import com.xinelu.common.core.domain.AjaxResult;
|
||||
import com.xinelu.common.exception.ServiceException;
|
||||
import com.xinelu.common.utils.SecurityUtils;
|
||||
import com.xinelu.common.utils.codes.GenerateSystemCodeUtil;
|
||||
import com.xinelu.common.utils.file.FileUtils;
|
||||
import com.xinelu.manage.domain.information.Information;
|
||||
import com.xinelu.manage.mapper.information.InformationMapper;
|
||||
import com.xinelu.manage.service.information.IInformationService;
|
||||
import com.xinelu.manage.service.nursestationitem.INurseStationItemService;
|
||||
import com.xinelu.manage.service.patientinfo.IPatientInfoService;
|
||||
import com.xinelu.manage.vo.information.InformationVO;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 资讯信息管理Service业务层处理
|
||||
*
|
||||
* @author xinyilu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Service
|
||||
public class InformationServiceImpl implements IInformationService {
|
||||
@Resource
|
||||
private InformationMapper informationMapper;
|
||||
@Resource
|
||||
private GenerateSystemCodeUtil generateSystemCodeUtil;
|
||||
@Resource
|
||||
private INurseStationItemService nurseStationItemService;
|
||||
@Resource
|
||||
private IPatientInfoService patientInfoService;
|
||||
|
||||
/**
|
||||
* 查询资讯信息管理
|
||||
*
|
||||
* @param id 资讯信息管理主键
|
||||
* @return 资讯信息管理
|
||||
*/
|
||||
@Override
|
||||
public Information selectInformationById(Long id) {
|
||||
return informationMapper.getInformationById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询资讯信息管理列表
|
||||
*
|
||||
* @param information 资讯信息管理
|
||||
* @return 资讯信息管理
|
||||
*/
|
||||
@Override
|
||||
public List<InformationVO> selectInformationList(Information information) {
|
||||
return informationMapper.selectInformationVoList(information);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增资讯信息管理
|
||||
*
|
||||
* @param information 资讯信息管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertInformation(Information information) {
|
||||
information.setCreateTime(LocalDateTime.now());
|
||||
information.setCreateBy(SecurityUtils.getUsername());
|
||||
information.setInformationCode(Constants.INFORMATION_CODE + generateSystemCodeUtil.generateSystemCode(Constants.INFORMATION_CODE));
|
||||
return informationMapper.insertInformation(information);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资讯信息管理
|
||||
*
|
||||
* @param information 资讯信息管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public AjaxResult updateInformation(Information information) {
|
||||
//根据id查询原数据库信息
|
||||
Information existInformation = informationMapper.selectInformationById(information.getId());
|
||||
if (Objects.isNull(existInformation)) {
|
||||
return AjaxResult.error("当前资讯信息不存在,无法修改,请联系管理员!");
|
||||
}
|
||||
//添加修改人,修改时间
|
||||
information.setUpdateTime(LocalDateTime.now());
|
||||
information.setUpdateBy(SecurityUtils.getUsername());
|
||||
//修改
|
||||
int count = informationMapper.updateInformation(information);
|
||||
if (count <= 0) {
|
||||
throw new ServiceException("修改资讯信息失败,请联系管理员!");
|
||||
}
|
||||
//删除缩略图
|
||||
if (!information.getLeadThumbnailUrl().equals(existInformation.getLeadThumbnailUrl())) {
|
||||
nurseStationItemService.deletePictureUrl(existInformation.getLeadThumbnailUrl());
|
||||
}
|
||||
if (StringUtils.isNotBlank(information.getInformationContent())
|
||||
&& StringUtils.isNotBlank(existInformation.getInformationContent())
|
||||
&& !information.getInformationContent().equals(existInformation.getInformationContent())) {
|
||||
List<String> informationImgSrc = FileUtils.getImgSrc(information.getInformationContent());
|
||||
List<String> getInformationImgSrc = FileUtils.getImgSrc(existInformation.getInformationContent());
|
||||
//差集不同的
|
||||
List<String> subtractNurseStationImgSrc = new ArrayList<>(CollectionUtils.subtract(getInformationImgSrc, informationImgSrc));
|
||||
//删除富文本图片
|
||||
for (String pictureUrl : subtractNurseStationImgSrc) {
|
||||
if (StringUtils.isBlank(pictureUrl)) {
|
||||
continue;
|
||||
}
|
||||
//修改路径
|
||||
String substring = pictureUrl.substring(pictureUrl.indexOf("/profile"));
|
||||
//删除富文本图片
|
||||
nurseStationItemService.deletePictureUrl(substring);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除资讯信息管理
|
||||
*
|
||||
* @param ids 需要删除的资讯信息管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public AjaxResult deleteInformationByIds(Long[] ids) {
|
||||
//查询删除之前数据
|
||||
List<Information> informationList = informationMapper.selectInformationByIds(ids);
|
||||
//删除表信息
|
||||
int count = informationMapper.deleteInformationByIds(ids);
|
||||
if (count <= 0) {
|
||||
return AjaxResult.error("删除资讯信息失败!");
|
||||
}
|
||||
//筛选资讯主缩略图
|
||||
List<String> leadThumbnailUrlList = informationList.stream().filter(Objects::nonNull).map(Information::getLeadThumbnailUrl).filter(StringUtils::isNotBlank).collect(Collectors.toList());
|
||||
//删除图片
|
||||
patientInfoService.updatePicture(leadThumbnailUrlList);
|
||||
//筛选资讯内容
|
||||
List<String> informationContentList = informationList.stream().filter(Objects::nonNull).map(Information::getInformationContent).filter(StringUtils::isNotBlank).collect(Collectors.toList());
|
||||
//遍历获取内容图片地址
|
||||
for (String informationContent : informationContentList) {
|
||||
List<String> pictureUrlList = FileUtils.getImgSrc(informationContent);
|
||||
for (String pictureUrl : pictureUrlList) {
|
||||
if (StringUtils.isBlank(pictureUrl)) {
|
||||
continue;
|
||||
}
|
||||
//修改路径
|
||||
String substring = pictureUrl.substring(pictureUrl.indexOf("/profile"));
|
||||
//删除富文本图片
|
||||
nurseStationItemService.deletePictureUrl(substring);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资讯信息管理信息
|
||||
*
|
||||
* @param id 资讯信息管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteInformationById(Long id) {
|
||||
return informationMapper.deleteInformationById(id);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.xinelu.manage.vo.goodsCategory;
|
||||
|
||||
import com.xinelu.common.annotation.Excel;
|
||||
import com.xinelu.common.custominterface.Insert;
|
||||
import com.xinelu.common.custominterface.Update;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ljh
|
||||
* @version 1.0
|
||||
* Create by 2023/1/28 15:05
|
||||
*/
|
||||
@Data
|
||||
public class GoodsCategoryNameVO implements Serializable {
|
||||
private static final long serialVersionUID = -2360475035289257536L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 父级分类id
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 商品分类名称
|
||||
*/
|
||||
@NotBlank(message = "商品分类名称不能为空", groups = {Insert.class, Update.class})
|
||||
@ApiModelProperty(value = "商品分类名称")
|
||||
@Excel(name = "商品分类名称")
|
||||
@Length(max = 10, message = "商品分类名称不能超过10个字符", groups = {Insert.class, Update.class})
|
||||
private String goodsCategoryName;
|
||||
|
||||
/**
|
||||
* 商品分类编码
|
||||
*/
|
||||
@ApiModelProperty(value = "商品分类编码")
|
||||
@Excel(name = "商品分类编码")
|
||||
private String goodsCategoryCode;
|
||||
|
||||
/**
|
||||
* 商品分类图片地址
|
||||
*/
|
||||
@ApiModelProperty(value = "商品分类图片地址")
|
||||
@Excel(name = "商品分类图片地址")
|
||||
private String goodsCategoryPicture;
|
||||
|
||||
/**
|
||||
* 分类概述
|
||||
*/
|
||||
@ApiModelProperty(value = "分类概述")
|
||||
@Excel(name = "分类概述")
|
||||
private String categoryRemark;
|
||||
|
||||
/**
|
||||
* 分类级别,0:代码根节点,1:代表一级节点,依次递增
|
||||
*/
|
||||
private Integer categoryLevel;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
@ApiModelProperty(value = "显示顺序")
|
||||
@Excel(name = "显示顺序")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private List<Integer> goodsCategoryNameId;
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.xinelu.manage.vo.goodsCategory;
|
||||
|
||||
import com.xinelu.manage.domain.goodsCategory.GoodsCategory;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ljh
|
||||
* @version 1.0
|
||||
* Create by 2023/1/13 15:07
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class GoodsCategoryVO extends GoodsCategory {
|
||||
private static final long serialVersionUID = 7306585265130625106L;
|
||||
|
||||
@ApiModelProperty(value = "父节点名称")
|
||||
private String goodsCategoryName;
|
||||
|
||||
@ApiModelProperty("子分类列表")
|
||||
private List<GoodsCategoryVO> children;
|
||||
|
||||
public GoodsCategoryVO(GoodsCategory category) {
|
||||
BeanUtils.copyProperties(category, this);
|
||||
}
|
||||
|
||||
public GoodsCategoryVO(Long id,
|
||||
Long parentId,
|
||||
String goodsCategoryName,
|
||||
String goodsCategoryCode,
|
||||
String goodsCategoryPicture,
|
||||
String categoryRemark,
|
||||
Integer categoryLevel,
|
||||
Integer sort) {
|
||||
super(id,
|
||||
parentId,
|
||||
goodsCategoryName,
|
||||
goodsCategoryCode,
|
||||
goodsCategoryPicture,
|
||||
categoryRemark,
|
||||
categoryLevel,
|
||||
sort);
|
||||
}
|
||||
|
||||
|
||||
public List<GoodsCategoryVO> getChildren() {
|
||||
|
||||
if (children != null) {
|
||||
children.sort(new Comparator<GoodsCategoryVO>() {
|
||||
@Override
|
||||
public int compare(GoodsCategoryVO o1, GoodsCategoryVO o2) {
|
||||
return o1.getSort().compareTo(o2.getSort());
|
||||
}
|
||||
});
|
||||
return children;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.xinelu.manage.vo.information;
|
||||
|
||||
import com.xinelu.manage.domain.information.Information;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 资讯信息管理对象 information
|
||||
*
|
||||
* @author ZH
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class InformationVO extends Information implements Serializable {
|
||||
private static final long serialVersionUID = 182835156741534308L;
|
||||
|
||||
/**
|
||||
* 资讯分类名称
|
||||
*/
|
||||
private String informationCategoryName;
|
||||
}
|
||||
@ -0,0 +1,323 @@
|
||||
<?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.xinelu.manage.mapper.information.InformationMapper">
|
||||
|
||||
<resultMap type="Information" id="InformationResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="informationCategoryId" column="information_category_id"/>
|
||||
<result property="informationTitle" column="information_title"/>
|
||||
<result property="informationCode" column="information_code"/>
|
||||
<result property="informationContent" column="information_content"/>
|
||||
<result property="informationClickCount" column="information_click_count"/>
|
||||
<result property="informationJumpLink" column="information_jump_link"/>
|
||||
<result property="informationSource" column="information_source"/>
|
||||
<result property="leadThumbnailUrl" column="lead_thumbnail_url"/>
|
||||
<result property="negativeOneThumbnailUrl" column="negative_one_thumbnail_url"/>
|
||||
<result property="negativeTwoThumbnailUrl" column="negative_two_thumbnail_url"/>
|
||||
<result property="largePictureUrl" column="large_picture_url"/>
|
||||
<result property="informationSort" column="information_sort"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInformationVo">
|
||||
select id,
|
||||
information_category_id,
|
||||
information_title,
|
||||
information_code,
|
||||
information_content,
|
||||
information_click_count,
|
||||
information_jump_link,
|
||||
information_source,
|
||||
lead_thumbnail_url,
|
||||
negative_one_thumbnail_url,
|
||||
negative_two_thumbnail_url,
|
||||
large_picture_url,
|
||||
information_sort,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from information
|
||||
</sql>
|
||||
|
||||
<select id="selectInformationList" parameterType="Information" resultMap="InformationResult">
|
||||
<include refid="selectInformationVo"/>
|
||||
<where>
|
||||
<if test="informationCategoryId != null ">
|
||||
and information_category_id = #{informationCategoryId}
|
||||
</if>
|
||||
<if test="informationTitle != null and informationTitle != ''">
|
||||
and information_title like concat('%',#{informationTitle}, '%')
|
||||
</if>
|
||||
<if test="informationCode != null and informationCode != ''">
|
||||
and information_code = #{informationCode}
|
||||
</if>
|
||||
<if test="informationContent != null and informationContent != ''">
|
||||
and information_content = #{informationContent}
|
||||
</if>
|
||||
<if test="informationClickCount != null ">
|
||||
and information_click_count = #{informationClickCount}
|
||||
</if>
|
||||
<if test="informationJumpLink != null and informationJumpLink != ''">
|
||||
and information_jump_link = #{informationJumpLink}
|
||||
</if>
|
||||
<if test="informationSource != null and informationSource != ''">
|
||||
and information_source = #{informationSource}
|
||||
</if>
|
||||
<if test="leadThumbnailUrl != null and leadThumbnailUrl != ''">
|
||||
and lead_thumbnail_url = #{leadThumbnailUrl}
|
||||
</if>
|
||||
<if test="negativeOneThumbnailUrl != null and negativeOneThumbnailUrl != ''">
|
||||
and negative_one_thumbnail_url = #{negativeOneThumbnailUrl}
|
||||
</if>
|
||||
<if test="negativeTwoThumbnailUrl != null and negativeTwoThumbnailUrl != ''">
|
||||
and negative_two_thumbnail_url = #{negativeTwoThumbnailUrl}
|
||||
</if>
|
||||
<if test="largePictureUrl != null and largePictureUrl != ''">
|
||||
and large_picture_url = #{largePictureUrl}
|
||||
</if>
|
||||
<if test="informationSort != null ">
|
||||
and information_sort = #{informationSort}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
id DESC
|
||||
</select>
|
||||
|
||||
<select id="selectInformationById" parameterType="Long"
|
||||
resultMap="InformationResult">
|
||||
<include refid="selectInformationVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertInformation" parameterType="Information" useGeneratedKeys="true"
|
||||
keyProperty="id">
|
||||
insert into information
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="informationCategoryId != null">information_category_id,
|
||||
</if>
|
||||
<if test="informationTitle != null">information_title,
|
||||
</if>
|
||||
<if test="informationCode != null">information_code,
|
||||
</if>
|
||||
<if test="informationContent != null">information_content,
|
||||
</if>
|
||||
<if test="informationClickCount != null">information_click_count,
|
||||
</if>
|
||||
<if test="informationJumpLink != null">information_jump_link,
|
||||
</if>
|
||||
<if test="informationSource != null">information_source,
|
||||
</if>
|
||||
<if test="leadThumbnailUrl != null">lead_thumbnail_url,
|
||||
</if>
|
||||
<if test="negativeOneThumbnailUrl != null">negative_one_thumbnail_url,
|
||||
</if>
|
||||
<if test="negativeTwoThumbnailUrl != null">negative_two_thumbnail_url,
|
||||
</if>
|
||||
<if test="largePictureUrl != null">large_picture_url,
|
||||
</if>
|
||||
<if test="informationSort != null">information_sort,
|
||||
</if>
|
||||
<if test="createBy != null">create_by,
|
||||
</if>
|
||||
<if test="createTime != null">create_time,
|
||||
</if>
|
||||
<if test="updateBy != null">update_by,
|
||||
</if>
|
||||
<if test="updateTime != null">update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="informationCategoryId != null">#{informationCategoryId},
|
||||
</if>
|
||||
<if test="informationTitle != null">#{informationTitle},
|
||||
</if>
|
||||
<if test="informationCode != null">#{informationCode},
|
||||
</if>
|
||||
<if test="informationContent != null">#{informationContent},
|
||||
</if>
|
||||
<if test="informationClickCount != null">#{informationClickCount},
|
||||
</if>
|
||||
<if test="informationJumpLink != null">#{informationJumpLink},
|
||||
</if>
|
||||
<if test="informationSource != null">#{informationSource},
|
||||
</if>
|
||||
<if test="leadThumbnailUrl != null">#{leadThumbnailUrl},
|
||||
</if>
|
||||
<if test="negativeOneThumbnailUrl != null">#{negativeOneThumbnailUrl},
|
||||
</if>
|
||||
<if test="negativeTwoThumbnailUrl != null">#{negativeTwoThumbnailUrl},
|
||||
</if>
|
||||
<if test="largePictureUrl != null">#{largePictureUrl},
|
||||
</if>
|
||||
<if test="informationSort != null">#{informationSort},
|
||||
</if>
|
||||
<if test="createBy != null">#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateInformation" parameterType="Information">
|
||||
update information
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="informationCategoryId != null">information_category_id =
|
||||
#{informationCategoryId},
|
||||
</if>
|
||||
<if test="informationTitle != null">information_title =
|
||||
#{informationTitle},
|
||||
</if>
|
||||
<if test="informationCode != null">information_code =
|
||||
#{informationCode},
|
||||
</if>
|
||||
<if test="informationContent != null">information_content =
|
||||
#{informationContent},
|
||||
</if>
|
||||
<if test="informationClickCount != null">information_click_count =
|
||||
#{informationClickCount},
|
||||
</if>
|
||||
<if test="informationJumpLink != null">information_jump_link =
|
||||
#{informationJumpLink},
|
||||
</if>
|
||||
<if test="informationSource != null">information_source =
|
||||
#{informationSource},
|
||||
</if>
|
||||
<if test="leadThumbnailUrl != null">lead_thumbnail_url =
|
||||
#{leadThumbnailUrl},
|
||||
</if>
|
||||
<if test="negativeOneThumbnailUrl != null">negative_one_thumbnail_url =
|
||||
#{negativeOneThumbnailUrl},
|
||||
</if>
|
||||
<if test="negativeTwoThumbnailUrl != null">negative_two_thumbnail_url =
|
||||
#{negativeTwoThumbnailUrl},
|
||||
</if>
|
||||
<if test="largePictureUrl != null">large_picture_url =
|
||||
#{largePictureUrl},
|
||||
</if>
|
||||
<if test="informationSort != null">information_sort =
|
||||
#{informationSort},
|
||||
</if>
|
||||
<if test="createBy != null">create_by =
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">create_time =
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">update_by =
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">update_time =
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteInformationById" parameterType="Long">
|
||||
delete
|
||||
from information
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteInformationByIds" parameterType="String">
|
||||
delete from information where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getInformationById" resultType="com.xinelu.manage.vo.information.InformationVO">
|
||||
select im.id,
|
||||
im.information_category_id,
|
||||
im.information_title,
|
||||
im.information_code,
|
||||
im.information_content,
|
||||
im.information_click_count,
|
||||
im.information_jump_link,
|
||||
im.information_source,
|
||||
im.lead_thumbnail_url,
|
||||
im.negative_one_thumbnail_url,
|
||||
im.negative_two_thumbnail_url,
|
||||
im.large_picture_url,
|
||||
im.information_sort,
|
||||
ic.information_category_name
|
||||
from information im
|
||||
LEFT JOIN information_category ic ON ic.id = im.information_category_id
|
||||
where im.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectInformationByIds" resultType="com.xinelu.manage.domain.information.Information">
|
||||
<include refid="selectInformationVo"/>
|
||||
where id in
|
||||
<foreach item="ids" collection="array" open="(" separator="," close=")">
|
||||
#{ids}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectInformationVoList" resultType="com.xinelu.manage.vo.information.InformationVO">
|
||||
SELECT im.id,
|
||||
im.information_category_id,
|
||||
im.information_title,
|
||||
im.information_code,
|
||||
im.information_content,
|
||||
im.information_click_count,
|
||||
im.information_jump_link,
|
||||
im.information_source,
|
||||
im.lead_thumbnail_url,
|
||||
im.negative_one_thumbnail_url,
|
||||
im.negative_two_thumbnail_url,
|
||||
im.large_picture_url,
|
||||
im.information_sort,
|
||||
im.create_by,
|
||||
im.create_time,
|
||||
ic.information_category_name
|
||||
from information im
|
||||
LEFT JOIN information_category ic ON ic.id = im.information_category_id
|
||||
<where>
|
||||
<if test="informationCategoryId != null ">
|
||||
and im.information_category_id = #{informationCategoryId}
|
||||
</if>
|
||||
<if test="informationTitle != null and informationTitle != ''">
|
||||
and im.information_title like concat('%',#{informationTitle}, '%')
|
||||
</if>
|
||||
<if test="informationCode != null and informationCode != ''">
|
||||
and im.information_code = #{informationCode}
|
||||
</if>
|
||||
<if test="informationContent != null and informationContent != ''">
|
||||
and im.information_content = #{informationContent}
|
||||
</if>
|
||||
<if test="informationClickCount != null ">
|
||||
and im.information_click_count = #{informationClickCount}
|
||||
</if>
|
||||
<if test="informationJumpLink != null and informationJumpLink != ''">
|
||||
and im.information_jump_link = #{informationJumpLink}
|
||||
</if>
|
||||
<if test="informationSource != null and informationSource != ''">
|
||||
and im.information_source = #{informationSource}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY
|
||||
im.information_sort ASC,
|
||||
im.id DESC
|
||||
</select>
|
||||
|
||||
<select id="selectInformationByCategory" resultType="com.xinelu.manage.domain.information.Information">
|
||||
select ifn.id,
|
||||
ifn.information_title,
|
||||
ifn.information_content,
|
||||
ifn.lead_thumbnail_url
|
||||
from information_category ic
|
||||
LEFT JOIN information ifn ON ic.id = ifn.information_category_id
|
||||
where ic.information_category_type = #{informationCategoryType}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user