随机试卷

This commit is contained in:
flower 2019-01-17 00:05:41 +08:00
parent ae1f15d3a2
commit 692154150c
9 changed files with 775 additions and 278 deletions

View File

@ -9,9 +9,7 @@ import cn.hutool.json.JSON;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.ruoyi.exam.domain.*;
import com.ruoyi.exam.service.IExamPaperCategoryService;
import com.ruoyi.exam.service.IExamPaperQuestionService;
import com.ruoyi.exam.service.IExamQuestionService;
import com.ruoyi.exam.service.*;
import com.ruoyi.framework.web.util.ShiroUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
@ -20,7 +18,6 @@ import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.exam.service.IExamPaperService;
import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.common.base.AjaxResult;
@ -34,8 +31,7 @@ import com.ruoyi.common.utils.ExcelUtil;
*/
@Controller
@RequestMapping("/exam/examPaper")
public class ExamPaperController extends BaseController
{
public class ExamPaperController extends BaseController {
private String prefix = "exam/examPaper";
@Autowired
@ -50,24 +46,23 @@ public class ExamPaperController extends BaseController
@Autowired
private IExamQuestionService examQuestionService;
@Autowired
private IExamPaperTypeNumberService examPaperTypeNumberService;
@RequiresPermissions("exam:examPaper:view")
@GetMapping()
public String examPaper()
{
public String examPaper() {
return prefix + "/examPaper";
}
/**
* 查询试卷列表
*/
@RequiresPermissions("exam:examPaper:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(ExamPaper examPaper)
{
public TableDataInfo list(ExamPaper examPaper) {
List<ExamPaper> list = new ArrayList<>();
List<ExamPaper> listByIds = examPaperService.selectListByCategory(examPaper);
return getDataTable(listByIds);
@ -75,6 +70,7 @@ public class ExamPaperController extends BaseController
/**
* 递归找到所有下级的试卷
*
* @param list
* @param examPaper
* @return
@ -99,8 +95,7 @@ public class ExamPaperController extends BaseController
@RequiresPermissions("exam:examPaper:export")
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ExamPaper examPaper)
{
public AjaxResult export(ExamPaper examPaper) {
List<ExamPaper> list = examPaperService.selectExamPaperList(examPaper);
ExcelUtil<ExamPaper> util = new ExcelUtil<ExamPaper>(ExamPaper.class);
return util.exportExcel(list, "examPaper");
@ -110,8 +105,7 @@ public class ExamPaperController extends BaseController
* 新增试卷
*/
@GetMapping("/add/{id}")
public String add(@PathVariable("id") String id, ModelMap mmap)
{
public String add(@PathVariable("id") String id, ModelMap mmap) {
mmap.put("examPaperCategoryId", id);
return prefix + "/add";
}
@ -123,23 +117,67 @@ public class ExamPaperController extends BaseController
@Log(title = "试卷", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(ExamPaper examPaper)
{
public AjaxResult addSave(ExamPaperVO examPaper) {
examPaper.setCreateBy(ShiroUtils.getLoginName());
examPaper.setCreateDate(new Date());
examPaper.setScore(0);
examPaper.setQuestionNumber(0);
examPaper.setDelFlag("0");
return toAjax(examPaperService.insert(examPaper));
int insert = examPaperService.insert((ExamPaper) examPaper);
ExamPaperTypeNumber examPaperTypeNumber1 = new ExamPaperTypeNumber();
examPaperTypeNumber1.setDelFlag("0");
examPaperTypeNumber1.setExamPaperId(examPaper.getId());
examPaperTypeNumber1.setExamQuestionType(1);
examPaperTypeNumber1.setNumber(examPaper.getChoiceNumber());
examPaperTypeNumberService.insert(examPaperTypeNumber1);
ExamPaperTypeNumber examPaperTypeNumber2 = new ExamPaperTypeNumber();
examPaperTypeNumber2.setDelFlag("0");
examPaperTypeNumber2.setExamPaperId(examPaper.getId());
examPaperTypeNumber2.setExamQuestionType(2);
examPaperTypeNumber2.setNumber(examPaper.getMoreChoiceNumber());
examPaperTypeNumberService.insert(examPaperTypeNumber2);
ExamPaperTypeNumber examPaperTypeNumber3 = new ExamPaperTypeNumber();
examPaperTypeNumber3.setDelFlag("0");
examPaperTypeNumber3.setExamPaperId(examPaper.getId());
examPaperTypeNumber3.setExamQuestionType(3);
examPaperTypeNumber3.setNumber(examPaper.getJudgeNumber());
examPaperTypeNumberService.insert(examPaperTypeNumber3);
return success();
}
/**
* 修改试卷
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
{
ExamPaper examPaper = examPaperService.selectById(id);
public String edit(@PathVariable("id") Integer id, ModelMap mmap) {
JSONObject jsonObject = new JSONObject(examPaperService.selectById(id));
ExamPaperVO examPaper = jsonObject.toBean(ExamPaperVO.class);
examPaper.setChoiceNumber(0);
examPaper.setMoreChoiceNumber(0);
examPaper.setJudgeNumber(0);
if (examPaper.getType().equals("2")) {
ExamPaperTypeNumber examPaperTypeNumber = new ExamPaperTypeNumber();
examPaperTypeNumber.setExamPaperId(id);
List<ExamPaperTypeNumber> examPaperTypeNumbers = examPaperTypeNumberService.selectList(examPaperTypeNumber);
for (ExamPaperTypeNumber item : examPaperTypeNumbers) {
if (item.getExamQuestionType() == 1) {
examPaper.setChoiceNumber(item.getNumber());
}
if (item.getExamQuestionType() == 2) {
examPaper.setMoreChoiceNumber(item.getNumber());
}
if (item.getExamQuestionType() == 3) {
examPaper.setJudgeNumber(item.getNumber());
}
}
}
mmap.put("examPaper", examPaper);
return prefix + "/edit";
}
@ -151,11 +189,37 @@ public class ExamPaperController extends BaseController
@Log(title = "试卷", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(ExamPaper examPaper)
{
public AjaxResult editSave(ExamPaperVO examPaper) {
examPaper.setUpdateBy(ShiroUtils.getLoginName());
examPaper.setUpdateDate(new Date());
return toAjax(examPaperService.updateSelectiveById(examPaper));
examPaperService.updateSelectiveById(examPaper);
ExamPaperTypeNumber delete = new ExamPaperTypeNumber();
delete.setExamPaperId(examPaper.getId());
examPaperTypeNumberService.delete(delete);
ExamPaperTypeNumber examPaperTypeNumber1 = new ExamPaperTypeNumber();
examPaperTypeNumber1.setDelFlag("0");
examPaperTypeNumber1.setExamPaperId(examPaper.getId());
examPaperTypeNumber1.setExamQuestionType(1);
examPaperTypeNumber1.setNumber(examPaper.getChoiceNumber());
examPaperTypeNumberService.insert(examPaperTypeNumber1);
ExamPaperTypeNumber examPaperTypeNumber2 = new ExamPaperTypeNumber();
examPaperTypeNumber2.setDelFlag("0");
examPaperTypeNumber2.setExamPaperId(examPaper.getId());
examPaperTypeNumber2.setExamQuestionType(2);
examPaperTypeNumber2.setNumber(examPaper.getMoreChoiceNumber());
examPaperTypeNumberService.insert(examPaperTypeNumber2);
ExamPaperTypeNumber examPaperTypeNumber3 = new ExamPaperTypeNumber();
examPaperTypeNumber3.setDelFlag("0");
examPaperTypeNumber3.setExamPaperId(examPaper.getId());
examPaperTypeNumber3.setExamQuestionType(3);
examPaperTypeNumber3.setNumber(examPaper.getJudgeNumber());
examPaperTypeNumberService.insert(examPaperTypeNumber3);
return success();
}
/**
@ -165,15 +229,19 @@ public class ExamPaperController extends BaseController
@Log(title = "试卷", businessType = BusinessType.DELETE)
@PostMapping("/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
public AjaxResult remove(String ids) {
String[] split = ids.split(",");
for (String s : split) {
ExamPaperTypeNumber delete = new ExamPaperTypeNumber();
delete.setExamPaperId(Integer.parseInt(s));
examPaperTypeNumberService.delete(delete);
}
return toAjax(examPaperService.deleteByIds(ids));
}
@GetMapping("/addQuestion/{id}")
public String addQuestion(@PathVariable("id") String ids, ModelMap mmap)
{
public String addQuestion(@PathVariable("id") String ids, ModelMap mmap) {
String[] split = ids.split(",");
List<String> strings = Arrays.asList(split);
mmap.put("examPaperId", strings.get(0));
@ -185,8 +253,7 @@ public class ExamPaperController extends BaseController
// @Log(title = "试卷", businessType = BusinessType.DELETE)
@PostMapping("/saveQuestion")
@ResponseBody
public AjaxResult saveQuestion(@RequestBody List<ExamPaperQuestion> paperQuestionList)
{
public AjaxResult saveQuestion(@RequestBody List<ExamPaperQuestion> paperQuestionList) {
ExamPaperQuestion examPaperQuestion = paperQuestionList.get(0);
ExamPaperQuestion delete = new ExamPaperQuestion();
delete.setExamPaperId(examPaperQuestion.getExamPaperId());
@ -210,8 +277,7 @@ public class ExamPaperController extends BaseController
@GetMapping("/toManagerPaperQuestion/{id}")
public String toManagerPaperQuestion(@PathVariable("id") Integer id, ModelMap mmap)
{
public String toManagerPaperQuestion(@PathVariable("id") Integer id, ModelMap mmap) {
mmap.put("examPaper", examPaperService.selectById(id));
JSONObject json = new JSONObject();
List<ExamPaperQuestionVO> examPaperQuestions = examPaperQuestionService.selectQuestionForPaperId(id);
@ -227,8 +293,7 @@ public class ExamPaperController extends BaseController
@Log(title = "试卷", businessType = BusinessType.DELETE)
@PostMapping("/addQuestionForModel")
@ResponseBody
public AjaxResult addQuestionForModel(@RequestParam(value = "questionId[]" ,required = false) String[] questionId,@RequestParam("paperId")String paperId)
{
public AjaxResult addQuestionForModel(@RequestParam(value = "questionId[]", required = false) String[] questionId, @RequestParam("paperId") String paperId) {
//题目数量和总分数
int questionNum = 0;
int score = 0;

View File

@ -0,0 +1,166 @@
package com.ruoyi.exam.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.base.BaseEntity;
import javax.persistence.Id;
import java.util.Date;
/**
* 随机试卷题型数量表 exam_paper_type_number
*
* @author zhujj
* @date 2019-01-16
*/
public class ExamPaperTypeNumber
{
private static final long serialVersionUID = 1L;
/** 试卷题型数量ID */
@Id
private Integer id;
/** 试卷代码 */
private Integer examPaperId;
/** 问题类型(来自字典表) */
private Integer examQuestionType;
/** 题型数量 */
private Integer number;
/** 创建者 */
private String createBy;
/** 创建时间 */
private Date createDate;
/** 更新者 */
private String updateBy;
/** 更新时间 */
private Date updateDate;
/** 备注信息 */
private String remarks;
/** 删除标记 */
private String delFlag;
/** 设置试卷题型数量ID */
public void setId(Integer id)
{
this.id = id;
}
/** 获取试卷题型数量ID */
public Integer getId()
{
return id;
}
/** 设置试卷代码 */
public void setExamPaperId(Integer examPaperId)
{
this.examPaperId = examPaperId;
}
/** 获取试卷代码 */
public Integer getExamPaperId()
{
return examPaperId;
}
/** 设置问题类型(来自字典表) */
public void setExamQuestionType(Integer examQuestionType)
{
this.examQuestionType = examQuestionType;
}
/** 获取问题类型(来自字典表) */
public Integer getExamQuestionType()
{
return examQuestionType;
}
/** 设置题型数量 */
public void setNumber(Integer number)
{
this.number = number;
}
/** 获取题型数量 */
public Integer getNumber()
{
return number;
}
/** 设置创建者 */
public void setCreateBy(String createBy)
{
this.createBy = createBy;
}
/** 获取创建者 */
public String getCreateBy()
{
return createBy;
}
/** 设置创建时间 */
public void setCreateDate(Date createDate)
{
this.createDate = createDate;
}
/** 获取创建时间 */
public Date getCreateDate()
{
return createDate;
}
/** 设置更新者 */
public void setUpdateBy(String updateBy)
{
this.updateBy = updateBy;
}
/** 获取更新者 */
public String getUpdateBy()
{
return updateBy;
}
/** 设置更新时间 */
public void setUpdateDate(Date updateDate)
{
this.updateDate = updateDate;
}
/** 获取更新时间 */
public Date getUpdateDate()
{
return updateDate;
}
/** 设置备注信息 */
public void setRemarks(String remarks)
{
this.remarks = remarks;
}
/** 获取备注信息 */
public String getRemarks()
{
return remarks;
}
/** 设置删除标记 */
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
/** 获取删除标记 */
public String getDelFlag()
{
return delFlag;
}
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("examPaperId", getExamPaperId())
.append("examQuestionType", getExamQuestionType())
.append("number", getNumber())
.append("createBy", getCreateBy())
.append("createDate", getCreateDate())
.append("updateBy", getUpdateBy())
.append("updateDate", getUpdateDate())
.append("remarks", getRemarks())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,35 @@
package com.ruoyi.exam.domain;
/**
* Created by flower on 2019/1/16.
*/
public class ExamPaperVO extends ExamPaper {
private Integer choiceNumber;
private Integer moreChoiceNumber;
private Integer judgeNumber;
public Integer getChoiceNumber() {
return choiceNumber;
}
public void setChoiceNumber(Integer choiceNumber) {
this.choiceNumber = choiceNumber;
}
public Integer getMoreChoiceNumber() {
return moreChoiceNumber;
}
public void setMoreChoiceNumber(Integer moreChoiceNumber) {
this.moreChoiceNumber = moreChoiceNumber;
}
public Integer getJudgeNumber() {
return judgeNumber;
}
public void setJudgeNumber(Integer judgeNumber) {
this.judgeNumber = judgeNumber;
}
}

View File

@ -0,0 +1,24 @@
package com.ruoyi.exam.mapper;
import com.ruoyi.exam.domain.ExamPaperTypeNumber;
import java.util.List;
import com.ruoyi.framework.web.base.MyMapper;
/**
* 随机试卷题型数量 数据层
*
* @author zhujj
* @date 2019-01-16
*/
public interface ExamPaperTypeNumberMapper extends MyMapper<ExamPaperTypeNumber>
{
/**
* 查询随机试卷题型数量列表
*
* @param examPaperTypeNumber 随机试卷题型数量信息
* @return 随机试卷题型数量集合
*/
public List<ExamPaperTypeNumber> selectExamPaperTypeNumberList(ExamPaperTypeNumber examPaperTypeNumber);
}

View File

@ -0,0 +1,30 @@
package com.ruoyi.exam.service;
import com.ruoyi.exam.domain.ExamPaperTypeNumber;
import java.util.List;
import com.ruoyi.framework.web.base.AbstractBaseService;
/**
* 随机试卷题型数量 服务层
*
* @author zhujj
* @date 2019-01-16
*/
public interface IExamPaperTypeNumberService extends AbstractBaseService<ExamPaperTypeNumber>
{
/**
* 查询随机试卷题型数量分页列表
*
* @param examPaperTypeNumber 随机试卷题型数量信息
* @return 随机试卷题型数量集合
*/
public List<ExamPaperTypeNumber> selectExamPaperTypeNumberPage(ExamPaperTypeNumber examPaperTypeNumber);
/**
* 查询随机试卷题型数量列表
*
* @param examPaperTypeNumber 随机试卷题型数量信息
* @return 随机试卷题型数量集合
*/
public List<ExamPaperTypeNumber> selectExamPaperTypeNumberList(ExamPaperTypeNumber examPaperTypeNumber);
}

View File

@ -0,0 +1,48 @@
package com.ruoyi.exam.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.exam.mapper.ExamPaperTypeNumberMapper;
import com.ruoyi.exam.domain.ExamPaperTypeNumber;
import com.ruoyi.exam.service.IExamPaperTypeNumberService;
import com.ruoyi.common.support.Convert;
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
/**
* 随机试卷题型数量 服务层实现
*
* @author zhujj
* @date 2019-01-16
*/
@Service
public class ExamPaperTypeNumberServiceImpl extends AbstractBaseServiceImpl<ExamPaperTypeNumberMapper,ExamPaperTypeNumber> implements IExamPaperTypeNumberService
{
@Autowired
private ExamPaperTypeNumberMapper examPaperTypeNumberMapper;
/**
* 查询随机试卷题型数量列表
*
* @param examPaperTypeNumber 随机试卷题型数量信息
* @return 随机试卷题型数量集合
*/
@Override
public List<ExamPaperTypeNumber> selectExamPaperTypeNumberList(ExamPaperTypeNumber examPaperTypeNumber)
{
return examPaperTypeNumberMapper.selectExamPaperTypeNumberList(examPaperTypeNumber);
}
/**
* 查询随机试卷题型数量分页列表
*
* @param examPaperTypeNumber 随机试卷题型数量信息
* @return 随机试卷题型数量集合
*/
@Override
public List<ExamPaperTypeNumber> selectExamPaperTypeNumberPage(ExamPaperTypeNumber examPaperTypeNumber)
{
startPage();
return examPaperTypeNumberMapper.selectExamPaperTypeNumberList(examPaperTypeNumber);
}
}

View File

@ -0,0 +1,42 @@
<?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.ruoyi.exam.mapper.ExamPaperTypeNumberMapper">
<resultMap type="ExamPaperTypeNumber" id="ExamPaperTypeNumberResult">
<result property="id" column="id" />
<result property="examPaperId" column="exam_paper_id" />
<result property="examQuestionType" column="exam_question_type" />
<result property="number" column="number" />
<result property="createBy" column="create_by" />
<result property="createDate" column="create_date" />
<result property="updateBy" column="update_by" />
<result property="updateDate" column="update_date" />
<result property="remarks" column="remarks" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectExamPaperTypeNumberVo">
id, exam_paper_id, exam_question_type, number, create_by, create_date, update_by, update_date, remarks, del_flag </sql>
<select id="selectExamPaperTypeNumberList" parameterType="ExamPaperTypeNumber" resultMap="ExamPaperTypeNumberResult">
select
<include refid="selectExamPaperTypeNumberVo"/>
from exam_paper_type_number
<where>
<if test="id != null "> and id = #{id}</if>
<if test="examPaperId != null "> and exam_paper_id = #{examPaperId}</if>
<if test="examQuestionType != null "> and exam_question_type = #{examQuestionType}</if>
<if test="number != null "> and number = #{number}</if>
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
<if test="createDate != null "> and create_date = #{createDate}</if>
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
<if test="remarks != null and remarks != '' "> and remarks = #{remarks}</if>
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
</where>
</select>
</mapper>

View File

@ -14,12 +14,37 @@
<input id="name" name="name" class="form-control" type="text">
</div>
</div>
<!--<div class="form-group"> -->
<!--<label class="col-sm-3 control-label">试卷类型1-固定试卷2-随机试卷):</label>-->
<!--<div class="col-sm-8">-->
<!--<input id="type" name="type" class="form-control" type="text">-->
<!--</div>-->
<!--</div>-->
<div class="form-group">
<label class="col-sm-3 control-label">试卷类型</label>
<div class="col-sm-8">
<select id="type" name="type" class="form-control m-b" th:with="type=${@dict.getType('exam_paper_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group type">
<label class="col-sm-3 control-label">单选题数量:</label>
<div class="col-sm-8">
<input id="choiceNumber" name="choiceNumber" class="form-control" type="text" value="0">
</div>
</div>
<div class="form-group type">
<label class="col-sm-3 control-label">多选题数量:</label>
<div class="col-sm-8">
<input id="moreChoiceNumber" name="moreChoiceNumber" class="form-control" type="text" value="0">
</div>
</div>
<div class="form-group type">
<label class="col-sm-3 control-label">选择题:</label>
<div class="col-sm-8">
<input id="judgeNumber" name="judgeNumber" class="form-control" type="text" value="0">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注信息:</label>
<div class="col-sm-8">
@ -44,6 +69,23 @@
$.operate.save(prefix + "/add", $('#form-examPaper-add').serialize());
}
}
$(function(){
if($("#type").val().toString()=="1"){
$(".type").hide()
}else{
$(".type").show()
}
$("#type").change(function(){
if($("#type").val().toString()=="1"){
$(".type").hide()
}else{
$(".type").show()
}
})
})
</script>
</body>
</html>

View File

@ -14,12 +14,40 @@
<input id="name" name="name" th:field="*{name}" class="form-control" type="text">
</div>
</div>
<!--<div class="form-group"> -->
<!--<label class="col-sm-3 control-label">试卷类型:</label>-->
<!--<div class="col-sm-8">-->
<!--<input id="type" name="type" th:field="*{type}" class="form-control" type="text">-->
<!--</div>-->
<!--</div>-->
<div class="form-group">
<label class="col-sm-3 control-label">试卷类型:</label>
<div class="col-sm-8">
<select id="type" name="type" class="form-control m-b" th:field="*{type}"
th:with="type=${@dict.getType('exam_paper_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group type">
<label class="col-sm-3 control-label">单选题数量:</label>
<div class="col-sm-8">
<input id="choiceNumber" name="choiceNumber" th:field="*{choiceNumber}" class="form-control"
type="text">
</div>
</div>
<div class="form-group type">
<label class="col-sm-3 control-label">多选题数量:</label>
<div class="col-sm-8">
<input id="moreChoiceNumber" name="moreChoiceNumber" th:field="*{moreChoiceNumber}" class="form-control"
type="text">
</div>
</div>
<div class="form-group type">
<label class="col-sm-3 control-label">选择题:</label>
<div class="col-sm-8">
<input id="judgeNumber" name="judgeNumber" th:field="*{judgeNumber}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注信息:</label>
@ -46,6 +74,23 @@
$.operate.save(prefix + "/edit", $('#form-examPaper-edit').serialize());
}
}
$(function () {
if ($("#type").val().toString() == "1") {
$(".type").hide()
} else {
$(".type").show()
}
$("#type").change(function () {
if ($("#type").val().toString() == "1") {
$(".type").hide()
} else {
$(".type").show()
}
})
})
</script>
</body>
</html>