Authored by mali

activity

package com.yohoufo.dal.resource;
import com.yohoufo.dal.resource.model.ActivtyTemplatedFloor;
import java.util.List;
public interface ActivtyTemplatedFloorMapper {
List<ActivtyTemplatedFloor> selectByTemplatedId(Integer templatedId);
}
\ No newline at end of file
... ...
package com.yohoufo.dal.resource;
import com.yohoufo.dal.resource.model.ActivtyTemplated;
public interface ActivtyTemplatedMapper {
ActivtyTemplated selectByPrimaryKey(Integer id);
}
\ No newline at end of file
... ...
package com.yohoufo.dal.resource.model;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class ActivtyTemplated {
private Integer id;
private String title;
private Integer status;
private Integer isDel;
private Integer createTime;
private Integer updateTime;
private String updateUser;
}
\ No newline at end of file
... ...
package com.yohoufo.dal.resource.model;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class ActivtyTemplatedFloor {
private Integer id;
private Integer activtyTemplatedId;
private Integer order;
private Integer isDel;
private String moduleData;
}
\ 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.yohoufo.dal.resource.ActivtyTemplatedFloorMapper" >
<resultMap id="BaseResultMap" type="com.yohoufo.dal.resource.model.ActivtyTemplatedFloor" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="activty_templated_id" property="activtyTemplatedId" jdbcType="INTEGER" />
<result column="order" property="order" jdbcType="INTEGER" />
<result column="is_del" property="isDel" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="com.yohoufo.dal.resource.model.ActivtyTemplatedFloor" extends="BaseResultMap" >
<result column="module_data" property="moduleData" jdbcType="LONGVARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, activty_templated_id, order, is_del
</sql>
<sql id="Blob_Column_List" >
module_data
</sql>
<select id="selectByTemplatedId" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from activty_templated_floor
where activty_templated_id = #{activtyTemplatedId,jdbcType=INTEGER} AND is_del = 0 ORDER BY order ASC
</select>
</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.yohoufo.dal.resource.ActivtyTemplatedMapper" >
<resultMap id="BaseResultMap" type="com.yohoufo.dal.resource.model.ActivtyTemplated" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="title" property="title" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="is_del" property="isDel" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="update_user" property="updateUser" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, title, status, is_del, create_time, update_time, update_user
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from activty_templated
where id = #{id,jdbcType=INTEGER} AND is_del = 0
</select>
</mapper>
\ No newline at end of file
... ...
package com.yohoufo.resource.controller;
import com.yoho.tools.docs.ApiOperation;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.dal.resource.model.ActivtyTemplated;
import com.yohoufo.dal.resource.model.ActivtyTemplatedFloor;
import com.yohoufo.resource.request.ResourcesRequest;
import com.yohoufo.resource.service.IResourcesService;
import com.yohoufo.resource.service.impl.ActivtyTemplatedService;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* Created by li.ma on 2019/10/25.
*/
@RestController
public class ActivtyTemplatedController {
private static final Logger logger = LoggerFactory.getLogger(ActivtyTemplatedController.class);
@Autowired
private ActivtyTemplatedService activtyTemplatedService;
/**
* <p>根据templated_id返回活动模板信息</p>
*
* @param activty templated_id
* @return
* @date: Created on 2018年9月18日 上午10:36:49
*/
@ApiOperation(name = "ufo.activty.get", desc="活动模板获取")
@RequestMapping(params = "method=ufo.activty.get")
@IgnoreSession
@ResponseBody
public ApiResponse getResource(@RequestParam(name = "templated_id") Integer templatedId) {
logger.info("Get activty by content templatedId[{}]", templatedId);
List<ActivtyTemplatedFloor> data = activtyTemplatedService.get(templatedId);
logger.info("Get activty by content templatedId[{}] success.", templatedId);
return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("activty data").build();
}
}
... ...
package com.yohoufo.resource.service.impl;
import com.google.common.collect.Lists;
import com.yohoufo.dal.resource.ActivtyTemplatedFloorMapper;
import com.yohoufo.dal.resource.ActivtyTemplatedMapper;
import com.yohoufo.dal.resource.model.ActivtyTemplated;
import com.yohoufo.dal.resource.model.ActivtyTemplatedFloor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by li.ma on 2019/10/25.
*/
@Service
public class ActivtyTemplatedService {
@Autowired
private ActivtyTemplatedFloorMapper activtyTemplatedFloorMapper;
@Autowired
private ActivtyTemplatedMapper activtyTemplatedMapper;
public List<ActivtyTemplatedFloor> get(Integer templatedId) {
ActivtyTemplated activtyTemplated = activtyTemplatedMapper.selectByPrimaryKey(templatedId);
if (null == activtyTemplated) {
return Lists.newArrayList();
}
List<ActivtyTemplatedFloor> activtyTemplatedFloor = activtyTemplatedFloorMapper.selectByTemplatedId(templatedId);
return activtyTemplatedFloor;
}
}
... ...
... ... @@ -157,6 +157,8 @@ datasources:
- com.yohoufo.dal.resource.ResourcesMapper
- com.yohoufo.dal.resource.ConfigTypeMapper
- com.yohoufo.dal.resource.ResourcesGoodsPoolMapper
- com.yohoufo.dal.resource.ActivtyTemplatedMapper
- com.yohoufo.dal.resource.ActivtyTemplatedFloorMapper
line_shops:
servers:
... ...