浏览代码

Merge remote-tracking branch 'origin/master'

周箭河 5 年之前
父节点
当前提交
5f34774479

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TenantEntryActivitesDao.java

@@ -0,0 +1,9 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.TenantEntryActivites;
+import com.ym.mec.common.dal.BaseDAO;
+
+public interface TenantEntryActivitesDao extends BaseDAO<Integer, TenantEntryActivites> {
+
+	
+}

+ 158 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TenantEntryActivites.java

@@ -0,0 +1,158 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(tenant_entry_activites):
+ */
+public class TenantEntryActivites {
+
+	/**  */
+	private Integer id;
+	
+	/**  */
+	private String name;
+	
+	/**  */
+	private String coverImg;
+	
+	/**  */
+	private String detail;
+	
+	/**  */
+	private java.math.BigDecimal totalPrice;
+	
+	/**  */
+	private java.math.BigDecimal discountPrice;
+	
+	/**  */
+	private Integer giveMinutes;
+	
+	/**  */
+	private java.util.Date startDate;
+	
+	/**  */
+	private java.util.Date endDate;
+	
+	/**  */
+	private String condition;
+	
+	/**  */
+	private boolean delFlag;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setName(String name){
+		this.name = name;
+	}
+	
+	public String getName(){
+		return this.name;
+	}
+			
+	public void setCoverImg(String coverImg){
+		this.coverImg = coverImg;
+	}
+	
+	public String getCoverImg(){
+		return this.coverImg;
+	}
+			
+	public void setDetail(String detail){
+		this.detail = detail;
+	}
+	
+	public String getDetail(){
+		return this.detail;
+	}
+			
+	public void setTotalPrice(java.math.BigDecimal totalPrice){
+		this.totalPrice = totalPrice;
+	}
+	
+	public java.math.BigDecimal getTotalPrice(){
+		return this.totalPrice;
+	}
+			
+	public void setDiscountPrice(java.math.BigDecimal discountPrice){
+		this.discountPrice = discountPrice;
+	}
+	
+	public java.math.BigDecimal getDiscountPrice(){
+		return this.discountPrice;
+	}
+			
+	public void setGiveMinutes(Integer giveMinutes){
+		this.giveMinutes = giveMinutes;
+	}
+	
+	public Integer getGiveMinutes(){
+		return this.giveMinutes;
+	}
+			
+	public void setStartDate(java.util.Date startDate){
+		this.startDate = startDate;
+	}
+	
+	public java.util.Date getStartDate(){
+		return this.startDate;
+	}
+			
+	public void setEndDate(java.util.Date endDate){
+		this.endDate = endDate;
+	}
+	
+	public java.util.Date getEndDate(){
+		return this.endDate;
+	}
+			
+	public void setCondition(String condition){
+		this.condition = condition;
+	}
+	
+	public String getCondition(){
+		return this.condition;
+	}
+			
+	public void setDelFlag(boolean delFlag){
+		this.delFlag = delFlag;
+	}
+	
+	public boolean isDelFlag(){
+		return this.delFlag;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 32 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/TenantEntryActivitesQueryInfo.java

@@ -0,0 +1,32 @@
+package com.ym.mec.biz.dal.page;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
+import com.ym.mec.common.page.QueryInfo;
+
+public class TenantEntryActivitesQueryInfo extends QueryInfo {
+
+	@ApiModelProperty(value = "开始时间", required = false)
+	private Date startDate;
+
+	private Boolean delFlag;
+
+	public Date getStartDate() {
+		return startDate;
+	}
+
+	public void setStartDate(Date startDate) {
+		this.startDate = startDate;
+	}
+
+	public Boolean getDelFlag() {
+		return delFlag;
+	}
+
+	public void setDelFlag(Boolean delFlag) {
+		this.delFlag = delFlag;
+	}
+
+}

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/TenantEntryActivitesService.java

@@ -0,0 +1,14 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.TenantEntryActivites;
+import com.ym.mec.common.service.BaseService;
+
+public interface TenantEntryActivitesService extends BaseService<Integer, TenantEntryActivites> {
+
+	/**
+	 * 合并对象
+	 * @param tenantEntryActivites
+	 * @return
+	 */
+	public boolean merge(TenantEntryActivites tenantEntryActivites);
+}

+ 51 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantEntryActivitesServiceImpl.java

@@ -0,0 +1,51 @@
+package com.ym.mec.biz.service.impl;
+
+import java.util.Date;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ym.mec.biz.dal.dao.TenantEntryActivitesDao;
+import com.ym.mec.biz.dal.entity.TenantEntryActivites;
+import com.ym.mec.biz.service.TenantEntryActivitesService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+
+@Service
+public class TenantEntryActivitesServiceImpl extends BaseServiceImpl<Integer, TenantEntryActivites> implements TenantEntryActivitesService {
+
+	@Autowired
+	private TenantEntryActivitesDao tenantEntryActivitesDao;
+
+	@Override
+	public BaseDAO<Integer, TenantEntryActivites> getDAO() {
+		return tenantEntryActivitesDao;
+	}
+
+	@Override
+	public boolean merge(TenantEntryActivites tenantEntryActivites) {
+
+		if (!tenantEntryActivites.getStartDate().before(tenantEntryActivites.getEndDate())) {
+			throw new BizException("活动开始时间必须在结束时间之前");
+		}
+
+		Date date = new Date();
+		if (tenantEntryActivites.getId() != null) {
+			TenantEntryActivites orginTenantEntryActivites = tenantEntryActivitesDao.get(tenantEntryActivites.getId());
+
+			if (orginTenantEntryActivites == null) {
+				throw new BizException("操作失败,请检查输入参数");
+			}
+			tenantEntryActivites.setCreateTime(orginTenantEntryActivites.getCreateTime());
+			tenantEntryActivites.setUpdateTime(date);
+			tenantEntryActivitesDao.update(tenantEntryActivites);
+		} else {
+			tenantEntryActivites.setCreateTime(date);
+			tenantEntryActivites.setUpdateTime(date);
+			tenantEntryActivitesDao.insert(tenantEntryActivites);
+		}
+		return true;
+	}
+
+}

+ 122 - 0
mec-biz/src/main/resources/config/mybatis/TenantEntryActivitesMapper.xml

@@ -0,0 +1,122 @@
+<?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.ym.mec.biz.dal.dao.TenantEntryActivitesDao">
+
+	<resultMap type="com.ym.mec.biz.dal.entity.TenantEntryActivites"
+		id="TenantEntryActivites">
+		<result column="id_" property="id" />
+		<result column="name_" property="name" />
+		<result column="cover_img_" property="coverImg" />
+		<result column="detail_" property="detail" />
+		<result column="total_price_" property="totalPrice" />
+		<result column="discount_price_" property="discountPrice" />
+		<result column="give_minutes_" property="giveMinutes" />
+		<result column="start_date_" property="startDate" />
+		<result column="end_date_" property="endDate" />
+		<result column="condition_" property="condition" />
+		<result column="del_flag_" property="delFlag" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+	
+	<sql id="queryCondition">
+		<where>
+			<if test="startDate != null">
+				and (start_date_ &gt;= #{startDate} and end_date_ &lt;= #{startDate})
+			</if>
+			<if test="delFlag != null">
+				and del_flag_ = #{delFlag}
+			</if>
+		</where>
+	</sql>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="TenantEntryActivites">
+		SELECT * FROM tenant_entry_activites WHERE id_ = #{id}
+	</select>
+
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="TenantEntryActivites">
+		SELECT * FROM
+		tenant_entry_activites ORDER BY id_
+	</select>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.TenantEntryActivites"
+		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
+			AS ID FROM DUAL </selectKey> -->
+		INSERT INTO tenant_entry_activites
+		(id_,name_,cover_img_,detail_,total_price_,discount_price_,give_minutes_,start_date_,end_date_,condition_,del_flag_,create_time_,update_time_)
+		VALUES(#{id},#{name},#{coverImg},#{detail},#{totalPrice},#{discountPrice},#{giveMinutes},#{startDate},#{endDate},#{condition},#{delFlag},#{createTime},#{updateTime})
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.TenantEntryActivites">
+		UPDATE tenant_entry_activites
+		<set>
+			<if test="condition != null">
+				condition_ = #{condition},
+			</if>
+			<if test="delFlag != null">
+				del_flag_ = #{delFlag},
+			</if>
+			<if test="startDate != null">
+				start_date_ = #{startDate},
+			</if>
+			<if test="coverImg != null">
+				cover_img_ = #{coverImg},
+			</if>
+			<if test="id != null">
+				id_ = #{id},
+			</if>
+			<if test="giveMinutes != null">
+				give_minutes_ = #{giveMinutes},
+			</if>
+			<if test="name != null">
+				name_ = #{name},
+			</if>
+			<if test="createTime != null">
+				create_time_ = #{createTime},
+			</if>
+			<if test="totalPrice != null">
+				total_price_ = #{totalPrice},
+			</if>
+			<if test="detail != null">
+				detail_ = #{detail},
+			</if>
+			<if test="endDate != null">
+				end_date_ = #{endDate},
+			</if>
+			<if test="updateTime != null">
+				update_time_ = #{updateTime},
+			</if>
+			<if test="discountPrice != null">
+				discount_price_ = #{discountPrice},
+			</if>
+		</set>
+		WHERE id_ = #{id}
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete">
+		DELETE FROM tenant_entry_activites WHERE id_ = #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="TenantEntryActivites"
+		parameterType="map">
+		SELECT * FROM tenant_entry_activites
+		<include refid="queryCondition" />
+		order by id_ desc
+		<include refid="global.limit" />
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM tenant_entry_activites
+		<include refid="queryCondition" />
+		order by id_ desc
+	</select>
+</mapper>

+ 33 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TenantEntryActivitesController.java

@@ -0,0 +1,33 @@
+package com.ym.mec.teacher.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.Date;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.biz.dal.page.TenantEntryActivitesQueryInfo;
+import com.ym.mec.biz.service.TenantEntryActivitesService;
+import com.ym.mec.common.controller.BaseController;
+
+@RequestMapping("tenantEntryActivites")
+@Api(tags = "租客入驻活动")
+@RestController
+public class TenantEntryActivitesController extends BaseController {
+
+    @Autowired
+    private TenantEntryActivitesService tenantEntryActivitesService;
+
+    @ApiOperation(value = "分页查询活动列表")
+    @GetMapping("/queryPage")
+    public Object queryPage(TenantEntryActivitesQueryInfo queryInfo) {
+    	queryInfo.setDelFlag(false);
+    	queryInfo.setStartDate(new Date());
+        return succeed(tenantEntryActivitesService.queryPage(queryInfo));
+    }
+
+}

+ 49 - 0
mec-web/src/main/java/com/ym/mec/web/controller/TenantEntryActivitesController.java

@@ -0,0 +1,49 @@
+package com.ym.mec.web.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.biz.dal.entity.TenantEntryActivites;
+import com.ym.mec.biz.service.TenantEntryActivitesService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.page.QueryInfo;
+
+@RequestMapping("tenantEntryActivites")
+@Api(tags = "租客入驻活动")
+@RestController
+public class TenantEntryActivitesController extends BaseController {
+
+	@Autowired
+	private TenantEntryActivitesService tenantEntryActivitesService;
+
+	@ApiOperation(value = "分页查询活动列表")
+	@GetMapping("/queryPage")
+	@PreAuthorize("@pcs.hasPermissions('tenantEntryActivites/queryPage')")
+	public Object queryPage(QueryInfo queryInfo) {
+		return succeed(tenantEntryActivitesService.queryPage(queryInfo));
+	}
+
+	@ApiOperation(value = "查询活动信息")
+	@GetMapping("/query")
+	@PreAuthorize("@pcs.hasPermissions('tenantEntryActivites/query')")
+	public Object query(Integer id) {
+		return succeed(tenantEntryActivitesService.get(id));
+	}
+
+	@ApiOperation(value = "新增、修改活动")
+	@PostMapping("/merge")
+	@PreAuthorize("@pcs.hasPermissions('tenantEntryActivites/merge')")
+	public Object merge(@RequestBody TenantEntryActivites tenantEntryActivites) {
+		tenantEntryActivitesService.merge(tenantEntryActivites);
+		return succeed();
+	}
+
+}