Explorar el Código

add:分部课程单价设置

yonge hace 5 años
padre
commit
9e1ee611af

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/OrganizationCourseUnitPriceSettingsDao.java

@@ -0,0 +1,16 @@
+package com.ym.mec.biz.dal.dao;
+
+import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
+import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+import com.ym.mec.common.dal.BaseDAO;
+
+public interface OrganizationCourseUnitPriceSettingsDao extends BaseDAO<Integer, OrganizationCourseUnitPriceSettings> {
+
+	/**
+	 * 根据分部编号以及课程类型查询对象
+	 * @param organId 分部编号
+	 * @param courseType 课程类型
+	 * @return
+	 */
+	OrganizationCourseUnitPriceSettings queryByOrganIdAndCourseType(Integer organId, CourseScheduleType courseType);
+}

+ 83 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/OrganizationCourseUnitPriceSettings.java

@@ -0,0 +1,83 @@
+package com.ym.mec.biz.dal.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+
+/**
+ * 对应数据库表(organization_course_unit_price_settings):
+ */
+public class OrganizationCourseUnitPriceSettings {
+
+	/**  */
+	private Integer id;
+	
+	/**  */
+	private Integer organId;
+	
+	/** 课程类型 */
+	private CourseScheduleType courseType;
+	
+	/** 单价的json串(key-乐团模式,value-单价) */
+	private String unitPriceJson;
+	
+	/**  */
+	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 setOrganId(Integer organId){
+		this.organId = organId;
+	}
+	
+	public Integer getOrganId(){
+		return this.organId;
+	}
+			
+	public CourseScheduleType getCourseType() {
+		return courseType;
+	}
+
+	public void setCourseType(CourseScheduleType courseType) {
+		this.courseType = courseType;
+	}
+
+	public void setUnitPriceJson(String unitPriceJson){
+		this.unitPriceJson = unitPriceJson;
+	}
+	
+	public String getUnitPriceJson(){
+		return this.unitPriceJson;
+	}
+			
+	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);
+	}
+
+}

+ 31 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/OrganizationCourseUnitPriceSettingsQueryInfo.java

@@ -0,0 +1,31 @@
+package com.ym.mec.biz.dal.page;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+import com.ym.mec.common.page.QueryInfo;
+
+public class OrganizationCourseUnitPriceSettingsQueryInfo extends QueryInfo {
+
+	@ApiModelProperty(value = "分部编号", required = false)
+	private Integer organId;
+	
+	@ApiModelProperty(value = "课程类型", required = false)
+	private CourseScheduleType courseScheduleType;
+
+	public Integer getOrganId() {
+		return organId;
+	}
+
+	public void setOrganId(Integer organId) {
+		this.organId = organId;
+	}
+
+	public CourseScheduleType getCourseScheduleType() {
+		return courseScheduleType;
+	}
+
+	public void setCourseScheduleType(CourseScheduleType courseScheduleType) {
+		this.courseScheduleType = courseScheduleType;
+	}
+}

+ 16 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/OrganizationCourseUnitPriceSettingsService.java

@@ -0,0 +1,16 @@
+package com.ym.mec.biz.service;
+
+import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
+import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+import com.ym.mec.common.service.BaseService;
+
+public interface OrganizationCourseUnitPriceSettingsService extends BaseService<Integer, OrganizationCourseUnitPriceSettings> {
+
+	/**
+	 * 根据分部编号以及课程类型查询对象
+	 * @param organId 分部编号
+	 * @param courseType 课程类型
+	 * @return
+	 */
+	OrganizationCourseUnitPriceSettings queryByOrganIdAndCourseType(Integer organId, CourseScheduleType courseType);
+}

+ 29 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationCourseUnitPriceSettingsServiceImpl.java

@@ -0,0 +1,29 @@
+package com.ym.mec.biz.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.ym.mec.biz.dal.dao.OrganizationCourseUnitPriceSettingsDao;
+import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
+import com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings;
+import com.ym.mec.biz.service.OrganizationCourseUnitPriceSettingsService;
+import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.service.impl.BaseServiceImpl;
+
+@Service
+public class OrganizationCourseUnitPriceSettingsServiceImpl extends BaseServiceImpl<Integer, OrganizationCourseUnitPriceSettings>  implements OrganizationCourseUnitPriceSettingsService {
+	
+	@Autowired
+	private OrganizationCourseUnitPriceSettingsDao organizationCourseUnitPriceSettingsDao;
+
+	@Override
+	public BaseDAO<Integer, OrganizationCourseUnitPriceSettings> getDAO() {
+		return organizationCourseUnitPriceSettingsDao;
+	}
+
+	@Override
+	public OrganizationCourseUnitPriceSettings queryByOrganIdAndCourseType(Integer organId, CourseScheduleType courseType) {
+		return organizationCourseUnitPriceSettingsDao.queryByOrganIdAndCourseType(organId, courseType);
+	}
+	
+}

+ 96 - 0
mec-biz/src/main/resources/config/mybatis/OrganizationCourseUnitPriceSettingsMapper.xml

@@ -0,0 +1,96 @@
+<?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.OrganizationCourseUnitPriceSettingsDao">
+
+	<resultMap type="com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings" id="OrganizationCourseUnitPriceSettings">
+		<result column="id_" property="id" />
+		<result column="organ_id_" property="organId" />
+		<result column="course_type_" property="courseType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
+		<result column="unit_price_json_" property="unitPriceJson" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+	</resultMap>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="OrganizationCourseUnitPriceSettings">
+		SELECT * FROM organization_course_unit_price_settings WHERE id_ = #{id}
+	</select>
+
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="OrganizationCourseUnitPriceSettings">
+		SELECT * FROM organization_course_unit_price_settings ORDER BY id_
+	</select>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
+			AS ID FROM DUAL </selectKey> -->
+		INSERT INTO organization_course_unit_price_settings
+		(id_,organ_id_,course_type_,unit_price_json_,create_time_,update_time_)
+		VALUES(#{id},#{organId},#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{unitPriceJson},#{createTime},#{updateTime})
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.ym.mec.biz.dal.entity.OrganizationCourseUnitPriceSettings">
+		UPDATE organization_course_unit_price_settings
+		<set>
+			<if test="organId != null">
+				organ_id_ = #{organId},
+			</if>
+			<if test="id != null">
+				id_ = #{id},
+			</if>
+			<if test="updateTime != null">
+				update_time_ = #{updateTime},
+			</if>
+			<if test="courseType != null">
+				course_type_ = #{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
+			</if>
+			<if test="unitPriceJson != null">
+				unit_price_json_ = #{unitPriceJson},
+			</if>
+			<if test="createTime != null">
+				create_time_ = #{createTime},
+			</if>
+		</set>
+		WHERE id_ = #{id}
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete">
+		DELETE FROM organization_course_unit_price_settings WHERE id_ = #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="OrganizationCourseUnitPriceSettings" parameterType="map">
+		SELECT * FROM organization_course_unit_price_settings 
+		<where>
+			<if test="organId != null">
+				and organ_id_ = #{organId}
+			</if>
+			<if test="courseScheduleType != null">
+				and course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+			</if>
+		</where>
+		ORDER BY id_
+		<include refid="global.limit" />
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM organization_course_unit_price_settings
+		<where>
+			<if test="organId != null">
+				and organ_id_ = #{organId}
+			</if>
+			<if test="courseScheduleType != null">
+				and course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+			</if>
+		</where>
+	</select>
+	
+	<select id="queryByOrganIdAndCourseType" resultMap="OrganizationCourseUnitPriceSettings" parameterType="map">
+		SELECT * FROM organization_course_unit_price_settings WHERE organ_id_ = #{organId} and course_type_ = #{courseScheduleType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+	</select>
+</mapper>

+ 66 - 0
mec-web/src/main/java/com/ym/mec/web/controller/OrganizationCourseUnitPriceSettingsController.java

@@ -0,0 +1,66 @@
+package com.ym.mec.web.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+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.OrganizationCourseUnitPriceSettings;
+import com.ym.mec.biz.dal.page.OrganizationCourseUnitPriceSettingsQueryInfo;
+import com.ym.mec.biz.service.OrganizationCourseUnitPriceSettingsService;
+import com.ym.mec.common.controller.BaseController;
+
+@RequestMapping("organizationCourseUnitPriceSettings")
+@Api(tags = "分部课程单价设置服务")
+@RestController
+public class OrganizationCourseUnitPriceSettingsController extends BaseController {
+
+	@Autowired
+	private OrganizationCourseUnitPriceSettingsService organizationCourseUnitPriceSettingsService;
+
+	@ApiOperation(value = "分页查询列表")
+	@GetMapping(value = "/queryPage", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('organizationCourseUnitPriceSettings/queryPage')")
+	public Object queryPage(OrganizationCourseUnitPriceSettingsQueryInfo queryInfo) {
+		return succeed();
+	}
+
+	@ApiOperation(value = "新增对象")
+	@PostMapping(value = "/insert", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('organizationCourseUnitPriceSettings/update')")
+	public Object insert(@RequestBody OrganizationCourseUnitPriceSettings organizationCourseUnitPriceSettings) {
+		OrganizationCourseUnitPriceSettings originalObj = organizationCourseUnitPriceSettingsService.queryByOrganIdAndCourseType(
+				organizationCourseUnitPriceSettings.getOrganId(), organizationCourseUnitPriceSettings.getCourseType());
+		if (originalObj != null) {
+			return failed("当前分部已经存在该课程类型的单价");
+		}
+		organizationCourseUnitPriceSettingsService.insert(organizationCourseUnitPriceSettings);
+		return succeed();
+	}
+
+	@ApiOperation(value = "修改对象")
+	@PostMapping(value = "/update", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('organizationCourseUnitPriceSettings/update')")
+	public Object update(@RequestBody OrganizationCourseUnitPriceSettings organizationCourseUnitPriceSettings) {
+		organizationCourseUnitPriceSettingsService.update(organizationCourseUnitPriceSettings);
+		return succeed();
+	}
+
+	@ApiOperation(value = "删除收费类型")
+	@PostMapping("/del/{id}")
+	@PreAuthorize("@pcs.hasPermissions('organizationCourseUnitPriceSettings/del')")
+	public Object del(@ApiParam(value = "编号", required = true) @PathVariable("id") Integer id) {
+		organizationCourseUnitPriceSettingsService.delete(id);
+		return succeed();
+	}
+
+}