Showing
9 changed files
with
190 additions
and
0 deletions
1 | +package com.yohoufo.dal.resource.model; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | +import lombok.ToString; | ||
5 | + | ||
6 | +@Data | ||
7 | +@ToString | ||
8 | +public class ActivtyTemplated { | ||
9 | + private Integer id; | ||
10 | + | ||
11 | + private String title; | ||
12 | + | ||
13 | + private Integer status; | ||
14 | + | ||
15 | + private Integer isDel; | ||
16 | + | ||
17 | + private Integer createTime; | ||
18 | + | ||
19 | + private Integer updateTime; | ||
20 | + | ||
21 | + private String updateUser; | ||
22 | +} |
1 | +package com.yohoufo.dal.resource.model; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | +import lombok.ToString; | ||
5 | + | ||
6 | +@Data | ||
7 | +@ToString | ||
8 | +public class ActivtyTemplatedFloor { | ||
9 | + private Integer id; | ||
10 | + | ||
11 | + private Integer activtyTemplatedId; | ||
12 | + | ||
13 | + private Integer order; | ||
14 | + | ||
15 | + private Integer isDel; | ||
16 | + | ||
17 | + private String moduleData; | ||
18 | +} |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.yohoufo.dal.resource.ActivtyTemplatedFloorMapper" > | ||
4 | + <resultMap id="BaseResultMap" type="com.yohoufo.dal.resource.model.ActivtyTemplatedFloor" > | ||
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | ||
6 | + <result column="activty_templated_id" property="activtyTemplatedId" jdbcType="INTEGER" /> | ||
7 | + <result column="order" property="order" jdbcType="INTEGER" /> | ||
8 | + <result column="is_del" property="isDel" jdbcType="INTEGER" /> | ||
9 | + </resultMap> | ||
10 | + <resultMap id="ResultMapWithBLOBs" type="com.yohoufo.dal.resource.model.ActivtyTemplatedFloor" extends="BaseResultMap" > | ||
11 | + <result column="module_data" property="moduleData" jdbcType="LONGVARCHAR" /> | ||
12 | + </resultMap> | ||
13 | + <sql id="Base_Column_List" > | ||
14 | + id, activty_templated_id, order, is_del | ||
15 | + </sql> | ||
16 | + <sql id="Blob_Column_List" > | ||
17 | + module_data | ||
18 | + </sql> | ||
19 | + <select id="selectByTemplatedId" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" > | ||
20 | + select | ||
21 | + <include refid="Base_Column_List" /> | ||
22 | + , | ||
23 | + <include refid="Blob_Column_List" /> | ||
24 | + from activty_templated_floor | ||
25 | + where activty_templated_id = #{activtyTemplatedId,jdbcType=INTEGER} AND is_del = 0 ORDER BY order ASC | ||
26 | + </select> | ||
27 | +</mapper> |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.yohoufo.dal.resource.ActivtyTemplatedMapper" > | ||
4 | + <resultMap id="BaseResultMap" type="com.yohoufo.dal.resource.model.ActivtyTemplated" > | ||
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | ||
6 | + <result column="title" property="title" jdbcType="VARCHAR" /> | ||
7 | + <result column="status" property="status" jdbcType="INTEGER" /> | ||
8 | + <result column="is_del" property="isDel" jdbcType="INTEGER" /> | ||
9 | + <result column="create_time" property="createTime" jdbcType="INTEGER" /> | ||
10 | + <result column="update_time" property="updateTime" jdbcType="INTEGER" /> | ||
11 | + <result column="update_user" property="updateUser" jdbcType="VARCHAR" /> | ||
12 | + </resultMap> | ||
13 | + <sql id="Base_Column_List" > | ||
14 | + id, title, status, is_del, create_time, update_time, update_user | ||
15 | + </sql> | ||
16 | + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > | ||
17 | + select | ||
18 | + <include refid="Base_Column_List" /> | ||
19 | + from activty_templated | ||
20 | + where id = #{id,jdbcType=INTEGER} AND is_del = 0 | ||
21 | + </select> | ||
22 | +</mapper> |
1 | +package com.yohoufo.resource.controller; | ||
2 | + | ||
3 | +import com.yoho.tools.docs.ApiOperation; | ||
4 | +import com.yohoufo.common.ApiResponse; | ||
5 | +import com.yohoufo.common.annotation.IgnoreSession; | ||
6 | +import com.yohoufo.dal.resource.model.ActivtyTemplated; | ||
7 | +import com.yohoufo.dal.resource.model.ActivtyTemplatedFloor; | ||
8 | +import com.yohoufo.resource.request.ResourcesRequest; | ||
9 | +import com.yohoufo.resource.service.IResourcesService; | ||
10 | +import com.yohoufo.resource.service.impl.ActivtyTemplatedService; | ||
11 | +import org.slf4j.Logger; | ||
12 | +import org.slf4j.LoggerFactory; | ||
13 | +import org.springframework.beans.factory.annotation.Autowired; | ||
14 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
15 | +import org.springframework.web.bind.annotation.RequestParam; | ||
16 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
17 | +import org.springframework.web.bind.annotation.RestController; | ||
18 | + | ||
19 | +import java.util.List; | ||
20 | + | ||
21 | +/** | ||
22 | + * Created by li.ma on 2019/10/25. | ||
23 | + */ | ||
24 | +@RestController | ||
25 | +public class ActivtyTemplatedController { | ||
26 | + private static final Logger logger = LoggerFactory.getLogger(ActivtyTemplatedController.class); | ||
27 | + | ||
28 | + @Autowired | ||
29 | + private ActivtyTemplatedService activtyTemplatedService; | ||
30 | + | ||
31 | + /** | ||
32 | + * <p>根据templated_id返回活动模板信息</p> | ||
33 | + * | ||
34 | + * @param activty templated_id | ||
35 | + * @return | ||
36 | + * @date: Created on 2018年9月18日 上午10:36:49 | ||
37 | + */ | ||
38 | + @ApiOperation(name = "ufo.activty.get", desc="活动模板获取") | ||
39 | + @RequestMapping(params = "method=ufo.activty.get") | ||
40 | + @IgnoreSession | ||
41 | + @ResponseBody | ||
42 | + public ApiResponse getResource(@RequestParam(name = "templated_id") Integer templatedId) { | ||
43 | + | ||
44 | + logger.info("Get activty by content templatedId[{}]", templatedId); | ||
45 | + List<ActivtyTemplatedFloor> data = activtyTemplatedService.get(templatedId); | ||
46 | + logger.info("Get activty by content templatedId[{}] success.", templatedId); | ||
47 | + return new ApiResponse.ApiResponseBuilder().data(data).code(200).message("activty data").build(); | ||
48 | + } | ||
49 | +} |
1 | +package com.yohoufo.resource.service.impl; | ||
2 | + | ||
3 | +import com.google.common.collect.Lists; | ||
4 | +import com.yohoufo.dal.resource.ActivtyTemplatedFloorMapper; | ||
5 | +import com.yohoufo.dal.resource.ActivtyTemplatedMapper; | ||
6 | +import com.yohoufo.dal.resource.model.ActivtyTemplated; | ||
7 | +import com.yohoufo.dal.resource.model.ActivtyTemplatedFloor; | ||
8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
9 | +import org.springframework.stereotype.Service; | ||
10 | + | ||
11 | +import java.util.List; | ||
12 | + | ||
13 | +/** | ||
14 | + * Created by li.ma on 2019/10/25. | ||
15 | + */ | ||
16 | +@Service | ||
17 | +public class ActivtyTemplatedService { | ||
18 | + @Autowired | ||
19 | + private ActivtyTemplatedFloorMapper activtyTemplatedFloorMapper; | ||
20 | + | ||
21 | + @Autowired | ||
22 | + private ActivtyTemplatedMapper activtyTemplatedMapper; | ||
23 | + | ||
24 | + public List<ActivtyTemplatedFloor> get(Integer templatedId) { | ||
25 | + ActivtyTemplated activtyTemplated = activtyTemplatedMapper.selectByPrimaryKey(templatedId); | ||
26 | + | ||
27 | + if (null == activtyTemplated) { | ||
28 | + return Lists.newArrayList(); | ||
29 | + } | ||
30 | + | ||
31 | + List<ActivtyTemplatedFloor> activtyTemplatedFloor = activtyTemplatedFloorMapper.selectByTemplatedId(templatedId); | ||
32 | + return activtyTemplatedFloor; | ||
33 | + } | ||
34 | +} |
@@ -157,6 +157,8 @@ datasources: | @@ -157,6 +157,8 @@ datasources: | ||
157 | - com.yohoufo.dal.resource.ResourcesMapper | 157 | - com.yohoufo.dal.resource.ResourcesMapper |
158 | - com.yohoufo.dal.resource.ConfigTypeMapper | 158 | - com.yohoufo.dal.resource.ConfigTypeMapper |
159 | - com.yohoufo.dal.resource.ResourcesGoodsPoolMapper | 159 | - com.yohoufo.dal.resource.ResourcesGoodsPoolMapper |
160 | + - com.yohoufo.dal.resource.ActivtyTemplatedMapper | ||
161 | + - com.yohoufo.dal.resource.ActivtyTemplatedFloorMapper | ||
160 | 162 | ||
161 | line_shops: | 163 | line_shops: |
162 | servers: | 164 | servers: |
-
Please register or login to post a comment