Kaynağa Gözat

fix(admin): 后台题目操作

Go 4 yıl önce
ebeveyn
işleme
e2e118a14f
23 değiştirilmiş dosya ile 190 ekleme ve 88 silme
  1. 13 12
      front/project/admin/components/Association/index.js
  2. 0 25
      front/project/admin/components/QuestionNoList/index.js
  3. 22 4
      front/project/admin/routes/course/previewDetail/page.js
  4. 3 5
      front/project/admin/routes/subject/examination/page.js
  5. 5 7
      front/project/admin/routes/subject/exercise/page.js
  6. 3 4
      front/project/admin/routes/subject/question/page.js
  7. 3 3
      front/project/admin/routes/subject/textbook/page.js
  8. 2 6
      front/project/www/components/Header/index.js
  9. 2 2
      front/project/www/components/PayModal/index.js
  10. 1 1
      front/project/www/components/VipRenew/index.js
  11. 2 6
      front/project/www/routes/my/main/page.js
  12. 1 0
      server/data/src/main/java/com/qxgmat/data/relation/TextbookQuestionRelationMapper.java
  13. 2 2
      server/data/src/main/java/com/qxgmat/data/relation/mapping/QuestionNoRelationMapper.xml
  14. 4 1
      server/data/src/main/java/com/qxgmat/data/relation/mapping/TextbookQuestionRelationMapper.xml
  15. 1 1
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/ExaminationController.java
  16. 1 1
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/ExerciseController.java
  17. 2 1
      server/gateway-api/src/main/java/com/qxgmat/controller/admin/TextbookController.java
  18. 60 0
      server/gateway-api/src/main/java/com/qxgmat/dto/admin/response/ExaminationQuestionListDto.java
  19. 40 0
      server/gateway-api/src/main/java/com/qxgmat/dto/admin/response/ExerciseQuestionListDto.java
  20. 3 3
      server/gateway-api/src/main/java/com/qxgmat/service/extend/ExerciseService.java
  21. 2 2
      server/gateway-api/src/main/java/com/qxgmat/service/inline/QuestionNoService.java
  22. 2 2
      server/gateway-api/src/main/java/com/qxgmat/service/inline/TextbookQuestionService.java
  23. 16 0
      server/tools/src/main/java/com/nuliji/tools/AbstractService.java

+ 13 - 12
front/project/admin/components/Association/index.js

@@ -10,18 +10,18 @@ import { Sentence } from '../../stores/sentence';
 class Association extends Component {
   constructor(props) {
     super(props);
-    this.state = { ids: this.props.ids, show: !!props.modal, loading: false, err: '' };
+    this.state = { ids: props.ids, show: !!props.modal, loading: false, err: '' };
     this.questionNos = [];
 
-    generateSearch(this.props.field, { mode: 'multiple' }, this, (search) => {
+    generateSearch(props.field, { mode: 'multiple' }, this, (search) => {
       return this.searchQuestion(search);
     }, (row) => {
       return {
         title: row.title,
         value: row.id,
       };
-    }, this.props.ids, null);
-    this.listQuestion(this.props.ids, 'ids');
+    }, props.ids, null);
+    this.listQuestion(props.ids, 'ids');
   }
 
   onConfirm() {
@@ -51,19 +51,21 @@ class Association extends Component {
     if (this.props.onCancel) this.props.onCancel();
   }
 
-  listQuestion(values, field = 'ids') {
+  listQuestion(values, ids = 'ids') {
+    const { getFieldDecorator, setFieldsValue } = this.props.form;
+    const { field = 'questionNoIds' } = this.props;
+    getFieldDecorator(field);
+    setFieldsValue({ [field]: values });
     if (!values || values.length === 0) {
       this.setState({ questionNos: [] });
       return;
     }
     let handler;
     switch (this.props.module) {
+      case 'sentence':
       case 'exercise':
         // 查找练习题目
-        handler = Question.listNo({ [field]: values, module: this.props.module });
-        break;
-      case 'sentence':
-        handler = Sentence.listQuestion({ [field]: values });
+        handler = Question.listNo({ [ids]: values, module: this.props.module });
         break;
       default:
         return;
@@ -79,14 +81,13 @@ class Association extends Component {
 
   searchQuestion(params) {
     let handler;
+    params.module = this.props.module;
     switch (this.props.module) {
+      case 'sentence':
       case 'exercise':
         // 查找练习题目
         handler = Question.searchNo(params);
         break;
-      case 'sentence':
-        handler = Sentence.searchQuestion(params);
-        break;
       default:
         handler = Promise.reject(new Error('module is error'));
     }

+ 0 - 25
front/project/admin/components/QuestionNoList/index.js

@@ -7,18 +7,9 @@ export default class QuestionNoList extends Component {
   constructor(props) {
     super(props);
     this.state = { loading: 0 };
-    // this.searchQuestion(this.props.ids, 'ids');
     this.setState({ questionNos: this.props.questionNos });
   }
 
-  // componentWillReceiveProps(nextProps) {
-  //   if (this.props.ids !== nextProps.ids) {
-  //     this.searchQuestion(nextProps.ids, 'ids');
-  //   } else if (this.props.nos !== nextProps.nos) {
-  //     this.searchQuestion(nextProps.nos, 'nos');
-  //   }
-  // }
-
   componentWillReceiveProps(nextProps) {
     const { loading } = this.state;
     this.setState({ questionNos: nextProps.questionNos, loading: loading + 1 });
@@ -43,22 +34,6 @@ export default class QuestionNoList extends Component {
     this.props.onChange(questionNos);
   }
 
-  // searchQuestion(values, field = 'nos') {
-  //   // console.log('search', values, field);
-  //   if (!values || values.length === 0) {
-  //     this.setState({ questionNos: [] });
-  //     return;
-  //   }
-  //   // 查找练习题目
-  //   Question.listNo({ [field]: values, module: this.props.module }).then(result => {
-  //     const { loading } = this.state;
-  //     const map = getMap(result, 'no');
-  //     const questionNos = values.map(no => map[no]).filter(row => row);
-  //     this.setState({ questionNos, loading: loading + 1 });
-  //     this.props.onChange(questionNos);
-  //   });
-  // }
-
   render() {
     return <DragList
       key={this.state.loading}

+ 22 - 4
front/project/admin/routes/course/previewDetail/page.js

@@ -13,6 +13,12 @@ import { Course } from '../../../stores/course';
 import { User } from '../../../stores/user';
 
 export default class extends Page {
+  initState() {
+    return {
+      questionType: QuestionType,
+    };
+  }
+
   init() {
     this.onlineList = [{
       key: 'courseTime',
@@ -66,6 +72,7 @@ export default class extends Page {
         form.setFieldsValue(result);
         this.setState({ module: result.courseModule, data: result, questionNoIds });
         this.refresh();
+        if (result.courseId) this.refreshCourse(result.courseId);
       });
   }
 
@@ -110,6 +117,7 @@ export default class extends Page {
       if (data.courseModule === 'video') {
         this.refreshNo(id);
       }
+      this.refreshType(info.extend);
     });
   }
 
@@ -127,6 +135,16 @@ export default class extends Page {
     });
   }
 
+  refreshType(questionType) {
+    if (questionType) {
+      const { setFieldsValue } = this.props.form;
+      setFieldsValue({ questionType });
+      this.setState({ questionType: QuestionType.filter(row => row.value === questionType) });
+    } else {
+      this.setState({ questionType: QuestionType });
+    }
+  }
+
   submit() {
     const { form } = this.props;
     form.validateFields((err) => {
@@ -144,9 +162,9 @@ export default class extends Page {
         handler.then((result) => {
           asyncSMessage('保存成功');
           if (data.id) {
-            linkTo(`/subject/preview/detail/${data.id}`);
+            linkTo(`/course/preview/detail/${data.id}`);
           } else {
-            linkTo(`/subject/preview/detail/${result.id}`);
+            linkTo(`/course/preview/detail/${result.id}`);
           }
         }).catch((e) => {
           if (e.result) form.setFields(formatFormError(data, e.result));
@@ -196,7 +214,7 @@ export default class extends Page {
 
 
   renderBase() {
-    const { data = {}, questionNoIds } = this.state;
+    const { data = {}, questionNoIds, questionType } = this.state;
     const { getFieldDecorator } = this.props.form;
     return <Block>
       <Form>
@@ -227,7 +245,7 @@ export default class extends Page {
               { required: true, message: '请选择题型' },
             ],
           })(
-            <Select select={QuestionType} placeholder='请选择题型' />,
+            <Select select={questionType} placeholder='请选择题型' />,
           )}
         </Form.Item>
         <Form.Item labelCol={{ span: 5 }} wrapperCol={{ span: 16 }} label='作业标题'>

+ 3 - 5
front/project/admin/routes/subject/examination/page.js

@@ -41,7 +41,6 @@ const filterForm = [
     name: '难度',
     select: QuestionDifficult,
     placeholder: '请选择',
-    number: true,
   },
   {
     key: 'questionType',
@@ -50,7 +49,6 @@ const filterForm = [
     name: '题型',
     select: QuestionType,
     placeholder: '请选择',
-    number: true,
   },
   {
     key: 'questionNoId',
@@ -83,7 +81,7 @@ export default class extends Page {
       title: '出题原理',
       dataIndex: 'first',
       render: (text, record) => {
-        return this.categoryMap[record.questionNo.moduleStruct[0]] || text;
+        return this.categoryMap[record.moduleStruct[0]] || text;
       },
     }, {
       title: '类别',
@@ -113,7 +111,7 @@ export default class extends Page {
       title: '错误率',
       dataIndex: 'correct',
       render: (text, record) => {
-        return formatPercent(record.questionNo.totalNumber - record.questionNo.totalCorrect, record.questionNo.totalNumber, false);
+        return formatPercent(record.totalNumber - record.totalCorrect, record.totalNumber, false);
       },
     }, {
       title: '修改时间',
@@ -128,7 +126,7 @@ export default class extends Page {
       render: (text, record) => {
         return <div className="table-button">
           {(
-            <Link to={`/subject/question/${record.question_id}`}>编辑</Link>
+            <Link to={`/subject/question/${record.questionId}`}>编辑</Link>
           )}
         </div>;
       },

+ 5 - 7
front/project/admin/routes/subject/exercise/page.js

@@ -25,7 +25,6 @@ const filterForm = [{
   name: '题型',
   select: QuestionType,
   placeholder: '请选择',
-  number: true,
 },
 {
   key: 'structId',
@@ -52,7 +51,6 @@ const filterForm = [{
   name: '考点',
   select: [],
   placeholder: '请选择',
-  number: true,
 },
 {
   key: 'difficult',
@@ -61,7 +59,6 @@ const filterForm = [{
   name: '难度',
   select: QuestionDifficult,
   placeholder: '请选择',
-  number: true,
 },
 {
   key: 'time',
@@ -101,7 +98,7 @@ export default class extends Page {
       title: '学科',
       dataIndex: 'first',
       render: (text, record) => {
-        return this.categoryMap[record.questionNo.moduleStruct[0]] || text;
+        return this.categoryMap[record.moduleStruct[0]] || text;
       },
     }, {
       title: '题型',
@@ -131,13 +128,13 @@ export default class extends Page {
       title: '易错度',
       dataIndex: 'correct',
       render: (text, record) => {
-        return formatPercent(record.questionNo.totalNumber - record.questionNo.totalCorrect, record.questionNo.totalNumber, false);
+        return formatPercent(record.totalNumber - record.totalCorrect, record.totalNumber, false);
       },
     }, {
       title: '平均时间',
       dataIndex: 'time',
       render: (text, record) => {
-        return formatSeconds(record.questionNo.totalTime / record.questionNo.totalNumber);
+        return formatSeconds(record.totalTime / record.totalNumber);
       },
     }, {
       title: '序号',
@@ -163,7 +160,7 @@ export default class extends Page {
       render: (text, record) => {
         return <div className="table-button">
           {(
-            <Link to={`/subject/question/${record.question_id}`}>编辑</Link>
+            <Link to={`/subject/question/${record.questionId}`}>编辑</Link>
           )}
           {(
             <a onClick={() => {
@@ -276,6 +273,7 @@ export default class extends Page {
           if (data.time.length > 0) {
             data.time = [data.time[0].format('YYYY-MM-DD HH:mm:ss'), data.time[1].format('YYYY-MM-DD HH:mm:ss')];
           }
+          console.log(data);
           this.search(data);
         }} />}
       <ActionLayout

+ 3 - 4
front/project/admin/routes/subject/question/page.js

@@ -56,7 +56,6 @@ export default class extends Page {
         return { value: 'examination', key: 'examination', label: '模考', title: '模考', children: formatTreeData(result.map(row => { row.title = `${row.titleZh}/${row.titleEn}`; return row; }), 'id', 'title', 'parentId') };
       }),
     ]).then(result => {
-      console.log(result);
       this.setState({ moduleStructData: result });
     });
   }
@@ -68,7 +67,7 @@ export default class extends Page {
     if (id) {
       handler = Question.get({ id }).then(result => {
         result.content = result.content || { questions: [], steps: [] };
-        result.keyword = result.keyword || [];
+        result.keyword = result.keyword ? result.keyword.filter(row => row) : [];
         return result;
       });
     } else {
@@ -186,10 +185,10 @@ export default class extends Page {
         let nodeString;
         switch (data.module) {
           case 'exercise':
-            nodeString = this.exerciseStructMap[node].titleEn;
+            nodeString = this.exerciseStructMap[node].titleZh;
             break;
           case 'examination':
-            nodeString = this.examinationStructMap[node].titleEn;
+            nodeString = this.examinationStructMap[node].titleZh;
             break;
           default:
         }

+ 3 - 3
front/project/admin/routes/subject/textbook/page.js

@@ -36,7 +36,7 @@ const filterForm = [
     number: true,
   },
   {
-    key: 'questionNoId',
+    key: 'id',
     type: 'select',
     allowClear: true,
     name: '题目ID',
@@ -98,14 +98,14 @@ export default class extends Page {
         value: row.id,
       };
     }, this.state.search.paperId ? Number(this.state.search.paperId) : null, null);
-    bindSearch(filterForm, 'questionNoId', this, (search) => {
+    bindSearch(filterForm, 'id', this, (search) => {
       return Textbook.searchQuestion(search);
     }, (row) => {
       return {
         title: row.title,
         value: row.id,
       };
-    }, this.state.search.questionNoId ? Number(this.state.search.questionNoId) : null, null);
+    }, this.state.search.id ? Number(this.state.search.id) : null, null);
   }
 
   initData() {

+ 2 - 6
front/project/www/components/Header/index.js

@@ -9,7 +9,7 @@ import { formatDate } from '../../../../src/services/Tools';
 
 function Header(props) {
   const { tabs = [], active, user } = props;
-  const { info } = user;
+  const { info = {} } = user;
   let inviteStatus = false;
   if (info.login) {
     const inviteDate = new Date(info.inviteLatestTime);
@@ -95,11 +95,7 @@ function Header(props) {
             </Dropdown>
           ) : (<Button onClick={() => {
             User.needLogin();
-          }}
-          >
-            登录
-            </Button>
-          )}
+          }}>登录</Button>)}
         </div>
       </div>
     </div>

+ 2 - 2
front/project/www/components/PayModal/index.js

@@ -253,7 +253,7 @@ export class PayMModal extends Component {
             />
             <div hidden={pay === 'bank'} className="pay">
               <div className="qrcode">
-                <Assets name="qrcode" src={checked ? payInfo.qr : '模糊'} />
+                <Assets src={checked ? payInfo.qr : '模糊'} />
               </div>
               <div className="t">请使用手机微信或支付宝扫码付款</div>
               <div className="t">支付金额: ¥ {order.money}</div>
@@ -342,7 +342,7 @@ export class PayMutilModal extends Component {
             />
             <div hidden={pay === 'bank'} className="pay">
               <div className="qrcode">
-                <Assets name="qrcode" src={checked ? payInfo.qr : '模糊'} />
+                <Assets src={checked ? payInfo.qr : '模糊'} />
               </div>
               <div className="t">请使用手机微信或支付宝扫码付款</div>
               <div className="t">支付金额: ¥ {order.money}</div>

+ 1 - 1
front/project/www/components/VipRenew/index.js

@@ -192,7 +192,7 @@ export default class extends Component {
               onChange={key => this.changePay(key)}
             />
             <div className="qrcode">
-              <Assets name="qrcode" src={payInfo.qr} />
+              <Assets src={payInfo.qr} />
             </div>
             <div className="t">请使用手机微信或支付宝扫码付款</div>
             {order && <div className="t">支付金额: ¥ {order.money}</div>}

+ 2 - 6
front/project/www/routes/my/main/page.js

@@ -512,7 +512,7 @@ export default class extends Page {
     return (
       <div className="info-layout">
         <div className="body">
-          <div className="info">
+          <div className="info c-p">
             <Assets
               name="sun_blue"
               src={info.avatar}
@@ -522,7 +522,7 @@ export default class extends Page {
             />
             <div className="detail">
               <div
-                className="name"
+                className="name c-p"
                 onClick={() => {
                   this.setState({ showEdit: true });
                 }}
@@ -547,7 +547,6 @@ export default class extends Page {
             <GIcon name="user-wechat" noHover active={info.bindWechat} />
             <GIcon
               name="user-phone"
-              noHover
               active={info.bindMobile}
               onClick={() => {
                 this.setState({ showPhone: true });
@@ -555,7 +554,6 @@ export default class extends Page {
             />
             <GIcon
               name="user-realname"
-              noHover
               active={info.bindReal}
               onClick={() => {
                 this.setState({ showReal: true });
@@ -563,7 +561,6 @@ export default class extends Page {
             />
             <GIcon
               name="user-email"
-              noHover
               active={!!info.email}
               onClick={() => {
                 this.setState({ showEmail: true });
@@ -571,7 +568,6 @@ export default class extends Page {
             />
             <GIcon
               name="user-info"
-              noHover
               active={info.bindPrepare}
               onClick={() => {
                 this.setState({ showExamination: true });

+ 1 - 0
server/data/src/main/java/com/qxgmat/data/relation/TextbookQuestionRelationMapper.java

@@ -27,6 +27,7 @@ public interface TextbookQuestionRelationMapper {
             @Param("questionType") String questionType,
             @Param("paperId") Number paperId,
             @Param("questionNoId") Number questionNoId,
+            @Param("id") Number id,
             @Param("order") String order,
             @Param("direction") String direction
     );

+ 2 - 2
server/data/src/main/java/com/qxgmat/data/relation/mapping/QuestionNoRelationMapper.xml

@@ -188,7 +188,7 @@
       left join `exercise_paper` ep on find_in_set(qn.`id`, trim(TRAILING ']' from trim(LEADING '[' from eq.`question_no_ids`)))
       and ep.`id` = #{paperId,jdbcType=VARCHAR}
     </if>
-    where q.`id` &gt; 0 and qn.`question_id` &gt; 0 and qn.`delete_time` = null
+    where q.`id` &gt; 0 and qn.`question_id` &gt; 0 and qn.`delete_time` is null
     and qn.`module` = "exercise"
     <if test="paperId != null">
       and ep.`id` &gt; 0
@@ -229,7 +229,7 @@
       left join `examination_paper` ep on find_in_set(qn.`id`, trim(TRAILING ']' from trim(LEADING '[' from eq.`question_no_ids`)))
       and ep.`id` = #{paperId,jdbcType=VARCHAR}
     </if>
-    where q.`id` &gt; 0 and qn.`question_id` &gt; 0 and qn.`delete_time` = null
+    where q.`id` &gt; 0 and qn.`question_id` &gt; 0 and qn.`delete_time` is null
     and qn.`module` = "examination"
     <if test="paperId != null">
       and ep.`id` &gt; 0

+ 4 - 1
server/data/src/main/java/com/qxgmat/data/relation/mapping/TextbookQuestionRelationMapper.xml

@@ -46,8 +46,11 @@
     <if test="paperId != null">
       and tp.`id` &gt; 0
     </if>
+    <if test="id != null">
+      and tq.`id` =#{id,jdbcType=VARCHAR}
+    </if>
     <if test="questionNoId != null">
-      and tq.`id` =#{questionNoId,jdbcType=VARCHAR}
+      and tq.`question_no_id` =#{questionNoId,jdbcType=VARCHAR}
     </if>
     <if test="questionType != null">
       and tq.`question_type` =#{questionType,jdbcType=VARCHAR}

+ 1 - 1
server/gateway-api/src/main/java/com/qxgmat/controller/admin/ExaminationController.java

@@ -82,7 +82,7 @@ public class ExaminationController {
     public Response<PageMessage<ExaminationPaperListDto>> listPaper(
             @RequestParam(required = false, defaultValue = "1") int page,
             @RequestParam(required = false, defaultValue = "100") int size,
-            @RequestParam(required = false, defaultValue = "") String keyword,
+            @RequestParam(required = false) String keyword,
             @RequestParam(required = false) Integer[] ids,
             @RequestParam(required = false, defaultValue = "id") String order,
             @RequestParam(required = false, defaultValue = "desc") String direction,

+ 1 - 1
server/gateway-api/src/main/java/com/qxgmat/controller/admin/ExerciseController.java

@@ -96,7 +96,7 @@ public class ExerciseController {
     public Response<PageMessage<ExercisePaperListDto>> listPaper(
             @RequestParam(required = false, defaultValue = "1") int page,
             @RequestParam(required = false, defaultValue = "100") int size,
-            @RequestParam(required = false, defaultValue = "") String keyword,
+            @RequestParam(required = false) String keyword,
             @RequestParam(required = false) Integer[] ids,
             @RequestParam(required = false, defaultValue = "id") String order,
             @RequestParam(required = false, defaultValue = "desc") String direction,

+ 2 - 1
server/gateway-api/src/main/java/com/qxgmat/controller/admin/TextbookController.java

@@ -145,10 +145,11 @@ public class TextbookController {
             @RequestParam(required = false) String questionType,
             @RequestParam(required = false) Integer paperId,
             @RequestParam(required = false) Integer questionNoId,
+            @RequestParam(required = false) Integer id,
             @RequestParam(required = false, defaultValue = "id") String order,
             @RequestParam(required = false, defaultValue = "desc") String direction,
             HttpSession session) {
-        Page<TextbookQuestionRelation> p = textbookQuestionService.listAdmin(page, size, questionType, paperId, questionNoId, order, DirectionStatus.ValueOf(direction));
+        Page<TextbookQuestionRelation> p = textbookQuestionService.listAdmin(page, size, questionType, paperId, questionNoId, id, order, DirectionStatus.ValueOf(direction));
         List<TextbookQuestionListDto> pr = Transform.convert(p, TextbookQuestionListDto.class);
 
         return ResponseHelp.success(pr, page, size, p.getTotal());

+ 60 - 0
server/gateway-api/src/main/java/com/qxgmat/dto/admin/response/ExaminationQuestionListDto.java

@@ -17,6 +17,18 @@ public class ExaminationQuestionListDto {
 
     private QuestionExtendDto question;
 
+    private int[] moduleStruct;
+
+    private String title;
+
+    private Integer no;
+
+    private Integer totalTime;
+
+    private Integer totalNumber;
+
+    private Integer totalCorrect;
+
     public Integer getId() {
         return id;
     }
@@ -48,4 +60,52 @@ public class ExaminationQuestionListDto {
     public void setQuestionId(Integer questionId) {
         this.questionId = questionId;
     }
+
+    public int[] getModuleStruct() {
+        return moduleStruct;
+    }
+
+    public void setModuleStruct(int[] moduleStruct) {
+        this.moduleStruct = moduleStruct;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public Integer getNo() {
+        return no;
+    }
+
+    public void setNo(Integer no) {
+        this.no = no;
+    }
+
+    public Integer getTotalTime() {
+        return totalTime;
+    }
+
+    public void setTotalTime(Integer totalTime) {
+        this.totalTime = totalTime;
+    }
+
+    public Integer getTotalNumber() {
+        return totalNumber;
+    }
+
+    public void setTotalNumber(Integer totalNumber) {
+        this.totalNumber = totalNumber;
+    }
+
+    public Integer getTotalCorrect() {
+        return totalCorrect;
+    }
+
+    public void setTotalCorrect(Integer totalCorrect) {
+        this.totalCorrect = totalCorrect;
+    }
 }

+ 40 - 0
server/gateway-api/src/main/java/com/qxgmat/dto/admin/response/ExerciseQuestionListDto.java

@@ -17,10 +17,18 @@ public class ExerciseQuestionListDto {
 
     private QuestionExtendDto question;
 
+    private int[] moduleStruct;
+
     private String title;
 
     private Integer no;
 
+    private Integer totalTime;
+
+    private Integer totalNumber;
+
+    private Integer totalCorrect;
+
     public Integer getId() {
         return id;
     }
@@ -68,4 +76,36 @@ public class ExerciseQuestionListDto {
     public void setTitle(String title) {
         this.title = title;
     }
+
+    public int[] getModuleStruct() {
+        return moduleStruct;
+    }
+
+    public void setModuleStruct(int[] moduleStruct) {
+        this.moduleStruct = moduleStruct;
+    }
+
+    public Integer getTotalTime() {
+        return totalTime;
+    }
+
+    public void setTotalTime(Integer totalTime) {
+        this.totalTime = totalTime;
+    }
+
+    public Integer getTotalNumber() {
+        return totalNumber;
+    }
+
+    public void setTotalNumber(Integer totalNumber) {
+        this.totalNumber = totalNumber;
+    }
+
+    public Integer getTotalCorrect() {
+        return totalCorrect;
+    }
+
+    public void setTotalCorrect(Integer totalCorrect) {
+        this.totalCorrect = totalCorrect;
+    }
 }

+ 3 - 3
server/gateway-api/src/main/java/com/qxgmat/service/extend/ExerciseService.java

@@ -75,7 +75,7 @@ public class ExerciseService extends AbstractService {
      * @param pageSize
      * @param questionType
      * @param structId
-     * @param questionNo
+     * @param questionNoId
      * @param paperId
      * @param place
      * @param difficult
@@ -85,7 +85,7 @@ public class ExerciseService extends AbstractService {
      * @param direction
      * @return
      */
-    public Page<QuestionNoRelation> listAdmin(int page, int pageSize, String questionType, Number structId, Number questionNo, Number paperId, String place, String difficult, Date startTime, Date endTime, String order, DirectionStatus direction){
+    public Page<QuestionNoRelation> listAdmin(int page, int pageSize, String questionType, Number structId, Number questionNoId, Number paperId, String place, String difficult, Date startTime, Date endTime, String order, DirectionStatus direction){
         if(order == null || order.isEmpty()){
             order = "id";
         }
@@ -101,7 +101,7 @@ public class ExerciseService extends AbstractService {
         DirectionStatus finalDirection = direction;
 
         Page<QuestionNoRelation> p = page(() -> {
-            questionNoRelationMapper.listExerciseAdmin(questionType, structId, questionNo, paperId, place, difficult, startTime, endTime, finalOrder, finalDirection.key);
+            questionNoRelationMapper.listExerciseAdmin(questionType, structId, questionNoId, paperId, place, difficult, startTime, endTime, finalOrder, finalDirection.key);
         }, page, pageSize);
 
         Collection ids = Transform.getIds(p, QuestionNoRelation.class, "id");

+ 2 - 2
server/gateway-api/src/main/java/com/qxgmat/service/inline/QuestionNoService.java

@@ -30,7 +30,7 @@ import java.util.stream.Collectors;
 @Service
 public class QuestionNoService extends AbstractService {
     private static final Logger logger = LoggerFactory.getLogger(QuestionNoService.class);
-    protected boolean SOFT_FLAG = true;
+    protected boolean SOFT_FLAG = false;
 
     @Resource
     private QuestionNoMapper questionNoMapper;
@@ -489,7 +489,7 @@ public class QuestionNoService extends AbstractService {
     public QuestionNo add(QuestionNo question){
         QuestionNo in = getByNo(question.getTitle(), question.getModule());
         if (in != null){
-            return in;
+            throw new ParameterException("题目已经存在");
         }
         int result = insert(questionNoMapper, question);
         question = one(questionNoMapper, question.getId());

+ 2 - 2
server/gateway-api/src/main/java/com/qxgmat/service/inline/TextbookQuestionService.java

@@ -52,7 +52,7 @@ public class TextbookQuestionService extends AbstractService {
      * @param direction
      * @return
      */
-    public Page<TextbookQuestionRelation> listAdmin(int page, int pageSize, String questionType, Number paperId, Integer questionNoId, String order, DirectionStatus direction){
+    public Page<TextbookQuestionRelation> listAdmin(int page, int pageSize, String questionType, Number paperId, Integer questionNoId, Integer id, String order, DirectionStatus direction){
         if(order == null || order.isEmpty()){
             order = "id";
         }
@@ -68,7 +68,7 @@ public class TextbookQuestionService extends AbstractService {
         DirectionStatus finalDirection = direction;
 
         Page<TextbookQuestionRelation> p = page(() -> {
-            textbookQuestionRelationMapper.listAdmin(questionType, paperId, questionNoId, finalOrder, finalDirection.key);
+            textbookQuestionRelationMapper.listAdmin(questionType, paperId, questionNoId, id, finalOrder, finalDirection.key);
         }, page, pageSize);
 
         Collection ids = Transform.getIds(p, TextbookQuestionRelation.class, "id");

+ 16 - 0
server/tools/src/main/java/com/nuliji/tools/AbstractService.java

@@ -71,6 +71,16 @@ public abstract class AbstractService {
         }
     }
 
+    protected <T> int recover(Mapper<T> mapper, Number id){
+        CommonObject co = CommonObject.getRecover();
+        co.setId(id);
+        return mapper.updateByPrimaryKey(Transform.convert(co, MapperHelper.getEntityClass(mapper)));
+    }
+
+    protected <T> int recover(Mapper<T> mapper, Example example){
+        return mapper.updateByExample(Transform.convert(CommonObject.getRecover(), MapperHelper.getEntityClass(mapper)), example);
+    }
+
 //    protected <T> int delete(Mapper<T> mapper, T record){
 //        return delete(mapper, record, SOFT_FLAG);
 //    }
@@ -358,6 +368,12 @@ public abstract class AbstractService {
             co.setUpdateTime(new Date());
             return co;
         }
+        public static CommonObject getRecover(){
+            CommonObject co = new CommonObject();
+            co.setDeleteTime(null);
+            co.setUpdateTime(new Date());
+            return co;
+        }
 
         public Number getId() {
             return id;