测体排序

zhc4dev
wangjiadong 2 years ago
parent d5019f37d2
commit 152c61ce57
  1. 20
      ant-design-vue-jeecg/src/views/customermeasure/admin/CustomerMeasureList.vue
  2. 49
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/controller/CustomerMeasureController.java
  3. 17
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/mapper/CustomerMeasureMapper.java
  4. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/service/ICustomerMeasureService.java
  5. 39
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/customermeasure/service/impl/CustomerMeasureServiceImpl.java

@ -101,7 +101,7 @@
<span slot="action" slot-scope="text, record">
<!-- <a @click="paixu(record.id,record.processName)">排序</a>-->
<!-- <a @click="paixu(record)">排序</a>-->
<a @click="paixu(record)">排序</a>
<a-divider type="vertical" />
<a @click="handleEdit(record)">编辑</a>
@ -126,7 +126,7 @@
</div>
<customer-measure-modal ref="modalForm" @ok="modalFormOk"></customer-measure-modal>
<!-- <customer-measure-modalpaixu ref="modalFormpaixu" @ok="modalFormOk"></customer-measure-modalpaixu>-->
<customer-measure-modal1 ref="modalFormpaixu" @ok="modalFormOk"></customer-measure-modal1>
</a-card>
</template>
@ -136,7 +136,7 @@
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CustomerMeasureModal from './modules/CustomerMeasureModal'
/* import CustomerMeasureModalpaixu from './modules/CustomerMeasureModalpaixu'*/
import CustomerMeasureModal1 from './modules/CustomerMeasureModal1'
import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
import { getAction } from '@/api/manage'
@ -144,8 +144,8 @@
name: 'CustomerMeasureList',
mixins:[JeecgListMixin, mixinDevice],
components: {
CustomerMeasureModal/*,
CustomerMeasureModalpaixu*/
CustomerMeasureModal,
CustomerMeasureModal1
},
data () {
return {
@ -284,20 +284,20 @@
superFieldList:[],
}
},
created(record){
/* created(record){
getAction(this.url.moreYear,{ id: record.id})
},
},*/
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
/* paixu: function (record) {
this.$refs.modalFormpaixu.edit(record.id);
paixu: function (record) {
this.$refs.modalFormpaixu.edit(record.userId);
this.$refs.modalFormpaixu.title = record.userId_dictText+"测体管理";
this.$refs.modalFormpaixu.disableSubmit = false;
},*/
},
initDictConfig(){
},
getSuperFieldList(){

@ -8,6 +8,7 @@ import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
@ -73,6 +74,32 @@ public class CustomerMeasureController extends JeecgController<CustomerMeasure,
return Result.OK(pageList);
}
/**
* 分页列表查询
*
* @param customerMeasure
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "顾客测体管理-分页列表查询")
@ApiOperation(value="顾客测体管理-分页列表查询", notes="顾客测体管理-分页列表查询")
@GetMapping(value = "/list1")
public Result<?> queryPageList1(CustomerMeasure customerMeasure,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<CustomerMeasure> queryWrapper = QueryGenerator.initQueryWrapper(customerMeasure, req.getParameterMap());
System.out.println(req.toString());
System.out.println(customerMeasure);
queryWrapper.eq("user_id",customerMeasure.getUserId());
Page<CustomerMeasure> page = new Page<CustomerMeasure>(pageNo, pageSize);
IPage<CustomerMeasure> pageList = customerMeasureService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
@ -282,4 +309,26 @@ public class CustomerMeasureController extends JeecgController<CustomerMeasure,
return super.importExcel(request, response, CustomerMeasure.class);
}
@AutoLog(value = "排序")
@ApiOperation(value="排序", notes="排序")
@GetMapping(value = "/up")
public Result<?> shang(@RequestParam(name="id",required=true) String id) {
customerMeasureService.up(id);
return Result.ok("升序成功");
}
@AutoLog(value = "排序")
@ApiOperation(value="排序", notes="排序")
@GetMapping(value = "/down")
public Result<?> xia(@RequestParam(name="id",required=true) String id) {
int a=customerMeasureService.findSort(id);
if(a==0){
return Result.error("当前已经是最低级别!!!");}else {
customerMeasureService.down(id);
return Result.ok("降序成功");
}
}
}

@ -5,6 +5,8 @@ package org.jeecg.modules.demo.customermeasure.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure;
@ -17,4 +19,19 @@ import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure;
*/
public interface CustomerMeasureMapper extends BaseMapper<CustomerMeasure> {
@Select("select sort from customer_measure where id=#{id} ")
Integer upfindsort(String id);
@Select("select id from customer_measure where sort=#{i} ")
String findproid(int i);
@Update("update customer_measure set sort =#{i} where id = #{id} ")
void innew(String id, int i);
@Update("update customer_measure set sort =#{sort} where id = #{proid} ")
void innewpro(String proid, Integer sort);
@Select("select sort from customer_measure where id=#{id} ")
int findSort(String id);
}

@ -13,4 +13,9 @@ import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure;
*/
public interface ICustomerMeasureService extends IService<CustomerMeasure> {
void up(String id);
int findSort(String id);
void down(String id);
}

@ -6,6 +6,7 @@ package org.jeecg.modules.demo.customermeasure.service.impl;
import org.jeecg.modules.demo.customermeasure.entity.CustomerMeasure;
import org.jeecg.modules.demo.customermeasure.mapper.CustomerMeasureMapper;
import org.jeecg.modules.demo.customermeasure.service.ICustomerMeasureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -19,4 +20,42 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class CustomerMeasureServiceImpl extends ServiceImpl<CustomerMeasureMapper, CustomerMeasure> implements ICustomerMeasureService {
@Autowired
CustomerMeasureMapper customerMeasureMapper;
@Override
public void up(String id) {
Integer sort = customerMeasureMapper.upfindsort(id);
if (sort>0) {
//升序前找到后一个排序
String proid = customerMeasureMapper.findproid(sort + 1);
if (proid!="") {
//调换排序
customerMeasureMapper.innew(id,sort+1);
customerMeasureMapper.innewpro(proid,sort);
}
}
}
@Override
public int findSort(String id) {
return customerMeasureMapper.findSort(id);
}
@Override
public void down(String id) {
Integer sort = customerMeasureMapper.upfindsort(id);
if (sort>0) {
String proid = customerMeasureMapper.findproid(sort - 1);
if (proid!="") {
customerMeasureMapper.innew(id,sort-1);
customerMeasureMapper.innewpro(proid,sort);
}
}
}
}

Loading…
Cancel
Save