Authored by csgyoho

no message

package com.yoho.ufo.dal;
/**
* Created by shengguo.cai on 2018/11/16.
*/
public interface ResourcesContentData {
}
... ...
package com.yoho.ufo.dal;
/**
* Created by shengguo.cai on 2018/11/16.
*/
public interface ResourcesContentMapper {
}
... ...
package com.yoho.ufo.dal;
import com.yoho.ufo.model.resource.Resources;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* Created by shengguo.cai on 2018/11/16.
*/
public interface ResourcesMapper {
List<Resources> selectResourcesByPage(@Param("start") int start,@Param("size") int size);
}
... ...
package com.yoho.ufo.model.resource;
import java.io.Serializable;
/**
* Created by shengguo.cai on 2018/11/16.
*/
public class Resources implements Serializable {
private Integer id;
private String name;
private Integer sortId;
private Integer platformId;
private String code;
private String matchCode;
private Integer createTime;
private Integer publishTime;
private String lockPersonName;
private String lockPersonId;
private Integer lockTime;
private Integer status;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getSortId() {
return sortId;
}
public void setSortId(Integer sortId) {
this.sortId = sortId;
}
public Integer getPlatformId() {
return platformId;
}
public void setPlatformId(Integer platformId) {
this.platformId = platformId;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMatchCode() {
return matchCode;
}
public void setMatchCode(String matchCode) {
this.matchCode = matchCode;
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
public Integer getPublishTime() {
return publishTime;
}
public void setPublishTime(Integer publishTime) {
this.publishTime = publishTime;
}
public String getLockPersonName() {
return lockPersonName;
}
public void setLockPersonName(String lockPersonName) {
this.lockPersonName = lockPersonName;
}
public String getLockPersonId() {
return lockPersonId;
}
public void setLockPersonId(String lockPersonId) {
this.lockPersonId = lockPersonId;
}
public Integer getLockTime() {
return lockTime;
}
public void setLockTime(Integer lockTime) {
this.lockTime = lockTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
... ...
package com.yoho.ufo.model.resource;
import java.io.Serializable;
/**
* Created by shengguo.cai on 2018/11/16.
*/
public class ResourcesContent implements Serializable {
private Integer id;
private Integer platformId;
private Integer sortId;
private Integer resourcesId;
private String name;
private Integer orderBy;
private Integer createTime;
private Integer status;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getPlatformId() {
return platformId;
}
public void setPlatformId(Integer platformId) {
this.platformId = platformId;
}
public Integer getSortId() {
return sortId;
}
public void setSortId(Integer sortId) {
this.sortId = sortId;
}
public Integer getResourcesId() {
return resourcesId;
}
public void setResourcesId(Integer resourcesId) {
this.resourcesId = resourcesId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getOrderBy() {
return orderBy;
}
public void setOrderBy(Integer orderBy) {
this.orderBy = orderBy;
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
... ...
package com.yoho.ufo.model.resource;
/**
* Created by shengguo.cai on 2018/11/16.
*/
public class ResourcesContentData {
private Integer id;
private Integer platformId;
private Integer sortId;
private Integer resourceContentId;
private String templateKey;
private String contentData;
private Integer createTime;
private Integer publishTime;
private Integer updateTime;
private Integer preContentId;
private Integer status;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getPlatformId() {
return platformId;
}
public void setPlatformId(Integer platformId) {
this.platformId = platformId;
}
public Integer getSortId() {
return sortId;
}
public void setSortId(Integer sortId) {
this.sortId = sortId;
}
public Integer getResourceContentId() {
return resourceContentId;
}
public void setResourceContentId(Integer resourceContentId) {
this.resourceContentId = resourceContentId;
}
public String getTemplateKey() {
return templateKey;
}
public void setTemplateKey(String templateKey) {
this.templateKey = templateKey;
}
public String getContentData() {
return contentData;
}
public void setContentData(String contentData) {
this.contentData = contentData;
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
public Integer getPublishTime() {
return publishTime;
}
public void setPublishTime(Integer publishTime) {
this.publishTime = publishTime;
}
public Integer getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Integer updateTime) {
this.updateTime = updateTime;
}
public Integer getPreContentId() {
return preContentId;
}
public void setPreContentId(Integer preContentId) {
this.preContentId = preContentId;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}
... ...
<?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.yoho.ufo.dal.ResourcesContentData">
<resultMap id="BaseResultMap" type="com.yoho.ufo.model.resource.ResourcesContentData" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="platform_id" property="platformId" jdbcType="INTEGER" />
<result column="sort_id" property="sortId" jdbcType="INTEGER" />
<result column="resource_content_id" property="resourceContentId" jdbcType="INTEGER" />
<result column="template_key" property="templateKey" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="publish_time" property="publishTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="pre_content_id" property="preContentId" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="content_data" property="contentData" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id, platform_id, sort_id, resource_content_id, template_key, create_time, publish_time,update_time
, pre_content_id, status,content_data
</sql>
</mapper>
\ No newline at end of file
... ...
<?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.yoho.ufo.dal.ResourcesContentMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.model.resource.ResourcesContent" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="platform_id" property="platformId" jdbcType="INTEGER" />
<result column="sort_id" property="sortId" jdbcType="INTEGER" />
<result column="resources_id" property="resourcesId" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="order_by" property="orderBy" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="TINYINT" />
</resultMap>
<sql id="Base_Column_List">
id, platform_id, sort_id, resources_id, name, order_by, status,create_time
</sql>
</mapper>
\ No newline at end of file
... ...
<?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.yoho.ufo.dal.ResourcesMapper">
<resultMap id="BaseResultMap" type="com.yoho.ufo.model.resource.Resources">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="sort_id" property="sortId" jdbcType="INTEGER" />
<result column="platform_id" property="platformId" jdbcType="INTEGER" />
<result column="code" property="code" jdbcType="VARCHAR" />
<result column="match_code" property="matchCode" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="publish_time" property="publishTime" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="lock_person_name" property="lockPersonName" jdbcType="VARCHAR" />
<result column="lock_person_id" property="lockPersonId" jdbcType="VARCHAR" />
<result column="lock_time" property="lockTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, name, sort_id, platform_id, code, match_code, create_time, publish_time, status,
lock_person_name, lock_person_id, lock_time
</sql>
<select id="selectResourcesByPage" resultType="com.yoho.ufo.model.resource.Resources">
select <include refid="Base_Column_List" /> from resources
limit #{start},#{size}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -40,6 +40,11 @@
<version>${ufo.model.version}</version>
</dependency>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>resource-ufo-model</artifactId>
<version>${ufo.model.version}</version>
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-dal</artifactId>
<version>${project.version}</version>
... ... @@ -61,6 +66,11 @@
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-resource</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-common</artifactId>
<version>${project.version}</version>
</dependency>
... ... @@ -248,5 +258,6 @@
<module>dal</module>
<module>web</module>
<module>deploy</module>
<module>resource</module>
</modules>
</project>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ufo-platform</artifactId>
<groupId>com.yoho.ufo</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ufo-platform-resource</artifactId>
<groupId>com.yoho.ufo</groupId>
<packaging>jar</packaging>
<name>ufo-platform-resource</name>
<dependencies>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-dal</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-common</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo.model</groupId>
<artifactId>resource-ufo-model</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.core</groupId>
<artifactId>yoho-core-dal</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
... ...
package com.yoho.ufo.resource.controller;
import com.yoho.ufo.dal.ResourcesMapper;
import com.yoho.ufo.resource.service.IResourceService;
import com.yoho.ufo.service.model.ApiResponse;
import com.yoho.ufo.service.model.PageRequestBO;
import com.yohobuy.ufo.model.resp.ResourceGetBo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* Created by shengguo.cai on 2018/11/16.
*/
@RestController
@RequestMapping(value = "/resource")
public class ResourceController {
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceController.class);
@Autowired
private IResourceService resourceService;
@Autowired
private ResourcesMapper resourcesMapper;
@RequestMapping(value = "/getResources")
public ApiResponse getResources(PageRequestBO req) {
LOGGER.info("enter getResources,param is {}",req);
if(req == null){
req = new PageRequestBO();
}
List<ResourceGetBo> result = this.resourceService.getResources(req);
return new ApiResponse.ApiResponseBuilder().code(200).data(result).build();
}
}
... ...
package com.yoho.ufo.resource.service;
import com.yoho.ufo.service.model.PageRequestBO;
import com.yohobuy.ufo.model.resp.ResourceGetBo;
import java.util.List;
/**
* Created by shengguo.cai on 2018/11/16.
*/
public interface IResourceService {
List<ResourceGetBo> getResources(PageRequestBO req);
}
... ...
package com.yoho.ufo.resource.service.impl;
import com.yoho.ufo.dal.ResourcesMapper;
import com.yoho.ufo.model.resource.Resources;
import com.yoho.ufo.resource.service.IResourceService;
import com.yoho.ufo.service.model.PageRequestBO;
import com.yohobuy.ufo.model.resp.ResourceGetBo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shengguo.cai on 2018/11/16.
*/
@Service
public class ResourceServiceImpl implements IResourceService{
private static final Logger LOGGER = LoggerFactory.getLogger(ResourceServiceImpl.class);
@Autowired
private ResourcesMapper resourcesMapper;
@Override
public List<ResourceGetBo> getResources(PageRequestBO req) {
LOGGER.info("enter getResources,param is {}",req);
List<Resources> resourcesList = resourcesMapper.selectResourcesByPage(req.getStart(),req.getSize());
if(null == resourcesList){
return null;
}
List<ResourceGetBo> resourceGetBoList = new ArrayList<>();
for(Resources res : resourcesList){
ResourceGetBo bo = new ResourceGetBo(res.getId(), res.getName(), "APP",
res.getCode(), res.getCreateTime());
resourceGetBoList.add(bo);
}
return resourceGetBoList;
}
}
... ...
... ... @@ -37,6 +37,10 @@
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-resource</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.ufo</groupId>
<artifactId>ufo-platform-common</artifactId>
</dependency>
<dependency>
... ...
... ... @@ -33,5 +33,16 @@ datasources:
- com.yoho.order.dal.OrderOperateRecordMapper
- com.yoho.order.dal.TradeBillsMapper
ufo_resource:
servers:
- 192.168.102.219:3306
- 192.168.102.219:3306
username: yh_test
password: 9nm0icOwt6bMHjMusIfMLw==
maxTotal: 100
daos:
- com.yoho.ufo.dal.ResourcesMapper
- com.yoho.ufo.dal.ResourcesContentMapper
- com.yoho.ufo.dal.ResourcesContentData
readOnlyInSlave: true
... ...