Commit 1b7d6f15 authored by 廖旭伟's avatar 廖旭伟

增加图片资源

parent a6528e9a
......@@ -120,3 +120,20 @@ ALTER TABLE `mortals_xhx_favorites_businesscard` CHANGE `staffId` `bussinesscard
-- 2024-12-26
-- ----------------------------
ALTER TABLE `mortals_xhx_product` ADD COLUMN `shelves` tinyint(1) DEFAULT '1' COMMENT '是否上架(0.否,1.是)';
-- ----------------------------
-- 图片资源表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_resource_image`;
CREATE TABLE mortals_xhx_resource_image(
`id` bigint(20) AUTO_INCREMENT COMMENT '序号,主键,自增长',
`imageName` varchar(128) COMMENT '名称',
`imageType` tinyint(2) NOT NULL DEFAULT '1' COMMENT '资源类型',
`url` varchar(255) COMMENT '图片地址',
`remark` varchar(255) COMMENT '备注',
`createUserId` bigint(20) COMMENT '创建用户',
`createTime` datetime COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='图片资源';
package com.mortals.xhx.module.resource.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.resource.model.ResourceImageEntity;
import java.util.List;
/**
* 图片资源Dao
* 图片资源 DAO接口
*
* @author zxfei
* @date 2025-01-02
*/
public interface ResourceImageDao extends ICRUDDao<ResourceImageEntity,Long>{
}
package com.mortals.xhx.module.resource.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.resource.dao.ResourceImageDao;
import com.mortals.xhx.module.resource.model.ResourceImageEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 图片资源DaoImpl DAO接口
*
* @author zxfei
* @date 2025-01-02
*/
@Repository("resourceImageDao")
public class ResourceImageDaoImpl extends BaseCRUDDaoMybatis<ResourceImageEntity,Long> implements ResourceImageDao {
}
package com.mortals.xhx.module.resource.model;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.resource.model.vo.ResourceImageVo;
import lombok.Data;
/**
* 图片资源实体对象
*
* @author zxfei
* @date 2025-01-02
*/
@Data
public class ResourceImageEntity extends ResourceImageVo {
private static final long serialVersionUID = 1L;
/**
* 名称
*/
private String imageName;
/**
* 资源类型
*/
private Integer imageType;
/**
* 图片地址
*/
private String url;
/**
* 备注
*/
private String remark;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof ResourceImageEntity) {
ResourceImageEntity tmp = (ResourceImageEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.imageName = "";
this.imageType = 1;
this.url = "";
this.remark = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.resource.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.resource.model.ResourceImageEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 图片资源视图对象
*
* @author zxfei
* @date 2025-01-02
*/
@Data
public class ResourceImageVo extends BaseEntityLong {
/** 序号,主键,自增长列表 */
private List <Long> idList;
}
\ No newline at end of file
package com.mortals.xhx.module.resource.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.resource.model.ResourceImageEntity;
import com.mortals.xhx.module.resource.dao.ResourceImageDao;
/**
* ResourceImageService
*
* 图片资源 service接口
*
* @author zxfei
* @date 2025-01-02
*/
public interface ResourceImageService extends ICRUDService<ResourceImageEntity,Long>{
ResourceImageDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.resource.service.impl;
import org.springframework.beans.BeanUtils;
import java.util.function.Function;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.resource.dao.ResourceImageDao;
import com.mortals.xhx.module.resource.model.ResourceImageEntity;
import com.mortals.xhx.module.resource.service.ResourceImageService;
import lombok.extern.slf4j.Slf4j;
/**
* ResourceImageService
* 图片资源 service实现
*
* @author zxfei
* @date 2025-01-02
*/
@Service("resourceImageService")
@Slf4j
public class ResourceImageServiceImpl extends AbstractCRUDServiceImpl<ResourceImageDao, ResourceImageEntity, Long> implements ResourceImageService {
}
\ No newline at end of file
package com.mortals.xhx.module.resource.web;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.resource.model.ResourceImageEntity;
import com.mortals.xhx.module.resource.service.ResourceImageService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("resourceImage")
public class ResourceImageController extends BaseCRUDJsonBodyMappingController<ResourceImageService, ResourceImageEntity,Long> {
public ResourceImageController(){
super.setModuleDesc( "产品分类");
}
@Override
protected void init(Map<String, Object> model, Context context) {
Map<String,String> imageType = new HashMap<>();
imageType.put("1","名片背景");
this.addDict(model, "shelves", imageType);
super.init(model, context);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment